Ver código fonte

testing lite struct ciobfig

arkadiusz binder 5 anos atrás
pai
commit
e8bd1a421f
20 arquivos alterados com 525 adições e 8 exclusões
  1. 1 1
      SE/projects/bocian
  2. 13 6
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/P5_automation_arduino_status_submodule/P5_automation_arduino_status_submodule.ino
  3. 2 1
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/P5_automation_arduino_status_submodule/___CONFIG/config_status.h
  4. 24 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/config.h
  5. 7 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/pins.h
  6. 0 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/pins_setup.h
  7. 18 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/config_defaults.h
  8. 8 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/config_individual.h
  9. 0 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/pins.h
  10. 5 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/pins_setup.h
  11. 97 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__display.h
  12. 4 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__intro.h
  13. 32 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__pins__setup.h
  14. 8 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__pwm.h
  15. 22 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__router.h
  16. 70 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__struct.h
  17. 4 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__swing.h
  18. 61 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__task.h
  19. 2 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__task__loop.h
  20. 147 0
      SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/testing_pwm_amp.ino

+ 1 - 1
SE/projects/bocian

@@ -1 +1 @@
-Subproject commit b2da6943377d6c973952e19e448499028dd7945d
+Subproject commit 884f8afb76695cc71bcf21ec47914bf8571d6823

+ 13 - 6
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/P5_automation_arduino_status_submodule/P5_automation_arduino_status_submodule.ino

@@ -1,3 +1,5 @@
+#include "___CONFIG/__has_config.h"
+
 #define HAS_u8g2
 //#define HAS_PCF8591
 
@@ -6,9 +8,9 @@
 #include <U8g2lib.h>
 #include <SPI.h>
 #include <Wire.h>
-
-#include "PCF8591_init.h"
-
+  #if defined(HAS_PCF8591)
+    #include "PCF8591_init.h"
+  #endif
 
 //SSD1306
 #include <Adafruit_SSD1306.h>
@@ -38,7 +40,6 @@ U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0);
 
 
 #include "___CONFIG/config_status.h"
-int test_pwm_pin = 9;
 
 //#define HAS_task
 
