Loading...
Searching...
No Matches
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
30extern "C" {
31#endif
32
37#if defined(CPU_MODEL_STM32F302R8) || defined(CPU_MODEL_STM32L433RC)
38#define LED0_PIN_NUM 13
39#define LED0_PORT_NUM PORT_B
40#else
41#define LED0_PIN_NUM 5
42#define LED0_PORT_NUM PORT_A
43#endif
50#define BTN0_PIN GPIO_PIN(PORT_C, 13)
51#if defined(CPU_MODEL_STM32L433RC) || defined(CPU_MODEL_STM32G474RE) || \
52 defined(CPU_MODEL_STM32G431RB)
53#define BTN0_MODE GPIO_IN_PD
54#else
55#define BTN0_MODE GPIO_IN_PU
56#endif
63static const motor_driver_config_t motor_driver_config[] = {
64 {
65 .pwm_dev = 1,
66 .mode = MOTOR_DRIVER_1_DIR,
67 .mode_brake = MOTOR_BRAKE_HIGH,
68 .pwm_mode = PWM_LEFT,
69 .pwm_frequency = 20000U,
70 .pwm_resolution = 2250U,
71 .nb_motors = 1,
72 .motors = {
73 {
74 .pwm_channel = 0,
75 .gpio_enable = 0,
76 .gpio_dir0 = ARDUINO_PIN_15,
77 .gpio_dir1_or_brake = 0,
78 .gpio_dir_reverse = 0,
79 .gpio_enable_invert = 0,
80 .gpio_brake_invert = 0,
81 },
82 },
83 .cb = NULL,
84 },
85};
86
87#define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
94#ifndef MRF24J40_PARAM_SPI
95#define MRF24J40_PARAM_SPI SPI_DEV(0)
96#endif
97
98#ifndef MRF24J40_PARAM_SPI_CLK
99#define MRF24J40_PARAM_SPI_CLK SPI_CLK_5MHZ
100#endif
101
102#ifndef MRF24J40_PARAM_CS
103#define MRF24J40_PARAM_CS ARDUINO_PIN_10
104#endif
105
106#ifndef MRF24J40_PARAM_INT
107#define MRF24J40_PARAM_INT ARDUINO_PIN_7
108#endif
109
110#ifndef MRF24J40_PARAM_RESET
111#define MRF24J40_PARAM_RESET ARDUINO_PIN_5
112#endif
113
116#ifdef __cplusplus
117}
118#endif
119
120#include "stm32_leds.h"
121
122#endif /* BOARD_H */
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.
pwm_t pwm_dev
PWM device driving motors.