board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef BOARD_H
23 #define BOARD_H
24 
25 #include "board_nucleo.h"
26 #include "arduino_pinmap.h"
27 #include "motor_driver.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #if defined(CPU_MODEL_STM32F302R8) || defined(CPU_MODEL_STM32L433RC)
38 #define LED0_PIN_NUM 13
39 #define LED0_PORT GPIO_PORT_B
40 #define LED0_PORT_NUM PORT_B
41 #else
42 #define LED0_PIN_NUM 5
43 #define LED0_PORT GPIO_PORT_A
44 #define LED0_PORT_NUM PORT_A
45 #endif
52 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
53 #if defined(CPU_MODEL_STM32L433RC) || defined(CPU_MODEL_STM32G474RE) || \
54  defined(CPU_MODEL_STM32G431RB)
55 #define BTN0_MODE GPIO_IN_PD
56 #else
57 #define BTN0_MODE GPIO_IN_PU
58 #endif
65 static const motor_driver_config_t motor_driver_config[] = {
66  {
67  .pwm_dev = 1,
68  .mode = MOTOR_DRIVER_1_DIR,
69  .mode_brake = MOTOR_BRAKE_HIGH,
70  .pwm_mode = PWM_LEFT,
71  .pwm_frequency = 20000U,
72  .pwm_resolution = 2250U,
73  .nb_motors = 1,
74  .motors = {
75  {
76  .pwm_channel = 0,
77  .gpio_enable = 0,
78  .gpio_dir0 = ARDUINO_PIN_15,
79  .gpio_dir1_or_brake = 0,
80  .gpio_dir_reverse = 0,
81  .gpio_enable_invert = 0,
82  .gpio_brake_invert = 0,
83  },
84  },
85  .cb = NULL,
86  },
87 };
88 
89 #define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
96 #ifndef MRF24J40_PARAM_SPI
97 #define MRF24J40_PARAM_SPI SPI_DEV(0)
98 #endif
99 
100 #ifndef MRF24J40_PARAM_SPI_CLK
101 #define MRF24J40_PARAM_SPI_CLK SPI_CLK_5MHZ
102 #endif
103 
104 #ifndef MRF24J40_PARAM_CS
105 #define MRF24J40_PARAM_CS ARDUINO_PIN_10
106 #endif
107 
108 #ifndef MRF24J40_PARAM_INT
109 #define MRF24J40_PARAM_INT ARDUINO_PIN_7
110 #endif
111 
112 #ifndef MRF24J40_PARAM_RESET
113 #define MRF24J40_PARAM_RESET ARDUINO_PIN_5
114 #endif
115 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #include "stm32_leds.h"
123 
124 #endif /* BOARD_H */
Compatibility wrapper for arduino_iomap.h.
Global common Nucleo board configuration.
@ MOTOR_DRIVER_1_DIR
Single GPIO for direction, \ no BRAKE.
Definition: motor_driver.h:118
@ MOTOR_BRAKE_HIGH
High stage brake.
Definition: motor_driver.h:129
@ PWM_LEFT
left aligned
Definition: periph_conf.h:221
High-level driver for DC motors.
Common LED macros.
Describe DC motor driver with PWM device and motors array.
Definition: motor_driver.h:168
pwm_t pwm_dev
PWM device driving motors.
Definition: motor_driver.h:169