iot-firmware/src/user_code.hpp

62 lines
1.7 KiB
C++

#pragma once
#include <ESPMegaPRO.h>
#include <Nextion.h>
#include <PubSubClient.h>
#include <PubSubClientTools.h>
#include "espmega_iot_timer.hpp"
#include "espmega_iot_external_lcd.hpp"
// Enable Software Module(s)
#define ENABLE_INTERNAL_LCD
#define ENABLE_IR_MODULE
#define ENABLE_CLIMATE_MODULE // Require IR Module
#define ENABLE_WEBUI
// Infrared Transciever
#define IR_RECIEVE_PIN 35
#define IR_SEND_PIN 17
#define MARK_EXCESS_MICROS 20
#define RAW_BUFFER_LENGTH 750
#define AC_MAX_TEMPERATURE 30
#define AC_MIN_TEMPERATURE 15
// External LCD Configuration
#define ENABLE_EXTERNAL_LCD
#define TXD2 4
#define RXD2 17
#ifdef ENABLE_EXTERNAL_LCD
#define ESPMega_EXTLCD Serial2
#endif
// User Defined Functions
void user_pre_init();
void user_init();
void user_loop();
void virtual_interrupt_user_callback(int pin, int state);
void pwm_changed_user_callback(int pin);
void ac_changed_user_callback(int mode, int temperature, int fan_speed);
void timer_tick_callback();
void timer1_callback();
void mqtt_connected_user_callback();
void bt0PopCallback(void *ptr);
void user_state_request_callback();
// ESPMega IoT Core Build-in Functions
extern void pwm_set_state(int id, int state);
extern void pwm_set_value(int id, int value);
extern void pwm_toggle(int id);
extern void pwm_toggle(int id1, int id2);
extern void pwm_cycle_value(int id);
extern bool pwm_get_state(int id);
extern uint16_t pwm_get_value(int id);
extern boolean pwm_group_state(int id1, int id2);
extern bool input_get_state(int id);
extern void ac_set_state(int mode, int temperature, int fan_speed);
extern uint8_t ac_get_temperature();
extern uint8_t ac_get_mode();
extern uint8_t ac_get_fan_speed();
extern bool standalone;
extern PubSubClient mqtt_client;
extern PubSubClientTools mqtt;