dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_dmashot.c File Reference
#include <pios.h>
#include "pios_dmashot.h"

Go to the source code of this file.

Data Structures

union  dma_buffer
 
struct  servo_timer
 

Macros

#define MAX_TIMERS   8
 
#define DMASHOT_MESSAGE_WIDTH   16
 
#define DMASHOT_MESSAGE_PAUSE   1
 
#define DMASHOT_STM32_BUFFER   (DMASHOT_MESSAGE_PAUSE + DMASHOT_MESSAGE_WIDTH + DMASHOT_MESSAGE_PAUSE)
 
#define DSHOT_DUTY_CYCLE_0   36
 
#define DSHOT_DUTY_CYCLE_1   74
 
#define TIMC_TO_INDEX(c)   ((c)>>2)
 

Functions

static bool PIOS_DMAShot_HalfWord (struct servo_timer *s_timer)
 
static int PIOS_DMAShot_GetNumChannels (struct servo_timer *timer)
 
void PIOS_DMAShot_Init (const struct pios_dmashot_cfg *config)
 Initializes the DMAShot driver by loading the configuration. More...
 
void PIOS_DMAShot_Prepare ()
 Makes sure the DMAShot driver has allocated all internal structs. More...
 
static struct servo_timerPIOS_DMAShot_GetServoTimer (const struct pios_tim_channel *servo_channel)
 
void PIOS_DMAShot_WriteValue (const struct pios_tim_channel *servo_channel, uint16_t throttle)
 Sets the throttle value of a specific servo. More...
 
bool PIOS_DMAShot_RegisterTimer (TIM_TypeDef *timer, uint32_t clockrate, uint32_t dshot_freq)
 Tells the DMAShot driver about a timer that needs to be set up. More...
 
bool PIOS_DMAShot_RegisterServo (const struct pios_tim_channel *servo_channel)
 Tells the DMAShot driver about a servo that needs to be set up. More...
 
void PIOS_DMAShot_Validate ()
 Validates any timer and servo registrations. More...
 
void PIOS_DMAShot_InitializeGPIOs ()
 Initializes the GPIO on the registered servos for DMAShot operation. More...
 
static void PIOS_DMAShot_TimerSetup (struct servo_timer *s_timer, uint32_t sysclock, uint32_t dshot_freq, TIM_OCInitTypeDef *ocinit, bool master)
 
void PIOS_DMAShot_InitializeTimers (TIM_OCInitTypeDef *ocinit)
 Initializes and configures the registered timers for DMAShot operation. More...
 
static void PIOS_DMAShot_DMASetup (struct servo_timer *s_timer)
 
static uint32_t PIOS_DMAShot_AllocateBuffer (uint16_t size)
 
void PIOS_DMAShot_InitializeDMAs ()
 Initializes and configures the known DMA channels for DMAShot operation. More...
 
void PIOS_DMAShot_TriggerUpdate ()
 Triggers the configured DMA channels to fire and send throttle values to the timer DMAR and optional CCRx registers. More...
 
bool PIOS_DMAShot_IsReady ()
 Checks whether DMAShot is ready for use (i.e. at least one DMA configured timer). More...
 
bool PIOS_DMAShot_IsConfigured ()
 Checks whether DMAShot has been configured. More...
 

Variables

const struct pios_dmashot_cfgdmashot_cfg
 
struct servo_timer ** servo_timers
 

Detailed Description

Author
dRonin, http://dRonin.org/, Copyright (C) 2017

Definition in file pios_dmashot.c.