Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lay the ground work for a hardware abstraction layer #15

Merged
merged 16 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LVGL Simulator/LVGL.Simulator/HardwareSimulator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "HardwareSimulator.hpp"
30 changes: 30 additions & 0 deletions LVGL Simulator/LVGL.Simulator/HardwareSimulator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once
#include "HardwareAbstractionInterface.h"
#include <string>
#include <iostream>

class HardwareSimulator :
public HardwareAbstractionInterface
{
public:

HardwareSimulator() = default;

virtual void debugPrint(std::string message) override {
std::cout << message;
}

virtual void sendIR() override {

}

virtual void MQTTPublish(const char* topic, const char* payload) override {

};

virtual void init() override {
lv_init();
}

};

777 changes: 38 additions & 739 deletions LVGL Simulator/LVGL.Simulator/LVGL.Simulator.cpp

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion LVGL Simulator/LVGL.Simulator/LVGL.Simulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<MileProjectType>ConsoleApplication</MileProjectType>
<MileProjectManifestFile>LVGL.Simulator.manifest</MileProjectManifestFile>
<MileProjectEnableVCLTLSupport>true</MileProjectEnableVCLTLSupport>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Debug'">
<SupportLTL>false</SupportLTL>
Expand All @@ -18,6 +19,9 @@
<PropertyGroup>
<IncludePath>$(MSBuildThisFileDirectory);$(MSBuildThisFileDirectory)..\LvglPlatform\lvgl\;$(MSBuildThisFileDirectory)..\LvglPlatform\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<SourcePath>$(VC_SourcePath);</SourcePath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand All @@ -32,10 +36,19 @@
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">stdcpp17</LanguageStandard>
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="LVGL.Portable.vcxitems" />
<Import Project="LVGL.Drivers.vcxitems" />
<ItemGroup>
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareAbstractionInterface.h" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\Images.hpp" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\OmoteUI.hpp" />
<ClInclude Include="HardwareSimulator.hpp" />
<ClInclude Include="omoteconfig.h" />
<ClInclude Include="lv_conf.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -49,7 +62,12 @@
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="LVGL.Simulator.cpp" />
<ClCompile Include="..\..\Platformio\src\HardwareAbstractionInterface.cpp" />
<ClCompile Include="..\..\Platformio\src\OmoteUI.cpp" />
<ClCompile Include="HardwareSimulator.cpp" />
<ClCompile Include="LVGL.Simulator.cpp">
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp17</LanguageStandard>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LVGL.Simulator.rc" />
Expand Down
23 changes: 23 additions & 0 deletions LVGL Simulator/LVGL.Simulator/LVGL.Simulator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
<ItemGroup>
<ClInclude Include="lv_conf.h" />
<ClInclude Include="lv_drv_conf.h" />
<ClInclude Include="HardwareSimulator.hpp" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareAbstractionInterface.h">
<Filter>OmoteUI</Filter>
</ClInclude>
<ClInclude Include="..\..\Platformio\include\OmoteUI\OmoteUI.hpp">
<Filter>OmoteUI</Filter>
</ClInclude>
<ClInclude Include="omoteconfig.h" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\Images.hpp">
<Filter>OmoteUI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Manifest Include="LVGL.Simulator.manifest" />
Expand All @@ -15,6 +26,13 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="LVGL.Simulator.cpp" />
<ClCompile Include="HardwareSimulator.cpp" />
<ClCompile Include="..\..\Platformio\src\HardwareAbstractionInterface.cpp">
<Filter>OmoteUI</Filter>
</ClCompile>
<ClCompile Include="..\..\Platformio\src\OmoteUI.cpp">
<Filter>OmoteUI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LVGL.Simulator.rc" />
Expand All @@ -25,4 +43,9 @@
<ItemGroup>
<None Include="freetype.props" />
</ItemGroup>
<ItemGroup>
<Filter Include="OmoteUI">
<UniqueIdentifier>{0b1f99aa-73cb-482d-9d62-20e17f93b890}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions LVGL Simulator/LVGL.Simulator/omoteconfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#define IS_SIMULATOR true

#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 360
54 changes: 52 additions & 2 deletions Platformio/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,57 @@
"cmake.configureOnOpen": false,
"files.associations": {
"random": "cpp",
"array": "cpp"
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
},
"cmake.sourceDirectory": "${workspaceFolder}/.pio/libdeps/esp32/Adafruit BusIO"
"cmake.sourceDirectory": "${workspaceFolder}/.pio/libdeps/esp32/Adafruit BusIO",
"editor.formatOnSave": false,
"idf.portWin": "COM8"
}
16 changes: 16 additions & 0 deletions Platformio/include/OmoteUI/HardwareAbstractionInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// OMOTE Hardware Abstraction
// 2023 Matthew Colvin

#pragma once
#include <lvgl.h>
#include <string>

class HardwareAbstractionInterface {
public:
HardwareAbstractionInterface() = default;

virtual void init() = 0;
virtual void sendIR() = 0;
virtual void MQTTPublish(const char *topic, const char *payload) = 0;
virtual void debugPrint(std::string message) = 0;
};
Loading