_Slave_Ports_Struct.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. typedef struct {
  2. const char * const _Protocol;
  3. int _Slave_ID; //remote id - use FF for broadcast
  4. int PortTypes; //0xFF = 1111 1111 s
  5. /*
  6. {
  7. bit 1 - PWM port
  8. bit 2 - on I2C managed port
  9. bit 3 - expanded port with LocalPort address
  10. bit 4 - not allocated
  11. bit 2 - not allocated
  12. bit 5 - not allocated
  13. bit 6 - not allocated
  14. bit 7 - not allocated
  15. bit 8 - not allocated
  16. }
  17. */
  18. // byte has_Address;
  19. int Address ;
  20. // byte has_Local_Port;
  21. int LocalPort;
  22. int Exp_state; /*0xFF = 1111 1111
  23. 0x00 = 0000 0000 = OFF = 0V
  24. 0x01 = 0000 0001 = ON = PWM max
  25. {
  26. bit 1 - OFF = 0V
  27. bit 2 - ON = PWM max
  28. bit 3 - not allocated
  29. bit 4 - not allocated
  30. bit 2 - not allocated
  31. bit 5 - not allocated
  32. bit 6 - not allocated
  33. bit 7 - not allocated
  34. bit 8 - not allocated
  35. }*/
  36. int Exp_state_ttl; // 0x00 = odswiezyc
  37. //int Broadcast_state; //0x00 - not broadcast; 0x01
  38. } _Slave_Port;
  39. struct _Slave_Ports_queue_tasksS {
  40. int queueID;
  41. int _Slave_Ports_queue_task_type ; /*
  42. { 0x01 _Slave_Ports_ttl_decrement,
  43. 0x02 request_confirm_Exp_state ,
  44. 0x03 request_set_new_Exp_state,
  45. 0x04
  46. }
  47. */
  48. int _Slave_Port_link; //todo link
  49. long time_seq_id;
  50. long time_min_run;
  51. } ;
  52. typedef struct _Slave_Ports_queue_tasksS _Slave_Ports_queue_tasksT;
  53. typedef int _Slave_ID_BROADCAST_T ;
  54. typedef int _SENDER_T ;
  55. //#define _Slave_ID_BROADCAST_T _Slave_ID_BROADCAST 0xFF ;
  56. #if ! defined(Active_ControllerID)
  57. #error "#9 not defined Active_ControllerID"
  58. #endif
  59. struct _Slave_Ports_Protocol_CAN_broadcast_S {
  60. const _Slave_ID_BROADCAST_T _Slave_ID_BROADCAST = 0xFF ; // 1remote id - use FF for broadcast
  61. const _SENDER_T _SENDER = Active_ControllerID ; //2 sender //Device which orginated port
  62. int Port_ID ; //3 global id for device //const char * const _Protocol;
  63. int PortTypes; //4 0xFF = 1111 1111 s
  64. //int Address ; //
  65. //int LocalPort; //
  66. int Exp_state; //5
  67. int Exp_state_ttl; //6
  68. int Broadcast_state; //7
  69. const int _CAN_8 = 0x07 ; //8 - nbot used
  70. } ;
  71. typedef struct _Slave_Ports_Protocol_CAN_broadcast_S _Slave_Ports_Protocol_CAN_broadcast_T;
  72. typedef int _CAN_SEND_1_T ; //1 byte = 0
  73. typedef int _CAN_SEND_2_T ; //2 byte = 8
  74. struct _Slave_Ports_Protocol_CAN_SEND_S {
  75. const _SENDER_T _SENDER = Active_ControllerID ;
  76. const _CAN_SEND_1_T _CAN_SEND_1 = 0 ;
  77. const _CAN_SEND_2_T _CAN_SEND_2 = 8 ;
  78. _Slave_Ports_Protocol_CAN_broadcast_T _Slave_Ports_Protocol_CAN_broadcast_A ;
  79. } ;
  80. //typedef byte _Slave_Ports_Protocol_CAN_broadcast_AS[8] ;
  81. /*
  82. struct _Slave_Ports_Protocol_CAN_broadcast_AS {
  83. const byte _Slave_ID_BROADCAST = 0xFF ; // 1remote id - use FF for broadcast
  84. const byte _SENDER = Active_ControllerID ; //2 sender //Device which orginated port
  85. byte Port_ID ; //3 global id for device //const char * const _Protocol;
  86. byte PortTypes; //4 0xFF = 1111 1111 s
  87. //int Address ; //
  88. //int LocalPort; //
  89. byte Exp_state; //5
  90. byte Exp_state_ttl; //6
  91. byte Broadcast_state; //7
  92. const byte _CAN_8 = 0x07 ; //8 - nbot used
  93. } ;
  94. */
  95. typedef byte _Slave_Ports_Protocol_CAN_broadcast_AS[8] ;