Tab5 camera + other stuff (#558)
* Tab5 camera + other stuff Tab5 camera driver - SC2356 Custom SliderBox widget - slider with plus and minus buttons + value label and snapping Rtc Time service + rtc api Sdk release - only include drivers built for that specific target, eg: sc2356 driver is mipi / p4 only. No more hardcoded manual sdk cmakelists New function to find device by compatible string match. no more static cast bool wildness when trying to match a single device (like M5Stack PaperS3 for example) * feedback + fixes Fixed external app user data path. fix(gui): block app teardown until onHide() completes, preventing ELF unload racing a still-running app added camera device type and api * drain the snake sssem --------- Co-authored-by: Ken Van Hoeylandt <git@kenvanhoeylandt.net>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <tactility/drivers/camera.h>
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
#define CAMERA_DRIVER_API(driver) ((struct CameraApi*)driver->api)
|
||||
|
||||
extern "C" {
|
||||
|
||||
error_t camera_open(Device* device, CameraHandle* out_handle) {
|
||||
const auto* driver = device_get_driver(device);
|
||||
return CAMERA_DRIVER_API(driver)->open(device, out_handle);
|
||||
}
|
||||
|
||||
error_t camera_close(CameraHandle handle) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->close(handle);
|
||||
}
|
||||
|
||||
error_t camera_get_frame(CameraHandle handle, uint8_t** buf, size_t* len, uint32_t timeout_ms, uint32_t* out_width, uint32_t* out_height) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->get_frame(handle, buf, len, timeout_ms, out_width, out_height);
|
||||
}
|
||||
|
||||
error_t camera_release_frame(CameraHandle handle) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->release_frame(handle);
|
||||
}
|
||||
|
||||
uint32_t camera_get_width(CameraHandle handle) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->get_width(handle);
|
||||
}
|
||||
|
||||
uint32_t camera_get_height(CameraHandle handle) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->get_height(handle);
|
||||
}
|
||||
|
||||
error_t camera_set_rotation(CameraHandle handle, CameraRotation rotation) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->set_rotation(handle, rotation);
|
||||
}
|
||||
|
||||
error_t camera_capture_jpeg(CameraHandle handle, uint8_t** out_buf, size_t* out_len, uint8_t quality) {
|
||||
const auto* driver = device_get_driver(handle->device);
|
||||
return CAMERA_DRIVER_API(driver)->capture_jpeg(handle, out_buf, out_len, quality);
|
||||
}
|
||||
|
||||
const struct DeviceType CAMERA_TYPE {
|
||||
.name = "camera"
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user