Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include <ch.h>
#include <hal.h>
#include "mcu_periph/input_capture_arch.h"
#include "mcu_periph/hal_stm32_dma.h"
#include "mcu_periph/timerDmaCache.h"
#include "modules/actuators/esc_dshot_config.h"
Go to the source code of this file.
Data Structures | |
struct | DshotDmaStreamChan |
structure defining dma channel More... | |
struct | DshotRpmCaptureOneChannelDmaBuffer |
DMA capture if (errFrame > 2000) { chSysHalt("p *dshotd.config.dma_capt_cfg.dma_capture"); } buffer. More... | |
struct | DshotRpmCaptureDmaBuffer |
struct | DshotRpmCaptureConfig |
: DSHOT Rpm Capture Driver configuration structure. More... | |
struct | DshotRpmCapture |
Macros | |
#define | DSHOT_DMA_DATA_LEN 16U |
#define | DSHOT_DMA_EXTRADATA_LEN 2U |
#define | DSHOT_CONCAT_CAPTURE_NX(pre, tim, stream, channel) pre ## tim ## stream , pre ## tim ## channel |
macro helper to design DMA stream More... | |
#define | DSHOTS_1STREAM(tim) DSHOT_CONCAT_CAPTURE_NX(STM32_TIM, tim, _CH1_DMA_STREAM, _CH1_DMA_CHANNEL) |
#define | DSHOTS_2STREAMS(tim) |
#define | DSHOTS_3STREAMS(tim) |
#define | DSHOTS_4STREAMS(tim) |
#define | STM32_SYSCLK STM32_SYS_CK |
Functions | |
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... | |
static uint32_t | dshotRpmGetFrame (const DshotRpmCapture *drcp, uint8_t index) |
return last collected erps frame More... | |
struct DshotDmaStreamChan |
structure defining dma channel
Definition at line 79 of file dshot_rpmCapture.h.
Data Fields | ||
---|---|---|
uint8_t | channel | |
uint32_t | stream |
struct DshotRpmCaptureOneChannelDmaBuffer |
DMA capture if (errFrame > 2000) { chSysHalt("p *dshotd.config.dma_capt_cfg.dma_capture"); } buffer.
Definition at line 95 of file dshot_rpmCapture.h.
Data Fields | ||
---|---|---|
uint16_t | buf[DSHOT_DMA_DATA_LEN+DSHOT_DMA_EXTRADATA_LEN] |
struct DshotRpmCaptureDmaBuffer |
Definition at line 99 of file dshot_rpmCapture.h.
Data Fields | ||
---|---|---|
DshotRpmCaptureOneChannelDmaBuffer | dma_buf[DSHOT_CHANNELS] |
struct DshotRpmCaptureConfig |
: DSHOT Rpm Capture Driver configuration structure.
Definition at line 106 of file dshot_rpmCapture.h.
Data Fields | ||
---|---|---|
DshotRpmCaptureDmaBuffer * | dma_capture |
: pointer to the input capture DMA buffer
|
DshotDmaStreamChan | dma_streams[DSHOT_CHANNELS] | : array of DMA stream for each capture channel |
GPTDriver * | gptd |
: GPT Driver to manage microseconds timeout
|
struct DshotRpmCapture |
Definition at line 131 of file dshot_rpmCapture.h.
Data Fields | ||
---|---|---|
TimerDmaCache | cache |
: cache for timer and dma configuration
|
const DshotRpmCaptureConfig * | config |
: pointer to configuration structure
|
DMAConfig | dmaCfgs[DSHOT_CHANNELS] | : dma input capture configuration |
DMADriver | dmads[DSHOT_CHANNELS] | : dma input capture drivers |
uint32_t | erps[DSHOT_CHANNELS] | : array of erps frames |
TimICConfig | icCfg | : input capture timer configuration |
TimICDriver | icd | : input capture timer driver |
uint32_t | rpms[DSHOT_CHANNELS] | : array of rpms |
#define DSHOT_CONCAT_CAPTURE_NX | ( | pre, | |
tim, | |||
stream, | |||
channel | |||
) | pre ## tim ## stream , pre ## tim ## channel |
macro helper to design DMA stream
Definition at line 23 of file dshot_rpmCapture.h.
#define DSHOT_DMA_DATA_LEN 16U |
Definition at line 14 of file dshot_rpmCapture.h.
#define DSHOT_DMA_EXTRADATA_LEN 2U |
Definition at line 15 of file dshot_rpmCapture.h.
#define DSHOTS_1STREAM | ( | tim | ) | DSHOT_CONCAT_CAPTURE_NX(STM32_TIM, tim, _CH1_DMA_STREAM, _CH1_DMA_CHANNEL) |
Definition at line 24 of file dshot_rpmCapture.h.
#define DSHOTS_2STREAMS | ( | tim | ) |
Definition at line 25 of file dshot_rpmCapture.h.
#define DSHOTS_3STREAMS | ( | tim | ) |
Definition at line 27 of file dshot_rpmCapture.h.
#define DSHOTS_4STREAMS | ( | tim | ) |
Definition at line 30 of file dshot_rpmCapture.h.
#define STM32_SYSCLK STM32_SYS_CK |
Definition at line 71 of file dshot_rpmCapture.h.
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().
|
inlinestatic |
return last collected erps frame
[in] | drcp | pointer to the DshotRpmCapture object |
[in] | index | index of the channel [1 .. 4] @api |
Definition at line 197 of file dshot_rpmCapture.h.
References DshotRpmCapture::rpms.