WIP. send a large constant string twice a second, in order to test out the transport with something indicative of our required load.
Dependencies: FXOS8700CQ NTPClient azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip
Fork of FXOS8700CQ_To_Azure_IoT by
SingletonFXOS8700CQ.cpp@7:0d1a0fe537dc, 2017-01-05 (annotated)
- Committer:
- julianhigginson
- Date:
- Thu Jan 05 23:40:24 2017 +0000
- Revision:
- 7:0d1a0fe537dc
- Parent:
- 0:6c46c366f500
modified dummy message for minimal data transport
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
markrad | 0:6c46c366f500 | 1 | // Copyright (c) Microsoft. All rights reserved. |
markrad | 0:6c46c366f500 | 2 | // Licensed under the MIT license. See LICENSE file at https://github.com/Azure/azure-iot-sdks/blob/master/LICENSE for full license information. |
markrad | 0:6c46c366f500 | 3 | |
markrad | 0:6c46c366f500 | 4 | #include "SingletonFXOS8700CQ.h" |
markrad | 0:6c46c366f500 | 5 | |
markrad | 0:6c46c366f500 | 6 | SingletonFXOS8700CQ::SingletonFXOS8700CQ(PinName sda, PinName scl, int addr) : |
markrad | 0:6c46c366f500 | 7 | fxos(sda, scl, addr), |
markrad | 0:6c46c366f500 | 8 | fxos_int1(PTC6), |
markrad | 0:6c46c366f500 | 9 | fxos_int2(PTC13) |
markrad | 0:6c46c366f500 | 10 | { |
markrad | 0:6c46c366f500 | 11 | fxos_int2.fall(&trigger_fxos_int2); |
markrad | 0:6c46c366f500 | 12 | } |
markrad | 0:6c46c366f500 | 13 | |
markrad | 0:6c46c366f500 | 14 | uint8_t SingletonFXOS8700CQ::getData(READING &reading) |
markrad | 0:6c46c366f500 | 15 | { |
markrad | 0:6c46c366f500 | 16 | SRAWDATA accel_data; |
markrad | 0:6c46c366f500 | 17 | SRAWDATA magn_data; |
markrad | 0:6c46c366f500 | 18 | |
markrad | 0:6c46c366f500 | 19 | memset(&reading, 0, sizeof(reading)); |
markrad | 0:6c46c366f500 | 20 | |
markrad | 0:6c46c366f500 | 21 | uint8_t rc = fxos.get_data(&accel_data, &magn_data); |
markrad | 0:6c46c366f500 | 22 | |
markrad | 0:6c46c366f500 | 23 | if (rc == 0) |
markrad | 0:6c46c366f500 | 24 | { |
markrad | 0:6c46c366f500 | 25 | reading.accelerometer.x = accel_data.x; |
markrad | 0:6c46c366f500 | 26 | reading.accelerometer.y = accel_data.y; |
markrad | 0:6c46c366f500 | 27 | reading.accelerometer.z = accel_data.z; |
markrad | 0:6c46c366f500 | 28 | reading.magnometer.x = magn_data.x; |
markrad | 0:6c46c366f500 | 29 | reading.magnometer.y = magn_data.y; |
markrad | 0:6c46c366f500 | 30 | reading.magnometer.z = magn_data.z; |
markrad | 0:6c46c366f500 | 31 | } |
markrad | 0:6c46c366f500 | 32 | |
markrad | 0:6c46c366f500 | 33 | return rc; |
markrad | 0:6c46c366f500 | 34 | } |