@@ -56,9 +57,14 @@ int test_pwm_pin = 9;
 #endif
 
  void setup(void) {
+    #if defined(HAS_serial_115200)
     Serial.begin (115200);
-    #include "PCF8591_setup.h"
-
+    #endif
+     
+     #if defined(HAS_PCF8591)
+        #include "PCF8591_setup.h"
+     #endif 
+     
     #if defined(HAS_Adafruit_SSD1306)
     //SSD1306
     display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
@@ -67,6 +73,7 @@ int test_pwm_pin = 9;
     #endif
     
    #if defined(HAS_u8g2)
+   u8g2.setDisplayRotation(U8G2_R2);
    u8g2.begin();
    #endif
 

+ 2 - 1
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/P5_automation_arduino_status_submodule/___CONFIG/config_status.h

@@ -13,7 +13,8 @@ STATUS_PHYS_PIN_INPUT_T in_test_status_p5_temp_4 = A3 ;
     STATUS_PHYS_PIN_INPUT_RANGE_T in_test_status_p5_temp_4_RANGE_A = { 0 , 2000 } ;
 
 STATUS_PHYS_PIN_INPUT_T in_test_status_p5_current = A6 ;
-        STATUS_PHYS_PIN_INPUT_RANGE_T in_test_status_p5_curren_RANGE_A = { 0 , 1000 } ;
+        //STATUS_PHYS_PIN_INPUT_RANGE_T in_test_status_p5_curren_RANGE_A = { 0 , 520 } ; //== about 2A test
+        STATUS_PHYS_PIN_INPUT_RANGE_T in_test_status_p5_curren_RANGE_A = { 0 , 950 } ; //== about 2A test
 
 
 

+ 24 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/config.h

@@ -0,0 +1,24 @@
+//config of 0x20
+
+#define HAS_u8g2
+#define HAS_u8g2__ROTATED
+
+#define HAS_serial_115200
+
+#include "pins.h"
+
+
+
+//todo appends
+
+//P5__TASK__CONFIG_A[1]. = { "PW" , P5__TASK__TYPE__ROOT };
+//P5__TASK__CONFIG_A[1].P5__TASK__CONFIG__NAME_A = "PW" ;
+//P5__TASK__CONFIG_A[1].P5__TASK__TYPE__CLASS_A = P5__TASK__TYPE__ROOT ;
+
+//p5__task__config__set(P5__TASK__CONFIG_A, 1,  {"P","W"} ,  P5__TASK__TYPE__ROOT ) ;
+
+
+void p5__config__individual__init(P5__TASK__CONFIG_T* P5__TASK__CONFIG_A) {
+   //p5__task__config__set(P5__TASK__CONFIG_A, 1,  "PW" ,  P5__TASK__TYPE__ROOT ) ;
+
+}

+ 7 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/pins.h

@@ -0,0 +1,7 @@
+#define HAS_u8g2
+#define HAS_serial_115200
+
+#define P5__PWM__PIN__CONF  P5__PWM__PIN
+
+
+int test_pwm_pin = P5__PWM__PIN__CONF;

+ 0 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/0x20/pins_setup.h


+ 18 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/config_defaults.h

@@ -0,0 +1,18 @@
+
+
+#if not(defined(HAS_NOT_u8g2))
+   #define HAS_u8g2
+#endif
+
+
+#if not(defined(HAS_u8g2__ROTATED))
+   #define HAS_NOT_u8g2__ROTATED
+#endif
+
+
+#if not(defined(HAS_NOT_serial))
+    #define HAS_serial_115200
+#endif
+
+    
+#include "pins.h"

+ 8 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/config_individual.h

@@ -0,0 +1,8 @@
+#if not(defined(Active_ControllerID))
+  #ERROR NOT DEFINED Active_ControllerID
+#elif (Active_ControllerID == 0x20)
+   #include "0x20/config.h"
+
+#else
+    #ERROR no config for Active_ControllerID
+#endif

+ 0 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/pins.h


+ 5 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___CONFIG/pins_setup.h

@@ -0,0 +1,5 @@
+#if Active_ControllerID == 0x20
+   #include "0x20/pins_setup.h"
+#else
+    #error "unknown controller ID Active_ControllerID" 
+#endif

+ 97 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__display.h

@@ -0,0 +1,97 @@
+
+ #include <U8g2lib.h>
+ #include <Print.h>
+
+
+typedef P5__ROUTER_STRING_T P5__DISPLAY__SCREEN__LAST_T ;
+
+/*
+
+ P5__DISPLAY__SCREEN__LAST_T p5__display__last( P5__ROUTER_STRING_T P5__ROUTER_STRING_A) {
+    static P5__DISPLAY__SCREEN__LAST_T P5__DISPLAY__SCREEN__LAST_A = P5__ROUTER_STRING_A;
+    
+    P5__ROUTER_STRING_T P5__ROUTER_STRING_A_R = P5__DISPLAY__SCREEN__LAST_A ;
+     P5__DISPLAY__SCREEN__LAST_A = P5__ROUTER_STRING_A ;
+        
+    return P5__ROUTER_STRING_A_R ;
+    
+ }
+*/
+
+/*
+class p5__display__class : public U8G2LOG  { //
+    private: 
+        //U8X8_SH1106_128X64_NONAME_HW_I2C u8x8;
+        U8G2LOG u8g2log_A;
+        
+        //int    U8LOG_WIDTH_A  ;
+        //int U8LOG_HEIGHT_A;
+        //uint8_t u8log_buffer_A;
+        //int dupa_A;
+        //U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2_A;
+       
+    public: 
+           p5__display__class() :  //U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2, int U8LOG_WIDTH,int U8LOG_HEIGHT, uint8_t u8log_buffer
+           U8G2LOG{u8g2log_A} { 
+               // u8g2log_A ;
+             //   U8G2LOG u8g2log_A;
+               // begin(U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C, 
+               //     int , int , uint8_t );
+           }
+           
+           
+           bool begin(U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2, 
+                uint8_t U8LOG_WIDTH,
+                    uint8_t U8LOG_HEIGHT, 
+                        uint8_t u8log_buffer) {
+
+           
+          // begin(U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2, int U8LOG_WIDTH,int U8LOG_HEIGHT, uint8_t u8log_buffer) {
+            u8g2.begin();
+            u8g2.setFont(u8g2_font_tom_thumb_4x6_mf);	// set the font for the terminal window
+
+         //     Serial.println("PDB");
+             u8g2log_A.begin(u8g2,  U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer); 
+             //u8g2log.begin(); 
+        //x     u8g2log_A.setLineHeightOffset(0);	// set extra space between lines in pixel, this can be negative
+        //x     u8g2log_A.setRedrawMode(0);	
+           //  u8g2log_A.print("millis=");
+//             u8g2log.print(millis());
+         //    u8g2log_A.print("\n");
+             
+              //             Serial.println("CCA");
+
+           }
+
+     //   print(char* char_A) {
+     //       u8g2log_A.print(char_A);
+     //   }
+      //  print( P5__ROUTER_STRING_T P5__ROUTER_STRING_A) : u8g2log.print(P5__ROUTER_STRING_A);
+       // void print_clock([...]); 
+     // print( P5__ROUTER_STRING_T P5__ROUTER_STRING_A) {u8g2log.print(P5__ROUTER_STRING_A);}
+     
+     // print(Print char_a ) {p5__display__class.print(char_a);}
+
+};
+
+*/
+
+void p5__display__print( 
+    U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2,
+    U8G2LOG u8g2log, 
+   /// p5__display__class p5__display__class_A,
+    //P5__ROUTER_STRING_T P5__ROUTER_STRING_A
+    char* P5__ROUTER_STRING_A) 
+    {
+    
+ //   p5__display__class p5__display__class_A;
+    // p5__display__class_A.print(P5__ROUTER_STRING_A);
+  /*  u8g2.clearBuffer();         // clear the internal memory
+    u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f);  // choose a suitable font
+    u8g2.setCursor(4,29);
+    u8g2.print(P5__ROUTER_STRING_A);  // write something to the internal memory
+    u8g2.sendBuffer();
+    */
+     u8g2log.print(P5__ROUTER_STRING_A);
+    
+    }

+ 4 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__intro.h

@@ -0,0 +1,4 @@
+#ifndef P5__INTRO
+#define P5__INTRO
+
+#endif

+ 32 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__pins__setup.h

@@ -0,0 +1,32 @@
+#ifndef P5__PINS__SETUP
+ #define P5__PINS__SETUP
+   #include <U8g2lib.h>
+
+   // typedef int P5__STATUS_T ;
+
+    
+    //P5__STATUS_T
+     void p5__pins__setup(
+     U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2,
+    U8G2LOG u8g2log, 
+      // p5__display__class p5__display__class_A,
+     P5__STATUS_T &P5__STATUS_A
+     
+     ) {
+        //P5__STATUS_T P5__STATUS_A ;
+        #if defined(P5__PWM__PIN__CONF)
+               pinMode(P5__PWM__PIN__CONF, OUTPUT);  // sets the pin as output
+               analogWrite(P5__PWM__PIN__CONF, 100); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
+
+        #endif
+        
+              //12345678
+        //return "PIN ST +";
+      //  return 10;
+                     //12345678
+       P5__STATUS_A = "PIN ST+";
+       p5__router__status__final__string(u8g2,u8g2log , P5__STATUS_A );
+        
+    }
+
+#endif

+ 8 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__pwm.h

@@ -0,0 +1,8 @@
+#ifndef P5__PWM
+#define P5__PWM
+
+#define P5__PWM__PIN  9
+//int test_pwm_pin = 9;
+
+
+#endif

+ 22 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__router.h

@@ -0,0 +1,22 @@
+#ifndef P5__ROUTER
+ #define P5__ROUTER
+
+
+ 
+    void p5__router__status__final__string(
+     U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2,
+    U8G2LOG u8g2log, 
+    //p5__display__class p5__display__class_A,
+    P5__ROUTER_STRING_T P5__ROUTER_STRING_A) {
+        // #if defined(HAS_u8g2)
+        
+     //  p5__display__print( p5__display__class_A, P5__ROUTER_STRING_A);  // write something to the internal memory
+         //u8g2.drawStr(4,29,"test123");
+        // u8g2.sendBuffer();         // transfer internal memory to the display
+         
+        // delay(2000);
+         
+    //#endif
+    }
+ 
+#endif

+ 70 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__struct.h

@@ -0,0 +1,70 @@
+#include <Arduino.h>
+  
+  typedef int P5__ARRAY_T;
+  typedef  P5__ARRAY_T P5__ARRAY__INDEX_T ;
+
+
+  
+  typedef int P5__LIMITS_T;
+  
+  
+  
+  typedef int P5__TASK_T;
+  typedef P5__TASK_T P5__TASK__TYPE_T;
+  
+  
+  typedef P5__TASK__TYPE_T P5__TASK__TYPE__CLASS_T;
+
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__ROOT   = 1;
+  
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__REFERENCE    = 2;
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__PARENT = 3;
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__SEQUENCE = 4;
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__ELEMENT = 5;
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__TYPE = 6;
+  const P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__GROUP = 7;
+
+ // typedef P5__TASK_T P5__TASK__CONFIG_T ;
+  typedef char P5__TASK__CONFIG__NAME_T[3] ; //nazwa elementu
+  
+  struct P5__TASK__CONFIG_S {
+    P5__TASK__CONFIG__NAME_T P5__TASK__CONFIG__NAME_A;
+    P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__CLASS_A;
+  };
+  
+  typedef  P5__TASK__CONFIG_S P5__TASK__CONFIG_T;
+  
+  const P5__LIMITS_T P5__TASK__CONFIG__LIMIT = 50;
+  
+  
+  //todo to init
+ // P5__TASK__CONFIG_T P5__TASK__CONFIG_A;
+  
+ // P5__TASK__CONFIG_A[P5__TASK__CONFIG__LIMIT] = {} ;
+  
+ static   P5__TASK__CONFIG_T P5__TASK__CONFIG_A[P5__TASK__CONFIG__LIMIT] = {} ;
+
+ //static   P5__TASK__CONFIG_T P5__TASK__CONFIG_A[10] = {
+ //   {"PW" , P5__TASK__TYPE__ROOT }
+ //} ;
+ 
+
+ //P5__TASK__CONFIG_A[1].P5__TASK__CONFIG__NAME_A = "PW" ;
+ //P5__TASK__CONFIG_A[1].P5__TASK__TYPE__CLASS_A = P5__TASK__TYPE__ROOT ;
+  
+  //std::vector<int> P5__TASK__CONFIG_V {1 } ;
+  //std::vector<int> numbers {7, 42 ,15};
+  
+ // P5__TASK__CONFIG_A[2] = {"PW" ,  P5__TASK__TYPE__ROOT  };
+  
+  typedef int P5__ROUTER_T ;
+  const P5__ROUTER_T P5__ROUTER__STATUS__FINAL = 1;
+  
+  typedef String P5__ROUTER_STRING_T ;
+
+  typedef P5__ROUTER_STRING_T P5__STATUS_T;
+  // typedef char P5__STATUS_T[8];
+   const P5__STATUS_T P5__STATUS__INIT = "1234567";
+   
+   
+     

+ 4 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__swing.h

@@ -0,0 +1,4 @@
+#ifndef P5__SWING
+#define P5__SWING
+
+#endif

+ 61 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__task.h

@@ -0,0 +1,61 @@
+
+
+/*
+
+void p5__task__config__init(P5__TASK__CONFIG_T* P5__TASK__CONFIG_A) {
+
+
+ P5__TASK__CONFIG_A[1].P5__TASK__CONFIG__NAME_A[0] = "P";
+ P5__TASK__CONFIG_A[1].P5__TASK__CONFIG__NAME_A[1] = "W";
+ P5__TASK__CONFIG_A[1].P5__TASK__TYPE__CLASS_A = P5__TASK__TYPE__ROOT ;
+
+
+}
+
+*/
+
+
+
+void p5__task__config__set(P5__TASK__CONFIG_T* P5__TASK__CONFIG_A,
+    P5__ARRAY__INDEX_T P5__ARRAY__INDEX_A ,
+     P5__TASK__CONFIG__NAME_T P5__TASK__CONFIG__NAME_A,
+     P5__TASK__TYPE__CLASS_T P5__TASK__TYPE__CLASS_A
+     ) {
+
+ P5__TASK__CONFIG_A[P5__ARRAY__INDEX_A].P5__TASK__CONFIG__NAME_A[0] = P5__TASK__CONFIG__NAME_A[1];
+ P5__TASK__CONFIG_A[P5__ARRAY__INDEX_A].P5__TASK__CONFIG__NAME_A[1] = P5__TASK__CONFIG__NAME_A[2];
+// P5__TASK__CONFIG_A[P5__ARRAY__INDEX_A].P5__TASK__CONFIG__NAME_A[1] = "W";
+
+ P5__TASK__CONFIG_A[P5__ARRAY__INDEX_A].P5__TASK__TYPE__CLASS_A =P5__TASK__TYPE__CLASS_A ;
+
+}
+
+
+//    P5__TASK__CONFIG__NAME_T P5__TASK__CONFIG__NAME_A = "PW" ;
+//p5__task__config__set(P5__TASK__CONFIG_A, 1,  P5__TASK__CONFIG__NAME_A ,  P5__TASK__TYPE__ROOT ) ;
+
+
+
+void p5__task__loop__run(P5__TASK__CONFIG_T* P5__TASK__CONFIG_A
+    ,P5__ARRAY__INDEX_T P5__ARRAY__INDEX_A ,
+    U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2,
+    U8G2LOG u8g2log
+    //, p5__display__class p5__display__class_A
+    ) {
+
+       //for(P5__ARRAY__INDEX_T i = 1; i++ ; i<P5__TASK__CONFIG__LIMIT) {
+       
+       //}
+       
+       if(P5__TASK__CONFIG_A[P5__ARRAY__INDEX_A].P5__TASK__CONFIG__NAME_A == "PW") {
+                   P5__STATUS_T P5__STATUS_A = "TSK PW>";
+                   p5__router__status__final__string( //p5__display__class_A,
+                   u8g2, u8g2log ,
+                    P5__STATUS_A );
+       } else {
+                   P5__STATUS_T P5__STATUS_A = "TSK ?";
+                   P5__STATUS_A.concat(String(P5__ARRAY__INDEX_A ));
+                   p5__router__status__final__string( u8g2, u8g2log, P5__STATUS_A );
+       
+       }
+}

+ 2 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/___P5_LIB/p5__task__loop.h

@@ -0,0 +1,2 @@
+
+//p5__task__loop__run(P5__TASK__CONFIG_A , 1, u8g2) ; //todo ind next

+ 147 - 0
SE/stuff/P5_Automation_can-dev-res-working-1930/___SUBMODULES___/testing_pwm_amp/testing_pwm_amp.ino

@@ -0,0 +1,147 @@
+#define Active_ControllerID 0x20
+
+//#include <StandardCplusplus.h>
+//#include <vector>
+//#include <iterator>
+
+#include "___P5_LIB/p5__struct.h"
+#include "___P5_LIB/p5__display.h"
+
+#include "___P5_LIB/p5__router.h"
+
+
+
+#include "___P5_LIB/p5__intro.h"
+#include "___P5_LIB/p5__pwm.h"
+#include "___P5_LIB/p5__swing.h"
+#include "___P5_LIB/p5__pins__setup.h"
+
+
+#include "___P5_LIB/p5__task.h"
+
+
+#define HAS_u8g2
+
+#include <Arduino.h>
+#include <U8g2lib.h>
+#include <SPI.h>
+#include <Wire.h>
+
+
+#include "___CONFIG/config_individual.h"
+
+#include "___CONFIG/config_defaults.h"
+
+
+
+
+#if defined(HAS_u8g2)
+U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0); 
+//u8g2_uint_t offset;			// current offset for the scrolling text
+//u8g2_uint_t width;			// pixel width of the scrolling text (must be lesser than 128 unless U8G2_16BIT is defined
+//char *text ;
+//const char *text = "U8g2 ";
+//AA U8G2LOG u8g2log;
+
+#define  U8LOG_WIDTH_D 32
+uint8_t U8LOG_WIDTH = U8LOG_WIDTH_D ;
+
+#define U8LOG_HEIGHT_D 5 //10 
+uint8_t U8LOG_HEIGHT = U8LOG_HEIGHT_D ;
+uint8_t u8log_buffer[U8LOG_WIDTH_D*U8LOG_HEIGHT_D];
+U8G2LOG u8g2log;
+
+//p5__display__class p5__display__class_A(u8g2,U8LOG_WIDTH, U8LOG_HEIGHT , u8log_buffer ) ;
+//p5__display__class p5__display__class_A ;
+
+
+#endif 
+
+
+
+ void setup(void) {
+    Serial.begin(115200);
+      Serial.println(" ST ");
+
+
+
+   
+
+   #if defined(HAS_u8g2)
+    #if defined(HAS_u8g2__ROTATED)
+      u8g2.setDisplayRotation(U8G2_R2);
+    # elif defined( HAS_NOT_u8g2__ROTATED)
+      #else 
+        
+    #endif
+//B   u8g2.begin();
+  //  u8g2log.begin(u8g2, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer);
+ // u8g2log.setLineHeightOffset(0);	// set extra space between lines in pixel, this can be negative
+ // u8g2log.setRedrawMode(0);		// 0: Update screen with newline, 1: Update screen for every char  
+   
+   
+   #endif
+
+
+  #if defined(HAS_u8g2)
+  // u8g2.clearBuffer();         // clear the internal memory
+  // u8g2.setFont(u8g2_font_helvR10_tf);  // choose a suitable font at https://github.com/olikraus/u8g2/wiki/fntlistall
+   //u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f);  // choose a suitable font
+ //B u8g2.setFont(u8g2_font_tom_thumb_4x6_mf);	// set the font for the terminal window
+
+
+ // u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f);	// set the target font to calculate the pixel width
+  //width = u8g2.getUTF8Width(text);		// calculate the pixel width of the text
+ //p5__display__class_A.begin(u8g2,U8LOG_WIDTH, U8LOG_HEIGHT , u8log_buffer ) ;
+    u8g2.begin();  
+  
+    u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f//u8g2_font_tom_thumb_4x6_mf);	// set the font for the terminal window
+                );
+    u8g2log.begin(u8g2, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer);
+    u8g2log.setLineHeightOffset(0);	// set extra space between lines in pixel, this can be negative
+    u8g2log.setRedrawMode(0);		// 0: Update screen with newline, 1: Update screen for every char  
+      Serial.println(" SB ");
+
+ 
+   #endif
+
+    P5__STATUS_T P5__STATUS_A = P5__STATUS__INIT;
+        
+     //  p5__pins__setup(p5__display__class_A , P5__STATUS_A);
+     //p5__pins__setup();
+     //  p5__router()
+     
+    //  p5__config__individual__init(P5__TASK__CONFIG_A);
+     
+    }
+    
+    
+    
+unsigned long t = 0;
+
+    
+void loop(void) {
+   
+//  #include "___P5_LIB/p5__task__loop.h"
+
+  // delay(100);
+   
+ 
+    if ( t < millis() ) {
+    t = millis() + 15000;			// every 15 seconds
+   // p5__display__print(u8g2,u8g2log, "\f");			// \f = form feed: clear the screen
+    u8g2log.print("\f");	
+  }
+    p5__display__print(u8g2,u8g2log,"t[");
+   // p5__display__print(u8g2,u8g2log,millis());
+   // p5__display__print(u8g2,u8g2log,"\n");
+       u8g2log.print(millis()); //todo  type class; p5__display__print(u8g2,u8g2log,millis());
+        u8g2log.print(u8g2,u8g2log,"\n"); //todo class type \n
+  
+  delay(500);
+     Serial.println(" L");
+   
+   
+   
+   
+  }