forked from achamaikin/CCSModuleSW30Web
Policy/executor hooks, event-driven OFF/ON state machine, and release binaries. Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
763 B
C
36 lines
763 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "charger_config.h"
|
|
|
|
typedef struct {
|
|
uint16_t voltage_V;
|
|
uint16_t current_0p1A;
|
|
} PowerSetpoint_t;
|
|
|
|
typedef enum {
|
|
POWER_SETPOINT_NORMAL,
|
|
POWER_SETPOINT_FAST_DISCHARGE,
|
|
} PowerSetpointAction_t;
|
|
|
|
typedef struct {
|
|
uint8_t dc_contactor_closed;
|
|
uint8_t psu_hv_enabled;
|
|
uint16_t measured_voltage_V;
|
|
uint16_t measured_current_0p1A;
|
|
uint8_t power_delivery_active;
|
|
uint8_t enable_output;
|
|
uint8_t psu_state_connected;
|
|
uint8_t psu_cont_fault;
|
|
uint8_t psu_fault;
|
|
uint8_t fast_discharge_count;
|
|
uint32_t last_fast_discharge_ms;
|
|
uint32_t now_ms;
|
|
} PowerPathContext_t;
|
|
|
|
PowerSetpointAction_t PowerSetpoint_Decide(
|
|
const PowerSetpoint_t *applied,
|
|
const PowerSetpoint_t *next,
|
|
const PowerPathContext_t *ctx);
|