board.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2025 TU Dresden
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include "cpu.h"
19 #include "motor_driver.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
29 #define LED0_IS_INVERTED 1
30 #define LED0_PIN_NUM 3 /* LED top right red */
31 #define LED0_PORT GPIO_PORT_C
32 #define LED0_PORT_NUM PORT_C
33 
34 #define LED1_IS_INVERTED 1
35 #define LED1_PIN_NUM 2 /* LED top right green */
36 #define LED1_PORT GPIO_PORT_C
37 #define LED1_PORT_NUM PORT_C
38 
39 #define LED2_PIN_NUM 2 /* LED bottom left blue */
40 #define LED2_PORT GPIO_PORT_D
41 #define LED2_PORT_NUM PORT_D
42 
43 #define LED3_IS_INVERTED 1
44 #define LED3_PIN_NUM 0 /* LED top left red*/
45 #define LED3_PORT GPIO_PORT_C
46 #define LED3_PORT_NUM PORT_C
47 
48 #define LED4_IS_INVERTED 1
49 #define LED4_PIN_NUM 1 /* LED top left green */
50 #define LED4_PORT GPIO_PORT_C
51 #define LED4_PORT_NUM PORT_C
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 = 4200U,
67  .nb_motors = 3,
68  .motors = {
69  {
70  .pwm_channel = 1,
71  .gpio_enable = 0,
72  .gpio_dir0 = 0,
73  .gpio_dir1_or_brake = 0,
74  .gpio_dir_reverse = 0,
75  .gpio_enable_invert = 0,
76  .gpio_brake_invert = 0,
77  },
78  {
79  .pwm_channel = 3,
80  .gpio_enable = 0,
81  .gpio_dir0 = 0,
82  .gpio_dir1_or_brake = 0,
83  .gpio_dir_reverse = 0,
84  .gpio_enable_invert = 0,
85  .gpio_brake_invert = 0,
86  },
87  {
88  .pwm_channel = 0,
89  .gpio_enable = 0,
90  .gpio_dir0 = 0,
91  .gpio_dir1_or_brake = 0,
92  .gpio_dir_reverse = 0,
93  .gpio_enable_invert = 0,
94  .gpio_brake_invert = 0,
95  },
96  },
97  .cb = NULL,
98  },
99  {
100  .pwm_dev = 2,
101  .mode = MOTOR_DRIVER_1_DIR,
102  .mode_brake = MOTOR_BRAKE_HIGH,
103  .pwm_mode = PWM_LEFT,
104  .pwm_frequency = 20000U,
105  .pwm_resolution = 4200U,
106  .nb_motors = 1,
107  .motors = {
108  {
109  .pwm_channel = 0,
110  .gpio_enable = 0,
111  .gpio_dir0 = 0,
112  .gpio_dir1_or_brake = 0,
113  .gpio_dir_reverse = 0,
114  .gpio_enable_invert = 0,
115  .gpio_brake_invert = 0,
116  },
117  },
118  .cb = NULL,
119  }
120 };
121 
123 #define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #include "stm32_leds.h"
static const motor_driver_config_t motor_driver_config[]
Motor driver config.
Definition: board.h:59
@ 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