/* * ports.h * * Created on: Mar 21, 2023 * Author: Keith.Lloyd */ #ifndef PORTS_H_ #define PORTS_H_ typedef enum { ID_ERROR = 0, //0V should never happen. Error condition ID_TX_SINGLE_DIRECT, //Transmitter accessory ID_TX_DUAL_DIRECT, //Transmitter accessory ID_TX_TBD1, // ID_CLAMP2, // ID_CLAMP, //Receiver Clamp ID_TBD1, // ID_DIGITAL, //Digital Accessory - Use for EMS boot in future ID_FAULT_PROBE, //Fault Probe ID_TBD2, // ID_TBD3, // ID_NONE, //No accessory connected ID_NUM }ACCY_ID_t; typedef struct { bool isConnected; //Accessory is connected ACCY_ID_t connected; //Currently connected accessory ACCY_ID_t lastDetected; //accessory detected last scan uint32_t consecutiveScans; //number of consecutive scans of same accessory }ACCESSORY_t; #define DELAY_100MS 10 #define DELAY_ONE_SECOND 100 #define AC_NUM_SCANS_TO_CONNECT 3 //require 3 consecutive scans to connect to accessory #define A1_SLCT 0b00000000 #define A2_SLCT 0b00010000 #define B1_SLCT 0b00001000 #define B2_SLCT 0b00011000 #define TOP_SR 0 //0 #define MID_SR 1 #define BOTTOM_SR 2 //1 #define LF false #define HF true typedef enum { ONE, TWO, THREE, FOUR }OUTPUT_SELECT_t; void ACCY_Init(void); void ACCY_Update1(void); void ACCY_Update2(void); void Read_Tx_Ports(void); // check for whats plugged in at the ports. void Tx_ConfigureFrequency(void); void ACCY_Connect1(ACCY_ID_t id); void ACCY_Connect2(ACCY_ID_t id); bool ACCY_IsConnected(uint8_t port); ACCY_ID_t ACCY_GetConnectedAccessory(uint8_t port); ACCY_ID_t ACCY_GetActive(void); void Select_Output_Port(void); // Mutually exclusive output port selector void Enable_BC(void); void Disable_DC(void); void Disable_BC(void); void Disconnect(uint8_t port); // called when you disconnect uint32_t Search_BC_Frequency(void); 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); #endif /* PORTS_H_ */