Loading...
Searching...
No Matches
motor_driver_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 COGIP Robotics association
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "board.h"
19#include "motor_driver.h"
20#include "saul_reg.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
30
34#define MOTOR_DRIVER_0_PARAMS \
35 { \
36 .mode = MOTOR_DRIVER_1_DIR, \
37 .pwm_dev = 1, \
38 .pwm_mode = PWM_LEFT, \
39 .pwm_frequency = 20000U, \
40 .pwm_resolution = 4200U, \
41 .brake_inverted = true, \
42 .enable_inverted = false, \
43 .nb_motors = 3, \
44 .motors = { \
45 { \
46 .pwm_channel = 1, \
47 .gpio_enable = GPIO_UNDEF, \
48 .gpio_dir0 = GPIO_UNDEF, \
49 .gpio_dir1 = GPIO_UNDEF, \
50 .gpio_dir_reverse = GPIO_UNDEF, \
51 }, \
52 { \
53 .pwm_channel = 3, \
54 .gpio_enable = GPIO_UNDEF, \
55 .gpio_dir0 = GPIO_UNDEF, \
56 .gpio_dir1 = GPIO_UNDEF, \
57 .gpio_dir_reverse = GPIO_UNDEF, \
58 }, \
59 { \
60 .pwm_channel = 0, \
61 .gpio_enable = GPIO_UNDEF, \
62 .gpio_dir0 = GPIO_UNDEF, \
63 .gpio_dir1 = GPIO_UNDEF, \
64 .gpio_dir_reverse = GPIO_UNDEF, \
65 } \
66 }, \
67 .motor_set_post_cb = NULL \
68 }
69
73#define MOTOR_DRIVER_1_PARAMS \
74 { \
75 .mode = MOTOR_DRIVER_1_DIR, \
76 .pwm_dev = 2, \
77 .pwm_mode = PWM_LEFT, \
78 .pwm_frequency = 20000U, \
79 .pwm_resolution = 4200U, \
80 .brake_inverted = true, \
81 .enable_inverted = false, \
82 .nb_motors = 1, \
83 .motors = { \
84 { \
85 .pwm_channel = 0, \
86 .gpio_enable = GPIO_UNDEF, \
87 .gpio_dir0 = GPIO_UNDEF, \
88 .gpio_dir1 = GPIO_UNDEF, \
89 .gpio_dir_reverse = GPIO_UNDEF, \
90 } \
91 }, \
92 .motor_set_post_cb = NULL \
93 }
94
95#ifndef MOTOR_DRIVER_PARAMS
99# define MOTOR_DRIVER_PARAMS \
100 MOTOR_DRIVER_0_PARAMS, \
101 MOTOR_DRIVER_1_PARAMS
102#endif
103
104#ifndef MOTOR_DRIVER_SAUL_INFO
108# define MOTOR_DRIVER_SAUL_INFO \
109 { .name = "motor_driver_0" }, \
110 { .name = "motor_driver_1" }
111#endif
113
121
129
130#ifdef __cplusplus
131}
132#endif
Board specific definitions for the Crazyflie 2.1 main application MCU.
#define MOTOR_DRIVER_PARAMS
Motor driver configuration array.
static const saul_reg_info_t motor_driver_saul_info[]
Additional meta information to keep in the SAUL registry.
static const motor_driver_params_t motor_driver_params[]
MOTOR_DRIVER configuration.
#define MOTOR_DRIVER_SAUL_INFO
SAUL registry information for motor drivers.
High-level driver for DC motors.
SAUL registry interface definition.
Describe DC motor driver with PWM device and motors array.
Additional data to collect for each entry.
Definition saul_reg.h:48