#ifndef SLAVE_PORTS_STATUS_H #define SLAVE_PORTS_STATUS_H #define I2C_driver_NOT_USED_ 0x00 #define I2C_driver_Adafruit_PWMServoDriver 0x01 #include #ifndef voidfuncptr_t #define voidfuncptr_t voidfuncptr_t typedef void (*voidfuncptr_t)(void); // void function pointer typedef #endif #ifndef vfp_vpu32b_t #define vfp_vpu32b_t vfp_vpu32b_t typedef void (*vfp_vpu32b_t)(void*, uint32_t, bool); #endif typedef struct { uint8_t CNF1; } I2C_driver_T; static I2C_driver_T constexpr _NOT_USED_ = {0x00}; static I2C_driver_T constexpr Adafruit_PWMServoDriver = {0x01}; /* typedef struct { char I2C_driver_TA[32]; } I2C_driver_TS ; */ //typedef struct I2C_driver_TS I2C_driver_TT; //I2C_driver_TS I2C_driver_AA = { "_NOT_USED_" }; //I2C_driver_AA[0] = "_NOT_USED_" ; //I2C_driver_AA[0x01] = "Adafruit_PWMServoDriver" ; 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 0000 = OFF = 0V 0x01 = 0000 0001 = 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; // 0x00 = 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; /* enum class Mode : uint8_t { Normal = 0x00, Sleep = 0x20, Loopback = 0x40, ListenOnly = 0x60, Config = 0x80 }; */ //char I2C_driver_FT[32] ; static char I2C_driver_FT[24]; #include "Slave_Ports_Status_QUEUE.h" class Slave_Ports_Status { //private: //public: // static Slave_Ports_Status *first; //static Slave_Ports_Status *_data; public: int _count; // int _queue_id_current ; // int _queue_count ; Slave_Ports_Status_T *Slave_Ports_Status_A; //Slave_Ports_Status_QUEUE_T *Slave_Ports_Status_QUEUE_A ; // void push(Slave_Ports_Status_S const &item); //void push(); //Slave_Ports_Status(); // bool setMode(); //voidfuncptr_t func; // address of coroutine function Slave_Ports_Status(); /* inline int add( Slave_Ports_Status_LIST_T Slave_Ports_Status_LIST_A , Slave_Ports_Status_T Slave_Ports_Status_A ) { }; */ void add_port( 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 //I2C_driver_T I2C_driver ); bool add_empty(); void print_ports(); void list_ports(); // Slave_Ports_Status_S get_port(int Port_ID); // int get_count(); // void I2C_driver_FS(int I2C_driver) ;//char* // byte _Slave_Ports_Protocol_CAN_broadcast_F(); ~Slave_Ports_Status(); // int queue__add_A(Slave_Ports_Status_QUEUE_T QUEUE_A); // int queue__add(TASK_TYPE_T, long int, long int); }; #endif