Eli Hughes
/
RobotPowerLogger-V2
For Terrance
Headers/System.h@0:085749c8446f, 2012-06-13 (annotated)
- Committer:
- emh203
- Date:
- Wed Jun 13 15:10:06 2012 +0000
- Revision:
- 0:085749c8446f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emh203 | 0:085749c8446f | 1 | #ifndef _SYSTEM_H |
emh203 | 0:085749c8446f | 2 | #define _SYSTEM_H |
emh203 | 0:085749c8446f | 3 | |
emh203 | 0:085749c8446f | 4 | |
emh203 | 0:085749c8446f | 5 | #include "DataTypes.h" |
emh203 | 0:085749c8446f | 6 | #include "mbed.h" |
emh203 | 0:085749c8446f | 7 | #include "Serial.h" |
emh203 | 0:085749c8446f | 8 | #include "ADC.h" |
emh203 | 0:085749c8446f | 9 | #include "Configuration.h" |
emh203 | 0:085749c8446f | 10 | #include "stdio.h" |
emh203 | 0:085749c8446f | 11 | #include "FixedMath.h" |
emh203 | 0:085749c8446f | 12 | #include "KeyValue.h" |
emh203 | 0:085749c8446f | 13 | #include "SmartSwitch.h" |
emh203 | 0:085749c8446f | 14 | #include "GFX.h" |
emh203 | 0:085749c8446f | 15 | #include "ff.h" |
emh203 | 0:085749c8446f | 16 | #include "FIRMWARE_VERSION.h" |
emh203 | 0:085749c8446f | 17 | #include "Terminal.h" |
emh203 | 0:085749c8446f | 18 | |
emh203 | 0:085749c8446f | 19 | #define SYSTEM_STATE_INIT 0 |
emh203 | 0:085749c8446f | 20 | #define SYSTEM_STATE_LOGGING 1 |
emh203 | 0:085749c8446f | 21 | #define SYSTEM_STATE_IDLE 2 |
emh203 | 0:085749c8446f | 22 | |
emh203 | 0:085749c8446f | 23 | void EnterSystemState(BYTE NextState); |
emh203 | 0:085749c8446f | 24 | void InitButton(); |
emh203 | 0:085749c8446f | 25 | void InitRobotPowerMeasurementSystem(); |
emh203 | 0:085749c8446f | 26 | |
emh203 | 0:085749c8446f | 27 | void CheckButton(); |
emh203 | 0:085749c8446f | 28 | void UpdateDisplay(); |
emh203 | 0:085749c8446f | 29 | void CheckSDCardStatus(); |
emh203 | 0:085749c8446f | 30 | void UpdateHostTerminal(); |
emh203 | 0:085749c8446f | 31 | |
emh203 | 0:085749c8446f | 32 | extern BYTE SystemState; |
emh203 | 0:085749c8446f | 33 | |
emh203 | 0:085749c8446f | 34 | #define DATA_BLOCK_SIZE 1024 |
emh203 | 0:085749c8446f | 35 | |
emh203 | 0:085749c8446f | 36 | typedef struct { |
emh203 | 0:085749c8446f | 37 | |
emh203 | 0:085749c8446f | 38 | float Voltage[DATA_BLOCK_SIZE]; |
emh203 | 0:085749c8446f | 39 | float Current[DATA_BLOCK_SIZE]; |
emh203 | 0:085749c8446f | 40 | |
emh203 | 0:085749c8446f | 41 | SIGNED_DWORD WriteOutPtr; |
emh203 | 0:085749c8446f | 42 | SIGNED_DWORD ReadInPtr; |
emh203 | 0:085749c8446f | 43 | |
emh203 | 0:085749c8446f | 44 | }DataBlock; |
emh203 | 0:085749c8446f | 45 | |
emh203 | 0:085749c8446f | 46 | extern DataBlock MyDataBlock; |
emh203 | 0:085749c8446f | 47 | extern SIGNED_DWORD ReadWriteDifferential; |
emh203 | 0:085749c8446f | 48 | |
emh203 | 0:085749c8446f | 49 | #define MIN_WRITE_BLOCK_THRESH (16) |
emh203 | 0:085749c8446f | 50 | #define MAX_WRITE_BLOCK_THRESH ((DATA_BLOCK_SIZE/2)-1) |
emh203 | 0:085749c8446f | 51 | |
emh203 | 0:085749c8446f | 52 | void InitDataBlocks(DataBlock * DB); |
emh203 | 0:085749c8446f | 53 | extern BOOL DataLogError; |
emh203 | 0:085749c8446f | 54 | extern CHAR *ErrorMsg; |
emh203 | 0:085749c8446f | 55 | void LogData(); |
emh203 | 0:085749c8446f | 56 | void DisplayBootMsg(); |
emh203 | 0:085749c8446f | 57 | |
emh203 | 0:085749c8446f | 58 | #endif |