From 1b2249c6272772a27683d652689a3dd0f7cca7b2 Mon Sep 17 00:00:00 2001 From: Nick Wright Date: Tue, 5 Mar 2019 15:58:11 -0500 Subject: [PATCH] Fixing MCC 118 comms issue. --- lib/mcc118.c | 5 +++-- version_history.txt | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/mcc118.c b/lib/mcc118.c index 1a8097e..bd60902 100644 --- a/lib/mcc118.c +++ b/lib/mcc118.c @@ -204,7 +204,7 @@ static const char* const spi_device = SPI_DEVICE_0; // the spidev device static const uint8_t spi_mode = SPI_MODE_1; // use mode 1 (CPOL=0, // CPHA=1) static const uint8_t spi_bits = 8; // 8 bits per transfer -static const uint32_t spi_speed = 10000000; // maximum SPI clock +static const uint32_t spi_speed = 9600000; // maximum SPI clock // frequency static const uint16_t spi_delay = 0; // delay in us before // removing CS @@ -929,6 +929,7 @@ static void* _scan_thread(void* arg) } #define MIN_SLEEP_US 200 +#define TRIG_SLEEP_US 1000 done = false; sleep_us = MIN_SLEEP_US; @@ -957,7 +958,7 @@ static void* _scan_thread(void* arg) else if (info->triggered == 0) { // waiting for trigger, use a longer sleep time - sleep_us = 5000; + sleep_us = TRIG_SLEEP_US; } else { diff --git a/version_history.txt b/version_history.txt index 5821408..5cfbaba 100644 --- a/version_history.txt +++ b/version_history.txt @@ -1,5 +1,8 @@ -1.1.0.2: Fixed an issue with high CPU usage when waiting for a trigger on the +1.1.0.2: + - Fixed an issue with high CPU usage when waiting for a trigger on the MCC 118 - updated both library and trigger examples. + - Lowered the max SPI clock rate for the MCC 118 to fix communications + issues on some systems. 1.1.0.1: Fixed an issue with resource conflicts when using multiple threads in the same process (such as using multiple MCC 118s.)