Maxim Integrated / Mbed OS MAXREFDES220#

Dependencies:   USBDevice max32630fthr

Committer:
Shaun Kelsey
Date:
Thu May 24 14:45:27 2018 -0700
Revision:
6:85ac8bf9955e
Add LEDStatus and EventStats

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Shaun Kelsey 6:85ac8bf9955e 1 /*******************************************************************************
Shaun Kelsey 6:85ac8bf9955e 2 * Author: Shaun Kelsey, shaun.kelsey@maximintegrated.com
Shaun Kelsey 6:85ac8bf9955e 3 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
Shaun Kelsey 6:85ac8bf9955e 4 *
Shaun Kelsey 6:85ac8bf9955e 5 * Permission is hereby granted, free of charge, to any person obtaining a
Shaun Kelsey 6:85ac8bf9955e 6 * copy of this software and associated documentation files (the "Software"),
Shaun Kelsey 6:85ac8bf9955e 7 * to deal in the Software without restriction, including without limitation
Shaun Kelsey 6:85ac8bf9955e 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Shaun Kelsey 6:85ac8bf9955e 9 * and/or sell copies of the Software, and to permit persons to whom the
Shaun Kelsey 6:85ac8bf9955e 10 * Software is furnished to do so, subject to the following conditions:
Shaun Kelsey 6:85ac8bf9955e 11 *
Shaun Kelsey 6:85ac8bf9955e 12 * The above copyright notice and this permission notice shall be included
Shaun Kelsey 6:85ac8bf9955e 13 * in all copies or substantial portions of the Software.
Shaun Kelsey 6:85ac8bf9955e 14 *
Shaun Kelsey 6:85ac8bf9955e 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Shaun Kelsey 6:85ac8bf9955e 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Shaun Kelsey 6:85ac8bf9955e 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Shaun Kelsey 6:85ac8bf9955e 18 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Shaun Kelsey 6:85ac8bf9955e 19 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Shaun Kelsey 6:85ac8bf9955e 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Shaun Kelsey 6:85ac8bf9955e 21 * OTHER DEALINGS IN THE SOFTWARE.
Shaun Kelsey 6:85ac8bf9955e 22 *
Shaun Kelsey 6:85ac8bf9955e 23 * Except as contained in this notice, the name of Maxim Integrated
Shaun Kelsey 6:85ac8bf9955e 24 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Shaun Kelsey 6:85ac8bf9955e 25 * Products, Inc. Branding Policy.
Shaun Kelsey 6:85ac8bf9955e 26 *
Shaun Kelsey 6:85ac8bf9955e 27 * The mere transfer of this software does not imply any licenses
Shaun Kelsey 6:85ac8bf9955e 28 * of trade secrets, proprietary technology, copyrights, patents,
Shaun Kelsey 6:85ac8bf9955e 29 * trademarks, maskwork rights, or any other form of intellectual
Shaun Kelsey 6:85ac8bf9955e 30 * property whatsoever. Maxim Integrated Products, Inc. retains all
Shaun Kelsey 6:85ac8bf9955e 31 * ownership rights.
Shaun Kelsey 6:85ac8bf9955e 32 *
Shaun Kelsey 6:85ac8bf9955e 33 ******************************************************************************/
Shaun Kelsey 6:85ac8bf9955e 34 #ifndef _PLATFORM_EVENT_H
Shaun Kelsey 6:85ac8bf9955e 35 #define _PLATFORM_EVENT_H
Shaun Kelsey 6:85ac8bf9955e 36
Shaun Kelsey 6:85ac8bf9955e 37
Shaun Kelsey 6:85ac8bf9955e 38 #include "mbed.h"
Shaun Kelsey 6:85ac8bf9955e 39
Shaun Kelsey 6:85ac8bf9955e 40 class EventStats
Shaun Kelsey 6:85ac8bf9955e 41 {
Shaun Kelsey 6:85ac8bf9955e 42 public:
Shaun Kelsey 6:85ac8bf9955e 43 EventStats();
Shaun Kelsey 6:85ac8bf9955e 44 EventStats(int report_period, const char* name);
Shaun Kelsey 6:85ac8bf9955e 45
Shaun Kelsey 6:85ac8bf9955e 46 //Start an event
Shaun Kelsey 6:85ac8bf9955e 47 void start();
Shaun Kelsey 6:85ac8bf9955e 48
Shaun Kelsey 6:85ac8bf9955e 49 //Stop an event. If report_period time has passed, prints stats
Shaun Kelsey 6:85ac8bf9955e 50 void stop();
Shaun Kelsey 6:85ac8bf9955e 51
Shaun Kelsey 6:85ac8bf9955e 52 //Print out stats. Set report_period to < 0 if you want to call this manually
Shaun Kelsey 6:85ac8bf9955e 53 void print_events(bool reset);
Shaun Kelsey 6:85ac8bf9955e 54
Shaun Kelsey 6:85ac8bf9955e 55 private:
Shaun Kelsey 6:85ac8bf9955e 56
Shaun Kelsey 6:85ac8bf9955e 57 const char* name;
Shaun Kelsey 6:85ac8bf9955e 58 int report_period;
Shaun Kelsey 6:85ac8bf9955e 59 int num_evts;
Shaun Kelsey 6:85ac8bf9955e 60 int total_evt_time;
Shaun Kelsey 6:85ac8bf9955e 61
Shaun Kelsey 6:85ac8bf9955e 62 bool evt_in_prog;
Shaun Kelsey 6:85ac8bf9955e 63 Timer single_evt;
Shaun Kelsey 6:85ac8bf9955e 64 Timer all_evts;
Shaun Kelsey 6:85ac8bf9955e 65 };
Shaun Kelsey 6:85ac8bf9955e 66
Shaun Kelsey 6:85ac8bf9955e 67
Shaun Kelsey 6:85ac8bf9955e 68 #endif