46 lines
1.3 KiB
C
Executable File
46 lines
1.3 KiB
C
Executable File
#ifndef EVSE_ERROR_H
|
|
#define EVSE_ERROR_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "pilot.h"
|
|
|
|
|
|
#define EVSE_ERR_AUTO_CLEAR_BITS ( \
|
|
EVSE_ERR_DIODE_SHORT_BIT | \
|
|
EVSE_ERR_TEMPERATURE_HIGH_BIT | \
|
|
EVSE_ERR_RCM_TRIGGERED_BIT )
|
|
|
|
// Error bits
|
|
#define EVSE_ERR_DIODE_SHORT_BIT (1 << 0)
|
|
#define EVSE_ERR_LOCK_FAULT_BIT (1 << 1)
|
|
#define EVSE_ERR_UNLOCK_FAULT_BIT (1 << 2)
|
|
#define EVSE_ERR_RCM_SELFTEST_FAULT_BIT (1 << 3)
|
|
#define EVSE_ERR_RCM_TRIGGERED_BIT (1 << 4)
|
|
#define EVSE_ERR_TEMPERATURE_HIGH_BIT (1 << 5)
|
|
#define EVSE_ERR_PILOT_FAULT_BIT (1 << 6)
|
|
#define EVSE_ERR_TEMPERATURE_FAULT_BIT (1 << 7)
|
|
|
|
// Inicialização do módulo de erros
|
|
void evse_error_init(void);
|
|
|
|
// Verificações e monitoramento
|
|
void evse_error_check(pilot_voltage_t pilot_voltage, bool is_n12v);
|
|
|
|
void evse_temperature_check(void);
|
|
|
|
void evse_error_tick(void);
|
|
|
|
// Leitura e controle de erros
|
|
uint32_t evse_get_error(void);
|
|
bool evse_is_error_cleared(void);
|
|
void evse_mark_error_cleared(void);
|
|
void evse_error_set(uint32_t bitmask);
|
|
void evse_error_clear(uint32_t bitmask);
|
|
bool evse_error_is_active(void);
|
|
uint32_t evse_error_get_bits(void);
|
|
void evse_error_reset_flag(void);
|
|
bool evse_error_cleared_flag(void);
|
|
|
|
#endif // EVSE_ERROR_H
|