unPhone implementation and more (#169)
- Implemented [unPhone](https://unphone.net/) v9 board - Updated `.clang-format` to better reflect the intended code style - Fix SD card compatibility issues for all boards (frequency wasn't set well) - Moved `I2cDevice` class from CoreS3 board project to TactilityHeadless project - Tactility configuration now has default empty lists for apps and services fields - Fix for Launcher app: we don't need padding when showing it vertically - Fix for I2cDevice read/write calls that checked for `esp_err_t` instead of `bool` - Fix for TinyUSB init that checked for `esp_err_t` instead of `bool`
This commit is contained in:
committed by
GitHub
parent
3ea02d912f
commit
72230129bb
@@ -1,5 +1,5 @@
|
||||
idf_component_register(
|
||||
SRC_DIRS "Source" "Source/hal" "Source/Axp2101" "Source/Aw9523" "Source/I2cDevice"
|
||||
SRC_DIRS "Source" "Source/hal" "Source/Axp2101" "Source/Aw9523"
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd esp_lcd_ili9341 esp_lcd_touch_ft5x06 driver vfs fatfs
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "I2cDevice/I2cDevice.h"
|
||||
#include "hal/i2c/I2cDevice.h"
|
||||
|
||||
#define AW9523_ADDRESS 0x58
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "hal/i2c/I2c.h"
|
||||
#include "I2cDevice/I2cDevice.h"
|
||||
#include "hal/i2c/I2cDevice.h"
|
||||
|
||||
#define AXP2101_ADDRESS 0x34
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#include "I2cDevice.h"
|
||||
|
||||
bool I2cDevice::readRegister12(uint8_t reg, float& out) const {
|
||||
std::uint8_t data[2] = {0};
|
||||
if (tt::hal::i2c::masterReadRegister(port, address, reg, data, 2, DEFAULT_TIMEOUT) == ESP_OK) {
|
||||
out = (data[0] & 0x0F) << 8 | data[1];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool I2cDevice::readRegister14(uint8_t reg, float& out) const {
|
||||
std::uint8_t data[2] = {0};
|
||||
if (tt::hal::i2c::masterReadRegister(port, address, reg, data, 2, DEFAULT_TIMEOUT) == ESP_OK) {
|
||||
out = (data[0] & 0x3F) << 8 | data[1];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool I2cDevice::readRegister16(uint8_t reg, uint16_t& out) const {
|
||||
std::uint8_t data[2] = {0};
|
||||
if (tt::hal::i2c::masterReadRegister(port, address, reg, data, 2, DEFAULT_TIMEOUT) == ESP_OK) {
|
||||
out = data[0] << 8 | data[1];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool I2cDevice::readRegister8(uint8_t reg, uint8_t& result) const {
|
||||
return tt::hal::i2c::masterWriteRead(port, address, ®, 1, &result, 1, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
bool I2cDevice::writeRegister8(uint8_t reg, uint8_t value) const {
|
||||
return tt::hal::i2c::masterWriteRegister(port, address, reg, &value, 1, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
bool I2cDevice::bitOn(uint8_t reg, uint8_t bitmask) const {
|
||||
uint8_t state;
|
||||
if (readRegister8(reg, state)) {
|
||||
state |= bitmask;
|
||||
return writeRegister8(reg, state);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool I2cDevice::bitOff(uint8_t reg, uint8_t bitmask) const {
|
||||
uint8_t state;
|
||||
if (readRegister8(reg, state)) {
|
||||
state &= ~bitmask;
|
||||
return writeRegister8(reg, state);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "hal/i2c/I2c.h"
|
||||
|
||||
class I2cDevice {
|
||||
|
||||
protected:
|
||||
|
||||
i2c_port_t port;
|
||||
uint8_t address;
|
||||
|
||||
static constexpr TickType_t DEFAULT_TIMEOUT = 1000 / portTICK_PERIOD_MS;
|
||||
|
||||
bool readRegister8(uint8_t reg, uint8_t& result) const;
|
||||
bool writeRegister8(uint8_t reg, uint8_t value) const;
|
||||
bool readRegister12(uint8_t reg, float& out) const;
|
||||
bool readRegister14(uint8_t reg, float& out) const;
|
||||
bool readRegister16(uint8_t reg, uint16_t& out) const;
|
||||
bool bitOn(uint8_t reg, uint8_t bitmask) const;
|
||||
bool bitOff(uint8_t reg, uint8_t bitmask) const;
|
||||
|
||||
public:
|
||||
|
||||
explicit I2cDevice(i2c_port_t port, uint32_t address) : port(port), address(address) {}
|
||||
};
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <esp_vfs_fat.h>
|
||||
|
||||
#define CORES3_SDCARD_SPI_FREQUENCY 800000U
|
||||
#define CORES3_SDCARD_SPI_FREQUENCY 20000000U
|
||||
#define CORES3_SDCARD_PIN_CS GPIO_NUM_4
|
||||
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user