mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/native: add two factice motors with qdec simulation
Configure 2 factice motors in one motor_driver. native_motor_driver_qdec_simulation() is provided to simulate QDEC encoders virtually linked to the motors. Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
This commit is contained in:
parent
ffad5048fc
commit
3fd3eea5bc
@ -8,6 +8,7 @@ FEATURES_PROVIDED += periph_qdec
|
||||
|
||||
# Various other features (if any)
|
||||
FEATURES_PROVIDED += ethernet
|
||||
FEATURES_PROVIDED += motor_driver
|
||||
|
||||
# The board MPU family (used for grouping by the CI system)
|
||||
FEATURES_MCU_GROUP = x86
|
||||
|
@ -140,6 +140,51 @@ void native_motor_driver_qdec_simulation( \
|
||||
const motor_driver_t motor_driver, uint8_t motor_id, \
|
||||
int32_t pwm_duty_cycle);
|
||||
|
||||
/* C++ standard do not support designated initializers */
|
||||
#ifndef __cplusplus
|
||||
|
||||
/**
|
||||
* @name Describe DC motors with PWM channel and GPIOs
|
||||
* @{
|
||||
*/
|
||||
static const motor_driver_config_t motor_driver_config[] = {
|
||||
{
|
||||
.pwm_dev = 0,
|
||||
.mode = MOTOR_DRIVER_1_DIR_BRAKE,
|
||||
.mode_brake = MOTOR_BRAKE_LOW,
|
||||
.pwm_mode = PWM_LEFT,
|
||||
.pwm_frequency = 20000U,
|
||||
.pwm_resolution = 1000U,
|
||||
.nb_motors = 2,
|
||||
.motors = {
|
||||
{
|
||||
.pwm_channel = 0,
|
||||
.gpio_enable = GPIO_PIN(0, 0),
|
||||
.gpio_dir0 = GPIO_PIN(0, 0),
|
||||
.gpio_dir1_or_brake = GPIO_PIN(0, 0),
|
||||
.gpio_dir_reverse = 0,
|
||||
.gpio_enable_invert = 0,
|
||||
.gpio_brake_invert = 0,
|
||||
},
|
||||
{
|
||||
.pwm_channel = 1,
|
||||
.gpio_enable = GPIO_PIN(0, 0),
|
||||
.gpio_dir0 = GPIO_PIN(0, 0),
|
||||
.gpio_dir1_or_brake = GPIO_PIN(0, 0),
|
||||
.gpio_dir_reverse = 1,
|
||||
.gpio_enable_invert = 0,
|
||||
.gpio_brake_invert = 0,
|
||||
},
|
||||
},
|
||||
.cb = native_motor_driver_qdec_simulation,
|
||||
},
|
||||
};
|
||||
|
||||
#define MOTOR_DRIVER_NUMOF (sizeof(motor_driver_config) / sizeof(motor_driver_config[0]))
|
||||
/** @} */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user