Explains how to communicate over the SPI bus.
#include <stm32f4xx.h>
#define DS1722_CONFIG_ADDR 0x80
#define DS1722_DEFAULT 0xE0
#define DS1722_1SHOT 0x10
#define DS1722_RES_8BIT 0x00
#define DS1722_RES_9BIT 0x02
#define DS1722_RES_10BIT 0x04
#define DS1722_RES_11BIT 0x06
#define DS1722_RES_12BIT 0x08
#define DS1722_SHUTDOWN (1<<0)
#define DS1722_TEMP_LSB 0x01
#define DS1722_TEMP_MSB 0x02
int main(void) {
uint16_t spiData[2];
uint8_t celsius;
for (;;) {
celsius = ((spiData[1] << 8 | spiData[0]) >> 7) / 2;
}
return 0;
}