Merge develop into main (#303)
- `DisplayDevice` improvements related `DisplayDriver` - Replaced incorrect usage of `spiBusHandle` with `spiHostDevice` in all SPI display devices - Disabled `DisplayDriver` support for RGB displays for now - Updated `GraphicsDemo` project for the above changes - TactilityC improvements: - created `tt_hal_device_find()` - created `tt_hal_display_*` - created `tt_hal_touch_*` - created `tt_lvgl_*` - export `tt_app_*` calls
This commit is contained in:
committed by
GitHub
parent
d875ade8cb
commit
fbaff8cbac
@@ -0,0 +1,48 @@
|
||||
#include "tt_hal_device.h"
|
||||
|
||||
#include "Tactility/Check.h"
|
||||
|
||||
#include <Tactility/hal/Device.h>
|
||||
|
||||
static tt::hal::Device::Type toTactilityDeviceType(DeviceType type) {
|
||||
switch (type) {
|
||||
case DEVICE_TYPE_I2C:
|
||||
return tt::hal::Device::Type::I2c;
|
||||
case DEVICE_TYPE_DISPLAY:
|
||||
return tt::hal::Device::Type::Display;
|
||||
case DEVICE_TYPE_TOUCH:
|
||||
return tt::hal::Device::Type::Touch;
|
||||
case DEVICE_TYPE_SDCARD:
|
||||
return tt::hal::Device::Type::SdCard;
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
return tt::hal::Device::Type::Keyboard;
|
||||
case DEVICE_TYPE_POWER:
|
||||
return tt::hal::Device::Type::Power;
|
||||
case DEVICE_TYPE_GPS:
|
||||
return tt::hal::Device::Type::Gps;
|
||||
default:
|
||||
tt_crash("Device::Type not supported");
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
bool tt_hal_device_find(DeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount) {
|
||||
assert(maxCount > 0);
|
||||
|
||||
int16_t currentIndex = -1;
|
||||
uint16_t maxIndex = maxCount - 1;
|
||||
|
||||
findDevices(toTactilityDeviceType(type), [&](const std::shared_ptr<tt::hal::Device>& device) {
|
||||
currentIndex++;
|
||||
deviceIds[currentIndex] = device->getId();
|
||||
// Continue if there is storage capacity left
|
||||
return currentIndex < maxIndex;
|
||||
});
|
||||
|
||||
*count = currentIndex + 1;
|
||||
|
||||
return currentIndex >= 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user