-
Notifications
You must be signed in to change notification settings - Fork 0
/
max6675.h
38 lines (31 loc) · 1.08 KB
/
max6675.h
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
30
31
32
33
34
35
36
37
38
// this library is public domain. enjoy!
//***************************************************************************
// by iPa 04.10.2010
//***************************************************************************
#ifndef MAX6675_H
#define MAX6675_H
#include "stm32f1xx_hal.h"
#include "stdbool.h"
#define SPI_TIMEOUT 1000
#define FILTER_LVL 0.10
//***************************************************************************
// CLASS MAX6675
//***************************************************************************
class MAX6675 {
public:
MAX6675(SPI_HandleTypeDef *hspi, GPIO_TypeDef* CS_Port, uint16_t CS_Pin);
void initMeasure(void); // Need to call it after all sytem init (/* Initialize all configured peripherals */) !!!
float readCelsius(bool filtered);
float get_celcius(bool filtered) const;
void set_filterLevel(uint8_t level); //0-99
bool get_status(void) const; // TRUE = connected
protected:
float _celcius;
float _cFiltered;
bool _connected;
float _filterLvl;
SPI_HandleTypeDef *_hspi;
GPIO_TypeDef* _CS_Port;
uint16_t _CS_Pin;
};
#endif