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,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum DeviceType {
|
||||
DEVICE_TYPE_I2C,
|
||||
DEVICE_TYPE_DISPLAY,
|
||||
DEVICE_TYPE_TOUCH,
|
||||
DEVICE_TYPE_SDCARD,
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
DEVICE_TYPE_POWER,
|
||||
DEVICE_TYPE_GPS
|
||||
};
|
||||
|
||||
typedef uint32_t DeviceId;
|
||||
|
||||
/**
|
||||
* Find one or more devices of a certain type.
|
||||
* @param[in] type the type to look for
|
||||
* @param[inout] deviceIds the output ids, which should fit at least maxCount amount of devices
|
||||
* @param[out] count the resulting number of device ids that were returned
|
||||
* @param[in] maxCount the maximum number of items that the "deviceIds" output can contain (minimum value is 1)
|
||||
* @return true if one or more devices were found
|
||||
*/
|
||||
bool tt_hal_device_find(DeviceType type, DeviceId* deviceIds, uint16_t* count, uint16_t maxCount);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include <tt_kernel.h>
|
||||
|
||||
#include "tt_hal_device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void* DisplayDriverHandle;
|
||||
|
||||
enum ColorFormat {
|
||||
COLOR_FORMAT_MONOCHROME, // 1 bpp
|
||||
COLOR_FORMAT_BGR565,
|
||||
COLOR_FORMAT_BGR565_SWAPPED,
|
||||
COLOR_FORMAT_RGB565,
|
||||
COLOR_FORMAT_RGB565_SWAPPED,
|
||||
COLOR_FORMAT_RGB888
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the display driver interface is supported for this device.
|
||||
* @param[in] displayId the identifier of the display device
|
||||
* @return true if the driver is supported.
|
||||
*/
|
||||
bool tt_hal_display_driver_supported(DeviceId displayId);
|
||||
|
||||
/**
|
||||
* Allocate a driver object for the specified displayId.
|
||||
* @warning check whether the driver is supported by calling tt_hal_display_driver_supported() first
|
||||
* @param[in] displayId the identifier of the display device
|
||||
* @return the driver handle
|
||||
*/
|
||||
DisplayDriverHandle tt_hal_display_driver_alloc(DeviceId displayId);
|
||||
|
||||
/**
|
||||
* Free the memory for the display driver.
|
||||
* @param[in] handle the display driver handle
|
||||
*/
|
||||
void tt_hal_display_driver_free(DisplayDriverHandle handle);
|
||||
|
||||
/**
|
||||
* Lock the display device. Call this function before doing any draw calls.
|
||||
* Certain display devices are on a shared bus (e.g. SPI) so they must run
|
||||
* mutually exclusive with other devices on the same bus (e.g. SD card)
|
||||
* @param[in] handle the display driver handle
|
||||
* @param[in] timeout the maximum amount of ticks to wait for getting a lock
|
||||
* @return true if the lock was acquired
|
||||
*/
|
||||
bool tt_hal_display_driver_lock(DisplayDriverHandle handle, TickType timeout);
|
||||
|
||||
/**
|
||||
* Unlock the display device. Must be called exactly once after locking.
|
||||
* @param[in] handle the display driver handle
|
||||
*/
|
||||
void tt_hal_display_driver_unlock(DisplayDriverHandle handle);
|
||||
|
||||
/**
|
||||
* @param[in] handle the display driver handle
|
||||
* @return the native color format for this display
|
||||
*/
|
||||
ColorFormat tt_hal_display_driver_get_colorformat(DisplayDriverHandle handle);
|
||||
|
||||
/**
|
||||
* @param[in] handle the display driver handle
|
||||
* @return the horizontal resolution of the display
|
||||
*/
|
||||
uint16_t tt_hal_display_driver_get_pixel_width(DisplayDriverHandle handle);
|
||||
|
||||
/**
|
||||
* @param[in] handle the display driver handle
|
||||
* @return the vertical resolution of the display
|
||||
*/
|
||||
uint16_t tt_hal_display_driver_get_pixel_height(DisplayDriverHandle handle);
|
||||
|
||||
/**
|
||||
* Draw pixels on the screen. Make sure to call the lock function first and unlock afterwards.
|
||||
* Many draw calls can be done inbetween a single lock and unlock.
|
||||
* @param[in] handle the display driver handle
|
||||
* @param[in] xStart the starting x coordinate for rendering the pixel data
|
||||
* @param[in] yStart the starting y coordinate for rendering the pixel data
|
||||
* @param[in] xEnd the last x coordinate for rendering the pixel data (absolute pixel value, not relative to xStart!)
|
||||
* @param[in] yEnd the last y coordinate for rendering the pixel data (absolute pixel value, not relative to yStart!)
|
||||
* @param[in] pixelData a buffer of pixels. the data is placed as "RowRowRowRow". The size depends on the ColorFormat
|
||||
*/
|
||||
void tt_hal_display_driver_draw_bitmap(DisplayDriverHandle handle, int xStart, int yStart, int xEnd, int yEnd, const void* pixelData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "tt_hal_device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void* TouchDriverHandle;
|
||||
/**
|
||||
* Check if the touch driver interface is supported for this device.
|
||||
* @param[in] touchDeviceId the identifier of the touch device
|
||||
* @return true if the driver is supported.
|
||||
*/
|
||||
bool tt_hal_touch_driver_supported(DeviceId touchDeviceId);
|
||||
|
||||
/**
|
||||
* Allocate a driver object for the specified touchDeviceId.
|
||||
* @warning check whether the driver is supported by calling tt_hal_touch_driver_supported() first
|
||||
* @param[in] touchDeviceId the identifier of the touch device
|
||||
* @return the driver handle
|
||||
*/
|
||||
TouchDriverHandle tt_hal_touch_driver_alloc(DeviceId touchDeviceId);
|
||||
|
||||
/**
|
||||
* Free the memory for the touch driver.
|
||||
* @param[in] handle the touch driver handle
|
||||
*/
|
||||
void tt_hal_touch_driver_free(TouchDriverHandle handle);
|
||||
|
||||
/**
|
||||
* Get the coordinates for the currently touched points on the screen.
|
||||
*
|
||||
* @param[in] handle the touch driver handle
|
||||
* @param[in] x array of X coordinates
|
||||
* @param[in] y array of Y coordinates
|
||||
* @param[in] strength array of strengths (with the minimum size of maxPointCount) or NULL
|
||||
* @param[in] pointCount the number of points currently touched on the screen
|
||||
* @param[in] maxPointCount the maximum number of points that can be touched at once
|
||||
*
|
||||
* @return true when touched and coordinates are available
|
||||
*/
|
||||
bool tt_hal_touch_driver_get_touched_points(TouchDriverHandle handle, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned long TickType;
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in milliseconds to stall.
|
||||
*/
|
||||
void tt_kernel_delay_millis(uint32_t milliseconds);
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in microsends to stall.
|
||||
*/
|
||||
void tt_kernel_delay_micros(uint32_t microSeconds);
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in ticks to stall.
|
||||
*/
|
||||
void tt_kernel_delay_ticks(TickType ticks);
|
||||
|
||||
/** @return the number of ticks since the device was started */
|
||||
TickType tt_kernel_get_ticks();
|
||||
|
||||
/** Convert milliseconds to ticks */
|
||||
TickType tt_kernel_millis_to_ticks(uint32_t milliSeconds);
|
||||
|
||||
/** Stall the current task until the specified timestamp
|
||||
* @return false if for some reason the delay was broken off
|
||||
*/
|
||||
bool tt_kernel_delay_until_tick(TickType tick);
|
||||
|
||||
/** @return the tick frequency of the kernel (commonly 1000 Hz when running FreeRTOS) */
|
||||
uint32_t tt_kernel_get_tick_frequency();
|
||||
|
||||
/** @return the number of milliseconds that have passed since the device was started */
|
||||
uint32_t tt_kernel_get_millis();
|
||||
|
||||
unsigned long tt_kernel_get_micros();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @return true if LVGL is started and active */
|
||||
bool tt_lvgl_is_started();
|
||||
|
||||
/** Start LVGL and related background services */
|
||||
void tt_lvgl_start();
|
||||
|
||||
/** Stop LVGL and related background services */
|
||||
void tt_lvgl_stop();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user