Skip to content

Commit 01e4243

Browse files
Fixes
1 parent 5bdbdd6 commit 01e4243

File tree

8 files changed

+21
-23
lines changed

8 files changed

+21
-23
lines changed

Devices/m5stack-tab5/Source/Configuration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "devices/Display.h"
22
#include "devices/SdCard.h"
3+
#include <driver/gpio.h>
34

45
#include <Tactility/hal/Configuration.h>
56

Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
pin-scl-pullup;
2525
};
2626

27-
uart0 {
27+
uart1 {
2828
compatible = "espressif,esp32-uart";
2929
port = <UART_NUM_1>;
3030
pin-tx = <43>;

Platforms/PlatformEsp32/Source/drivers/esp32_i2s.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@
1414

1515
#define TAG "esp32_i2s"
1616

17-
struct Esp32SpiInternal {
17+
struct Esp32I2sInternal {
1818
Mutex mutex {};
1919
i2s_chan_handle_t tx_handle = nullptr;
2020
i2s_chan_handle_t rx_handle = nullptr;
2121
I2sConfig config {};
2222
bool config_set = false;
2323

24-
Esp32SpiInternal() {
24+
Esp32I2sInternal() {
2525
mutex_construct(&mutex);
2626
}
2727

28-
~Esp32SpiInternal() {
28+
~Esp32I2sInternal() {
2929
mutex_destruct(&mutex);
3030
}
3131
};
3232

3333
#define GET_CONFIG(device) ((Esp32I2sConfig*)device->config)
34-
#define GET_DATA(device) ((Esp32SpiInternal*)device_get_driver_data(device))
34+
#define GET_DATA(device) ((Esp32I2sInternal*)device_get_driver_data(device))
3535

3636
#define lock(data) mutex_lock(&data->mutex);
3737
#define unlock(data) mutex_unlock(&data->mutex);
3838

3939
extern "C" {
4040

41-
static error_t cleanup_channel_handles(Esp32SpiInternal* driver_data) {
41+
static error_t cleanup_channel_handles(Esp32I2sInternal* driver_data) {
4242
// TODO: error handling of i2ss functions
4343
if (driver_data->tx_handle) {
4444
i2s_channel_disable(driver_data->tx_handle);
@@ -188,7 +188,7 @@ static error_t get_config(Device* device, struct I2sConfig* config) {
188188

189189
static error_t start(Device* device) {
190190
ESP_LOGI(TAG, "start %s", device->name);
191-
auto* data = new(std::nothrow) Esp32SpiInternal();
191+
auto* data = new(std::nothrow) Esp32I2sInternal();
192192
if (!data) return ERROR_OUT_OF_MEMORY;
193193

194194
device_set_driver_data(device, data);

Platforms/PlatformEsp32/Source/drivers/esp32_spi.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@ static error_t start(Device* device) {
5353
auto* data = new(std::nothrow) Esp32SpiInternal();
5454
if (!data) return ERROR_OUT_OF_MEMORY;
5555

56-
data->initialized = false;
56+
if (data->initialized) {
57+
return ERROR_INVALID_STATE;
58+
}
59+
5760
device_set_driver_data(device, data);
5861

5962
auto* dts_config = GET_CONFIG(device);
6063

61-
if (data->initialized) {
62-
spi_bus_free(dts_config->host);
63-
data->initialized = false;
64-
}
65-
6664
spi_bus_config_t buscfg = {
6765
.mosi_io_num = dts_config->pin_mosi,
6866
.miso_io_num = dts_config->pin_miso,
@@ -73,7 +71,11 @@ static error_t start(Device* device) {
7371
.data5_io_num = GPIO_NUM_NC,
7472
.data6_io_num = GPIO_NUM_NC,
7573
.data7_io_num = GPIO_NUM_NC,
74+
.data_io_default_level = false,
7675
.max_transfer_sz = dts_config->max_transfer_sz,
76+
.flags = 0,
77+
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
78+
.intr_flags = 0
7779
};
7880

7981
esp_err_t ret = spi_bus_initialize(dts_config->host, &buscfg, SPI_DMA_CH_AUTO);

Tactility/Private/Tactility/hal/gps/Ublox.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ void checksum(uint8_t* message, size_t length);
1414
// From https://github.com/meshtastic/firmware/blob/7648391f91f2b84e367ae2b38220b30936fb45b1/src/gps/GPS.cpp#L128
1515
uint8_t makePacket(uint8_t classId, uint8_t messageId, const uint8_t* payload, uint8_t payloadSize, uint8_t* bufferOut);
1616

17-
template<size_t DataSize>
18-
inline void sendPacket(::Device* uart, uint8_t type, uint8_t id, uint8_t data[DataSize], const char* errorMessage, uint32_t timeout) {
19-
static uint8_t buffer[250] = {0};
20-
size_t length = makePacket(type, id, data, DataSize, buffer);
21-
// hal::uart::writeBytes(port, buffer, length);
22-
}
23-
2417
GpsModel probe(::Device* uart);
2518

2619
bool init(::Device* uart, GpsModel model);

Tactility/Source/hal/gps/GpsInit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ GpsResponse getACKCas(::Device* uart, uint8_t class_id, uint8_t msg_id, uint32_t
8181
uint32_t startTime = kernel::getMillis();
8282
uint8_t buffer[CAS_ACK_NACK_MSG_SIZE] = {0};
8383
uint8_t bufferPos = 0;
84+
TickType_t waitTicks = pdMS_TO_TICKS(waitMillis);
8485

8586
// CAS-ACK-(N)ACK structure
8687
// | H1 | H2 | Payload Len | cls | msg | Payload | Checksum (4) |
@@ -89,7 +90,7 @@ GpsResponse getACKCas(::Device* uart, uint8_t class_id, uint8_t msg_id, uint32_t
8990
// ACK-NACK| 0xBA | 0xCE | 0x04 | 0x00 | 0x05 | 0x00 | 0xXX | 0xXX | 0x00 | 0x00 | 0xXX | 0xXX | 0xXX | 0xXX |
9091
// ACK-ACK | 0xBA | 0xCE | 0x04 | 0x00 | 0x05 | 0x01 | 0xXX | 0xXX | 0x00 | 0x00 | 0xXX | 0xXX | 0xXX | 0xXX |
9192

92-
while (kernel::getTicks() - startTime < waitMillis) {
93+
while (kernel::getTicks() - startTime < waitTicks) {
9394
size_t available = 0;
9495
uart_controller_get_available(uart, &available);
9596
if (available > 0) {

Tactility/Source/hal/gps/Ublox.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ GpsResponse getAck(::Device* uart, uint8_t class_id, uint8_t msg_id, uint32_t wa
6464
const uint8_t ackP[2] = {class_id, msg_id};
6565
uint8_t buf[10] = {0xB5, 0x62, 0x05, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
6666
uint32_t startTime = kernel::getMillis();
67+
TickType_t waitTicks = pdMS_TO_TICKS(waitMillis);
6768
const char frame_errors[] = "More than 100 frame errors";
6869
int sCounter = 0;
6970
#ifdef GPS_DEBUG
@@ -81,7 +82,7 @@ GpsResponse getAck(::Device* uart, uint8_t class_id, uint8_t msg_id, uint32_t wa
8182
buf[9] += buf[8];
8283
}
8384

84-
while (kernel::getTicks() - startTime < waitMillis) {
85+
while (kernel::getTicks() - startTime < waitTicks) {
8586
if (ack > 9) {
8687
#ifdef GPS_DEBUG
8788
LOGGER.info("Got ACK for class {:02X} message {:02X} in {}ms", class_id, msg_id, kernel::getMillis() - startTime);

TactilityKernel/Include/tactility/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct Device {
4646
/**
4747
* Holds a device pointer and a compatible string.
4848
* The device must not be constructed, added or started yet.
49-
* This is used by the devicetree code generator and the application init sequence::.
49+
* This is used by the devicetree code generator and the application init sequence.
5050
*/
5151
struct CompatibleDevice {
5252
struct Device* device;

0 commit comments

Comments
 (0)