-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensor.cpp
43 lines (39 loc) · 1002 Bytes
/
sensor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//#include "sensor.h"
/*
// set sensor indicator (on PIO_A)
void Sensor::setSensorIndicator(device_t d, uint8_t indval) {
#ifdef SERIAL_DEBUGXX
Serial.print("setting indicator:");
Serial.println(indval);
#endif
//#define PIO_A 0
//#define PIO_B 1
//d.port is the sensor read port
//indicator port is the other one ??
uint8_t indicator_port = d.port ? 0 : 1;
#ifdef SERIAL_DEBUGXX
Serial.print("setSensorIndicator:prot=");
Serial.print(d.port);
Serial.print(" indicator port=");
Serial.println(indicator_port);
#endif
p_ow->writePIOtest(d.dev_rom, indicator_port, indval); //WRITE TO PIO-x
}
float Sensor::getLastTemperature() {
return last_temp;
}
char* Sensor::romFormat(char *buf, uint8_t rom[]) {
char *bp = buf;
int n = 0;
for(int i=0;i<8;i++) {
bp = &buf[n];
int rb = rom[i];
if(rb<16) *bp++='0';
itoa((int)rb, bp, 16);
n+=2;
buf[n++]='-';
}
buf[n-1]=0;
return buf;
}
*/