1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#include <stdio.h>
#include <string.h>
#include "InovaLedDisplay.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#define CHAR_HEIGHT 8
#define CHAR_WIDTH 8
#define RED 1
#define GREEN 2
#define ORANGE 3
#define PIN_NUM_MISO 12
#define PIN_NUM_MOSI 13
#define PIN_NUM_CLK 14
#define PIN_NUM_CS 15
#define PIN_NUM_R_LATCH 16
#define PIN_NUM_R_CLK 17
#define PIN_NUM_R_ADDR_0 5
#define PIN_NUM_R_ADDR_1 18
#define PIN_NUM_R_ADDR_2 19
#define TAG "led_display"
#define STACK_SIZE 2000
/* extern "C" void drawCharAtPosition(char character, int x_start, int y_start, uint16_t color) { */
/* uint8_t cur_char_row; */
/* for(int y = y_start; (y - y_start) < CHAR_HEIGHT && y < NUM_ROW; y++) { */
/* cur_char_row = atascii_font[(uint8_t) character][y - y_start]; */
/* for(int x = x_start; (x - x_start) < CHAR_WIDTH && x < NUM_COL; x++) { */
/* if(x >= 0) { */
/* if((0b10000000 >> (x - x_start)) & cur_char_row) { */
/* setPixel(x, y, color); */
/* } */
/* else { */
/* setPixel(x, y, 0); */
/* } */
/* } */
/* } */
/* } */
/* } */
extern "C" void runDisplayTask(void* taskParams) {
InovaLedDisplay* display = (InovaLedDisplay*) taskParams;
display->runDisplay();
}
extern "C" void app_main(void)
{
InovaLedDisplay display = InovaLedDisplay(PIN_NUM_MISO, PIN_NUM_MOSI, PIN_NUM_CLK, PIN_NUM_CS, PIN_NUM_R_LATCH, PIN_NUM_R_CLK, PIN_NUM_R_ADDR_0, PIN_NUM_R_ADDR_1, PIN_NUM_R_ADDR_2);
display.fillScreen(0);
display.drawPixel(80, 4, 3);
display.setCursor(0, 0);
String some_string = "meow";
display.print(some_string);
//display.drawChar(0, 0, 'M', 3, 0, 1);
//display.drawChar(6, 0, 'e', 3, 0, 1);
//display.drawChar(12, 0, 'o', 3, 0, 1);
//display.drawChar(18, 0, 'w', 3, 0, 1);
//TaskHandle_t taskHandle;
//xTaskCreate(runDisplayTask, "updateDisplay", STACK_SIZE, &display, tskIDLE_PRIORITY, &taskHandle);
runDisplayTask(&display);
while(true) {
vTaskDelay(100 / portTICK_PERIOD_MS);
}
/* int j = NUM_COL; */
/* int color = 1; */
/* char* hello = "Hello World!! 0123456789"; */
/* int hello_length = strlen(hello); */
/* int min_x = hello_length * -CHAR_WIDTH; */
/* while(true) { */
/* for(int i = 0; i < strlen(hello); i++) { */
/* drawCharAtPosition(hello[i], j + (i * CHAR_WIDTH), 0, color); */
/* } */
/* if(--j == min_x) { */
/* j = NUM_COL; */
/* if(++color > 3) { */
/* color = 1; */
/* } */
/* } */
/* vTaskDelay(50 / portTICK_PERIOD_MS); */
/* } */
}
|