Create DTS files for all devices and implement I2C changes (#466)
Devictree changes: - Create DTS files for all remaining devices - Update corresponding `devicetree.yaml` - Remove `i2c` configuration from corresponding `tt::hal::Configuration` Apps & HAL: - Removed I2C Settings (we'll make a new one later after I rework that part of the HAL) - Delete TactilityC GPIO and I2C functionality - Delete Related SystemEvent types - Refactor `tt::hal::i2c` to only use `struct Device*` wrapping Scripting: - Fix DevicetreeCompiler boolean parsing - Create `build-all.py`
This commit is contained in:
committed by
GitHub
parent
71f8369377
commit
87ca888bb4
@@ -1,82 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Logical GPIO pin identifier used by the HAL. Typically maps to the SoC GPIO number. */
|
||||
typedef unsigned int GpioPin;
|
||||
/** Value indicating that no GPIO pin is used/applicable. */
|
||||
#define GPIO_NO_PIN -1
|
||||
|
||||
/** GPIO pin mode used by the HAL.
|
||||
* @warning The order must match tt::hal::gpio::Mode
|
||||
*/
|
||||
typedef enum {
|
||||
/** Pin is disabled (high-impedance). */
|
||||
GpioModeDisable = 0,
|
||||
/** Pin configured as input only. */
|
||||
GpioModeInput,
|
||||
/** Pin configured as push-pull output only. */
|
||||
GpioModeOutput,
|
||||
/** Pin configured as open-drain output only. */
|
||||
GpioModeOutputOpenDrain,
|
||||
/** Pin configured for both input and output (push-pull). */
|
||||
GpioModeInputOutput,
|
||||
/** Pin configured for both input and output (open-drain). */
|
||||
GpioModeInputOutputOpenDrain
|
||||
} GpioMode;
|
||||
|
||||
/** Configure a single GPIO pin.
|
||||
* @param[in] pin GPIO number to configure.
|
||||
* @param[in] mode Desired I/O mode for the pin.
|
||||
* @param[in] pullUp Enable internal pull-up if true.
|
||||
* @param[in] pullDown Enable internal pull-down if true.
|
||||
* @return true on success, false if the pin is invalid or configuration failed.
|
||||
*/
|
||||
bool tt_hal_gpio_configure(GpioPin pin, GpioMode mode, bool pullUp, bool pullDown);
|
||||
|
||||
/** Configure a set of GPIO pins in one call.
|
||||
* The bit index of pin N is (1ULL << N).
|
||||
* @param[in] pinBitMask Bit mask of pins to configure.
|
||||
* @param[in] mode Desired I/O mode for the pins.
|
||||
* @param[in] pullUp Enable internal pull-up on the selected pins if true.
|
||||
* @param[in] pullDown Enable internal pull-down on the selected pins if true.
|
||||
* @return true on success, false if any pin is invalid or configuration failed.
|
||||
*/
|
||||
bool tt_hal_gpio_configure_with_pin_bitmask(uint64_t pinBitMask, GpioMode mode, bool pullUp, bool pullDown);
|
||||
|
||||
/** Set the input/output mode for the specified pin.
|
||||
* @param[in] pin The pin to configure.
|
||||
* @param[in] mode The mode to set.
|
||||
* @return true on success, false if the pin is invalid or mode not supported.
|
||||
*/
|
||||
bool tt_hal_gpio_set_mode(GpioPin pin, GpioMode mode);
|
||||
|
||||
/** Read the current logic level of a pin.
|
||||
* The pin should be configured for input or input/output.
|
||||
* @param[in] pin The pin to read.
|
||||
* @return true if the level is high, false if low. If the pin is invalid, the
|
||||
* behavior is implementation-defined and may return false.
|
||||
*/
|
||||
bool tt_hal_gpio_get_level(GpioPin pin);
|
||||
|
||||
/** Drive the output level of a pin.
|
||||
* The pin should be configured for output or input/output.
|
||||
* @param[in] pin The pin to drive.
|
||||
* @param[in] level Output level to set (true = high, false = low).
|
||||
* @return true on success, false if the pin is invalid or not configured as output.
|
||||
*/
|
||||
bool tt_hal_gpio_set_level(GpioPin pin, bool level);
|
||||
|
||||
/** Get the number of GPIO pins available on this platform.
|
||||
* @return The count of valid GPIO pins.
|
||||
*/
|
||||
int tt_hal_gpio_get_pin_count();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <hal/i2c_types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Start I2C communications for the specified port
|
||||
* @param[in] port the I2C port to init
|
||||
* @return true on success
|
||||
*/
|
||||
bool tt_hal_i2c_start(i2c_port_t port);
|
||||
|
||||
/**
|
||||
* Stop I2C communications for the specified port
|
||||
* @param[in] port the I2C port to deinit
|
||||
* @return true on success
|
||||
*/
|
||||
bool tt_hal_i2c_stop(i2c_port_t port);
|
||||
|
||||
/**
|
||||
* Check if the port was successfully started.
|
||||
* @param[in] port the port to check
|
||||
* @return true when the port was successfully started
|
||||
*/
|
||||
bool tt_hal_i2c_is_started(i2c_port_t port);
|
||||
|
||||
/**
|
||||
* Read from an I2C port in master mode.
|
||||
* @param[in] port the I2C port to read from
|
||||
* @param[in] address
|
||||
* @param[in] data
|
||||
* @param[in] dataSize
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_read(i2c_port_t port, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Read a register from an I2C port in master mode.
|
||||
* @param[in] port the I2C port to read from
|
||||
* @param[in] address
|
||||
* @param[in] reg
|
||||
* @param[in] data
|
||||
* @param[in] dataSize
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_read_register(i2c_port_t port, uint8_t address, uint8_t reg, uint8_t* data, size_t dataSize, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Write to an I2C port in master mode.
|
||||
* @param[in] port the I2C port to write to
|
||||
* @param[in] address
|
||||
* @param[in] data
|
||||
* @param[in] dataSize
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_write(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Write to a register of an I2C port in master mode.
|
||||
* @param[in] port the I2C port to write to
|
||||
* @param[in] address
|
||||
* @param[in] reg
|
||||
* @param[in] data
|
||||
* @param[in] dataSize
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_write_register(i2c_port_t port, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t dataSize, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Write then read from an I2C port in master mode.
|
||||
* @param[in] port the I2C port to communicate with
|
||||
* @param[in] address
|
||||
* @param[in] writeData
|
||||
* @param[in] writeDataSize
|
||||
* @param[in] readData
|
||||
* @param[in] readDataSize
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_write_read(i2c_port_t port, uint8_t address, const uint8_t* writeData, size_t writeDataSize, uint8_t* readData, size_t readDataSize, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Check if an I2C port has a device at the specified address.
|
||||
* @param[in] port the I2C port to communicate with
|
||||
* @param[in] address
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_master_has_device_at_address(i2c_port_t port, uint8_t address, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Used to lock an I2C port.
|
||||
* This is useful for creating thread-safe I2C calls while calling ESP-IDF directly of third party I2C APIs.
|
||||
* @param[in] port the I2C port to lock
|
||||
* @param[in] timeout
|
||||
*/
|
||||
bool tt_hal_i2c_lock(i2c_port_t port, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Used to unlock an I2C port.
|
||||
* This is useful for creating thread-safe I2C calls while calling ESP-IDF directly of third party I2C APIs.
|
||||
*/
|
||||
void tt_hal_i2c_unlock(i2c_port_t port);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "tt_hal_gpio.h"
|
||||
#include <Tactility/hal/gpio/Gpio.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
bool tt_hal_gpio_configure(GpioPin pin, GpioMode mode, bool pullUp, bool pullDown) {
|
||||
return gpio::configure(pin, static_cast<gpio::Mode>(mode), pullUp, pullDown);
|
||||
}
|
||||
|
||||
bool tt_hal_gpio_configure_with_pin_bitmask(uint64_t pinBitMask, GpioMode mode, bool pullUp, bool pullDown) {
|
||||
return gpio::configureWithPinBitmask(pinBitMask, static_cast<gpio::Mode>(mode), pullUp, pullDown);
|
||||
}
|
||||
|
||||
bool tt_hal_gpio_set_mode(GpioPin pin, GpioMode mode) {
|
||||
return gpio::setMode(pin, static_cast<gpio::Mode>(mode));
|
||||
}
|
||||
|
||||
bool tt_hal_gpio_get_level(GpioPin pin) {
|
||||
return gpio::getLevel(pin);
|
||||
}
|
||||
|
||||
bool tt_hal_gpio_set_level(GpioPin pin, bool level) {
|
||||
return gpio::setLevel(pin, level);
|
||||
}
|
||||
|
||||
int tt_hal_gpio_get_pin_count() {
|
||||
return gpio::getPinCount();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "tt_hal_i2c.h"
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
bool tt_hal_i2c_start(i2c_port_t port) {
|
||||
return tt::hal::i2c::start(port);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_stop(i2c_port_t port) {
|
||||
return tt::hal::i2c::stop(port);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_is_started(i2c_port_t port) {
|
||||
return tt::hal::i2c::isStarted(port);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_read(i2c_port_t port, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterRead(port, address, data, dataSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_read_register(i2c_port_t port, uint8_t address, uint8_t reg, uint8_t* data, size_t dataSize, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterReadRegister(port, address, reg, data, dataSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_write(i2c_port_t port, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterWrite(port, address, data, dataSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_write_register(i2c_port_t port, uint8_t address, uint8_t reg, const uint8_t* data, uint16_t dataSize, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterWriteRegister(port, address, reg, data, dataSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_write_read(i2c_port_t port, uint8_t address, const uint8_t* writeData, size_t writeDataSize, uint8_t* readData, size_t readDataSize, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterWriteRead(port, address, writeData, writeDataSize, readData, readDataSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_master_has_device_at_address(i2c_port_t port, uint8_t address, TickType_t timeout) {
|
||||
return tt::hal::i2c::masterHasDeviceAtAddress(port, address, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_i2c_lock(i2c_port_t port, TickType_t timeout) {
|
||||
return tt::hal::i2c::getLock(port).lock(timeout);
|
||||
}
|
||||
|
||||
void tt_hal_i2c_unlock(i2c_port_t port) {
|
||||
tt::hal::i2c::getLock(port).unlock();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "tt_hal.h"
|
||||
#include "tt_hal_device.h"
|
||||
#include "tt_hal_display.h"
|
||||
#include "tt_hal_gpio.h"
|
||||
#include "tt_hal_i2c.h"
|
||||
#include "tt_hal_touch.h"
|
||||
#include "tt_hal_uart.h"
|
||||
#include <tt_lock.h>
|
||||
@@ -219,23 +217,6 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_hal_display_driver_lock),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_display_driver_unlock),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_display_driver_supported),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_configure),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_configure_with_pin_bitmask),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_set_mode),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_get_level),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_set_level),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_gpio_get_pin_count),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_start),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_stop),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_is_started),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_read),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_read_register),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write_register),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_write_read),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_has_device_at_address),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_lock),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_unlock),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_touch_driver_supported),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_touch_driver_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_touch_driver_free),
|
||||
|
||||
Reference in New Issue
Block a user