diff --git a/slave/slave/config.h b/slave/slave/config.h
--- a/slave/slave/config.h
+++ b/slave/slave/config.h
@@ -34,8 +34,9 @@
//I2C Addresses
#define EEPROM_ADDR 0xA0 // Read 0xA1 - Write 0xA0
#define BOARDTEMP_ADDR 0x90 // Read 0x91 - Write 0x90
- #define PRESSURE_ADDR 0xB1 //THIS VALUE IS WRONG
- #define HUMID_ADDR 0xB4 //THIS VALUE IS WRONG
+ #define PRESSURE_ADDR 0xEF // Read 0xEF - Write 0xEE
+ #define HUMID_ADDR 0x27 // Read 0x27 - Write 0x26
+ #define LIGHT_ADDR 0x95 // Read 0x95 - Write 0x94
#define RTC_ADDR 0xB2 //DEBUG [Used for testing] // Read 0xA3 - Write 0xA2
diff --git a/slave/slave/lib/sensors.c b/slave/slave/lib/sensors.c
--- a/slave/slave/lib/sensors.c
+++ b/slave/slave/lib/sensors.c
@@ -17,6 +17,9 @@
int16_t spiTemp; // Thermocouple Temperature (from spi)
int8_t boardTemp; // Board Temperature (from i2c)
+uint16_t pressure; // Pressure (from i2c)
+//int humid; // Humidity (from i2c)
+uint8_t light; // Lux reading (from i2c)
void sensors_readSpiTemp()
@@ -52,6 +55,33 @@ void sensors_readBoardTemp()
boardTemp = boardTemp - 3; // Linear offset
}
+void sensors_readPressure()
+{//needs editing
+ pressure = i2c_read(PRESSURE_ADDR, 0xF6);
+ pressure = pressure << 8;
+ pressure = pressure | i2c_read(PRESSURE_ADDR, 0xF7);
+}
+
+void sensors_readHumid()
+{
+ //humid = i2c_read(HUMID_ADDR, 0xXX);
+}
+
+void sensors_readLight()
+{
+ light = i2c_read(LIGHT_ADDR, 0x03);
+ // light = light << 4;
+ // light = light | (0x0F & i2c_read(LIGHT_ADDR, 0x04)); // This can be used to read in the 4 LSBs from the second register
+ // FOR FIRST BYTE:
+ // Lux = 2^(exponent)*mantissa*0.72
+ // exponent = 8xE3 + 4xE2 + 2xE1 + E0
+ // mantissa = 8xM7 + 4xM6 + 2xM5 + M4
+ // FOR BOTH BYTES:
+ // Lux = 2^(exponent)*mantissa*0.045
+ // exponent = 8xE3 + 4xE2 + 2xE1 + E0
+ // mantissa = 128xM7 + 64xM6 + 32xM5 + 16xM4 + 8xM3 + 4xM2 + 2xM1 + M0
+}
+
int16_t sensors_getSpiTemp(void) // Gets spi temperature from variable
{
return spiTemp;
@@ -62,3 +92,17 @@ int8_t sensors_getBoardTemp(void) // Get
return boardTemp;
}
+uint16_t sensors_getPressure(void)
+{
+ return pressure;
+}
+
+//int sensors_getHumid(void)
+//{
+ //return humid;
+//}
+
+uint8_t sensors_getLight(void)
+{
+ return light;
+}
\ No newline at end of file
diff --git a/slave/slave/lib/sensors.h b/slave/slave/lib/sensors.h
--- a/slave/slave/lib/sensors.h
+++ b/slave/slave/lib/sensors.h
@@ -12,8 +12,14 @@
void sensors_readSpiTemp(void); // Reads spi temperature
void sensors_readBoardTemp(void); // Reads board temperature
+void sensors_readPressure(void); // Reads pressure
+void sensors_readHumid(void); // Reads humidity
+void sensors_readLight(void); // Reads lux
int16_t sensors_getSpiTemp(void); // Gets spi temperature from variable
int8_t sensors_getBoardTemp(void); // Gets board temperature from variable
+uint16_t sensors_getPressure(void); // Gets pressure from variable
+//int sensors_getHumid(void); // Gets humidity from variable
+uint8_t sensors_getLight(void); // Gets lux from variable
#endif /* SENSORS_H_ */
\ No newline at end of file
diff --git a/slave/slave/slave.cproj b/slave/slave/slave.cproj
--- a/slave/slave/slave.cproj
+++ b/slave/slave/slave.cproj
@@ -20,7 +20,7 @@
false
0
- 3.1.3
+ 2.11.1
ISP
com.atmel.avrdbg.tool.ispmk2