Added software timers

Accessory state machine framework functional
This commit is contained in:
2025-06-18 17:53:00 -05:00
parent aaa7f0dc29
commit 658cedfa3b
18 changed files with 614 additions and 580 deletions

View File

@@ -32,13 +32,15 @@ typedef enum
{
PORT_STATE_DEINIT = -1,
PORT_STATE_INIT = 0,
PORT_STATE_STANDBY = 1,
PORT_STATE_RUNNING = 2,
} PortState_t;
typedef enum
{
ACCY_PORT_INDUCTION = -1,
ACCY_PORT_1 = 0,
ACCY_PORT_2 = 1,
ACCY_PORT_INDUCTION = 0,
ACCY_PORT_1 = 1,
ACCY_PORT_2 = 2,
NUM_PORTS
} AccessoryPortId_t;
@@ -67,6 +69,12 @@ struct ACCESSORY_s {
AccessoryChannel_t channels[NUM_CHANNELS];
AccyChannelId_t activeChannel;
uint32_t stateTimer;
AccessoryPortId_t portId;
};
#define DELAY_100MS 10
@@ -94,6 +102,7 @@ typedef enum {
void ACCY_Init(void);
bool ACCY_isKnown(ACCY_ID_t id);
void ACCY_Update(void);
void ACCY_Update1(void);
void ACCY_Update2(void);
void Read_Tx_Ports(void); // check for whats plugged in at the ports.
@@ -113,4 +122,11 @@ uint32_t Search_Frequency(uint32_t pattern);
bool Is_Clamp_Detected(void);
void Cycled_Freq_Change_BC(uint8_t value);
void Reset_Power_Gain(void);
void ACCY_service(void);
bool ACCY_Connect(ACCESSORY_t *accy, ACCY_ID_t id);
void ACCY_setActive(ACCESSORY_t *accy, AccyChannelId_t channel);
void ACCY_next(void);
#endif /* PORTS_H_ */