App for BLE Nano to monitor the power consumption for a specific location, by intercepting the led flashes of a standard power meter. It counts and log the flashes for each second. It works with RedBear App for smart phone (Simple Chat App).

Dependencies:   BLE_API lib_mma8451q mbed nRF51822

Fork of nRF51822_DataLogger_with_Chat by Valentin Tanasa

myData.h

Committer:
tanasaro10
Date:
2016-04-11
Revision:
8:f28ad4600b0f
Child:
9:303d3628986a

File content as of revision 8:f28ad4600b0f:


typedef struct{
    uint8_t hour;
    uint8_t min;
    uint8_t sec;
} mtime_t;

typedef struct{
    mtime_t currentTime;
    mtime_t newTime;
    bool updateTime;  // true if currentTime needs to be updated with newTime;
} mtime_manager_t;


typedef struct {
    uint8_t month; // 1..12
    uint8_t day;  // 1..31
    uint8_t year;  // 20_XX, 2016 => 16;
}date_t;


typedef struct{
    date_t currentDate;
    date_t newDate;
    bool updateDate;  // true if currentDate needs to be updated with newDate;
} mdate_manager_t;


typedef struct {
    float light;
    float gndV;
    float temp;
    bool led_on;
    mtime_t time;
    date_t date;
} myData_t;

#define MAXBUFFER  90
// bool isInputValid(uint8_t * buffer);

uint8_t eNrDaysPerMonth[12]= {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};