UoS³ Flight Computer Firmware
 All Data Structures Files Functions Groups Pages
temperature_sensors.c
Go to the documentation of this file.
1 
11 #include "board.h"
12 #include "../i2c.h"
13 
14 #include "../temperature_sensors.h"
15 
17 {
18  // radio amplifier temperature slave address 1001 000 (to 1001 111) depending on pins
19  // register with temp data is 00, others are configuration, hysteresis, overtemperature shutdown, tilde (sampling rate) and temp conversion
20  // temp is 2 byte, MSB then LSB, 2s complement. each is .125C bottom 5 bits ignored
21  // to read 1. scl sda free, send slave address, pointer ,write bit
22  // then read slave address, then receive 2 bytes
23 
24  const unsigned char pct2075_address=0x49; // %1001000;
25  int16_t data = (int16_t)(I2CReceive16(I2C_TEMP, pct2075_address, 0)>>5); // for temp in C divide by 8 - bottom 5 bits worthless
26  return data;
27 }
28 
30 {
31  // radio amplifier temperature slave address 1001 000 (or 1001001 or 1001010) depending on pins
32  // register with temp data is 00, others are configuration, tlow and thigh
33  // temp is 2 byte, MSB then LSB, 2s complement. each is .125C bottom 5 bits ignored
34  // to read 1. scl sda free, send slave address, pointer ,write bit
35  // then read slave address, then receive 2 bytes
36 
37  const unsigned char tmp100_address=0x48; // %1001000;
38  int16_t data = (int16_t)(I2CReceive16(I2C_TEMP, tmp100_address, 0)>>5); // for temp in C divide by 8 - bottom 5 bits worthless
39  return data;
40 }
int16_t Temperature_read_pct2075(void)
int16_t Temperature_read_tmp100(void)