MX5051 Wheel Speed
DMA capture based RPM calculation with 16-bit or 32-bit timer support.
Functions
void MX5051_Init(MX5051_Typedef_t* s, uint32_t tim_clk_hz, uint32_t pulses_per_rev, uint8_t timer_is_32bit, uint8_t port, Generic_Kalman_Settings_t k)
Initializes timer parameters, buffer, and metadata.
void MX5051_Update_RPM(MX5051_Typedef_t* s, uint32_t dma_items_left, uint32_t current_tim_cnt)
Updates RPM based on DMA timestamps and timer rollovers.
uint16_t MX5051_decode(uint8_t high_byte, uint8_t low_byte)
Combines two bytes into a raw value.
Usage
c
#include "mx5051.h"
void mx5051_example(void) {
MX5051_Typedef_t s = {0};
Generic_Kalman_Settings_t k = {0};
MX5051_Init(&s, 100000U, 25U, 0, 0, k);
MX5051_Update_RPM(&s, 0, 1000U);
}