board.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2017 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include "board_nucleo.h"
20 #include "arduino_pinmap.h"
21 #include "motor_driver.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
31 #if defined(CPU_MODEL_STM32F302R8) || defined(CPU_MODEL_STM32L433RC)
32 #define LED0_PIN_NUM 13
33 #define LED0_PORT GPIO_PORT_B
34 #define LED0_PORT_NUM PORT_B
35 #else
36 #define LED0_PIN_NUM 5
37 #define LED0_PORT GPIO_PORT_A
38 #define LED0_PORT_NUM PORT_A
39 #endif
46 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
47 #if defined(CPU_MODEL_STM32L433RC) || defined(CPU_MODEL_STM32G474RE) || \
48  defined(CPU_MODEL_STM32G431RB)
49 #define BTN0_MODE GPIO_IN_PD
50 #else
51 #define BTN0_MODE GPIO_IN_PU
52 #endif
60  {
61  .pwm_dev = 1,
62  .mode = MOTOR_DRIVER_1_DIR,
63  .mode_brake = MOTOR_BRAKE_HIGH,
64  .pwm_mode = PWM_LEFT,
65  .pwm_frequency = 20000U,
66  .pwm_resolution = 2250U,
67  .nb_motors = 1,
68  .motors = {
69  {
70  .pwm_channel = 0,
71  .gpio_enable = 0,
72  .gpio_dir0 = ARDUINO_PIN_15,
73  .gpio_dir1_or_brake = 0,
74  .gpio_dir_reverse = 0,
75  .gpio_enable_invert = 0,
76  .gpio_brake_invert = 0,
77  },
78  },
79  .cb = NULL,
80  },
81 };
82 
83 #define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
90 #ifndef MRF24J40_PARAM_SPI
91 #define MRF24J40_PARAM_SPI SPI_DEV(0)
92 #endif
93 
94 #ifndef MRF24J40_PARAM_SPI_CLK
95 #define MRF24J40_PARAM_SPI_CLK SPI_CLK_5MHZ
96 #endif
97 
98 #ifndef MRF24J40_PARAM_CS
99 #define MRF24J40_PARAM_CS ARDUINO_PIN_10
100 #endif
101 
102 #ifndef MRF24J40_PARAM_INT
103 #define MRF24J40_PARAM_INT ARDUINO_PIN_7
104 #endif
105 
106 #ifndef MRF24J40_PARAM_RESET
107 #define MRF24J40_PARAM_RESET ARDUINO_PIN_5
108 #endif
109 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #include "stm32_leds.h"
117 
Compatibility wrapper for arduino_iomap.h.
static const motor_driver_config_t motor_driver_config[]
Motor driver config.
Definition: board.h:59
Global common Nucleo board configuration.
@ MOTOR_DRIVER_1_DIR
Single GPIO for direction, \ no BRAKE.
Definition: motor_driver.h:117
@ MOTOR_BRAKE_HIGH
High stage brake.
Definition: motor_driver.h:128
@ PWM_LEFT
left aligned
Definition: periph_conf.h:217
High-level driver for DC motors.
Common LED macros.
Describe DC motor driver with PWM device and motors array.
Definition: motor_driver.h:167
pwm_t pwm_dev
PWM device driving motors.
Definition: motor_driver.h:168