File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < esp_log.h>
2
+ #include < FreeRTOS.h>
3
+ #include < SPI.h>
4
+ #include < string>
5
+ #include < stdio.h>
6
+ #include < Task.h>
7
+ #include " MAX7219.h"
8
+
9
+ #include " sdkconfig.h"
10
+
11
+ // static char tag[] = "task_cpp_utils";
12
+
13
+
14
+
15
+ class TestMAX7219 : public Task {
16
+ void test8x8 (MAX7219 &max7219) {
17
+ int dir=1 ;
18
+ int y=0 ;
19
+ while (1 ) {
20
+ for (auto x=0 ; x<8 ; x++) {
21
+ for (auto i=0 ; i<8 ; i++) {
22
+ max7219.setLed (x, y, true );
23
+ FreeRTOS::sleep (100 );
24
+ max7219.setLed (x, y, false );
25
+ y=y+dir;
26
+ }
27
+ dir = -dir;
28
+ y=y+dir;
29
+ }
30
+ }
31
+ }
32
+
33
+ void test7SegDisplay (MAX7219 &max7219) {
34
+ int i=0 ;
35
+ while (1 ) {
36
+ max7219.setNumber (i);
37
+ i++;
38
+ FreeRTOS::sleep (100 );
39
+ }
40
+ }
41
+
42
+ void run (void *data) override {
43
+ SPI spi;
44
+ spi.init ();
45
+
46
+ MAX7219 max7219 = MAX7219 (&spi, 1 );
47
+ max7219.shutdown (false );
48
+ max7219.setIntensity (4 );
49
+ // test7SegDisplay(max7219);
50
+ test8x8 (max7219);
51
+
52
+ } // End run
53
+ };
54
+
55
+
56
+ static TestMAX7219 testMAX7219 = TestMAX7219();
57
+
58
+ void task_max7219 (void *ignore) {
59
+ testMAX7219.start ();
60
+ FreeRTOS::deleteTask ();
61
+ }
You can’t perform that action at this time.
0 commit comments