![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.h@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 "mbed.h" |
markrad | 0:6c46c366f500 | 5 | #include "FXOS8700CQ.h" |
markrad | 0:6c46c366f500 | 6 | |
markrad | 0:6c46c366f500 | 7 | typedef struct |
markrad | 0:6c46c366f500 | 8 | { |
markrad | 0:6c46c366f500 | 9 | int16_t x; |
markrad | 0:6c46c366f500 | 10 | int16_t y; |
markrad | 0:6c46c366f500 | 11 | int16_t z; |
markrad | 0:6c46c366f500 | 12 | } AXES; |
markrad | 0:6c46c366f500 | 13 | |
markrad | 0:6c46c366f500 | 14 | typedef struct |
markrad | 0:6c46c366f500 | 15 | { |
markrad | 0:6c46c366f500 | 16 | AXES accelerometer; |
markrad | 0:6c46c366f500 | 17 | AXES magnometer; |
markrad | 0:6c46c366f500 | 18 | } READING; |
markrad | 0:6c46c366f500 | 19 | |
markrad | 0:6c46c366f500 | 20 | class SingletonFXOS8700CQ |
markrad | 0:6c46c366f500 | 21 | { |
markrad | 0:6c46c366f500 | 22 | private: |
markrad | 0:6c46c366f500 | 23 | |
markrad | 0:6c46c366f500 | 24 | SingletonFXOS8700CQ(PinName sda = PTE25, PinName scl = PTE24, int addr = FXOS8700CQ_SLAVE_ADDR1); |
markrad | 0:6c46c366f500 | 25 | SingletonFXOS8700CQ(const SingletonFXOS8700CQ &); |
markrad | 0:6c46c366f500 | 26 | SingletonFXOS8700CQ& operator=(const SingletonFXOS8700CQ&); |
markrad | 0:6c46c366f500 | 27 | |
markrad | 0:6c46c366f500 | 28 | FXOS8700CQ fxos; |
markrad | 0:6c46c366f500 | 29 | InterruptIn fxos_int1; // unused, common with SW2 on FRDM-K64F |
markrad | 0:6c46c366f500 | 30 | InterruptIn fxos_int2; // should just be the Data-Ready interrupt |
markrad | 0:6c46c366f500 | 31 | bool fxos_int1_triggered; |
markrad | 0:6c46c366f500 | 32 | bool fxos_int2_triggered; |
markrad | 0:6c46c366f500 | 33 | |
markrad | 0:6c46c366f500 | 34 | static void trigger_fxos_int1(void) |
markrad | 0:6c46c366f500 | 35 | { |
markrad | 0:6c46c366f500 | 36 | SingletonFXOS8700CQ::getInstance().setInt1Triggered(true); |
markrad | 0:6c46c366f500 | 37 | } |
markrad | 0:6c46c366f500 | 38 | |
markrad | 0:6c46c366f500 | 39 | static void trigger_fxos_int2(void) |
markrad | 0:6c46c366f500 | 40 | { |
markrad | 0:6c46c366f500 | 41 | SingletonFXOS8700CQ::getInstance().setInt2Triggered(true); |
markrad | 0:6c46c366f500 | 42 | //us_ellapsed = t.read_us(); |
markrad | 0:6c46c366f500 | 43 | } |
markrad | 0:6c46c366f500 | 44 | |
markrad | 0:6c46c366f500 | 45 | public: |
markrad | 0:6c46c366f500 | 46 | |
markrad | 0:6c46c366f500 | 47 | static SingletonFXOS8700CQ& getInstance() |
markrad | 0:6c46c366f500 | 48 | { |
markrad | 0:6c46c366f500 | 49 | static SingletonFXOS8700CQ instance; |
markrad | 0:6c46c366f500 | 50 | |
markrad | 0:6c46c366f500 | 51 | return instance; |
markrad | 0:6c46c366f500 | 52 | } |
markrad | 0:6c46c366f500 | 53 | |
markrad | 0:6c46c366f500 | 54 | void enable() { fxos.enable(); } |
markrad | 0:6c46c366f500 | 55 | void disable() { fxos.disable(); } |
markrad | 0:6c46c366f500 | 56 | |
markrad | 0:6c46c366f500 | 57 | uint8_t getData(READING&); |
markrad | 0:6c46c366f500 | 58 | |
markrad | 0:6c46c366f500 | 59 | bool getInt1Triggered() { return fxos_int1_triggered; } |
markrad | 0:6c46c366f500 | 60 | void setInt1Triggered(bool value) { fxos_int1_triggered = value; } |
markrad | 0:6c46c366f500 | 61 | bool getInt2Triggered() { return fxos_int2_triggered; } |
markrad | 0:6c46c366f500 | 62 | void setInt2Triggered(bool value) { fxos_int2_triggered = value; } |
markrad | 0:6c46c366f500 | 63 | uint8_t getWhoAmI() { return fxos.get_whoami(); } |
markrad | 0:6c46c366f500 | 64 | uint8_t getStatus() { return fxos.status(); } |
markrad | 0:6c46c366f500 | 65 | }; |