#ifndef Slave_Ports_Status_S_h #define Slave_Ports_Status_S_h #define I2C_driver_NOT_USED_ 0x00 #define I2C_driver_Adafruit_PWMServoDriver 0x01 #define PortTypes_PWM 0x01 #define PortTypes_I2C 0x02 #define PortTypes_EXP 0x03 #define PortTypes_P2M_EXP_I2C 0x07 #define Exp_state_OFF 0x01 #define Exp_state_ON 0x02 #define Exp_state_ttl_TO_REFRESH 0x01 #define Broadcast_state_TO_REFRESH 0x01 #define I2C_port_DEFAULT 0x01 struct Slave_Ports_Status_S { int Port_ID ; //global id for device //const char * const _Protocol; int _Slave_ID; //Device which orginated port //remote id - use FF for broadcast int PortTypes; //0xFF = 1111 1111 s /* { bit 1 - PWM port bit 2 - on I2C managed port bit 3 - expanded port with LocalPort address bit 4 - not allocated bit 2 - not allocated bit 5 - not allocated bit 6 - not allocated bit 7 - not allocated bit 8 - not allocated } */ // byte has_Address; int Address ; // byte has_Local_Port; int LocalPort; int Exp_state; /*0xFF = 1111 1111 0x00 = 0000 0001 = OFF = 0V 0x01 = 0000 0002 = ON = PWM max { bit 1 - OFF = 0V bit 2 - ON = PWM max bit 3 - not allocated bit 4 - not allocated bit 2 - not allocated bit 5 - not allocated bit 6 - not allocated bit 7 - not allocated bit 8 - not allocated }*/ int Exp_state_ttl; // 0x01 = odswiezyc int Broadcast_state; //0x00 - not broadcast; 0x01 int I2C_port ; //0x01 - default port, 0x00 - not I2C connected int I2C_driver; //0x00 - not driver, 0x01 Adafruit_PWMServoDriver.h // int IS_Local; // Define if port is local or remote added } ; typedef struct Slave_Ports_Status_S Slave_Ports_Status_T; typedef int Slave_Ports_Status_add_port_count_T; Slave_Ports_Status_add_port_count_T Slave_Ports_Status_add_port_count_A ; void Slave_Ports_Status_add_port( Slave_Ports_Status_T* Slave_Ports_Status_A , Slave_Ports_Status_add_port_count_T* Slave_Ports_Status_add_port_count_A, int Port_ID, int _Slave_ID, int PortTypes, int Address, int LocalPort, int Exp_state, int Exp_state_ttl, int Broadcast_state, int I2C_port, //int I2C_driver int I2C_driver ) { int i = Slave_Ports_Status_add_port_count_A ; if(Slave_Ports_Status_add_port_count_A == 0) { Slave_Ports_Status_add_port_count_A ++; Slave_Ports_Status_A[i].Port_ID=0x00; Slave_Ports_Status_A[i]._Slave_ID=0x00; Slave_Ports_Status_A[i].PortTypes=0x00; Slave_Ports_Status_A[i].Address=0x00; Slave_Ports_Status_A[i].LocalPort=0x00; Slave_Ports_Status_A[i].Exp_state=0x00; Slave_Ports_Status_A[i].Exp_state_ttl=0x00; Slave_Ports_Status_A[i].Broadcast_state=0x00; Slave_Ports_Status_A[i].I2C_port=0x00; Slave_Ports_Status_A[i].I2C_driver=0x00; Slave_Ports_Status_add_port_count_A ++; } Slave_Ports_Status_A[i + 1].Port_ID = Port_ID ; Slave_Ports_Status_A[i + 1]._Slave_ID = _Slave_ID ; Slave_Ports_Status_A[i + 1].PortTypes = PortTypes ; Slave_Ports_Status_A[i + 1].Address = Address ; Slave_Ports_Status_A[i + 1].LocalPort = LocalPort ; Slave_Ports_Status_A[i + 1].Exp_state = Exp_state ; Slave_Ports_Status_A[i + 1].Exp_state_ttl = Exp_state_ttl ; Slave_Ports_Status_A[i + 1].Broadcast_state = Broadcast_state ; Slave_Ports_Status_A[i + 1].I2C_port = I2C_port ; Slave_Ports_Status_A[i + 1].I2C_driver = I2C_driver ; // Slave_Ports_Status_A[Slave_Ports_Status_add_port_count_A + 1].I2C_driver = I2C_driver_F(I2C_driver) ; Slave_Ports_Status_add_port_count_A ++; } #endif