|
@@ -6,8 +6,24 @@ Servo myservo;
|
|
|
#define Port7 7 //for TFT_ILI9163C_CSpin 7
|
|
#define Port7 7 //for TFT_ILI9163C_CSpin 7
|
|
|
#define Port8 8 //for TFT_ILI9163C_DCpin 8
|
|
#define Port8 8 //for TFT_ILI9163C_DCpin 8
|
|
|
#define Port9 9 //for TFT_ILI9163C__RSTpin 9
|
|
#define Port9 9 //for TFT_ILI9163C__RSTpin 9
|
|
|
- #define TFT_ILI9163C_CSpin Port7 // 7 // __CSpin // 53 // 10 // chip select
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // #define TFT_ILI9163C_CSpin Port7 // 7 // __CSpin // 53 // 10 // chip select
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#include "__main_struct.h" //lite #include "___main/__main_struct.h"
|
|
|
|
|
+
|
|
|
|
|
+#include "progmem.h"
|
|
|
|
|
+
|
|
|
|
|
+#include "__main_struct_limits.h"
|
|
|
|
|
+#include "_PortTypes_struct.h"
|
|
|
|
|
+#include "_Port_Exp_state_ttl_struct.h"
|
|
|
|
|
+#include "_Port_Broadcast_state_struct.h"
|
|
|
|
|
+#include "_PortStates_struct.h"
|
|
|
|
|
+#include "_Port_I2C_driver_struct.h"
|
|
|
|
|
+#include "config_Active_ControllerID.h"
|
|
|
|
|
+#include "config_Slave_Ports_LOCAL_config.h" //lite
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#if ! defined(TFT_ILI9163C_DCpin)
|
|
#if ! defined(TFT_ILI9163C_DCpin)
|
|
|
#define TFT_ILI9163C_DCpin Port8 //8 // A0 data/command pin. sometimes called DC, RS, ...
|
|
#define TFT_ILI9163C_DCpin Port8 //8 // A0 data/command pin. sometimes called DC, RS, ...
|
|
@@ -18,20 +34,10 @@ Servo myservo;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
-#include "__main_struct.h" //lite #include "___main/__main_struct.h"
|
|
|
|
|
-
|
|
|
|
|
-#include "progmem.h"
|
|
|
|
|
-
|
|
|
|
|
-#include "__main_struct_limits.h"
|
|
|
|
|
-
|
|
|
|
|
-#include "config_Active_ControllerID.h"
|
|
|
|
|
-#include "config_Slave_Ports_LOCAL_config.h" //lite
|
|
|
|
|
-
|
|
|
|
|
#include "automation_driven.submodule.struct.write_neuron.h"
|
|
#include "automation_driven.submodule.struct.write_neuron.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
#if defined(HAS_LCD1602_I2C)
|
|
#if defined(HAS_LCD1602_I2C)
|
|
|
#include <LiquidCrystal_I2C.h>
|
|
#include <LiquidCrystal_I2C.h>
|
|
|
LiquidCrystal_I2C lcd(0x27,LCD1602_DISPLAY_PHYSICAL_X_CHARS_A,LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A);
|
|
LiquidCrystal_I2C lcd(0x27,LCD1602_DISPLAY_PHYSICAL_X_CHARS_A,LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A);
|
|
@@ -54,8 +60,8 @@ Servo myservo;
|
|
|
// #error test
|
|
// #error test
|
|
|
TFT_HX8357 DISPLAY_DEV = TFT_HX8357(); // Invoke custom library
|
|
TFT_HX8357 DISPLAY_DEV = TFT_HX8357(); // Invoke custom library
|
|
|
bool DISPLAY_PHYS_A_set() {
|
|
bool DISPLAY_PHYS_A_set() {
|
|
|
- DISPLAY_PHYS_A[0].X = 240 ;
|
|
|
|
|
- DISPLAY_PHYS_A[0].Y = 320 ;
|
|
|
|
|
|
|
+ DISPLAY_PHYS_A[0].X = 320 ;
|
|
|
|
|
+ DISPLAY_PHYS_A[0].Y = 240 ;
|
|
|
}
|
|
}
|
|
|
bool DISPLAY_PHYS_A_set_init = DISPLAY_PHYS_A_set();
|
|
bool DISPLAY_PHYS_A_set_init = DISPLAY_PHYS_A_set();
|
|
|
#endif
|
|
#endif
|
|
@@ -103,18 +109,51 @@ Servo myservo;
|
|
|
#include "_PCINT_init.h"
|
|
#include "_PCINT_init.h"
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+//#include "config_Slave_Ports_LOCAL_init.h"
|
|
|
|
|
+#include "automation_driven.submodule.struct.write_neuron_override.h"
|
|
|
|
|
|
|
|
#include "neuron-conf.h"
|
|
#include "neuron-conf.h"
|
|
|
|
|
+#include "config_Slave_Ports_LOCAL_neuron_config.h"
|
|
|
|
|
+
|
|
|
#include "neuron_Input_func.h"
|
|
#include "neuron_Input_func.h"
|
|
|
#include "neuron_Stress_func.h"
|
|
#include "neuron_Stress_func.h"
|
|
|
#include "neuron_Attract_func.h"
|
|
#include "neuron_Attract_func.h"
|
|
|
-
|
|
|
|
|
|
|
+#include "neuron_PORT_to_NEURON_func.h"
|
|
|
#include "neuron_Resting_Potenial_func.h"
|
|
#include "neuron_Resting_Potenial_func.h"
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#include "_TASK_TYPES_struct.h"
|
|
|
|
|
+
|
|
|
|
|
+bool neuron_print_ROTTARY_Coordinate_Y_SHIFT_flag = 0 ;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#include "automation_driven.submodule.struct.write_neuron.lcd_menu.h"
|
|
|
|
|
+
|
|
|
#include "Simulated_potential_show_lcd.h"
|
|
#include "Simulated_potential_show_lcd.h"
|
|
|
-#include "neuron_print.h"
|
|
|
|
|
|
|
+
|
|
|
|
|
+#include "_time_struct.h"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#if defined(HAS_ADKeyboard)
|
|
|
|
|
+ #include "ADKeyboard.h"
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
|
|
|
|
|
+ #include "neuron_print.h"
|
|
|
|
|
+ #endif
|
|
|
// bool if_show_p0_neuron_title = 0 ;
|
|
// bool if_show_p0_neuron_title = 0 ;
|
|
|
|
|
+#include "TASK_TYPE_T_Get_Ports_Status_INPUT_A___.h"
|
|
|
|
|
+#include "_Slave_Ports_Status_func_add_lite.h"
|
|
|
|
|
+
|
|
|
|
|
+#if Active_ControllerID == 0x14
|
|
|
|
|
+ #include "0x14/config_Slave_Ports_LOCAL_0x14_init.h"
|
|
|
|
|
+#elif Active_ControllerID == 0x38
|
|
|
|
|
+ #include "0x38/config_Slave_Ports_LOCAL_0x38_init.h"
|
|
|
|
|
+#else
|
|
|
|
|
+ #error not set correct Active_ControllerID
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -133,12 +172,44 @@ void action_button_input( ) {
|
|
|
for(int i=0; i<20;i++) {
|
|
for(int i=0; i<20;i++) {
|
|
|
lcd.setCursor(i,1);
|
|
lcd.setCursor(i,1);
|
|
|
if(IOKey == i+1) {
|
|
if(IOKey == i+1) {
|
|
|
- lcd.print("+");
|
|
|
|
|
- //NEURON_A[i].Simulated_potential = NEURON_A[i].Simulated_potential + ( action_button_input_Maximum_current * action_button_input_Time_constant ) / NEURON_A[i].Capacitance ;
|
|
|
|
|
- neuron_Input(i,action_button_input_Time_constant,action_button_input_Maximum_current, 0 );
|
|
|
|
|
- Serial.print(F(" ")); Serial.print(NEURON_A[i].Simulated_potential);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(IOKey == 11) {//11 l
|
|
|
|
|
+ lcd_menu__action_button_input__left() ;
|
|
|
|
|
+ } else if(IOKey == 12) { //12 up
|
|
|
|
|
+ lcd_menu__action_button_input__up() ;
|
|
|
|
|
+ } else if(IOKey == 13) { //13 fire
|
|
|
|
|
+ lcd_menu__action_button_input__toggle() ;
|
|
|
|
|
+ } else if(IOKey == 14) { //14 dol
|
|
|
|
|
+ lcd_menu__action_button_input__down();
|
|
|
|
|
+ } else if(IOKey == 15) { //15 r
|
|
|
|
|
+ lcd_menu__action_button_input__right() ;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lcd.print("+");
|
|
|
|
|
+ //NEURON_A[i].Simulated_potential = NEURON_A[i].Simulated_potential + ( action_button_input_Maximum_current * action_button_input_Time_constant ) / NEURON_A[i].Capacitance ;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ neuron_Input(i,neuron_Logic_A[0].action_button_input_Time_constant , neuron_Logic_A[0].action_button_input_Maximum_current, 0 );
|
|
|
|
|
+ Serial.print(F(" ")); Serial.print(NEURON_A[i].Simulated_potential);
|
|
|
|
|
+ }
|
|
|
} else lcd.print(" ");
|
|
} else lcd.print(" ");
|
|
|
}
|
|
}
|
|
|
|
|
+ #elif defined(HAS_ADKeyboard)
|
|
|
|
|
+ if(IOKey == 1) {
|
|
|
|
|
+ lcd_menu__action_button_input__right() ;
|
|
|
|
|
+ } else if(IOKey == 2) {
|
|
|
|
|
+ lcd_menu__action_button_input__down();
|
|
|
|
|
+ } else if(IOKey == 3) {
|
|
|
|
|
+ lcd_menu__action_button_input__up() ;
|
|
|
|
|
+ } else if(IOKey == 4) {
|
|
|
|
|
+ lcd_menu__action_button_input__left() ;
|
|
|
|
|
+ } else if(IOKey == 5) {
|
|
|
|
|
+ lcd_menu__action_button_input__toggle() ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -147,6 +218,14 @@ void action_button_input( ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+#if defined(HAS_HCSR04)
|
|
|
|
|
+ #include "HC-SR04.h"
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
Serial.begin(115200);
|
|
Serial.begin(115200);
|
|
|
lcd.init(); // Print a message to the LCD.
|
|
lcd.init(); // Print a message to the LCD.
|
|
@@ -155,14 +234,19 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
//lcd.print("debug neuron ");
|
|
//lcd.print("debug neuron ");
|
|
|
#if defined(HAS_TFT_HX8357)
|
|
#if defined(HAS_TFT_HX8357)
|
|
|
DISPLAY_DEV.init();
|
|
DISPLAY_DEV.init();
|
|
|
- #else
|
|
|
|
|
|
|
+ DISPLAY_DEV.setRotation(1);
|
|
|
|
|
+ #elif defined(HAS_TFT_ILI9163C)
|
|
|
DISPLAY_DEV.begin();
|
|
DISPLAY_DEV.begin();
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
|
|
|
// DISPLAY_DEV.setRotation(2);
|
|
// DISPLAY_DEV.setRotation(2);
|
|
|
DISPLAY_DEV.fillScreen(BLACK);//DISPLAY_DEV.clearScreen();
|
|
DISPLAY_DEV.fillScreen(BLACK);//DISPLAY_DEV.clearScreen();
|
|
|
DISPLAY_DEV.setCursor(0,0);
|
|
DISPLAY_DEV.setCursor(0,0);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ #endif
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#if defined(HAS__PCINT_setup)
|
|
#if defined(HAS__PCINT_setup)
|
|
|
#include "_PCINT_setup.h" //empty
|
|
#include "_PCINT_setup.h" //empty
|
|
@@ -174,14 +258,26 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
show_p0_neuron_title();
|
|
show_p0_neuron_title();
|
|
|
-
|
|
|
|
|
|
|
+ /*
|
|
|
pinMode(AnalogSensorLL_PIN, INPUT_PULLUP);
|
|
pinMode(AnalogSensorLL_PIN, INPUT_PULLUP);
|
|
|
pinMode(AnalogSensorLC_PIN, INPUT_PULLUP);
|
|
pinMode(AnalogSensorLC_PIN, INPUT_PULLUP);
|
|
|
pinMode(AnalogSensorRC_PIN, INPUT_PULLUP);
|
|
pinMode(AnalogSensorRC_PIN, INPUT_PULLUP);
|
|
|
pinMode(AnalogSensorRR_PIN, INPUT_PULLUP);
|
|
pinMode(AnalogSensorRR_PIN, INPUT_PULLUP);
|
|
|
-
|
|
|
|
|
- myservo.attach(PWM_Servo_PIN);
|
|
|
|
|
- myservo.write(90);
|
|
|
|
|
|
|
+ */
|
|
|
|
|
+ TASK_TYPE_T_Get_Ports_Status_INPUT_A___SETUP();
|
|
|
|
|
+ #if defined(PWM_Servo_PIN)
|
|
|
|
|
+ myservo.attach(PWM_Servo_PIN);
|
|
|
|
|
+ myservo.write(90);
|
|
|
|
|
+ #endif
|
|
|
|
|
+ #if defined(HAS_HCSR04)
|
|
|
|
|
+ pinMode(HCSR04_trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
|
|
|
|
|
+ pinMode(HCSR04_echoPin, INPUT); // Sets the echoPin as an INPUT
|
|
|
|
|
+ #endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #if defined(HAS_ADKeyboard)
|
|
|
|
|
+ // pinMode(ADKeyboard_PIN, INPUT_PULLUP) ;
|
|
|
|
|
+ #endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -218,12 +314,21 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
|
|
|
|
|
// if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
|
|
// if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
|
|
|
// Serial.print(F("R"));
|
|
// Serial.print(F("R"));
|
|
|
|
|
+
|
|
|
|
|
+ #if defined(HAS_HCSR04)
|
|
|
|
|
+ HCSR04_input();
|
|
|
|
|
+ #endif
|
|
|
|
|
+
|
|
|
|
|
+ neuron_PORT_to_NEURON();
|
|
|
|
|
+ neuron_Resting_Potenial_input();
|
|
|
neuron_Resting_Potenial();
|
|
neuron_Resting_Potenial();
|
|
|
// Serial.print(F("C"));
|
|
// Serial.print(F("C"));
|
|
|
Simulated_potential_show_lcd();
|
|
Simulated_potential_show_lcd();
|
|
|
// Serial.print(F("P"));
|
|
// Serial.print(F("P"));
|
|
|
|
|
+ #if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
|
|
|
neuron_print();
|
|
neuron_print();
|
|
|
-
|
|
|
|
|
|
|
+ #endif
|
|
|
|
|
+ TASK_TYPE_T_Get_Ports_Status_INPUT_A___LOOP();
|
|
|
|
|
|
|
|
#if defined(HAS_W5IOKeypad)
|
|
#if defined(HAS_W5IOKeypad)
|
|
|
// Serial.print(F("K"));
|
|
// Serial.print(F("K"));
|
|
@@ -238,6 +343,28 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
Serial.print(F("A"));
|
|
Serial.print(F("A"));
|
|
|
action_button_input();
|
|
action_button_input();
|
|
|
}
|
|
}
|
|
|
|
|
+ #elif defined(HAS_ADKeyboard)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(ADKeyboard_get_key_t > millis()) {
|
|
|
|
|
+ } else if(ADKeyboard_get_key()>0 and ADKeyboard_get_key_delay_t < millis()) {
|
|
|
|
|
+ ADKeyboard_get_key_delay_t = millis() + 100 ;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ IOKey=ADKeyboard_get_key();
|
|
|
|
|
+ if(IOKey == 0) {
|
|
|
|
|
+ IOKey_last = IOKey ;
|
|
|
|
|
+ } else if(IOKey_last == IOKey and IOKey != 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ADKeyboard_get_key_t = millis() + 300 ;
|
|
|
|
|
+ IOKey_last = IOKey ;
|
|
|
|
|
+ Serial.println(IOKey);
|
|
|
|
|
+ Serial.print(F(" A "));
|
|
|
|
|
+ SPFT2(input,analogRead(ADKeyboard_PIN));
|
|
|
|
|
+ action_button_input();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
#endif
|
|
#endif
|
|
|
// delay(100);
|
|
// delay(100);
|
|
|
}
|
|
}
|