revert mission timer to 32 bit, add signal level monitoring
This commit is contained in:
@@ -26,7 +26,7 @@ void mcp3550_spi_init()
|
||||
// .queue_size = 1,
|
||||
// };
|
||||
|
||||
// ESP_ERROR_CHECK(spi_bus_add_device(SPI2_HOST, &devcfg, &mcp3550_handle));
|
||||
// ESP_ERROR_CHECK_WITHOUT_ABORT(spi_bus_add_device(SPI2_HOST, &devcfg, &mcp3550_handle));
|
||||
|
||||
// Set MISO pin for input (needed for polling)
|
||||
gpio_set_direction(MCP3550_MISO_GPIO, GPIO_MODE_INPUT);
|
||||
@@ -132,9 +132,13 @@ int32_t mcp3550_read(uint8_t cs_pin)
|
||||
int64_t start = esp_timer_get_time();
|
||||
uint32_t timeout_us = MCP3550_TIMEOUT_MS * 1000;
|
||||
|
||||
ESP_LOGI(TAG_MCP, "Starting read from ADC CS %d", cs_pin);
|
||||
|
||||
// CS LOW
|
||||
mcp23018_set_pin(MCP23018_DEV_HANDLE, cs_pin, 0);
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
// Wait for DR (MISO LOW)
|
||||
while (gpio_get_level(MCP3550_MISO_GPIO)) {
|
||||
if ((esp_timer_get_time() - start) > timeout_us) {
|
||||
|
Reference in New Issue
Block a user