aboutsummaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
authorgamerdonkey2024-09-14 14:48:59 -0500
committergamerdonkey2024-09-14 14:48:59 -0500
commit35ff74c9be46e16030d1184a506451e1d3805c25 (patch)
tree0ee143a6a3ddf74ee985165cb10a1c44d9b8377f /main/main.cpp
parent5d3f7c6d67dd70b644c5527b07b72f03459413dd (diff)
downloadesp32-inova-led-controller-35ff74c9be46e16030d1184a506451e1d3805c25.tar.gz
esp32-inova-led-controller-35ff74c9be46e16030d1184a506451e1d3805c25.tar.bz2
esp32-inova-led-controller-35ff74c9be46e16030d1184a506451e1d3805c25.zip
First attempt at integrating Adafruit_GFX and converting to C++
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
new file mode 100644
index 0000000..04762c7
--- /dev/null
+++ b/main/main.cpp
@@ -0,0 +1,76 @@
+#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 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.drawPixel(0, 0, 3);
+ display.drawPixel(80, 4, 3);
+ display.runDisplay();
+ /* TaskHandle_t taskHandle; */
+ /* xTaskCreate(updateDisplay, "updateDisplay", STACK_SIZE, NULL, tskIDLE_PRIORITY, &taskHandle); */
+
+ /* 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); */
+ /* } */
+}