From a2e97cd881f86761195b9522e4857692b7d79521 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 19 Mar 2024 00:32:29 +0700 Subject: [PATCH] integrate display into main.cpp --- src/main.cpp | 28 +++++++++++++++++++++++++++- src/main.hpp | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 3717346..4b77228 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,13 @@ +/** + * @file main.cpp + * @author Siwat Sirichai (siwat@siwatinc.com) + * @brief CU Demonstration Secondary School IoT 2024 Project Main File + * @version 1.0 + * @date 2024-03-19 + * + * @copyright Copyright (c) Siwat System 2024 + * + */ #include /************************************************ @@ -18,6 +28,21 @@ AirConditioner ac_config = { ClimateCard ac = ClimateCard(AC_IR_TX_PIN, ac_config, AC_SENSOR_TYPE, AC_SENSOR_PIN, AC_IR_CHANNEL); +cud_display_conf_t cud_display_conf = { + .aqi = &aqi, + .ac = &ac, + .uart = &DISPLAY_UART, + .tx = DISPLAY_TX, + .rx = DISPLAY_RX, + .communication_baudrate = DISPLAY_COMMUNICATION_BAUDRATE, + .ota_baudrate = DISPLAY_OTA_BAUDRATE, + .light_pins = {LIGHT_ROW_1_PIN, LIGHT_ROW_2_PIN, LIGHT_ROW_3_PIN, LIGHT_ROW_4_PIN}, + .fan_pins = {FAN_ROW_1_PIN, FAN_ROW_2_PIN, FAN_ROW_3_PIN}, + .air_purifier_pin = AIR_PURIFIER_PIN, + .mosquito_zapper_pin = MOSQUITO_ZAPPER_PIN}; + +CUDDisplay cudDisplay = CUDDisplay(&cud_display_conf); + /************************************************ * End of Global Variables * ************************************************/ @@ -68,12 +93,13 @@ void setup() espmega.inputs.loop(); espmega.inputs.registerCallback(handle_input_change); // Start the display routine - // TODO - Write CUDDisplay class + cudDisplay.begin(); } void loop() { espmega.loop(); + cudDisplay.loop(); } void send_stop_bytes(HardwareSerial &uart) diff --git a/src/main.hpp b/src/main.hpp index a8e28f5..2487cdb 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -4,6 +4,7 @@ #include #include "lcd_elements.hpp" #include "ir_codes.hpp" +#include "cud_display.hpp" /*********************************************** * Pin Definitions *