mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-22 18:06:40 +00:00
[Nyx] Add init of temperature sensor
This commit is contained in:
parent
2bb0dba724
commit
fed15a2f2f
2 changed files with 18 additions and 0 deletions
|
@ -50,3 +50,16 @@ u16 tmp451_get_pcb_temp(bool intenger)
|
|||
|
||||
return temp;
|
||||
}
|
||||
|
||||
void tmp451_init()
|
||||
{
|
||||
// Disable ALARM.
|
||||
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CONFIG_REG, 0x80);
|
||||
|
||||
// Set conversion rate to 32/s and make a read to update the reg.
|
||||
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CNV_RATE_REG, 9);
|
||||
tmp451_get_soc_temp(false);
|
||||
|
||||
// Set rate to every 4 seconds.
|
||||
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CNV_RATE_REG, 2);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#define TMP451_PCB_TEMP_REG 0x00
|
||||
#define TMP451_SOC_TEMP_REG 0x01
|
||||
|
||||
#define TMP451_CONFIG_REG 0x09
|
||||
#define TMP451_CNV_RATE_REG 0x0A
|
||||
|
||||
#define TMP451_SOC_TMP_DEC_REG 0x10
|
||||
#define TMP451_PCB_TMP_DEC_REG 0x15
|
||||
|
||||
|
@ -33,5 +37,6 @@
|
|||
// Otherwise it's an integer oC.
|
||||
u16 tmp451_get_soc_temp(bool integer);
|
||||
u16 tmp451_get_pcb_temp(bool integer);
|
||||
void tmp451_init();
|
||||
|
||||
#endif /* __TMP451_H_ */
|
||||
|
|
Loading…
Reference in a new issue