PER Firmware
Loading...
Searching...
No Matches
current_sense.h
Go to the documentation of this file.
1
8#ifndef CURRENT_SENSE_H
9#define CURRENT_SENSE_H
10
11#include <stdint.h>
12#include "switch.h"
13
14// vTaskDelay(N) only guarantees N - 1 full ticks (ms) of elapsed time
15static constexpr uint32_t MUX_SETTLE_DELAY_MS = 2;
16static constexpr float MUX_SETTLE_TIME_US = 24.0f;
17static_assert(
18 MUX_SETTLE_DELAY_MS >= 1 && (MUX_SETTLE_DELAY_MS - 1) > (MUX_SETTLE_TIME_US / 1000.0f), // todo use dearunits here
19 "must delay longer than settle time"
20);
21
22static constexpr uint32_t CURRENT_SENSE_TASK_PERIOD_MS = 4;
23static_assert(
25 "task period must be longer than mux settle time"
26);
27void current_sense_periodic(void);
28
29#endif // CURRENT_SENSE_H
static constexpr uint32_t CURRENT_SENSE_TASK_PERIOD_MS
Definition current_sense.h:22
void current_sense_periodic(void)
Definition current_sense.c:43
static constexpr uint32_t MUX_SETTLE_DELAY_MS
Definition current_sense.h:15
static constexpr float MUX_SETTLE_TIME_US
Definition current_sense.h:16
switch mappings and control code