Fork for marginal changes to UI library.

Dependents:   Data-Management-Honka

Fork of UI by Michael Ling

UserInterface.h

Committer:
nathanhonka
Date:
2015-04-05
Revision:
7:53de0bee308d
Parent:
6:be26def664d1
Child:
8:7d9e183929a1

File content as of revision 7:53de0bee308d:

#ifndef USERINTERFACE_H
#define USERINTERFACE_H

/**
* Copyright (c) 2014
* All rights reserved.
*
 * This header file contains functions for reading received signals and checking that they are properly formed.
 * @author Bradley Perry
 * @date
*/

#include "mbed.h"
#include "initDatabed.h"

/* UI button press types */
enum UI_t {
    BUTTON_NONE = 0,
    BUTTON_A_PRESS = 1,
    BUTTON_B_PRESS = 2,
    BUTTON_A_HOLD = 3,
    BUTTON_B_HOLD = 4
};

extern UI_t UI;
class UserInterface
{
public:
    UserInterface(void);
    void find_length(char *idx, int *count);
    bool checksum_check(char * idx, int length);
    void checkUI_XBee();
    void readBuffer();
    void initializeUI();

private:
    int _buttonA;
    int _buttonA_prev;
    float _tHold;
    float _tIdle;
    int _SSconfirm;
    float _tRelease;
    Timer _time_StateChange;
    Timer _time_pressA;
    Timer _time_pressB;
    int _buttonB;
    int _buttonB_prev;
    char _xbeeBuffer[250];
    int _dataCnt;
    float _time_sinceA;
    float _time_sinceB;
};
#endif