Robert Ceschini / Mbed 2 deprecated PSU-POWERLOGGER

Dependencies:   mbed

Fork of PSU-POWERLOGGER by Eli Hughes

HEADERS/System.h

Committer:
rjc19
Date:
2012-09-28
Revision:
3:d55665050fcb
Parent:
1:871a329fd172

File content as of revision 3:d55665050fcb:

#ifndef _SYSTEM_H
#define _SYSTEM_H

#include "DataTypes.h"
#include "mbed.h"
#include "Serial.h"
#include "ADC.h"
#include "Configuration.h"
#include "stdio.h"
#include "FixedMath.h"
#include "KeyValue.h"
#include "SmartSwitch.h"
#include "GFX.h"
#include "ff.h"
#include "FIRMWARE_VERSION.h"
#include "Terminal.h"

#define SYSTEM_STATE_INIT       0   
#define SYSTEM_STATE_LOGGING    1    
#define SYSTEM_STATE_IDLE       2
#define SYSTEM_STATE_SERIAL_LOGGING 3

void EnterSystemState(BYTE NextState);
void InitButton();
void InitRobotPowerMeasurementSystem();

void CheckButton();
void UpdateDisplay();
void CheckSDCardStatus();
void UpdateHostTerminal();

extern BYTE SystemState;
extern BYTE WeAreInNormalMode;
extern char SerialLineBuffer[256];
extern UINT SerialLineBufferPtr;

extern FIL  CurrentLogFileHandle;
extern BYTE DisplayMode;
extern UINT LinesWritten;
extern WORD SerialCount;
#define NUMBEROFLINESBEFORESYNC 10

#define DATA_BLOCK_SIZE    1024

typedef struct {

    float   Voltage[DATA_BLOCK_SIZE];
    float   Current[DATA_BLOCK_SIZE];

   SIGNED_DWORD  WriteOutPtr;
   SIGNED_DWORD   ReadInPtr;
     
}DataBlock;

extern DataBlock MyDataBlock;
extern SIGNED_DWORD ReadWriteDifferential;

#define MIN_WRITE_BLOCK_THRESH                (16)
#define MAX_WRITE_BLOCK_THRESH                ((DATA_BLOCK_SIZE/2)-1)

void InitDataBlocks(DataBlock * DB);
extern BOOL DataLogError;
extern CHAR *ErrorMsg;
void LogData();
void DisplayBootMsg();
BOOL InitSerialDataLog();
extern time_t CurrentTime_InSec;
extern tm *CurrentTime;

#endif