|
|
@@ -88,7 +88,7 @@
|
|
|
//#define Active_ControllerID _Slave1_ID
|
|
|
|
|
|
#include "Slave_Ports_Status.h"
|
|
|
- Slave_Ports_Status Slave_Ports_Status_C;
|
|
|
+#include "Slave_Ports_QUEUE.h"
|
|
|
|
|
|
#include "_Slave_Ports_queue_task_type_LIST.h"
|
|
|
#include "_Slave_Ports_Protocol.h"
|
|
|
@@ -190,15 +190,20 @@ MCP_CAN CAN0(CAN_CSpin); // Set CS to pin 10
|
|
|
void setup() {
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
+
|
|
|
+ Slave_Ports_Status Slave_Ports_Status_C;
|
|
|
+ Slave_Ports_QUEUE Slave_Ports_QUEUE_C;
|
|
|
+
|
|
|
#include "_Slave_Ports_LOCAL_LIST.h"
|
|
|
#if defined(HAS_LCD1602)
|
|
|
lcd.begin(16, 2);
|
|
|
#endif
|
|
|
- Slave_Ports_Status_T _add[] = { 1, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01 };
|
|
|
+ //Slave_Ports_Status_T _add[] = { 1, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01 };
|
|
|
|
|
|
|
|
|
-
|
|
|
-/*Slave_Ports_Status_C.add_port(
|
|
|
+ Serial.println("#200 adding ports");
|
|
|
+
|
|
|
+Slave_Ports_Status_C.add_port(
|
|
|
1, // int Port_ID,
|
|
|
Active_ControllerID, // int _Slave_ID,
|
|
|
0x01, // int PortTypes,
|
|
|
@@ -208,13 +213,16 @@ void setup() {
|
|
|
0x01, // int Exp_state_ttl,
|
|
|
0x01, // int Broadcast_state,
|
|
|
0x01, // int I2C_port,
|
|
|
- _NOT_USED_ ); // int I2C_driver
|
|
|
-*/
|
|
|
-Slave_Ports_Status_C.add_port( 2, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, _NOT_USED_); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
+ I2C_driver_NOT_USED_ ); // int I2C_driver
|
|
|
+
|
|
|
+Slave_Ports_Status_C.add_port( 2, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, I2C_driver_NOT_USED_); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
+
|
|
|
+Slave_Ports_Status_C.add_port( 3, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, I2C_driver_Adafruit_PWMServoDriver ); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
+
|
|
|
+Slave_Ports_Status_C.add_port( 4, _Slave1_ID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, I2C_driver_Adafruit_PWMServoDriver ); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
+
|
|
|
|
|
|
-Slave_Ports_Status_C.add_port( 3, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, Adafruit_PWMServoDriver ); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
|
|
|
-//Slave_Ports_Status_C.add_port( 4, _Slave1_ID, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, Adafruit_PWMServoDriver ); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -290,9 +298,10 @@ delay(1000);
|
|
|
|
|
|
//if(CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
|
if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
|
- LCDarray1="MCP2515 Init Okay";
|
|
|
- LCDarray2="500KBPS 16MHZ";
|
|
|
- Serial.print(LCDarray1 + LCDarray2);
|
|
|
+ //LCDarray1="MCP2515 Init Okay";
|
|
|
+ //LCDarray2="500KBPS 16MHZ";
|
|
|
+ Serial.println("#303 MCP2515 Init Okay");
|
|
|
+ /*
|
|
|
#if defined(HAS_LCD1602)
|
|
|
LCD_print(LCDarray1, LCDarray2, LCDtim/5);
|
|
|
#endif
|
|
|
@@ -302,13 +311,16 @@ delay(1000);
|
|
|
display.print("MCP2515 Init Okay!!\r\n");
|
|
|
delay(LCDtim);
|
|
|
#endif
|
|
|
+ */
|
|
|
} else {
|
|
|
- LCDarray1 = "MCP2515 Init Failed";
|
|
|
+ /* LCDarray1 = "MCP2515 Init Failed";
|
|
|
LCDarray2 = "CAN_CSpin: ";
|
|
|
LCDarray2.concat(CAN_CSpin);
|
|
|
LCDarray2.concat("CAN_INTpin: ");
|
|
|
LCDarray2.concat(CAN_INTpin);
|
|
|
- Serial.print(LCDarray1);
|
|
|
+ */
|
|
|
+ Serial.println("#322 MCP2515 Init Failed");
|
|
|
+ /*
|
|
|
#if defined(HAS_LCD1602)
|
|
|
LCD_print(LCDarray1, LCDarray2, LCDtim / 2 ) ;
|
|
|
#endif
|
|
|
@@ -321,9 +333,10 @@ delay(1000);
|
|
|
display.print(LCDarray2);
|
|
|
delay(LCDtim);
|
|
|
#endif
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /*AAA
|
|
|
#if Active_ControllerID == _Slave1_ID
|
|
|
#include "_SlaveID_setup.h"
|
|
|
#elif Active_ControllerID == _ControllerID
|
|
|
@@ -343,28 +356,35 @@ delay(1000);
|
|
|
|
|
|
delay(LCDtim);
|
|
|
#endif
|
|
|
+ */
|
|
|
CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted
|
|
|
pinMode(CAN_INTpin, INPUT); // Setting pin 2 for /INT input
|
|
|
-
|
|
|
+ Serial.println("#362 set MCP_NORMAL");
|
|
|
//EOF CAN
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
+
|
|
|
+ /*AA
|
|
|
+ #if defined(HAS_LCD1602)
|
|
|
LCDarray1 = "#323 loop.... ";
|
|
|
//LCDarray2 = "....";
|
|
|
LCD_print1(LCDarray1, LCDtim/10);
|
|
|
|
|
|
#endif
|
|
|
-
|
|
|
-
|
|
|
+ */
|
|
|
+
|
|
|
//_Slave_Ports_queue.push(_LCD_print_queue.peek() + 1);
|
|
|
Serial.println("#298 _Slave_Ports_queue__list");
|
|
|
- _Slave_Ports_queue__INIT(_Slave_Ports_queue_tasks_LIST);
|
|
|
-_Slave_Ports_queue__list(_Slave_Ports_queue_tasks_LIST);
|
|
|
- int _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
+ //AA _Slave_Ports_queue__INIT(_Slave_Ports_queue_tasks_LIST);
|
|
|
+//AA _Slave_Ports_queue__list(_Slave_Ports_queue_tasks_LIST);
|
|
|
+//AA int _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
// int _Slave_Ports_queue_push = _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1) ;
|
|
|
//int _Slave_Ports_queue_peek_new = _Slave_Ports_queue.peek() ; _Slave_Ports_queue__add( *_Slave_Ports_queue_tasks_LIST, 0x01 ,0x00 ,100, 5000 ) ; // _Slave_Ports_queue_peek, _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1), _Slave_Ports_queue.peek());
|
|
|
//void _Slave_Ports_queue__add( _Slave_Ports_queue_tasksT* _Slave_Ports_queue_tasks_LIST,int _Slave_Ports_queue_task_type,int _Slave_Port_link,long time_seq_id, long time_min_run //,
|
|
|
-_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, int(0x04) ,0x00 ,100, 5000 ) ; // "_Slave_Ports_broadcast", //4
|
|
|
-_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x05 ,0x00 ,100, 5000 ) ; //"_Slave_Ports_set_I2C" //5 - to set ports associated on PW
|
|
|
+//A_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, int(0x04) ,0x00 ,100, 5000 ) ; // "_Slave_Ports_broadcast", //4
|
|
|
+int Slave_Ports_QUEUE_C_queue_id_current_broadcast = Slave_Ports_QUEUE_C.queue__add( TASK_TYPE_T_Slave_Ports_broadcast____,100, 5000 ) ; // "_Slave_Ports_broadcast", //4
|
|
|
+//_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x05 ,0x00 ,100, 5000 ) ; //"_Slave_Ports_set_I2C" //5 - to set ports associated on PW
|
|
|
+int Slave_Ports_QUEUE_C_queue_id_current_set_I2C = Slave_Ports_QUEUE_C.queue__add( TASK_TYPE_T_Slave_Ports_set_I2C______,100, 5000 ) ; // "_Slave_Ports_broadcast", //4
|
|
|
+
|
|
|
+delay(10000);
|
|
|
|
|
|
// _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
//_Slave_Ports_queue_push = _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1) ;
|
|
|
@@ -441,5 +461,3 @@ void loop() {
|
|
|
|
|
|
|
|
|
|
|
|
-#include "_PCINT_func.h"
|
|
|
-#include "_Slave_Ports_func.h"
|