mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
This commit contains @josemalm32 's implementation for the Guition JC1060P470CIWY (see https://github.com/ByteWelder/Tactility/issues/427) I've added these changes: - Updated the branch for the new logging method - Updated the branch for the PR that I mentioned in the above linked issue - Replaced the manually pasted in esp_lcd_jd9165 driver with the one from the component registry - Updated Spanish to English - Updated all drivers' mutexes/locks - Fixed the display color format - Fixed bug in power deinit - Renamed I2C bus in config - Added device to continuous integration - Renamed several Guition devices from CYD to Guition - Fix for `EspLcdDisplayV2` init for when features are not supported - Pin esp_wifi_remote to version 1.2.3 - Fix in `WifiManage` logging - Fix for `WifiEsp.cpp`'s check for wifi presence - Fix for `WifiEsp`'s scan list logging - Fix for `gcc_soft_float_symbols` in TactiltyC
85 lines
2.0 KiB
C++
85 lines
2.0 KiB
C++
#ifdef ESP_PLATFORM
|
|
#include <sdkconfig.h>
|
|
#endif
|
|
|
|
#if defined(CONFIG_TT_WIFI_ENABLED) && !defined(CONFIG_ESP_WIFI_REMOTE_ENABLED)
|
|
|
|
#include <Tactility/service/espnow/EspNow.h>
|
|
#include <Tactility/service/espnow/EspNowService.h>
|
|
|
|
#include <Tactility/Logger.h>
|
|
|
|
namespace tt::service::espnow {
|
|
|
|
static const auto LOGGER = Logger("EspNow");
|
|
|
|
void enable(const EspNowConfig& config) {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
service->enable(config);
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
}
|
|
}
|
|
|
|
void disable() {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
service->disable();
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
}
|
|
}
|
|
|
|
bool isEnabled() {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
return service->isEnabled();
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool addPeer(const esp_now_peer_info_t& peer) {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
return service->addPeer(peer);
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool send(const uint8_t* address, const uint8_t* buffer, size_t bufferLength) {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
return service->send(address, buffer, bufferLength);
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
ReceiverSubscription subscribeReceiver(std::function<void(const esp_now_recv_info_t* receiveInfo, const uint8_t* data, int length)> onReceive) {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
return service->subscribeReceiver(onReceive);
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
void unsubscribeReceiver(ReceiverSubscription subscription) {
|
|
auto service = findService();
|
|
if (service != nullptr) {
|
|
service->unsubscribeReceiver(subscription);
|
|
} else {
|
|
LOGGER.error("Service not found");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endif // ESP_PLATFORM
|