# addr type [other data]
0x23 (0x01 to 0x1F) (0x00 to 0xFF) [....]
Valid types are :
- - 'a' : all - request to send all available sensor data to host.
+ - 'a' : get all - request to send all available sensor data to host, no data.
- 'l' : set led color - set the sensor led color. Three bytes of data (RGB).
+ - 'c' : get compensation data from BME280 sensor. (TO BE DEFINED)
It is also possible to broadcast a message to all sensors by sending to address
255 (0xFF)
+The response for the "get all" request has the following format :
+ # (addr | sensors) data
+ 0x23 1 byte 18 bytes
+
+The second byte holds the address on the fist 5 bits (LSB), and information on
+available sensors on the three top bits :
+addr | sensors : (0x01 to 0x1F) | (got_tsl << 5) | (got_veml << 6) | (got_bme << 7)
+ got_tsl : Set if TSL256x sensor is present and configured
+ got_veml : Set if VEML6070 sensor is present and configured
+ got_bme : Set if BME280 sensor is present and configured
+
+data is a set of nine 16bits values, in network (big) endian order, with the
+following meaning, in this order :
+ - raw_humidity from soil moisture sensor
+ - lux value from TSL256x
+ - ir value from TSL256x
+ - uv value from VEML6070
+ - pressure from BME280
+ - comp_temp from BME280
+ - humidity from BME280
+ - unused - should be 0 (nul)
+ - unused - should be 0 (nul)
+
+
+The response for the "get compensation data" request has to be defined.
+
+
To set the sensor address using a serial line from a linux host, you can use
these commands (sensor connected to ttyUSB0) :
buff[0] = '#';
buff[1] = address | (got_tsl << 5) | (got_veml << 6) | (got_bme << 7);
- data[1] = (uint16_t)raw_humidity;
- data[2] = (uint16_t)lux;
- data[3] = (uint16_t)ir;
- data[4] = (uint16_t)uv;
- data[5] = (uint16_t)pressure;
- data[6] = (uint16_t)comp_temp;
- data[7] = (uint16_t)humidity;
+ data[1] = (uint16_t)htons(raw_humidity);
+ data[2] = (uint16_t)htons(lux);
+ data[3] = (uint16_t)htons(ir);
+ data[4] = (uint16_t)htons(uv);
+ data[5] = (uint16_t)htons(pressure);
+ data[6] = (uint16_t)htons(comp_temp);
+ data[7] = (uint16_t)htons(humidity);
gpio_clear(tx_en);
serial_write(UART0, buff, 20);