mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 21:56:35 +00:00
Add POSIX fbdev port
This commit is contained in:
parent
e922042a3d
commit
ac5fe4a424
@ -377,7 +377,11 @@ static WiFiSpiClass WiFi;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(POSIX)
|
#if defined(POSIX)
|
||||||
|
#ifdef USE_MONITOR
|
||||||
#define delay SDL_Delay
|
#define delay SDL_Delay
|
||||||
|
#else
|
||||||
|
#define delay msleep
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_TARGET_PC
|
#if HASP_TARGET_PC
|
||||||
@ -398,8 +402,10 @@ static WiFiSpiClass WiFi;
|
|||||||
#define halRestartMcu()
|
#define halRestartMcu()
|
||||||
#if USE_MONITOR
|
#if USE_MONITOR
|
||||||
#define millis SDL_GetTicks
|
#define millis SDL_GetTicks
|
||||||
#elif USE_WIN32DRV
|
#elif defined(WINDOWS)
|
||||||
#define millis Win32Millis
|
#define millis Win32Millis
|
||||||
|
#elif defined(POSIX)
|
||||||
|
#define millis PosixMillis
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEC 10
|
#define DEC 10
|
||||||
|
@ -19,7 +19,13 @@
|
|||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
|
|
||||||
|
#ifdef USE_MONITOR
|
||||||
#include "display/monitor.h"
|
#include "display/monitor.h"
|
||||||
|
#elif USE_FBDEV
|
||||||
|
#include "display/fbdev.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
// extern monitor_t monitor;
|
// extern monitor_t monitor;
|
||||||
|
|
||||||
@ -35,12 +41,6 @@ PosixDevice::PosixDevice()
|
|||||||
_core_version = "unknown";
|
_core_version = "unknown";
|
||||||
_chip_model = "unknown";
|
_chip_model = "unknown";
|
||||||
} else {
|
} else {
|
||||||
// LOG_VERBOSE(0,"Sysname: %s", uts.sysname);
|
|
||||||
// LOG_VERBOSE(0,"Nodename: %s", uts.nodename);
|
|
||||||
// LOG_VERBOSE(0,"Release: %s", uts.release);
|
|
||||||
// LOG_VERBOSE(0,"Version: %s", uts.version);
|
|
||||||
// LOG_VERBOSE(0,"Machine: %s", uts.machine);
|
|
||||||
|
|
||||||
char version[256];
|
char version[256];
|
||||||
snprintf(version, sizeof(version), "%s %s", uts.sysname, uts.release);
|
snprintf(version, sizeof(version), "%s %s", uts.sysname, uts.release);
|
||||||
_core_version = version;
|
_core_version = version;
|
||||||
@ -69,8 +69,9 @@ void PosixDevice::show_info()
|
|||||||
LOG_VERBOSE(0, "Machine : %s", uts.machine);
|
LOG_VERBOSE(0, "Machine : %s", uts.machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_VERBOSE(0, "Processor : %s", "unknown");
|
LOG_VERBOSE(0, "Processor : %s", get_chip_model());
|
||||||
LOG_VERBOSE(0, "CPU freq. : %i MHz", 0);
|
LOG_VERBOSE(0, "CPU freq. : %i MHz", get_cpu_frequency());
|
||||||
|
LOG_VERBOSE(0, "OS Version : %s", get_core_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* PosixDevice::get_hostname()
|
const char* PosixDevice::get_hostname()
|
||||||
@ -81,8 +82,11 @@ const char* PosixDevice::get_hostname()
|
|||||||
void PosixDevice::set_hostname(const char* hostname)
|
void PosixDevice::set_hostname(const char* hostname)
|
||||||
{
|
{
|
||||||
_hostname = hostname;
|
_hostname = hostname;
|
||||||
|
#if USE_MONITOR
|
||||||
monitor_title(hostname);
|
monitor_title(hostname);
|
||||||
// SDL_SetWindowTitle(monitor.window, hostname);
|
#elif USE_FBDEV
|
||||||
|
// fbdev doesn't really have a title bar
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* PosixDevice::get_core_version()
|
const char* PosixDevice::get_core_version()
|
||||||
@ -146,13 +150,11 @@ void PosixDevice::update_backlight()
|
|||||||
{
|
{
|
||||||
uint8_t level = _backlight_power ? _backlight_level : 0;
|
uint8_t level = _backlight_power ? _backlight_level : 0;
|
||||||
if(_backlight_invert) level = 255 - level;
|
if(_backlight_invert) level = 255 - level;
|
||||||
|
#if USE_MONITOR
|
||||||
monitor_backlight(level);
|
monitor_backlight(level);
|
||||||
// SDL_SetTextureColorMod(monitor.texture, level, level, level);
|
#elif USE_FBDEV
|
||||||
// window_update(&monitor);
|
// set display backlight, if possible
|
||||||
// monitor.sdl_refr_qry = true;
|
#endif
|
||||||
// monitor_sdl_refr(NULL);
|
|
||||||
// const lv_area_t area = {1,1,0,0};
|
|
||||||
// monitor_flush(NULL,&area,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PosixDevice::get_free_max_block()
|
size_t PosixDevice::get_free_max_block()
|
||||||
@ -221,6 +223,18 @@ long PosixDevice::get_uptime()
|
|||||||
|
|
||||||
} // namespace dev
|
} // namespace dev
|
||||||
|
|
||||||
|
long PosixMillis()
|
||||||
|
{
|
||||||
|
struct timespec spec;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &spec);
|
||||||
|
return (spec.tv_sec) * 1000 + (spec.tv_nsec) / 1e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
void msleep(unsigned long millis)
|
||||||
|
{
|
||||||
|
usleep(millis * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
dev::PosixDevice haspDevice;
|
dev::PosixDevice haspDevice;
|
||||||
|
|
||||||
#endif // POSIX
|
#endif // POSIX
|
||||||
|
@ -71,6 +71,9 @@ class PosixDevice : public BaseDevice {
|
|||||||
|
|
||||||
} // namespace dev
|
} // namespace dev
|
||||||
|
|
||||||
|
extern long PosixMillis();
|
||||||
|
extern void msleep(unsigned long millis);
|
||||||
|
|
||||||
using dev::PosixDevice;
|
using dev::PosixDevice;
|
||||||
extern dev::PosixDevice haspDevice;
|
extern dev::PosixDevice haspDevice;
|
||||||
|
|
||||||
|
@ -25,11 +25,33 @@ static inline void native_cpuid(unsigned int* eax, unsigned int* ebx, unsigned i
|
|||||||
asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "0"(*eax), "2"(*ecx) : "memory");
|
asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "0"(*eax), "2"(*ecx) : "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win32Device::reboot()
|
Win32Device::Win32Device()
|
||||||
{}
|
|
||||||
|
|
||||||
void Win32Device::show_info()
|
|
||||||
{
|
{
|
||||||
|
char buffer[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
|
DWORD length = sizeof(buffer);
|
||||||
|
|
||||||
|
if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNameNetBIOS, buffer, &length)) {
|
||||||
|
_hostname = buffer;
|
||||||
|
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNameDnsHostname, buffer, &length)) {
|
||||||
|
_hostname = buffer;
|
||||||
|
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsHostname, buffer, &length)) {
|
||||||
|
_hostname = buffer;
|
||||||
|
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsDomain, buffer, &length)) {
|
||||||
|
_hostname = buffer;
|
||||||
|
} else {
|
||||||
|
_hostname = "localhost";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the Windows version.
|
||||||
|
DWORD dwBuild = 0;
|
||||||
|
DWORD dwVersion = GetVersion();
|
||||||
|
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||||
|
DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
||||||
|
if(dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||||
|
|
||||||
|
char version[128];
|
||||||
|
snprintf(version, sizeof(version), "Windows %d.%d.%d", dwMajorVersion, dwMinorVersion, dwBuild);
|
||||||
|
_core_version = version;
|
||||||
|
|
||||||
unsigned int eax, ebx, ecx, edx;
|
unsigned int eax, ebx, ecx, edx;
|
||||||
eax = 0;
|
eax = 0;
|
||||||
@ -39,9 +61,21 @@ void Win32Device::show_info()
|
|||||||
memcpy(vendor, &ebx, 4);
|
memcpy(vendor, &ebx, 4);
|
||||||
memcpy(vendor + 4, &edx, 4);
|
memcpy(vendor + 4, &edx, 4);
|
||||||
memcpy(vendor + 8, &ecx, 4);
|
memcpy(vendor + 8, &ecx, 4);
|
||||||
vendor[12] = '\0';
|
vendor[12] = '\0';
|
||||||
|
_chip_model = vendor;
|
||||||
|
|
||||||
LOG_VERBOSE(0, F("Processor : %s"), vendor);
|
// _backlight_pin = -1;
|
||||||
|
_backlight_power = 1;
|
||||||
|
_backlight_invert = 0;
|
||||||
|
_backlight_level = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Win32Device::reboot()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Win32Device::show_info()
|
||||||
|
{
|
||||||
|
LOG_VERBOSE(0, F("Processor : %s"), get_chip_model());
|
||||||
LOG_VERBOSE(0, F("CPU freq. : %i MHz"), get_cpu_frequency());
|
LOG_VERBOSE(0, F("CPU freq. : %i MHz"), get_cpu_frequency());
|
||||||
LOG_VERBOSE(0, F("OS Version : %s"), get_core_version());
|
LOG_VERBOSE(0, F("OS Version : %s"), get_core_version());
|
||||||
}
|
}
|
||||||
@ -66,7 +100,7 @@ const char* Win32Device::get_core_version()
|
|||||||
|
|
||||||
const char* Win32Device::get_chip_model()
|
const char* Win32Device::get_chip_model()
|
||||||
{
|
{
|
||||||
return "SDL2";
|
return _chip_model.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Win32Device::get_hardware_id()
|
const char* Win32Device::get_hardware_id()
|
||||||
|
@ -18,39 +18,7 @@ namespace dev {
|
|||||||
class Win32Device : public BaseDevice {
|
class Win32Device : public BaseDevice {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Win32Device()
|
Win32Device();
|
||||||
{
|
|
||||||
char buffer[MAX_COMPUTERNAME_LENGTH + 1];
|
|
||||||
DWORD length = sizeof(buffer);
|
|
||||||
|
|
||||||
if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNameNetBIOS, buffer, &length)) {
|
|
||||||
_hostname = buffer;
|
|
||||||
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNameDnsHostname, buffer, &length)) {
|
|
||||||
_hostname = buffer;
|
|
||||||
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsHostname, buffer, &length)) {
|
|
||||||
_hostname = buffer;
|
|
||||||
} else if(GetComputerNameExA((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsDomain, buffer, &length)) {
|
|
||||||
_hostname = buffer;
|
|
||||||
} else {
|
|
||||||
_hostname = "localhost";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the Windows version.
|
|
||||||
DWORD dwBuild = 0;
|
|
||||||
DWORD dwVersion = GetVersion();
|
|
||||||
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
|
||||||
DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
|
||||||
if(dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion));
|
|
||||||
|
|
||||||
char version[128];
|
|
||||||
snprintf(version, sizeof(version), "Windows %d.%d.%d", dwMajorVersion, dwMinorVersion, dwBuild);
|
|
||||||
_core_version = version;
|
|
||||||
|
|
||||||
// _backlight_pin = -1;
|
|
||||||
_backlight_power = 1;
|
|
||||||
_backlight_invert = 0;
|
|
||||||
_backlight_level = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reboot() override;
|
void reboot() override;
|
||||||
void show_info() override;
|
void show_info() override;
|
||||||
@ -80,6 +48,7 @@ class Win32Device : public BaseDevice {
|
|||||||
private:
|
private:
|
||||||
std::string _hostname;
|
std::string _hostname;
|
||||||
std::string _core_version;
|
std::string _core_version;
|
||||||
|
std::string _chip_model;
|
||||||
|
|
||||||
uint8_t _backlight_pin;
|
uint8_t _backlight_pin;
|
||||||
uint8_t _backlight_level;
|
uint8_t _backlight_level;
|
||||||
|
@ -83,6 +83,9 @@ class BaseTft {
|
|||||||
#elif USE_WIN32DRV && HASP_TARGET_PC
|
#elif USE_WIN32DRV && HASP_TARGET_PC
|
||||||
// #warning Building for Win32Drv
|
// #warning Building for Win32Drv
|
||||||
#include "tft_driver_win32drv.h"
|
#include "tft_driver_win32drv.h"
|
||||||
|
#elif USE_FBDEV && HASP_TARGET_PC
|
||||||
|
// #warning Building for POSIX fbdev
|
||||||
|
#include "tft_driver_posix_fbdev.h"
|
||||||
#else
|
#else
|
||||||
// #warning Building for Generic Tfts
|
// #warning Building for Generic Tfts
|
||||||
using dev::BaseTft;
|
using dev::BaseTft;
|
||||||
|
117
src/drv/tft/tft_driver_posix_fbdev.cpp
Normal file
117
src/drv/tft/tft_driver_posix_fbdev.cpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2022 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#if USE_FBDEV && HASP_TARGET_PC
|
||||||
|
|
||||||
|
#include "hasplib.h"
|
||||||
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
#include "display/fbdev.h"
|
||||||
|
|
||||||
|
#include "drv/tft/tft_driver.h"
|
||||||
|
#include "tft_driver_posix_fbdev.h"
|
||||||
|
|
||||||
|
#include "dev/device.h"
|
||||||
|
#include "hasp_debug.h"
|
||||||
|
#include "hasp_gui.h"
|
||||||
|
|
||||||
|
#ifdef HASP_CUSTOMIZE_BOOTLOGO
|
||||||
|
#include "custom/bootlogo.h" // Sketch tab header for xbm images
|
||||||
|
#else
|
||||||
|
#include "custom/bootlogo_template.h" // Sketch tab header for xbm images
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A task to measure the elapsed time for LittlevGL
|
||||||
|
* @param data unused
|
||||||
|
* @return never return
|
||||||
|
*/
|
||||||
|
static void* tick_thread(void* data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
usleep(5000); /*Sleep for 5 millisecond*/
|
||||||
|
lv_tick_inc(5); /*Tell LittelvGL that 5 milliseconds were elapsed*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t TftFbdevDrv::width()
|
||||||
|
{
|
||||||
|
return _width;
|
||||||
|
}
|
||||||
|
int32_t TftFbdevDrv::height()
|
||||||
|
{
|
||||||
|
return _height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* gui_entrypoint(void* arg)
|
||||||
|
{
|
||||||
|
#if HASP_USE_LVGL_TASK
|
||||||
|
#error "fbdev LVGL task is not implemented"
|
||||||
|
#else
|
||||||
|
// create a LVGL tick thread
|
||||||
|
pthread_t thread;
|
||||||
|
pthread_create(&thread, 0, tick_thread, NULL);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TftFbdevDrv::init(int32_t w, int h)
|
||||||
|
{
|
||||||
|
/* Add a display
|
||||||
|
* Use the 'fbdev' driver which uses POSIX framebuffer device as a display
|
||||||
|
* The following input devices are handled: mouse, keyboard, mousewheel */
|
||||||
|
fbdev_init();
|
||||||
|
fbdev_get_sizes((uint32_t*)&_width, (uint32_t*)&_height);
|
||||||
|
|
||||||
|
#if HASP_USE_LVGL_TASK
|
||||||
|
#error "fbdev LVGL task is not implemented"
|
||||||
|
#else
|
||||||
|
// do not use the gui_task(), just init the GUI and return
|
||||||
|
gui_entrypoint(NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
void TftFbdevDrv::show_info()
|
||||||
|
{
|
||||||
|
splashscreen();
|
||||||
|
|
||||||
|
LOG_VERBOSE(TAG_TFT, F("Driver : %s"), get_tft_model());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TftFbdevDrv::splashscreen()
|
||||||
|
{
|
||||||
|
uint8_t fg[] = logoFgColor;
|
||||||
|
uint8_t bg[] = logoBgColor;
|
||||||
|
lv_color_t fgColor = lv_color_make(fg[0], fg[1], fg[2]);
|
||||||
|
lv_color_t bgColor = lv_color_make(bg[0], bg[1], bg[2]);
|
||||||
|
// TODO show splashscreen
|
||||||
|
}
|
||||||
|
void TftFbdevDrv::set_rotation(uint8_t rotation)
|
||||||
|
{}
|
||||||
|
void TftFbdevDrv::set_invert(bool invert)
|
||||||
|
{}
|
||||||
|
void TftFbdevDrv::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
|
||||||
|
{
|
||||||
|
fbdev_flush(disp, area, color_p);
|
||||||
|
}
|
||||||
|
bool TftFbdevDrv::is_driver_pin(uint8_t pin)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const char* TftFbdevDrv::get_tft_model()
|
||||||
|
{
|
||||||
|
return "POSIX fbdev";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
dev::TftFbdevDrv haspTft;
|
||||||
|
|
||||||
|
#endif // WINDOWS || POSIX
|
44
src/drv/tft/tft_driver_posix_fbdev.h
Normal file
44
src/drv/tft/tft_driver_posix_fbdev.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* MIT License - Copyright (c) 2019-2022 Francis Van Roie
|
||||||
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
|
#ifndef HASP_FBDEV_DRIVER_H
|
||||||
|
#define HASP_FBDEV_DRIVER_H
|
||||||
|
|
||||||
|
#include "tft_driver.h"
|
||||||
|
|
||||||
|
#if USE_FBDEV && HASP_TARGET_PC
|
||||||
|
// #warning Building H driver FBDEV
|
||||||
|
|
||||||
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
namespace dev {
|
||||||
|
|
||||||
|
class TftFbdevDrv : BaseTft {
|
||||||
|
public:
|
||||||
|
void init(int w, int h);
|
||||||
|
void show_info();
|
||||||
|
void splashscreen();
|
||||||
|
|
||||||
|
void set_rotation(uint8_t rotation);
|
||||||
|
void set_invert(bool invert);
|
||||||
|
|
||||||
|
void flush_pixels(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p);
|
||||||
|
bool is_driver_pin(uint8_t pin);
|
||||||
|
|
||||||
|
const char* get_tft_model();
|
||||||
|
|
||||||
|
int32_t width();
|
||||||
|
int32_t height();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32_t _width, _height;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dev
|
||||||
|
|
||||||
|
using dev::TftFbdevDrv;
|
||||||
|
extern dev::TftFbdevDrv haspTft;
|
||||||
|
|
||||||
|
#endif // HASP_TARGET_PC
|
||||||
|
|
||||||
|
#endif // HASP_FBDEV_DRIVER_H
|
@ -114,7 +114,7 @@ void TftWin32Drv::show_info()
|
|||||||
{
|
{
|
||||||
splashscreen();
|
splashscreen();
|
||||||
|
|
||||||
LOG_VERBOSE(TAG_TFT, F("Driver : Win32Drv"));
|
LOG_VERBOSE(TAG_TFT, F("Driver : %s"), get_tft_model());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TftWin32Drv::splashscreen()
|
void TftWin32Drv::splashscreen()
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
#define cwd getcwd
|
#define cwd getcwd
|
||||||
#define cd chdir
|
#define cd chdir
|
||||||
#endif
|
#endif
|
||||||
@ -178,25 +180,23 @@ int main(int argc, char* argv[])
|
|||||||
SDL_Init(0); // Needs to be initialized for GetPerfPath
|
SDL_Init(0); // Needs to be initialized for GetPerfPath
|
||||||
strcpy(config, SDL_GetPrefPath("hasp", "hasp"));
|
strcpy(config, SDL_GetPrefPath("hasp", "hasp"));
|
||||||
SDL_Quit(); // We'll properly init later
|
SDL_Quit(); // We'll properly init later
|
||||||
#elif USE_WIN32DRV
|
#elif defined(WINDOWS)
|
||||||
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, config))) {
|
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, config))) {
|
||||||
PathAppendA(config, "hasp");
|
PathAppendA(config, "hasp");
|
||||||
PathAppendA(config, "hasp");
|
PathAppendA(config, "hasp");
|
||||||
}
|
}
|
||||||
|
#elif defined(POSIX)
|
||||||
|
struct passwd* pw = getpwuid(getuid());
|
||||||
|
strcpy(config, pw->pw_dir);
|
||||||
|
strcat(config, "/.local/share/hasp/hasp");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
cd(config);
|
cd(config);
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
#if USE_MONITOR
|
|
||||||
while(1) {
|
|
||||||
loop();
|
|
||||||
}
|
|
||||||
#elif USE_WIN32DRV
|
|
||||||
while(haspDevice.pc_is_running) {
|
while(haspDevice.pc_is_running) {
|
||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#if defined(WINDOWS)
|
#if defined(WINDOWS)
|
||||||
|
@ -85,7 +85,6 @@ lib_ignore =
|
|||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*>
|
+<*>
|
||||||
-<*.h>
|
-<*.h>
|
||||||
+<../hal/sdl2>
|
|
||||||
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/*.c>
|
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/*.c>
|
||||||
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.c>
|
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.c>
|
||||||
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.h>
|
+<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.h>
|
||||||
|
98
user_setups/linux_sdl/linux_fbdev_64bits.ini
Normal file
98
user_setups/linux_sdl/linux_fbdev_64bits.ini
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
[env:linux_fbdev_64bits]
|
||||||
|
platform = native@^1.1.4
|
||||||
|
extra_scripts =
|
||||||
|
tools/linux_build_extra.py
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-D HASP_MODEL="Linux App"
|
||||||
|
-D HASP_TARGET_PC=1
|
||||||
|
|
||||||
|
; ----- Monitor
|
||||||
|
-D TFT_WIDTH=240
|
||||||
|
-D TFT_HEIGHT=320
|
||||||
|
; SDL drivers options
|
||||||
|
;-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
|
;-D LV_DRV_NO_CONF
|
||||||
|
-D USE_FBDEV
|
||||||
|
; ----- ArduinoJson
|
||||||
|
-D ARDUINOJSON_DECODE_UNICODE=1
|
||||||
|
-D HASP_NUM_PAGES=12
|
||||||
|
-D HASP_USE_SPIFFS=0
|
||||||
|
-D HASP_USE_LITTLEFS=0
|
||||||
|
-D LV_USE_FS_IF=1
|
||||||
|
-D HASP_USE_EEPROM=0
|
||||||
|
-D HASP_USE_GPIO=0
|
||||||
|
-D HASP_USE_CONFIG=1
|
||||||
|
-D HASP_USE_DEBUG=1
|
||||||
|
-D HASP_USE_PNGDECODE=1
|
||||||
|
-D HASP_USE_BMPDECODE=1
|
||||||
|
-D HASP_USE_GIFDECODE=0
|
||||||
|
-D HASP_USE_JPGDECODE=0
|
||||||
|
-D HASP_USE_MQTT=1
|
||||||
|
-D MQTT_MAX_PACKET_SIZE=2048
|
||||||
|
-D HASP_ATTRIBUTE_FAST_MEM=
|
||||||
|
-D IRAM_ATTR= ; No IRAM_ATTR available
|
||||||
|
-D PROGMEM= ; No PROGMEM available
|
||||||
|
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
|
||||||
|
;-D LV_LOG_PRINTF=1
|
||||||
|
; Add recursive dirs for hal headers search
|
||||||
|
-D POSIX
|
||||||
|
-D PAHO_MQTT_STATIC
|
||||||
|
-DPAHO_WITH_SSL=TRUE
|
||||||
|
-DPAHO_BUILD_DOCUMENTATION=FALSE
|
||||||
|
-DPAHO_BUILD_SAMPLES=FALSE
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DCMAKE_VERBOSE_MAKEFILE=TRUE
|
||||||
|
;-D NO_PERSISTENCE
|
||||||
|
-I.pio/libdeps/linux_fbdev_64bits/paho/src
|
||||||
|
-I.pio/libdeps/linux_fbdev_64bits/ArduinoJson/src
|
||||||
|
|
||||||
|
; ----- Statically linked libraries --------------------
|
||||||
|
-lm
|
||||||
|
-lpthread
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
;lv_drivers@~7.9.0
|
||||||
|
;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/7d71907c1d6b02797d066f50984b866e080ebeed.zip
|
||||||
|
https://github.com/eclipse/paho.mqtt.c.git
|
||||||
|
bblanchon/ArduinoJson@^6.21.4 ; Json(l) parser
|
||||||
|
https://github.com/fvanroie/lv_drivers
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
paho
|
||||||
|
AXP192
|
||||||
|
ArduinoLog
|
||||||
|
lv_lib_qrcode
|
||||||
|
ETHSPI
|
||||||
|
|
||||||
|
build_src_filter =
|
||||||
|
+<*>
|
||||||
|
-<*.h>
|
||||||
|
+<../.pio/libdeps/linux_fbdev_64bits/paho/src/*.c>
|
||||||
|
+<../.pio/libdeps/linux_fbdev_64bits/paho/src/MQTTClient.c>
|
||||||
|
-<../.pio/libdeps/linux_fbdev_64bits/paho/src/MQTTAsync.c>
|
||||||
|
-<../.pio/libdeps/linux_fbdev_64bits/paho/src/MQTTAsyncUtils.c>
|
||||||
|
-<../.pio/libdeps/linux_fbdev_64bits/paho/src/MQTTVersion.c>
|
||||||
|
-<../.pio/libdeps/linux_fbdev_64bits/paho/src/SSLSocket.c>
|
||||||
|
+<MQTTClient.c>
|
||||||
|
-<MQTTAsync.c>
|
||||||
|
-<MQTTAsyncUtils.c>
|
||||||
|
-<MQTTVersion.c>
|
||||||
|
-<SSLSocket.c>
|
||||||
|
-<sys/>
|
||||||
|
+<sys/gpio/>
|
||||||
|
-<hal/>
|
||||||
|
+<drv/>
|
||||||
|
-<drv/touch>
|
||||||
|
+<drv/tft>
|
||||||
|
+<dev/>
|
||||||
|
-<hal/>
|
||||||
|
-<svc/>
|
||||||
|
-<hasp_filesystem.cpp>
|
||||||
|
+<font/>
|
||||||
|
+<hasp/>
|
||||||
|
+<lang/>
|
||||||
|
-<log/>
|
||||||
|
+<mqtt/>
|
||||||
|
+<../.pio/libdeps/linux_fbdev_64bits/ArduinoJson/src/ArduinoJson.h>
|
@ -76,7 +76,6 @@ lib_ignore =
|
|||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*>
|
+<*>
|
||||||
-<*.h>
|
-<*.h>
|
||||||
+<../hal/sdl2>
|
|
||||||
+<../.pio/libdeps/linux_sdl_64bits/paho/src/*.c>
|
+<../.pio/libdeps/linux_sdl_64bits/paho/src/*.c>
|
||||||
+<../.pio/libdeps/linux_sdl_64bits/paho/src/MQTTClient.c>
|
+<../.pio/libdeps/linux_sdl_64bits/paho/src/MQTTClient.c>
|
||||||
-<../.pio/libdeps/linux_sdl_64bits/paho/src/MQTTAsync.c>
|
-<../.pio/libdeps/linux_sdl_64bits/paho/src/MQTTAsync.c>
|
||||||
|
@ -100,7 +100,6 @@ lib_ignore =
|
|||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*>
|
+<*>
|
||||||
-<*.h>
|
-<*.h>
|
||||||
+<../hal/sdl2>
|
|
||||||
+<../.pio/libdeps/windows_gdi_64bits/paho/src/*.c>
|
+<../.pio/libdeps/windows_gdi_64bits/paho/src/*.c>
|
||||||
+<../.pio/libdeps/windows_gdi_64bits/paho/src/MQTTClient.c>
|
+<../.pio/libdeps/windows_gdi_64bits/paho/src/MQTTClient.c>
|
||||||
-<../.pio/libdeps/windows_gdi_64bits/paho/src/MQTTAsync.c>
|
-<../.pio/libdeps/windows_gdi_64bits/paho/src/MQTTAsync.c>
|
||||||
|
@ -106,7 +106,6 @@ lib_ignore =
|
|||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*>
|
+<*>
|
||||||
-<*.h>
|
-<*.h>
|
||||||
+<../hal/sdl2>
|
|
||||||
+<../.pio/libdeps/windows_sdl_64bits/paho/src/*.c>
|
+<../.pio/libdeps/windows_sdl_64bits/paho/src/*.c>
|
||||||
+<../.pio/libdeps/windows_sdl_64bits/paho/src/MQTTClient.c>
|
+<../.pio/libdeps/windows_sdl_64bits/paho/src/MQTTClient.c>
|
||||||
-<../.pio/libdeps/windows_sdl_64bits/paho/src/MQTTAsync.c>
|
-<../.pio/libdeps/windows_sdl_64bits/paho/src/MQTTAsync.c>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user