-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
73 lines (56 loc) · 1.72 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* main.h
*
* Created on: 12 Oct 2012
* Author: Xuewu Daniel Dai
* Email: xuewu.dai@eng.ox.ac.uk
* URL: http://users.ox.ac.uk/~engs1058/
*
*/
#ifndef MAIN_H_
#define MAIN_H_
// #define DEBUG
#ifdef DEBUG
#define DEBUGF printf
#else
#define DEBUGF while(0)printf
#endif
/** A structure for saving mBed's status into Flash memory
*
* The IAP requires the number of bytes to be written should be 256 | 512 | 1024 | 4096,
* the size of the structure must be one of the above numbers.
* Table 578 "ISP Copy Command", Section 32.7.7 LPC1763_usermanual
*
* For data types and size in mBed, http://mbed.org/handbook/C-Data-Types
* int 4 Bytes, unsigned int 4B,
* short 2B, long 8B
* float 4B, double 8B
*/
struct statusmbed{
int nNow[3]; //nNow[1] for motorLED, nNow[2] for motorAPD, 12B
unsigned int irm; // magnitude
unsigned int irf; // frequency
unsigned int irg; // gain
unsigned int uvm;
unsigned int uvf;
unsigned int uvg;
float APDbv; // bias voltage of APD (v), 4B
unsigned int aomv; // analog output voltage (mv), 4B
unsigned int tempValue;
// size of data above: 48 Bytes = 11* sizeof(int) + 1 *sizeof(float)
// = 11*4 + 1*4
char mempad[256-48];
// int *p_statusLlEDMotor;
// int *p_nNow;
// float *p_motorSpd;
// int *p_ADCstatus;
// unsigned int *p_Fs;
};
void swingLED(int posA, int posB, int nSam);
void setAPDBiasVoltage(float bvAPD);
void setAnalogOut_mV(float ao_mv);
void dispmBedStatus();
void memdump( char *base, int n ) ;
int Initialize_main();
void testFlashMem();
#endif /* MAIN_H_ */