![]() |
Autodrone
Multi-Domain Vehicle
|
This files enables the gpio, timer, and dma peripherals to send dshot commands with pwm. More...
Go to the source code of this file.
Macros | |
#define | TIMER_CLOCK 108000000 |
#define | MHZ_TO_HZ(x) ((x) * 1000000) |
#define | DSHOT600_HZ MHZ_TO_HZ(108) |
#define | DSHOT300_HZ MHZ_TO_HZ(54) |
#define | DSHOT150_HZ MHZ_TO_HZ(27) |
#define | MOTOR_BIT_0 60 |
#define | MOTOR_BIT_1 120 |
#define | MOTOR_BITLENGTH 180 |
#define | DSHOT_FRAME_SIZE 16 |
#define | DSHOT_DMA_BUFFER_SIZE 18 /* resolution + frame reset (2us) */ |
#define | DSHOT_MIN_THROTTLE 48 |
#define | DSHOT_MAX_THROTTLE 2047 |
#define | DSHOT_RANGE (DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) |
#define | DSHOT_ARM_COUNT 1500 |
#define | DSHOT_SETTINGS_COUNT 10 |
Functions | |
void | dshotInit (dshot_type_e dshot_type) |
Initializes the low level registers to set up the timer with PWM DMA. More... | |
void | dshotWrite (uint16_t *motor_value) |
Writes to the DMA buffer and starts the DMA stream. More... | |
void | dshotWait (uint16_t wait_counts) |
Waits for a certain amount of dshot commands. More... | |
Variables | |
volatile uint16_t | dshot_command_count |
bool | dshot_telemetry |
This files enables the gpio, timer, and dma peripherals to send dshot commands with pwm.
#define DSHOT150_HZ MHZ_TO_HZ(27) |
#define DSHOT300_HZ MHZ_TO_HZ(54) |
#define DSHOT600_HZ MHZ_TO_HZ(108) |
#define DSHOT_ARM_COUNT 1500 |
#define DSHOT_DMA_BUFFER_SIZE 18 /* resolution + frame reset (2us) */ |
#define DSHOT_FRAME_SIZE 16 |
#define DSHOT_MAX_THROTTLE 2047 |
#define DSHOT_MIN_THROTTLE 48 |
#define DSHOT_RANGE (DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) |
#define DSHOT_SETTINGS_COUNT 10 |
#define MHZ_TO_HZ | ( | x | ) | ((x) * 1000000) |
#define MOTOR_BIT_0 60 |
#define MOTOR_BIT_1 120 |
#define MOTOR_BITLENGTH 180 |
#define TIMER_CLOCK 108000000 |
enum dshot_type_e |
enum dshotCommands_e |
void dshotInit | ( | dshot_type_e | dshot_type | ) |
Initializes the low level registers to set up the timer with PWM DMA.
dshot_type | DSHOT150/300/600. Allows you to adjust the speed. DSHOT600 is preferred |
void dshotWait | ( | uint16_t | wait_counts | ) |
Waits for a certain amount of dshot commands.
wait_counts | Number of commands to wait for. |
void dshotWrite | ( | uint16_t * | motor_value | ) |
Writes to the DMA buffer and starts the DMA stream.
*motor_value | A four length array with elements from 0 to 2047. |
|
extern |
|
extern |