20200716 read Status Register each second

Dependencies:   SDFileSystem mbed-os-example-ble-GattServer max32630fthr

Committer:
aureliocarella
Date:
Thu Jul 16 14:59:04 2020 +0000
Revision:
21:51e162c130a9
20200716

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aureliocarella 21:51e162c130a9 1 /*******************************************************************************
aureliocarella 21:51e162c130a9 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
aureliocarella 21:51e162c130a9 3 *
aureliocarella 21:51e162c130a9 4 * Permission is hereby granted, free of charge, to any person obtaining a
aureliocarella 21:51e162c130a9 5 * copy of this software and associated documentation files (the "Software"),
aureliocarella 21:51e162c130a9 6 * to deal in the Software without restriction, including without limitation
aureliocarella 21:51e162c130a9 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
aureliocarella 21:51e162c130a9 8 * and/or sell copies of the Software, and to permit persons to whom the
aureliocarella 21:51e162c130a9 9 * Software is furnished to do so, subject to the following conditions:
aureliocarella 21:51e162c130a9 10 *
aureliocarella 21:51e162c130a9 11 * The above copyright notice and this permission notice shall be included
aureliocarella 21:51e162c130a9 12 * in all copies or substantial portions of the Software.
aureliocarella 21:51e162c130a9 13 *
aureliocarella 21:51e162c130a9 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
aureliocarella 21:51e162c130a9 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
aureliocarella 21:51e162c130a9 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
aureliocarella 21:51e162c130a9 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
aureliocarella 21:51e162c130a9 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
aureliocarella 21:51e162c130a9 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
aureliocarella 21:51e162c130a9 20 * OTHER DEALINGS IN THE SOFTWARE.
aureliocarella 21:51e162c130a9 21 *
aureliocarella 21:51e162c130a9 22 * Except as contained in this notice, the name of Maxim Integrated
aureliocarella 21:51e162c130a9 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
aureliocarella 21:51e162c130a9 24 * Products, Inc. Branding Policy.
aureliocarella 21:51e162c130a9 25 *
aureliocarella 21:51e162c130a9 26 * The mere transfer of this software does not imply any licenses
aureliocarella 21:51e162c130a9 27 * of trade secrets, proprietary technology, copyrights, patents,
aureliocarella 21:51e162c130a9 28 * trademarks, maskwork rights, or any other form of intellectual
aureliocarella 21:51e162c130a9 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
aureliocarella 21:51e162c130a9 30 * ownership rights.
aureliocarella 21:51e162c130a9 31 *******************************************************************************
aureliocarella 21:51e162c130a9 32 */
aureliocarella 21:51e162c130a9 33
aureliocarella 21:51e162c130a9 34 #include "Device_Logging.h"
aureliocarella 21:51e162c130a9 35
aureliocarella 21:51e162c130a9 36 /**
aureliocarella 21:51e162c130a9 37 * @brief Check if logging is enabled for this device
aureliocarella 21:51e162c130a9 38 */
aureliocarella 21:51e162c130a9 39 int Device_Logging::isLoggingEnabled(void) { return enabled; }
aureliocarella 21:51e162c130a9 40
aureliocarella 21:51e162c130a9 41 /**
aureliocarella 21:51e162c130a9 42 * @brief Returns the sample rate for the device, rate is in seconds
aureliocarella 21:51e162c130a9 43 */
aureliocarella 21:51e162c130a9 44 int Device_Logging::getLoggingSampleRate(void) { return sampleRate; }
aureliocarella 21:51e162c130a9 45
aureliocarella 21:51e162c130a9 46 /**
aureliocarella 21:51e162c130a9 47 * @brief Initialize the sampling rate for the device
aureliocarella 21:51e162c130a9 48 * @param sampleRate Rate to log device output in seconds
aureliocarella 21:51e162c130a9 49 */
aureliocarella 21:51e162c130a9 50 void Device_Logging::initStart(int sampleRate) {
aureliocarella 21:51e162c130a9 51 this->sampleRate = sampleRate;
aureliocarella 21:51e162c130a9 52 enabled = 1;
aureliocarella 21:51e162c130a9 53 }
aureliocarella 21:51e162c130a9 54
aureliocarella 21:51e162c130a9 55 /**
aureliocarella 21:51e162c130a9 56 * @brief Disables further datalog and streaming sampling for the device
aureliocarella 21:51e162c130a9 57 * @param time Time for next sample in seconds, time is relative to a timer
aureliocarella 21:51e162c130a9 58 */
aureliocarella 21:51e162c130a9 59 void Device_Logging::stop(void) { enabled = 0; }
aureliocarella 21:51e162c130a9 60
aureliocarella 21:51e162c130a9 61 /**
aureliocarella 21:51e162c130a9 62 * @brief Gets a value that represents when device needs to be sampled again,
aureliocarella 21:51e162c130a9 63 * used for datalogging and usb streaming
aureliocarella 21:51e162c130a9 64 */
aureliocarella 21:51e162c130a9 65 int Device_Logging::getNextSampleTime(void) { return nextSampleTime; }
aureliocarella 21:51e162c130a9 66
aureliocarella 21:51e162c130a9 67 /**
aureliocarella 21:51e162c130a9 68 * @brief Sets a value that represents when device needs to be sampled again,
aureliocarella 21:51e162c130a9 69 * used for datalogging and usb streaming
aureliocarella 21:51e162c130a9 70 * @param time Time for next sample in seconds, time is relative to a timer
aureliocarella 21:51e162c130a9 71 */
aureliocarella 21:51e162c130a9 72 void Device_Logging::setNextSampleTime(int time) { nextSampleTime = time; }
aureliocarella 21:51e162c130a9 73