|
@@ -19,6 +19,7 @@ bool unitemp_LM75_alloc(Sensor* sensor) {
|
|
|
sensor->initializer = unitemp_LM75_init;
|
|
sensor->initializer = unitemp_LM75_init;
|
|
|
sensor->deinitializer = unitemp_LM75_deinit;
|
|
sensor->deinitializer = unitemp_LM75_deinit;
|
|
|
sensor->updater = unitemp_LM75_update;
|
|
sensor->updater = unitemp_LM75_update;
|
|
|
|
|
+ sensor->memoryfree = unitemp_LM75_free;
|
|
|
sensor->pollingInterval = 1000;
|
|
sensor->pollingInterval = 1000;
|
|
|
|
|
|
|
|
//Адреса на шине I2C (7 бит)
|
|
//Адреса на шине I2C (7 бит)
|
|
@@ -26,6 +27,10 @@ bool unitemp_LM75_alloc(Sensor* sensor) {
|
|
|
i2c_sensor->maxI2CAdr = 0b1001111;
|
|
i2c_sensor->maxI2CAdr = 0b1001111;
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+void unitemp_LM75_free(void* s) {
|
|
|
|
|
+ //Нечего высвобождать, так как ничего не было выделено
|
|
|
|
|
+ UNUSED(s);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
bool unitemp_LM75_init(void* s) {
|
|
bool unitemp_LM75_init(void* s) {
|
|
|
Sensor* sensor = (Sensor*)s;
|
|
Sensor* sensor = (Sensor*)s;
|
|
@@ -43,8 +48,6 @@ bool unitemp_LM75_deinit(void* s) {
|
|
|
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
|
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
|
|
if(!writeReg(i2c_sensor, LM75_REG_CONFIG, LM75_CONFIG_FAULTQUEUE_1 | LM75_CONFIG_SHUTDOWN))
|
|
if(!writeReg(i2c_sensor, LM75_REG_CONFIG, LM75_CONFIG_FAULTQUEUE_1 | LM75_CONFIG_SHUTDOWN))
|
|
|
return false;
|
|
return false;
|
|
|
- UNUSED(sensor);
|
|
|
|
|
- UNUSED(i2c_sensor);
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -62,7 +65,5 @@ UnitempStatus unitemp_LM75_update(void* s) {
|
|
|
}
|
|
}
|
|
|
sensor->temp = (float)raw / 2.0f;
|
|
sensor->temp = (float)raw / 2.0f;
|
|
|
|
|
|
|
|
- FURI_LOG_D(APP_NAME, "Sensor %s updated %f", sensor->name, (double)raw / (double)2.0);
|
|
|
|
|
-
|
|
|
|
|
return UT_OK;
|
|
return UT_OK;
|
|
|
}
|
|
}
|