switch to scalable timebase for digital reader to prevent overflows

added yielding to emulation loop
This commit is contained in:
g3gg0
2022-11-19 17:03:55 +01:00
parent 1344f8f667
commit f2457b6ee5
5 changed files with 73 additions and 33 deletions
+7 -4
View File
@@ -11,14 +11,16 @@ extern "C" {
#endif
#define PULSE_READER_NO_EDGE 0xFFFFFFFFUL
#define F_CPU 64000000UL
#define F_TIM2 64000000UL
/**
* unit of the edge durations to return
*/
typedef enum {
PulseReaderUnit64MHz = 1,
PulseReaderUnitPicosecond = 15625
PulseReaderUnit64MHz,
PulseReaderUnitPicosecond,
PulseReaderUnitNanosecond,
PulseReaderUnitMicrosecond,
} PulseReaderUnit;
@@ -28,7 +30,8 @@ typedef struct {
uint32_t size;
uint32_t pos;
uint32_t timer_value;
PulseReaderUnit unit;
uint32_t unit_multiplier;
uint32_t unit_divider;
uint32_t bit_time;
uint32_t dma_channel;
const GpioPin* gpio;