Librería para leer temperatura haciendo comunicación SPI con el integrado MAX6675
max6675.h@0:33fb492d139e, 2020-06-08 (annotated)
- Committer:
- cristian_junca
- Date:
- Mon Jun 08 23:18:38 2020 +0000
- Revision:
- 0:33fb492d139e
Read temperatura with SPI communication
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cristian_junca | 0:33fb492d139e | 1 | #ifndef MAX6675_h |
cristian_junca | 0:33fb492d139e | 2 | #define MAX6675_h |
cristian_junca | 0:33fb492d139e | 3 | |
cristian_junca | 0:33fb492d139e | 4 | #include "mbed.h" |
cristian_junca | 0:33fb492d139e | 5 | |
cristian_junca | 0:33fb492d139e | 6 | class max6675 |
cristian_junca | 0:33fb492d139e | 7 | { |
cristian_junca | 0:33fb492d139e | 8 | SPI& spi; |
cristian_junca | 0:33fb492d139e | 9 | DigitalOut ss; |
cristian_junca | 0:33fb492d139e | 10 | public: |
cristian_junca | 0:33fb492d139e | 11 | |
cristian_junca | 0:33fb492d139e | 12 | max6675(SPI& _spi, PinName _ss); |
cristian_junca | 0:33fb492d139e | 13 | |
cristian_junca | 0:33fb492d139e | 14 | void select(); |
cristian_junca | 0:33fb492d139e | 15 | void deselect(); |
cristian_junca | 0:33fb492d139e | 16 | float read_temp(); |
cristian_junca | 0:33fb492d139e | 17 | |
cristian_junca | 0:33fb492d139e | 18 | private: |
cristian_junca | 0:33fb492d139e | 19 | PinName _CS_pin; |
cristian_junca | 0:33fb492d139e | 20 | PinName _SO_pin; |
cristian_junca | 0:33fb492d139e | 21 | PinName _SCK_pin; |
cristian_junca | 0:33fb492d139e | 22 | int _units; |
cristian_junca | 0:33fb492d139e | 23 | float _error; |
cristian_junca | 0:33fb492d139e | 24 | }; |
cristian_junca | 0:33fb492d139e | 25 | |
cristian_junca | 0:33fb492d139e | 26 | #endif |