35#ifndef VAC_MONITOR_DEVICE_DRIVER_TYPEDEF_H
36#define VAC_MONITOR_DEVICE_DRIVER_TYPEDEF_H
72 } __attribute__((packed))
bits;
108 } __attribute__((packed))
bits;
enum VACM_STATES_e VACM_STATES_t
Enumeration of state machine operating states data type.
@ VACM_STATE_ACDROP
state #6: AC drop detected
@ VACM_STATE_WAIT_ZC
state #3: wait for first zero crossing
@ VACM_STATE_STANDBY
state #0: wait for launch trigger
@ VACM_STATE_DCMODE
state #2: catch-up state in DC mode, bypassing any further AC analysis of the input voltage
@ VACM_STATE_ONLINE
state #5: normal AC input operation
@ VACM_STATE_DCDETECT
state #1: check if input votlage is DC or AC
@ VACM_STATE_ACSYNC
state #4: startup-step synchronization on first few zero crossings after AC detected
VACM_STATES_e
Enumeration of state machine operating states.
bool ac_ok
Bit #2: flag indicating the status of the line voltage
bool zero_cross
Bit #3: flag indicating that we are in the zero cross region.
bool slope_pos
Bit #6: flag = 1 when ac line slope is positive, 0 when negative
bool polarity_pos
Bit #4: flag = 1 when polarity is positive, 0 when negative.
struct VACM_STATUS_s::@15::@17 bits
bool end_of_cycle
Bit #5: flag indicating that the end of cycle has just occured
bool dc_mode
Bit #1: 1 when Vin = DC, 0 when Vin = AC.
bool ac_drop
Bit #0: flag indicating that an ac drop may have occurred.
struct VACM_FAULT_s::@18::@20 bits
bool zc_timeout
Bit #4: flag indicating that have spent too long in zero cross region
bool fmin
Bit #2: flag indicating that frequency of line voltage < min.
bool uv
Bit #1: flag indicating that magnitude of line voltage > OV threshold.
bool ov
Bit #0: flag indicating that magnitude of line voltage < UV threshold.
bool fmax
Bit #3: flag indicating that frequency of line voltage > max.
uint16_t vloop_ff
square of the average input voltage
int16_t * ptr_offset
rectified input voltage
uint16_t * ptr_adcbuf
Pointer to register or variable where the value is read from (e.g. ADCBUFx) or written to (e....
uint16_t avg_prev
average of the rectified input voltage over 1/2 line cycle
uint16_t raw_prev
raw ADC reading of input voltage, before offset removed and rectified
uint16_t avg_sqrd
previous reading of average (over 1/2 line cycle)
uint16_t avg
pointer to offset upon which sensed input voltage sits before it is digitized by the ADC
uint16_t rectified
previous reading of raw input voltage
uint16_t counter_reset
counter used for computing the average of the rectified input voltage
uint32_t acc
when avg_counter reaches this value, compute average
uint16_t ac_drop_timer
used to time duration of zero cross
uint16_t vin_present_counter
used to time duration of AC drop event
uint16_t startup_counter
used to time duration of half cycle
uint16_t dc_loss_counter
TODO: add comment
uint16_t dc_present_counter
used to confirm that some input voltage is present
uint16_t zero_cross_timer
used to count periods at startup
uint16_t half_cycle_timer
measurement of half line cycle in IRQ ticks
Main AC Monitor data object data type declaration.
VACM_TIMEBASE_t timebase
information related to line cycle and zero cross timing
VACM_STATUS_t status
AC monitor status flags.
VACM_FAULT_t fault
AC monitor fault flags.
VACM_STATES_t state
state machine operating state ID
VACM_AVGCALC_BUFFER_t avgcalc_buffer
used for store information needed at runtime for calculation of average of rectified input voltage
VACM_VIN_t vin
information related to input voltage