8#error dynamic dshot speed is not yet implemented in DSHOT BIDIR
27#define SWTICH_TO_CAPTURE_BASE_TIMOUT 38U
28#elif defined STM32F7XX
29#define SWTICH_TO_CAPTURE_BASE_TIMOUT 32U
31#define SWTICH_TO_CAPTURE_BASE_TIMOUT 28U
48#if !defined __GNUC__ || __GNUC__ < 13
85#ifndef GPT_DRIVER_EXT_FIELDS
86#error dshot rpmcapture driver involve defining #define GPT_DRIVER_EXT_FIELDS void *user_data; in halconf.h
89#define GPT_DRIVER_EXT_FIELDS void *user_data;
93 .frequency = 1000U * 1000U,
156 memset(
drcp->config->dma_capture->dma_buf, 0,
sizeof(
drcp->config->dma_capture->dma_buf));
160 drcp->config->dma_capture->dma_buf[i].buf,
189 if (
drcp->config->dcache_memory_in_use ==
true) {
204#if defined(DFREQ) && (DFREQ < 10) && (DFREQ != 0)
220 if ((index != 0xff) && (index != i))
222 uint16_t cur =
drcp->config->dma_capture->dma_buf[i].buf[0];
225 cur =
drcp->config->dma_capture->dma_buf[i].buf[
j];
254#if STM32_DMA_SUPPORTS_DMAMUX
259 .inc_peripheral_addr =
false,
260 .inc_memory_addr =
true,
265#if STM32_DMA_USE_ASYNC_TIMOUT
276 .periph_inc_size_4 =
false,
277 .transfert_end_ctrl_by_periph =
false
282 drcp->dmaCfgs[i].stream =
drcp->config->dma_streams[i].stream;
283#if STM32_DMA_SUPPORTS_DMAMUX
284 drcp->dmaCfgs[i].dmamux =
drcp->config->dma_streams[i].dmamux;
286 drcp->dmaCfgs[i].channel =
drcp->config->dma_streams[i].channel;
355 for (
size_t i = 1U; i <
dmaLen; i++) {
static const uint32_t ERPS_BIT1_DUTY
static uint32_t processErpsDmaBuffer(const uint16_t *capture, size_t dmaLen)
convert DMA buffer full of pulse length into raw ERPS frame
static const uint32_t TIM_PRESCALER
static void buildDmaConfig(DshotRpmCapture *drcp)
build dma configuration structure
static void gptCb(GPTDriver *gptd)
dma timeout ISR :
void dshotRpmCaptureStart(DshotRpmCapture *drcp, const DshotRpmCaptureConfig *cfg, stm32_tim_t *timer)
Configures and activates the DSHOT ERPS CAPTURE driver.
static void dmaErrCb(DMADriver *dmad, dmaerrormask_t em)
dma error ISR :
static const GPTConfig gptCfg
static void startCapture(DshotRpmCapture *drcp)
start the DMA capture
static const struct @5 activeDier[4]
static const float bit1t_us
void dshotRpmCatchErps(DshotRpmCapture *drcp)
capture the DSHOT ERPS frame(s) : one frame for each DSHOT_CHANNELS
static const TimICConfig timicCfgSkel
static const float TIM_FREQ_MHZ
void dshotRpmCaptureStop(DshotRpmCapture *drcp)
stop the the DSHOT ERPS CAPTURE driver.
static void initCache(DshotRpmCapture *drcp)
build dma and timer registers cache
#define SWTICH_TO_CAPTURE_BASE_TIMOUT
static void stopCapture(DshotRpmCapture *drcp)
stop the DMA capture
static const float speed_factor
#define DSHOT_DMA_EXTRADATA_LEN
#define DSHOT_DMA_DATA_LEN
: DSHOT Rpm Capture Driver configuration structure.
#define DSHOT_SPEED
Base freq of DSHOT signal (in kHz) Possible values are: 150, 300, 600.
void chprintf(BaseSequentialStream *lchp, const char *fmt,...)
void dmaObjectInit(DMADriver *dmap)
bool dmaStartTransfert(DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size)
Starts a DMA transaction.
void dmaStopTransfertI(DMADriver *dmap)
Stops an ongoing transaction.
bool dmaStart(DMADriver *dmap, const DMAConfig *cfg)
Configures and activates the DMA peripheral.
@ DMA_ONESHOT
One transert then stop
@ DMA_DIR_P2M
PERIPHERAL to MEMORY
static size_t dmaGetTransactionCounter(DMADriver *dmap)
dmaerrormask_t
Possible DMA failure causes.
uint32_t stream
stream associated with transaction
DMA stream configuration structure.
Structure representing a DMA driver.
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
void timerDmaCache_restore(const TimerDmaCache *tdcp, DMADriver *toDma, stm32_tim_t *toTim)
void timerDmaCache_cache(TimerDmaCache *tdcp, const DMADriver *fromDma, const stm32_tim_t *fromTim)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.