|
@@ -9,10 +9,14 @@
|
|
|
* controls
|
|
* controls
|
|
|
* Slave ports via:
|
|
* Slave ports via:
|
|
|
* I2C
|
|
* I2C
|
|
|
- * ]PCA9685 - 16port 12bit PWM driver - can controll 16 eg. LEDs which can be 0....12V dimmed=]
|
|
|
|
|
|
|
+ * PCA9685 - 16port 12bit PWM driver - can controll 16 eg. LEDs which can be 0....12V dimmed=]
|
|
|
|
|
+ * todo 74HC595 - Serial to Parallel Shifting-Out - from 8 ports to many if connected in paraller
|
|
|
|
|
+ * based on https://www.arduino.cc/en/tutorial/ShiftOut
|
|
|
* or 16 servos
|
|
* or 16 servos
|
|
|
* - can have addressed many of PCA9685 on I2C bus - so can controll over 64 ports
|
|
* - can have addressed many of PCA9685 on I2C bus - so can controll over 64 ports
|
|
|
* to be added another devices tested
|
|
* to be added another devices tested
|
|
|
|
|
+ * todo Rottary Swich { GND, +, SW, DT, CLK } - to provide LCD menu access
|
|
|
|
|
+
|
|
|
* TODO structure of port is in _Slave_Ports.h
|
|
* TODO structure of port is in _Slave_Ports.h
|
|
|
* _Slave_Port _Slave_Ports[] = {
|
|
* _Slave_Port _Slave_Ports[] = {
|
|
|
{"CAN", 0x102, 0x80, 0x00, 0, 0x00, 0x00 },
|
|
{"CAN", 0x102, 0x80, 0x00, 0, 0x00, 0x00 },
|
|
@@ -72,6 +76,13 @@
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+#include "Queue.h"
|
|
|
|
|
+
|
|
|
|
|
+ Queue<int> _Slave_Ports_queue = Queue<int>(10);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#define _ControllerID 0x101
|
|
#define _ControllerID 0x101
|
|
|
#define _Slave1_ID 0x103
|
|
#define _Slave1_ID 0x103
|
|
|
|
|
|
|
@@ -79,31 +90,18 @@
|
|
|
//#define Active_ControllerID _Slave1_ID
|
|
//#define Active_ControllerID _Slave1_ID
|
|
|
|
|
|
|
|
|
|
|
|
|
- //REMOTE PORTS DEFINITIONS
|
|
|
|
|
- #include "_Slave_Ports.h"
|
|
|
|
|
- // #define _CAN_P_0x102_PWM0x00_0 { _Slave1_ID , "PWM", 0x00, 0 }
|
|
|
|
|
- //#define _CAN_P_0x102_PWMServoDriver0x40
|
|
|
|
|
-
|
|
|
|
|
- // #define Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver();
|
|
|
|
|
- // Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
#if Active_ControllerID == _ControllerID
|
|
#if Active_ControllerID == _ControllerID
|
|
|
String lcdPattern = "s" ;
|
|
String lcdPattern = "s" ;
|
|
|
#define HAS_LCD1602
|
|
#define HAS_LCD1602
|
|
|
// #define HAS_TFT_ILI9163C
|
|
// #define HAS_TFT_ILI9163C
|
|
|
|
|
+ #define HAS_ROTTARY_SW
|
|
|
#endif
|
|
#endif
|
|
|
#if Active_ControllerID == _Slave1_ID
|
|
#if Active_ControllerID == _Slave1_ID
|
|
|
String lcdPattern = "." ;
|
|
String lcdPattern = "." ;
|
|
|
#define HAS_TFT_ILI9163C
|
|
#define HAS_TFT_ILI9163C
|
|
|
// #define HAS_LCD1602
|
|
// #define HAS_LCD1602
|
|
|
#endif
|
|
#endif
|
|
|
-// #define __CSpin 53 // 10 // chip select
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- int LCDtim = 250; //the value of delay time
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//BEGIN 1602
|
|
//BEGIN 1602
|
|
|
#if defined(HAS_LCD1602)
|
|
#if defined(HAS_LCD1602)
|
|
|
#include <LiquidCrystal.h>
|
|
#include <LiquidCrystal.h>
|
|
@@ -113,39 +111,46 @@
|
|
|
const int LCD1602rs=12, LCD1602en=11, LCD1602db4=5, LCD1602db5=4, LCD1602db6=3, LCD1602db7=2; // lcd keypad shield pins
|
|
const int LCD1602rs=12, LCD1602en=11, LCD1602db4=5, LCD1602db5=4, LCD1602db6=3, LCD1602db7=2; // lcd keypad shield pins
|
|
|
LiquidCrystal lcd(LCD1602rs, LCD1602en, LCD1602db4, LCD1602db5, LCD1602db6, LCD1602db7);
|
|
LiquidCrystal lcd(LCD1602rs, LCD1602en, LCD1602db4, LCD1602db5, LCD1602db6, LCD1602db7);
|
|
|
int lcdPos = 0 ;
|
|
int lcdPos = 0 ;
|
|
|
|
|
+ #include "LCD1602.h"
|
|
|
|
|
+#endif
|
|
|
|
|
+ //REMOTE PORTS DEFINITIONS
|
|
|
|
|
+
|
|
|
|
|
+ #include "_Slave_Ports.h"
|
|
|
|
|
+ // #define _CAN_P_0x102_PWM0x00_0 { _Slave1_ID , "PWM", 0x00, 0 }
|
|
|
|
|
+ //#define _CAN_P_0x102_PWMServoDriver0x40
|
|
|
|
|
+
|
|
|
|
|
+ // #define Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver();
|
|
|
|
|
+ // Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// #define __CSpin 53 // 10 // chip select
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ int LCDtim = 250; //the value of delay time
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#if defined(HAS_ROTTARY_SW)
|
|
|
|
|
+ #include "_ROTTARY_SW.h"
|
|
|
#endif
|
|
#endif
|
|
|
// include the library code
|
|
// include the library code
|
|
|
/**********************************************************/
|
|
/**********************************************************/
|
|
|
//EOF BEGIN 1602
|
|
//EOF BEGIN 1602
|
|
|
|
|
|
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
|
|
|
+
|
|
|
#include <SPI.h>
|
|
#include <SPI.h>
|
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_GFX.h>
|
|
|
#include <TFT_ILI9163C.h>
|
|
#include <TFT_ILI9163C.h>
|
|
|
|
|
+ #include "TFT_ILI9163C.h"
|
|
|
|
|
|
|
|
- //#define TFT_ILI9163C_CSpin __CSpin // 53 // 10 // chip select
|
|
|
|
|
- #define TFT_ILI9163C_CSpin 7 // __CSpin // 53 // 10 // chip select
|
|
|
|
|
-
|
|
|
|
|
- #define TFT_ILI9163C_DCpin 8 // A0 data/command pin. sometimes called DC, RS, ...
|
|
|
|
|
-
|
|
|
|
|
- #define TFT_ILI9163C__RSTpin 9 //reset pin. you must connect. (or pullup)
|
|
|
|
|
- //#define __SDA 51 //11 //+ bidirectional data pin. Connect to MOSI
|
|
|
|
|
- //#define __SCK 52 //13 //+ clock. sometimes called SCLK, SCL, ...
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // Color definitions
|
|
|
|
|
- #define BLACK 0x0000
|
|
|
|
|
- #define BLUE 0x001F
|
|
|
|
|
- #define RED 0xF800
|
|
|
|
|
- #define GREEN 0x07E0
|
|
|
|
|
- #define CYAN 0x07FF
|
|
|
|
|
- #define MAGENTA 0xF81F
|
|
|
|
|
- #define YELLOW 0xFFE0
|
|
|
|
|
- #define WHITE 0xFFFF
|
|
|
|
|
-
|
|
|
|
|
- TFT_ILI9163C display = TFT_ILI9163C(TFT_ILI9163C_CSpin, TFT_ILI9163C_DCpin, TFT_ILI9163C__RSTpin);
|
|
|
|
|
- float p = 3.1415926;
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
@@ -162,9 +167,34 @@ const int CAN_CSpin = 53 , CAN_INTpin = 10 ;
|
|
|
MCP_CAN CAN0(CAN_CSpin); // Set CS to pin 10
|
|
MCP_CAN CAN0(CAN_CSpin); // Set CS to pin 10
|
|
|
//EOF CAN
|
|
//EOF CAN
|
|
|
|
|
|
|
|
|
|
+#include "_PCINT.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
void setup() {
|
|
|
|
|
+ Serial.begin(115200);
|
|
|
|
|
+// _LCD_print_queue.push(1);
|
|
|
|
|
+// _LCD_print_queue.push(2);
|
|
|
|
|
+// _LCD_print_queue.push(3);
|
|
|
|
|
+
|
|
|
|
|
+//String character = "Geas";
|
|
|
|
|
+//char b = abc.charAt(0);
|
|
|
|
|
+//int b_ascii_value = b;
|
|
|
|
|
+
|
|
|
|
|
+ // LCD_print_background_add( _LCD_print_buffors, 0, 0, 0, "W", 5000, 6000);
|
|
|
|
|
+ // LCD_print_background_add( _LCD_print_buffors, 1, 0, 0, "H", 5000, 6000);
|
|
|
|
|
+ // LCD_print_background_add( _LCD_print_buffors, 2, 0, 0, "W", 5000, 6000);
|
|
|
|
|
+ // LCD_print_background_add( _LCD_print_buffors, 3, 0, 0, "K", 5000, 6000);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//todo PCINT service
|
|
|
|
|
+#include "_PCINT_setup.h"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#if defined(HAS_ROTTARY_SW)
|
|
|
|
|
+ #include "_ROTTARY_SW_setup.h"
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
String LCDarray1="CAN_1602_LCD "; //the string to print onthe LCD
|
|
String LCDarray1="CAN_1602_LCD "; //the string to print onthe LCD
|
|
@@ -180,6 +210,9 @@ void setup() {
|
|
|
lcd.print(Active_ControllerID);
|
|
lcd.print(Active_ControllerID);
|
|
|
lcd.setCursor(0,1);
|
|
lcd.setCursor(0,1);
|
|
|
lcd.print(LCDarray2);
|
|
lcd.print(LCDarray2);
|
|
|
|
|
+ delay(LCDtim * 5);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
@@ -193,7 +226,7 @@ void setup() {
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
//BEGIN CAN
|
|
//BEGIN CAN
|
|
|
- Serial.begin(115200);
|
|
|
|
|
|
|
+
|
|
|
//if(CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
//if(CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
|
if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) {
|
|
|
|
|
|
|
@@ -212,66 +245,36 @@ void setup() {
|
|
|
delay(LCDtim);
|
|
delay(LCDtim);
|
|
|
#endif
|
|
#endif
|
|
|
} else {
|
|
} else {
|
|
|
- Serial.print("MCP2515 Init Failed!!\r\n");
|
|
|
|
|
|
|
+ LCDarray1 = "MCP2515 Init Failed";
|
|
|
|
|
+ LCDarray2 = "CAN_CSpin: ";
|
|
|
|
|
+ LCDarray2.concat(CAN_CSpin);
|
|
|
|
|
+ LCDarray2.concat("CAN_INTpin: ");
|
|
|
|
|
+ LCDarray2.concat(CAN_INTpin);
|
|
|
|
|
+ Serial.print(LCDarray1);
|
|
|
#if defined(HAS_LCD1602)
|
|
#if defined(HAS_LCD1602)
|
|
|
- delay(LCDtim);
|
|
|
|
|
- lcd.setCursor(0,1);
|
|
|
|
|
- lcd.print("MCP2515 Init Failed!!\r\n");
|
|
|
|
|
- delay(LCDtim);
|
|
|
|
|
- lcd.setCursor(0,0);
|
|
|
|
|
- lcd.print("CAN_CSpin: ");
|
|
|
|
|
- lcd.print(CAN_CSpin);
|
|
|
|
|
- lcd.print("CAN_INTpin: ");
|
|
|
|
|
- lcd.print(CAN_INTpin);
|
|
|
|
|
- delay(LCDtim);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ LCD_print(LCDarray1, LCDarray2, LCDtim / 2 ) ;
|
|
|
#endif
|
|
#endif
|
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
|
delay(LCDtim);
|
|
delay(LCDtim);
|
|
|
display.setCursor(0,20);
|
|
display.setCursor(0,20);
|
|
|
- display.print("MCP2515 Init Failed!! Check: \r\n");
|
|
|
|
|
|
|
+ display.print(LCDarray1);
|
|
|
delay(LCDtim);
|
|
delay(LCDtim);
|
|
|
display.setCursor(0,50);
|
|
display.setCursor(0,50);
|
|
|
- display.print("CAN_CSpin: ");
|
|
|
|
|
- display.print(CAN_CSpin);
|
|
|
|
|
- display.print("CAN_INTpin: ");
|
|
|
|
|
- display.print(CAN_INTpin);
|
|
|
|
|
|
|
+ display.print(LCDarray2);
|
|
|
delay(LCDtim);
|
|
delay(LCDtim);
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
#if Active_ControllerID == _Slave1_ID
|
|
#if Active_ControllerID == _Slave1_ID
|
|
|
- LCDarray1 = "Slave Module ";
|
|
|
|
|
- LCDarray2 = "enabling filters";
|
|
|
|
|
- //CAN0.init_Mask(0,0,0x010F0000); // Init first mask...
|
|
|
|
|
- //CAN0.init_Filt(0,0,0x01000000); // Init first filter...
|
|
|
|
|
- //CAN0.init_Filt(1,0,0x01010000); // Init second filter...
|
|
|
|
|
-
|
|
|
|
|
- //CAN0.init_Mask(1,0,0x010F0000); // Init second mask...
|
|
|
|
|
- //CAN0.init_Filt(2,0,0x01030000); // Init third filter...
|
|
|
|
|
- //CAN0.init_Filt(3,0,0x01040000); // Init fouth filter...
|
|
|
|
|
- //CAN0.init_Filt(4,0,0x01060000); // Init fifth filter...
|
|
|
|
|
- //CAN0.init_Filt(5,0,0x01070000); // Init sixth filter...
|
|
|
|
|
-
|
|
|
|
|
- //CAN0.init_Mask(0, 0, 0x01FF);
|
|
|
|
|
- //CAN0.init_Filt(0, 0, 0x103);
|
|
|
|
|
-
|
|
|
|
|
- //CAN.init_Mask(1, 0, 0x04FF);
|
|
|
|
|
- //CAN.init_Filt(1, 0, 0x4C0);
|
|
|
|
|
|
|
+ #include "_SlaveID_setup.h"
|
|
|
#elif Active_ControllerID == _ControllerID
|
|
#elif Active_ControllerID == _ControllerID
|
|
|
- LCDarray1 = "Master Module ";
|
|
|
|
|
- LCDarray2 = "enabling remotes";
|
|
|
|
|
|
|
+ LCDarray1 = "Master Module ";
|
|
|
|
|
+ LCDarray2 = "enabling remotes ";
|
|
|
#endif
|
|
#endif
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
Serial.println("");
|
|
Serial.println("");
|
|
|
#if defined(HAS_LCD1602)
|
|
#if defined(HAS_LCD1602)
|
|
|
- delay(LCDtim);
|
|
|
|
|
- lcd.setCursor(0,0);
|
|
|
|
|
- lcd.print(LCDarray1);
|
|
|
|
|
- lcd.setCursor(0,1);
|
|
|
|
|
- lcd.print(LCDarray2);
|
|
|
|
|
|
|
+ LCD_print(LCDarray1, LCDarray2, LCDtim / 5 ) ;
|
|
|
delay(LCDtim * 10);
|
|
delay(LCDtim * 10);
|
|
|
#endif
|
|
#endif
|
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
#if defined(HAS_TFT_ILI9163C)
|
|
@@ -291,91 +294,87 @@ void setup() {
|
|
|
lcd.print("loop...");
|
|
lcd.print("loop...");
|
|
|
lcdPos = 7;
|
|
lcdPos = 7;
|
|
|
#endif
|
|
#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() ;
|
|
|
|
|
+// 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());
|
|
|
|
|
+_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x01 ,0x00 ,100, 5000 ) ;
|
|
|
|
|
+ // _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
|
|
+ //_Slave_Ports_queue_push = _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1) ;
|
|
|
|
|
+ //_Slave_Ports_queue_peek_new = _Slave_Ports_queue.peek() ;
|
|
|
|
|
+//_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x02 ,0x00 ,100, 5000, _Slave_Ports_queue_peek, _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1), _Slave_Ports_queue.peek());
|
|
|
|
|
+// _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
|
|
+ //_Slave_Ports_queue_push = _Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1) ;
|
|
|
|
|
+ // _Slave_Ports_queue_peek_new = _Slave_Ports_queue.peek() ;
|
|
|
|
|
+//_Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x03 ,0x00 ,100, 5000, _Slave_Ports_queue_peek,
|
|
|
|
|
+//_Slave_Ports_queue.push(_Slave_Ports_queue.peek() + 1),
|
|
|
|
|
+//_Slave_Ports_queue.peek());
|
|
|
|
|
+
|
|
|
|
|
+ Serial.println("#301 _Slave_Ports_queue__list");
|
|
|
|
|
+_Slave_Ports_queue__list(_Slave_Ports_queue_tasks_LIST);
|
|
|
|
|
+Serial.print("#304 _Slave_Ports_queue.count(), "); Serial.println(_Slave_Ports_queue.count());
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // _Slave_Ports_queue__add( _Slave_Ports_queue_tasks_LIST, 0x03 ,0x00 ,100, 5000 ) ;
|
|
|
|
|
+ //Serial.println("#323 _Slave_Ports_queue__list"); _Slave_Ports_queue__list(_Slave_Ports_queue_tasks_LIST);
|
|
|
|
|
+// Serial.print("#324 _Slave_Ports_queue.count(), "); Serial.println(_Slave_Ports_queue.count());
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- #if Active_ControllerID == _ControllerID
|
|
|
|
|
- byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
|
|
|
|
|
- #endif
|
|
|
|
|
|
|
+ //#if Active_ControllerID == _ControllerID
|
|
|
|
|
+ // byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
|
|
|
|
|
+ //#endif
|
|
|
|
|
+
|
|
|
|
|
+ //String LCDarray1 ;
|
|
|
|
|
+ //String LCDarray2 ;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ unsigned long time;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- String LCDarray1 ;
|
|
|
|
|
- String LCDarray2 ;
|
|
|
|
|
void loop() {
|
|
void loop() {
|
|
|
|
|
+
|
|
|
|
|
+ #include "_PCINT_loop.h"
|
|
|
|
|
+
|
|
|
|
|
+ time = millis();
|
|
|
|
|
+ Serial.print("Time: " );
|
|
|
|
|
+ Serial.println(time);
|
|
|
// put your main code here, to run repeatedly:
|
|
// put your main code here, to run repeatedly:
|
|
|
//BEGIN CAN
|
|
//BEGIN CAN
|
|
|
|
|
+
|
|
|
#if Active_ControllerID == _Slave1_ID
|
|
#if Active_ControllerID == _Slave1_ID
|
|
|
- if(!digitalRead(CAN_INTpin)) // If pin 2 is low, read receive buffer
|
|
|
|
|
- {
|
|
|
|
|
- CAN0.readMsgBuf(&CANrxId, &CANlen, CANrxBuf); // Read data: len = data length, buf = data byte(s)
|
|
|
|
|
- Serial.print("ID: ");
|
|
|
|
|
- Serial.print(CANrxId, HEX);
|
|
|
|
|
- Serial.print(" Data: ");
|
|
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
|
|
- lcd.setCursor(0,0);
|
|
|
|
|
- lcd.print("ID: ");
|
|
|
|
|
- lcd.print(CANrxId, HEX);
|
|
|
|
|
- lcd.setCursor(0,1);
|
|
|
|
|
- lcd.print(" Data: ");
|
|
|
|
|
- #endif
|
|
|
|
|
- #if defined(HAS_TFT_ILI9163C)
|
|
|
|
|
- display.setCursor(0,40);
|
|
|
|
|
- display.print("ID: ");
|
|
|
|
|
- display.print(CANrxId, HEX);
|
|
|
|
|
- display.setCursor(0,50);
|
|
|
|
|
- display.print(" Data: ");
|
|
|
|
|
- #endif
|
|
|
|
|
- for(int i = 0; i<CANlen; i++) // Print each byte of the data
|
|
|
|
|
- {
|
|
|
|
|
- if(CANrxBuf[i] < 0x10) // If data byte is less than 0x10, add a leading zero
|
|
|
|
|
- {
|
|
|
|
|
- Serial.print("0");
|
|
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
|
|
- lcd.print("0");
|
|
|
|
|
- #endif
|
|
|
|
|
- #if defined(HAS_TFT_ILI9163C)
|
|
|
|
|
- display.print("0");
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- Serial.print(CANrxBuf[i], HEX);
|
|
|
|
|
- Serial.print(" ");
|
|
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
|
|
- lcd.print(CANrxBuf[i], HEX);
|
|
|
|
|
- lcd.print(" ");
|
|
|
|
|
- #endif
|
|
|
|
|
- #if defined(HAS_TFT_ILI9163C)
|
|
|
|
|
- display.print(CANrxBuf[i], HEX);
|
|
|
|
|
- display.print(" ");
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- Serial.println();
|
|
|
|
|
- }
|
|
|
|
|
- //EOF CAN
|
|
|
|
|
- #if defined(HAS_LCD1602)
|
|
|
|
|
- delay(LCDtim);
|
|
|
|
|
- //lcd.setCursor(0,1);
|
|
|
|
|
- lcd.print(lcdPattern);
|
|
|
|
|
- //lcd.print(lcdPos % 10);
|
|
|
|
|
- if(lcdPos == 16) {
|
|
|
|
|
- //lcd.print("N");
|
|
|
|
|
- lcd.setCursor(0,1);
|
|
|
|
|
- lcdPos = 0;
|
|
|
|
|
- if(lcdPattern==".") lcdPattern = "-" ;
|
|
|
|
|
- else lcdPattern = "." ;
|
|
|
|
|
- }
|
|
|
|
|
- lcdPos ++;
|
|
|
|
|
- #endif
|
|
|
|
|
- #if defined(HAS_TFT_ILI9163C)
|
|
|
|
|
- delay(LCDtim);
|
|
|
|
|
- display.setCursor(0,60);
|
|
|
|
|
- display.print("loop....");
|
|
|
|
|
- #endif
|
|
|
|
|
-
|
|
|
|
|
|
|
+ #include "_SlaveID_loop1.h"
|
|
|
#elif Active_ControllerID == _ControllerID
|
|
#elif Active_ControllerID == _ControllerID
|
|
|
#include "_ControllerID_loop1.h"
|
|
#include "_ControllerID_loop1.h"
|
|
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ _Slave_Ports_queue__list(_Slave_Ports_queue_tasks_LIST) ;
|
|
|
|
|
+ int _Slave_Ports_queue_count = _Slave_Ports_queue.count();
|
|
|
|
|
+ int _Slave_Ports_queue_front = _Slave_Ports_queue.front();
|
|
|
|
|
+ int _Slave_Ports_queue_back = _Slave_Ports_queue.back();
|
|
|
|
|
+ int _Slave_Ports_queue_peek = _Slave_Ports_queue.peek();
|
|
|
|
|
+ int _Slave_Ports_queue_pop = _Slave_Ports_queue.pop();
|
|
|
|
|
+ _Slave_Ports_queue__POP( _Slave_Ports_queue_tasks_LIST,
|
|
|
|
|
+ _Slave_Ports_queue_count,
|
|
|
|
|
+ _Slave_Ports_queue_pop,
|
|
|
|
|
+ _Slave_Ports_queue_front,
|
|
|
|
|
+ _Slave_Ports_queue_back,
|
|
|
|
|
+ _Slave_Ports_queue_peek,
|
|
|
|
|
+ LCDtim, _Slave_Ports);
|
|
|
|
|
+
|
|
|
|
|
+ //_LCD_print_buffors_list(_LCD_print_buffors) ;
|
|
|
|
|
+ //_LCD_print_screens_list(_LCD_print_screens);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+#include "_PCINT_func.h"
|
|
|
|
|
+#include "_Slave_Ports_func.h"
|