Files
@ 9030f018bc25
Branch filter:
Location: therm-ng/src/tempsense.c - annotation
9030f018bc25
1.1 KiB
text/plain
Work on minor graphics stuff, fix temp sensor type setting issue
2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 12de82b953bd 12de82b953bd 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 12de82b953bd 12de82b953bd 12de82b953bd 12de82b953bd f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da f602474ad6c6 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 f602474ad6c6 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da 2b4eb31dd8da | //
// TempSense: read temperature from TC, RTD, or NTC
//
#include "tempsense.h"
#include "flash.h"
#include "ssd1306/ssd1306.h"
#include "max31856/max31856.h"
void tempsense_init(void)
{
// TODO: Rework SPI stuff... init the port in a sharedlib then pass ref to display and tempsense
max31856_init(spi_get(), TEMPSENSE_MAX_CS_PORT, TEMPSENSE_MAX_CS_PIN, 0);
// Maybe don't perform temp sensor setup in here, but in readtemp?
// what happens if the user changes the tempsense type while running?
// we need to re-init...
}
// Returns the latest reading from the configured temperature sensor
float tempsense_readtemp(void)
{
switch(flash_getsettings()->val.sensor_type)
{
case SENSOR_TC_K:
case SENSOR_TC_E:
case SENSOR_TC_N:
case SENSOR_TC_R:
case SENSOR_TC_S:
case SENSOR_TC_T:
{
// Read MAX31856
} break;
case SENSOR_NTC:
{
// Read analog value from internal ADC, linearize the reading, etc
} break;
}
// either return latest reading from DMA loop (NTC, etc)
// or initiate a blocking read and return it.
// Need to gracefully handle the timeout...
}
|