|
Paparazzi UAS v7.1_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"#include "mcu_periph/sys_time_arch.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) |
| macro helper to design DMA stream | |
| #define | DSHOTS_1STREAM(tim) |
| #define | DSHOTS_2STREAMS(tim) |
| #define | DSHOTS_3STREAMS(tim) |
| #define | DSHOTS_4STREAMS(tim) |
Functions | |
| void | dshotRpmCaptureStart (DshotRpmCapture *drcp, const DshotRpmCaptureConfig *cfg, stm32_tim_t *timer) |
| Configures and activates the DSHOT ERPS CAPTURE driver. | |
| void | dshotRpmCaptureStop (DshotRpmCapture *drcp) |
| stop the the DSHOT ERPS CAPTURE driver. | |
| void | dshotRpmCatchErps (DshotRpmCapture *drcp) |
| capture the DSHOT ERPS frame(s) : one frame for each DSHOT_CHANNELS | |
| static uint32_t | dshotRpmGetFrame (const DshotRpmCapture *drcp, uint8_t index) |
| return last collected erps frame | |
| struct DshotDmaStreamChan |
structure defining dma channel
Definition at line 72 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 88 of file dshot_rpmCapture.h.
| Data Fields | ||
|---|---|---|
| uint16_t | buf[DSHOT_DMA_DATA_LEN+DSHOT_DMA_EXTRADATA_LEN] | |
| struct DshotRpmCaptureDmaBuffer |
Definition at line 92 of file dshot_rpmCapture.h.
| Data Fields | ||
|---|---|---|
| DshotRpmCaptureOneChannelDmaBuffer | dma_buf[DSHOT_CHANNELS] | |
| struct DshotRpmCaptureConfig |
: DSHOT Rpm Capture Driver configuration structure.
Definition at line 99 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 124 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 ) |
macro helper to design DMA stream
Definition at line 24 of file dshot_rpmCapture.h.
| #define DSHOT_DMA_DATA_LEN 16U |
Definition at line 15 of file dshot_rpmCapture.h.
Referenced by dshotRpmCatchErps().
| #define DSHOT_DMA_EXTRADATA_LEN 2U |
Definition at line 16 of file dshot_rpmCapture.h.
Referenced by dshotRpmCatchErps().
| #define DSHOTS_1STREAM | ( | tim | ) |
Definition at line 25 of file dshot_rpmCapture.h.
| #define DSHOTS_2STREAMS | ( | tim | ) |
Definition at line 26 of file dshot_rpmCapture.h.
| #define DSHOTS_3STREAMS | ( | tim | ) |
Definition at line 28 of file dshot_rpmCapture.h.
| #define DSHOTS_4STREAMS | ( | tim | ) |
Definition at line 31 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, DshotRpmCapture::config, TimICDriver::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, 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 190 of file dshot_rpmCapture.h.
References DshotRpmCapture::rpms.