Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the source code of this file.
Macros | |
#define | SWTICH_TO_CAPTURE_BASE_TIMOUT 28U |
#define | nullptr NULL |
Functions | |
static void | startCapture (DshotRpmCapture *drcp) |
start the DMA capture More... | |
static void | stopCapture (DshotRpmCapture *drcp) |
stop the DMA capture More... | |
static void | initCache (DshotRpmCapture *drcp) |
build dma and timer registers cache More... | |
static uint32_t | processErpsDmaBuffer (const uint16_t *capture, size_t dmaLen) |
convert DMA buffer full of pulse length into raw ERPS frame More... | |
static void | buildDmaConfig (DshotRpmCapture *drcp) |
build dma configuration structure More... | |
static void | dmaErrCb (DMADriver *dmad, dmaerrormask_t em) |
dma error ISR : More... | |
static void | gptCb (GPTDriver *gptd) |
dma timeout ISR : More... | |
void | dshotRpmCaptureStart (DshotRpmCapture *drcp, const DshotRpmCaptureConfig *cfg, stm32_tim_t *timer) |
Configures and activates the DSHOT ERPS CAPTURE driver. More... | |
void | dshotRpmCaptureStop (DshotRpmCapture *drcp) |
stop the the DSHOT ERPS CAPTURE driver. More... | |
void | dshotRpmCatchErps (DshotRpmCapture *drcp) |
capture the DSHOT ERPS frame(s) : one frame for each DSHOT_CHANNELS More... | |
Variables | |
static const float | TIM_FREQ_MHZ = (STM32_SYSCLK / 1e6d) |
static const float | bit1t_us = TIM_FREQ_MHZ * 6.67d * 4 / 5 |
static const float | speed_factor = DSHOT_SPEED / 150 |
static const uint32_t | ERPS_BIT1_DUTY = bit1t_us / speed_factor |
static const uint32_t | TIM_PRESCALER = 1U |
struct { | |
uint32_t | active |
uint32_t | dier |
} | activeDier [4] |
static const TimICConfig | timicCfgSkel |
static const GPTConfig | gptCfg |
#define nullptr NULL |
Definition at line 49 of file dshot_rpmCapture.c.
#define SWTICH_TO_CAPTURE_BASE_TIMOUT 28U |
Definition at line 31 of file dshot_rpmCapture.c.
|
static |
build dma configuration structure
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 250 of file dshot_rpmCapture.c.
References DMAConfig::channel, DshotDmaStreamChan::channel, DshotRpmCapture::config, DMA_DIR_P2M, DMA_ONESHOT, DshotRpmCaptureConfig::dma_streams, DshotRpmCapture::dmaCfgs, dmaErrCb(), DSHOT_CHANNELS, DMAConfig::stream, and DshotDmaStreamChan::stream.
Referenced by initCache().
|
static |
dma error ISR :
[in] | drcp | pointer to the DMADriver |
[in] | em | error mask |
Definition at line 397 of file dshot_rpmCapture.c.
Referenced by buildDmaConfig().
void dshotRpmCaptureStart | ( | DshotRpmCapture * | drcp, |
const DshotRpmCaptureConfig * | cfg, | ||
stm32_tim_t * | timer | ||
) |
Configures and activates the DSHOT ERPS CAPTURE driver.
[in] | drcp | pointer to the DshotRpmCapture object |
[in] | cfg | pointer to the DshotRpmCaptureConfig object. |
[in] | timer | pointer to the underlying timer (same one used to output control frame) @api |
Definition at line 108 of file dshot_rpmCapture.c.
References DshotRpmCapture::config, DshotRpmCapture::icCfg, initCache(), TimICConfig::timer, and timicCfgSkel.
Referenced by dshotStart().
void dshotRpmCaptureStop | ( | DshotRpmCapture * | drcp | ) |
stop the the DSHOT ERPS CAPTURE driver.
[in] | drcp | pointer to the DshotRpmCapture object @api |
Definition at line 124 of file dshot_rpmCapture.c.
References stopCapture().
Referenced by initCache().
void dshotRpmCatchErps | ( | DshotRpmCapture * | drcp | ) |
capture the DSHOT ERPS frame(s) : one frame for each DSHOT_CHANNELS
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 149 of file dshot_rpmCapture.c.
References DshotRpmCaptureOneChannelDmaBuffer::buf, TimICDriver::config, DshotRpmCapture::config, DshotRpmCaptureDmaBuffer::dma_buf, DshotRpmCaptureConfig::dma_capture, DshotRpmCapture::dmads, dmaGetTransactionCounter(), dmaStartTransfert(), dmaStopTransfertI(), DSHOT_CHANNELS, DSHOT_DMA_DATA_LEN, DSHOT_DMA_EXTRADATA_LEN, DSHOT_SPEED, DshotRpmCaptureConfig::gptd, DshotRpmCapture::icd, msg, processErpsDmaBuffer(), DshotRpmCapture::rpms, startCapture(), stopCapture(), SWTICH_TO_CAPTURE_BASE_TIMOUT, timeoutUs, and TimICConfig::timer.
Referenced by dshotSendFrame().
|
static |
dma timeout ISR :
[in] | gptd | pointer to the GPTDriver that trigger the timeout |
Definition at line 414 of file dshot_rpmCapture.c.
References DshotRpmCapture::dmads.
|
static |
build dma and timer registers cache
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 297 of file dshot_rpmCapture.c.
References buildDmaConfig(), DshotRpmCapture::cache, DshotRpmCapture::config, DshotRpmCapture::dmaCfgs, DshotRpmCapture::dmads, dmaObjectInit(), dmaStart(), DSHOT_CHANNELS, dshotRpmCaptureStop(), DshotRpmCaptureConfig::gptd, DshotRpmCapture::icCfg, DshotRpmCapture::icd, TimICConfig::timer, timerDmaCache_cache(), timIcObjectInit(), and timIcStart().
Referenced by dshotRpmCaptureStart().
convert DMA buffer full of pulse length into raw ERPS frame
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 347 of file dshot_rpmCapture.c.
References ERPS_BIT1_DUTY.
Referenced by dshotRpmCatchErps().
|
static |
start the DMA capture
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 320 of file dshot_rpmCapture.c.
References DshotRpmCapture::cache, DshotRpmCapture::config, DshotRpmCapture::dmads, gptCfg, DshotRpmCaptureConfig::gptd, DshotRpmCapture::icCfg, DshotRpmCapture::icd, TimICConfig::timer, timerDmaCache_restore(), and timIcStartCapture().
Referenced by dshotRpmCatchErps().
|
static |
stop the DMA capture
[in] | drcp | pointer to the DshotRpmCapture object |
Definition at line 333 of file dshot_rpmCapture.c.
References DshotRpmCapture::config, DshotRpmCaptureConfig::gptd, DshotRpmCapture::icd, timIcRccDisable(), and timIcStopCapture().
Referenced by dshotRpmCaptureStop(), and dshotRpmCatchErps().
const { ... } activeDier[4] |
|
static |
Definition at line 17 of file dshot_rpmCapture.c.
|
static |
Definition at line 20 of file dshot_rpmCapture.c.
Referenced by processErpsDmaBuffer().
|
static |
Definition at line 92 of file dshot_rpmCapture.c.
Referenced by startCapture().
|
static |
Definition at line 18 of file dshot_rpmCapture.c.
|
static |
Definition at line 15 of file dshot_rpmCapture.c.
|
static |
Definition at line 21 of file dshot_rpmCapture.c.
|
static |
Definition at line 68 of file dshot_rpmCapture.c.
Referenced by dshotRpmCaptureStart().