Send data in network endianness
[lpc82x] / apps / exanh / v04 / main.c
index b9b74ff..9d05de8 100644 (file)
@@ -484,13 +484,13 @@ int main(void)
 
                                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);