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
9#pragma once
10
23
24#include "board_nucleo.h"
25#include "arduino_pinmap.h"
26#include "motor_driver.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#if defined(CPU_MODEL_STM32F302R8) || defined(CPU_MODEL_STM32L433RC)
37#define LED0_PIN_NUM 13
38#define LED0_PORT GPIO_PORT_B
39#define LED0_PORT_NUM PORT_B
40#else
41#define LED0_PIN_NUM 5
42#define LED0_PORT GPIO_PORT_A
43#define LED0_PORT_NUM PORT_A
44#endif
46
51#define BTN0_PIN GPIO_PIN(PORT_C, 13)
52#if defined(CPU_MODEL_STM32L433RC) || defined(CPU_MODEL_STM32G474RE) || \
53 defined(CPU_MODEL_STM32G431RB)
54#define BTN0_MODE GPIO_IN_PD
55#else
56#define BTN0_MODE GPIO_IN_PU
57#endif
59
64static const motor_driver_config_t motor_driver_config[] = {
65 {
66 .pwm_dev = 1,
67 .mode = MOTOR_DRIVER_1_DIR,
68 .mode_brake = MOTOR_BRAKE_HIGH,
69 .pwm_mode = PWM_LEFT,
70 .pwm_frequency = 20000U,
71 .pwm_resolution = 2250U,
72 .nb_motors = 1,
73 .motors = {
74 {
75 .pwm_channel = 0,
76 .gpio_enable = 0,
77 .gpio_dir0 = ARDUINO_PIN_15,
78 .gpio_dir1_or_brake = 0,
79 .gpio_dir_reverse = 0,
80 .gpio_enable_invert = 0,
81 .gpio_brake_invert = 0,
82 },
83 },
84 .cb = NULL,
85 },
86};
87
88#define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
90
95#ifndef MRF24J40_PARAM_SPI
96#define MRF24J40_PARAM_SPI SPI_DEV(0)
97#endif
98
99#ifndef MRF24J40_PARAM_SPI_CLK
100#define MRF24J40_PARAM_SPI_CLK SPI_CLK_5MHZ
101#endif
102
103#ifndef MRF24J40_PARAM_CS
104#define MRF24J40_PARAM_CS ARDUINO_PIN_10
105#endif
106
107#ifndef MRF24J40_PARAM_INT
108#define MRF24J40_PARAM_INT ARDUINO_PIN_7
109#endif
110
111#ifndef MRF24J40_PARAM_RESET
112#define MRF24J40_PARAM_RESET ARDUINO_PIN_5
113#endif
114
116
117#ifdef __cplusplus
118}
119#endif
120
121#include "stm32_leds.h"
122
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.