More refactoring
Lots of things removed but compiles again
This commit is contained in:
@@ -8,8 +8,15 @@
|
||||
#ifndef PORTS_H_
|
||||
#define PORTS_H_
|
||||
|
||||
|
||||
#include "fgen.h"
|
||||
#include "driver.h"
|
||||
|
||||
|
||||
typedef struct ACCESSORY_s ACCESSORY_t;
|
||||
typedef int (*AccessoryHandler_t)(ACCESSORY_t *accy);
|
||||
typedef int (*AccessoryService_t)(ACCESSORY_t *accy);
|
||||
typedef FREQUENCY_t* (*AccessorySetFrequency_t)(ACCESSORY_t *accy, FREQUENCY_t *freq);
|
||||
typedef int (*AccessorySetPower_t)(ACCESSORY_t *accy, PowerLevel_t powerLevel);
|
||||
|
||||
typedef enum {
|
||||
ID_BROADCAST = -1,
|
||||
@@ -30,10 +37,12 @@ typedef enum {
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PORT_STATE_DEINIT = -1,
|
||||
PORT_STATE_ERROR = -1,
|
||||
PORT_STATE_INIT = 0,
|
||||
PORT_STATE_STANDBY = 1,
|
||||
PORT_STATE_RUNNING = 2,
|
||||
PORT_STATE_DEINIT,
|
||||
PORT_STATE_STANDBY,
|
||||
PORT_STATE_RUNNING,
|
||||
|
||||
} PortState_t;
|
||||
|
||||
typedef enum
|
||||
@@ -57,24 +66,30 @@ typedef struct
|
||||
bool connected;
|
||||
} AccessoryChannel_t;
|
||||
|
||||
struct ACCESSORY_s {
|
||||
struct ACCESSORY_s
|
||||
{
|
||||
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
|
||||
float *idVoltage;
|
||||
float *idVoltage;
|
||||
PortState_t state;
|
||||
bool initState;
|
||||
AccessoryHandler_t handler;
|
||||
|
||||
AccessoryService_t handler;
|
||||
AccessoryChannel_t channels[NUM_CHANNELS];
|
||||
|
||||
AccyChannelId_t activeChannel;
|
||||
|
||||
uint32_t stateTimer;
|
||||
|
||||
AccessoryPortId_t portId;
|
||||
|
||||
|
||||
AccessorySetFrequency_t setFrequency;
|
||||
AccessorySetPower_t setPower;
|
||||
|
||||
uint8_t powerLevel;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define DELAY_100MS 10
|
||||
@@ -111,7 +126,6 @@ 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);
|
||||
@@ -129,4 +143,8 @@ 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);
|
||||
|
||||
bool ACCY_timedOut(ACCESSORY_t *accy);
|
||||
void ACCY_setTimeout(ACCESSORY_t *accy, uint32_t msec);
|
||||
|
||||
#endif /* PORTS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user