Merge remote-tracking branch 'upstream/abstraction' into RefineAndImplementHardwareInterface
This commit is contained in:
commit
11d4e8d7e5
4 changed files with 35 additions and 1 deletions
27
Platformio/HAL/Interface/HardwareInterface.h
Normal file
27
Platformio/HAL/Interface/HardwareInterface.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// OMOTE Hardware Abstraction
|
||||||
|
// 2023 Matthew Colvin
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class HardwareInterface {
|
||||||
|
public:
|
||||||
|
struct batteryStatus {
|
||||||
|
/// @brief Percent of battery remaining (0-100]
|
||||||
|
int percentage;
|
||||||
|
/// @brief Voltage of battery in millivolts
|
||||||
|
int voltage;
|
||||||
|
/// @brief True - Battery is Charging
|
||||||
|
/// False - Battery discharging
|
||||||
|
bool isCharging;
|
||||||
|
};
|
||||||
|
|
||||||
|
HardwareInterface() = default;
|
||||||
|
|
||||||
|
virtual void init() = 0;
|
||||||
|
virtual void sendIR() = 0;
|
||||||
|
virtual void MQTTPublish(const char *topic, const char *payload) = 0;
|
||||||
|
virtual batteryStatus getBatteryPercentage() = 0;
|
||||||
|
virtual void debugPrint(std::string message) = 0;
|
||||||
|
};
|
|
@ -16,6 +16,7 @@
|
||||||
#include "wifihandler.hpp"
|
#include "wifihandler.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "omoteconfig.h"
|
#include "omoteconfig.h"
|
||||||
#include "BatteryInterface.h"
|
#include "BatteryInterface.h"
|
||||||
#include "wifiHandlerInterface.h"
|
#include "wifiHandlerInterface.h"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define IS_SIMULATOR true
|
#define IS_SIMULATOR true
|
||||||
|
|
|
@ -288,6 +288,9 @@ void OmoteUI::layout_UI() {
|
||||||
|
|
||||||
appleImg = imgs.addAppleDisplayImage(button);
|
appleImg = imgs.addAppleDisplayImage(button);
|
||||||
lv_obj_align(appleImg, LV_ALIGN_CENTER, -3, 0);
|
lv_obj_align(appleImg, LV_ALIGN_CENTER, -3, 0);
|
||||||
|
lv_obj_set_style_img_recolor(appleImg, lv_color_white(), LV_PART_MAIN);
|
||||||
|
lv_obj_set_style_img_recolor_opa(appleImg, LV_OPA_COVER, LV_PART_MAIN);
|
||||||
|
lv_obj_align(appleImg, LV_ALIGN_CENTER, -3, 0);
|
||||||
|
|
||||||
button = lv_btn_create(tab3);
|
button = lv_btn_create(tab3);
|
||||||
lv_obj_align(button, LV_ALIGN_BOTTOM_RIGHT, -10, 0);
|
lv_obj_align(button, LV_ALIGN_BOTTOM_RIGHT, -10, 0);
|
||||||
|
@ -298,6 +301,9 @@ void OmoteUI::layout_UI() {
|
||||||
|
|
||||||
appleImg = imgs.addAppleDisplayImage(button);
|
appleImg = imgs.addAppleDisplayImage(button);
|
||||||
lv_obj_align(appleImg, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(appleImg, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
lv_obj_set_style_img_recolor(appleImg, lv_color_white(), LV_PART_MAIN);
|
||||||
|
lv_obj_set_style_img_recolor_opa(appleImg, LV_OPA_COVER, LV_PART_MAIN);
|
||||||
|
lv_obj_align(appleImg, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
this->setup_settings(tab1);
|
this->setup_settings(tab1);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue