re enable interrupt logic for ADC drdy
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
RadoMmm for suggesting an improvement on the ADC-to-Volts conversion
|
RadoMmm for suggesting an improvement on the ADC-to-Volts conversion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DEBUGLOG_DEFAULT_LOG_LEVEL_DEBUG
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "ADS1256.h"
|
#include "ADS1256.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
@@ -62,16 +64,16 @@ ADS1256::ADS1256(const int8_t DRDY_pin, const int8_t RESET_pin, const int8_t SYN
|
|||||||
|
|
||||||
updateConversionParameter();
|
updateConversionParameter();
|
||||||
|
|
||||||
// m_drdyHigh = xSemaphoreCreateBinary();
|
m_drdyHigh = xSemaphoreCreateBinary();
|
||||||
// m_drdyLow = xSemaphoreCreateBinary();
|
m_drdyLow = xSemaphoreCreateBinary();
|
||||||
// if (!m_drdyHigh || !m_drdyLow) {
|
if (!m_drdyHigh || !m_drdyLow) {
|
||||||
// LOG_ERROR("ADC Unable to create interrupt semaphores");
|
LOG_ERROR("ADC Unable to create interrupt semaphores");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// xSemaphoreGive(m_drdyHigh);
|
xSemaphoreGive(m_drdyHigh);
|
||||||
// xSemaphoreGive(m_drdyLow);
|
xSemaphoreGive(m_drdyLow);
|
||||||
//attachInterruptArg(DRDY_pin, drdyCallback, (void *)this, CHANGE);
|
attachInterruptArg(DRDY_pin, drdyCallback, (void *)this, CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
@@ -125,16 +127,16 @@ void ADS1256::InitializeADC()
|
|||||||
|
|
||||||
void ADS1256::waitForLowDRDY()
|
void ADS1256::waitForLowDRDY()
|
||||||
{
|
{
|
||||||
while(digitalRead(m_DRDY_pin) == HIGH) {vTaskDelay(1);};
|
// while(digitalRead(m_DRDY_pin) == HIGH) {vTaskDelay(1);};
|
||||||
// xSemaphoreTake(m_drdyLow, pdMS_TO_TICKS(10));
|
xSemaphoreTake(m_drdyLow, pdMS_TO_TICKS(10));
|
||||||
// xSemaphoreGive(m_drdyLow);
|
xSemaphoreGive(m_drdyLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADS1256::waitForHighDRDY()
|
void ADS1256::waitForHighDRDY()
|
||||||
{
|
{
|
||||||
while(digitalRead(m_DRDY_pin) == LOW) {vTaskDelay(1);};
|
// while(digitalRead(m_DRDY_pin) == LOW) {vTaskDelay(1);};
|
||||||
// xSemaphoreTake(m_drdyHigh, pdMS_TO_TICKS(10));
|
xSemaphoreTake(m_drdyHigh, pdMS_TO_TICKS(10));
|
||||||
// xSemaphoreGive(m_drdyHigh);
|
xSemaphoreGive(m_drdyHigh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADS1256::stopConversion() // Sending SDATAC to stop the continuous conversion
|
void ADS1256::stopConversion() // Sending SDATAC to stop the continuous conversion
|
||||||
|
|||||||
Reference in New Issue
Block a user