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 Mark Radbourne

SingletonFXOS8700CQ.cpp

Committer:
julianhigginson
Date:
2017-01-05
Revision:
7:0d1a0fe537dc
Parent:
0:6c46c366f500

File content as of revision 7:0d1a0fe537dc:

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file at https://github.com/Azure/azure-iot-sdks/blob/master/LICENSE for full license information.

#include "SingletonFXOS8700CQ.h"

SingletonFXOS8700CQ::SingletonFXOS8700CQ(PinName sda, PinName scl, int addr) :
    fxos(sda, scl, addr),
    fxos_int1(PTC6),
    fxos_int2(PTC13)
{
    fxos_int2.fall(&trigger_fxos_int2);
}

uint8_t SingletonFXOS8700CQ::getData(READING &reading)
{
    SRAWDATA accel_data;
    SRAWDATA magn_data;
    
    memset(&reading, 0, sizeof(reading));
    
    uint8_t rc = fxos.get_data(&accel_data, &magn_data);
    
    if (rc == 0)
    {
        reading.accelerometer.x = accel_data.x;
        reading.accelerometer.y = accel_data.y;
        reading.accelerometer.z = accel_data.z;
        reading.magnometer.x = magn_data.x;
        reading.magnometer.y = magn_data.y;
        reading.magnometer.z = magn_data.z;
    }
    
    return rc;
}