blob: f243f2594749fe18670be5e2d847f44ba5e0c172 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* SpiTemperatureSensor.h
*
* Created on: 8 Jun 2017
* Author: David
*/
#ifndef SRC_HEATING_SPITEMPERATURESENSOR_H_
#define SRC_HEATING_SPITEMPERATURESENSOR_H_
#include "SensorWithPort.h"
#include "SharedSpi.h" // for sspi_device
class SpiTemperatureSensor : public SensorWithPort
{
protected:
SpiTemperatureSensor(unsigned int sensorNum, const char *name, uint8_t spiMode, uint32_t clockFrequency) noexcept;
bool ConfigurePort(GCodeBuffer& gb, const StringRef& reply, bool& seen);
void InitSpi() noexcept;
TemperatureError DoSpiTransaction(const uint8_t dataOut[], size_t nbytes, uint32_t& rslt) const noexcept
pre(nbytes <= 8);
sspi_device device;
uint32_t lastReadingTime;
float lastTemperature;
TemperatureError lastResult;
};
#endif /* SRC_HEATING_SPITEMPERATURESENSOR_H_ */
|