integrate display into main.cpp

This commit is contained in:
Siwat Sirichai 2024-03-19 00:32:29 +07:00
parent 03f08be184
commit a2e97cd881
2 changed files with 28 additions and 1 deletions

View File

@ -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 <main.hpp>
/************************************************
@ -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)

View File

@ -4,6 +4,7 @@
#include <RemoteVariable.hpp>
#include "lcd_elements.hpp"
#include "ir_codes.hpp"
#include "cud_display.hpp"
/***********************************************
* Pin Definitions *