Loading...
Searching...
No Matches
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
20
21#include "board_nucleo.h"
22#include "arduino_pinmap.h"
23#include "motor_driver.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33#if defined(CPU_MODEL_STM32F302R8) || defined(CPU_MODEL_STM32L433RC)
34#define LED0_PIN_NUM 13
35#define LED0_PORT GPIO_PORT_B
36#define LED0_PORT_NUM PORT_B
37#else
38#define LED0_PIN_NUM 5
39#define LED0_PORT GPIO_PORT_A
40#define LED0_PORT_NUM PORT_A
41#endif
43
48#define BTN0_PIN GPIO_PIN(PORT_C, 13)
49#if defined(CPU_MODEL_STM32L433RC) || defined(CPU_MODEL_STM32G474RE) || \
50 defined(CPU_MODEL_STM32G431RB)
51#define BTN0_MODE GPIO_IN_PD
52#else
53#define BTN0_MODE GPIO_IN_PU
54#endif
56
61static const motor_driver_config_t motor_driver_config[] = {
62 {
63 .pwm_dev = 1,
64 .mode = MOTOR_DRIVER_1_DIR,
65 .mode_brake = MOTOR_BRAKE_HIGH,
66 .pwm_mode = PWM_LEFT,
67 .pwm_frequency = 20000U,
68 .pwm_resolution = 2250U,
69 .nb_motors = 1,
70 .motors = {
71 {
72 .pwm_channel = 0,
73 .gpio_enable = 0,
74 .gpio_dir0 = ARDUINO_PIN_15,
75 .gpio_dir1_or_brake = 0,
76 .gpio_dir_reverse = 0,
77 .gpio_enable_invert = 0,
78 .gpio_brake_invert = 0,
79 },
80 },
81 .cb = NULL,
82 },
83};
84
85#define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
87
92#ifndef MRF24J40_PARAM_SPI
93#define MRF24J40_PARAM_SPI SPI_DEV(0)
94#endif
95
96#ifndef MRF24J40_PARAM_SPI_CLK
97#define MRF24J40_PARAM_SPI_CLK SPI_CLK_5MHZ
98#endif
99
100#ifndef MRF24J40_PARAM_CS
101#define MRF24J40_PARAM_CS ARDUINO_PIN_10
102#endif
103
104#ifndef MRF24J40_PARAM_INT
105#define MRF24J40_PARAM_INT ARDUINO_PIN_7
106#endif
107
108#ifndef MRF24J40_PARAM_RESET
109#define MRF24J40_PARAM_RESET ARDUINO_PIN_5
110#endif
111
113
114#ifdef __cplusplus
115}
116#endif
117
118#include "stm32_leds.h"
119
Compatibility wrapper for arduino_iomap.h.
Global common Nucleo board configuration.
@ PWM_LEFT
left aligned
@ MOTOR_DRIVER_1_DIR
Single GPIO for direction, \ no BRAKE.
@ MOTOR_BRAKE_HIGH
High stage brake.
High-level driver for DC motors.
Common LED macros.
Describe DC motor driver with PWM device and motors array.