STM32 EEPROM Testing
Dependencies: mbed
main.cpp@0:77080c9376de, 2018-04-04 (annotated)
- Committer:
- chromaticdeth87
- Date:
- Wed Apr 04 15:16:19 2018 +0000
- Revision:
- 0:77080c9376de
This is the Test for the Flash to EEPROM operations on STM32F334C8T6
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chromaticdeth87 | 0:77080c9376de | 1 | #include "mbed.h" |
| chromaticdeth87 | 0:77080c9376de | 2 | #include "cal.h" |
| chromaticdeth87 | 0:77080c9376de | 3 | |
| chromaticdeth87 | 0:77080c9376de | 4 | |
| chromaticdeth87 | 0:77080c9376de | 5 | /*------------------------------------------------------------------------------ |
| chromaticdeth87 | 0:77080c9376de | 6 | Before to use this example, ensure that you an hyperterminal installed on your |
| chromaticdeth87 | 0:77080c9376de | 7 | computer. More info here: https://developer.mbed.org/handbook/Terminals |
| chromaticdeth87 | 0:77080c9376de | 8 | |
| chromaticdeth87 | 0:77080c9376de | 9 | The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their |
| chromaticdeth87 | 0:77080c9376de | 10 | definition in the PinNames.h file). |
| chromaticdeth87 | 0:77080c9376de | 11 | |
| chromaticdeth87 | 0:77080c9376de | 12 | The default serial configuration in this case is 9600 bauds, 8-bit data, no parity |
| chromaticdeth87 | 0:77080c9376de | 13 | |
| chromaticdeth87 | 0:77080c9376de | 14 | If you want to change the baudrate for example, you have to redeclare the |
| chromaticdeth87 | 0:77080c9376de | 15 | serial object in your code: |
| chromaticdeth87 | 0:77080c9376de | 16 | |
| chromaticdeth87 | 0:77080c9376de | 17 | Serial pc(SERIAL_TX, SERIAL_RX); |
| chromaticdeth87 | 0:77080c9376de | 18 | |
| chromaticdeth87 | 0:77080c9376de | 19 | Then, you can modify the baudrate and print like this: |
| chromaticdeth87 | 0:77080c9376de | 20 | |
| chromaticdeth87 | 0:77080c9376de | 21 | pc.baud(115200); |
| chromaticdeth87 | 0:77080c9376de | 22 | pc.printf("Hello World !\n"); |
| chromaticdeth87 | 0:77080c9376de | 23 | ------------------------------------------------------------------------------*/ |
| chromaticdeth87 | 0:77080c9376de | 24 | BusOut FunctionLEDs(PB_15, PA_8); |
| chromaticdeth87 | 0:77080c9376de | 25 | BusOut LevelLEDs(PA_11,PA_12); |
| chromaticdeth87 | 0:77080c9376de | 26 | |
| chromaticdeth87 | 0:77080c9376de | 27 | Serial pc(PA_9, PA_10); //tx,rx |
| chromaticdeth87 | 0:77080c9376de | 28 | |
| chromaticdeth87 | 0:77080c9376de | 29 | |
| chromaticdeth87 | 0:77080c9376de | 30 | //StartupLEDs |
| chromaticdeth87 | 0:77080c9376de | 31 | #define Blank 0x00 |
| chromaticdeth87 | 0:77080c9376de | 32 | #define AllLEDs 0xFF |
| chromaticdeth87 | 0:77080c9376de | 33 | |
| chromaticdeth87 | 0:77080c9376de | 34 | //Function LED Defines |
| chromaticdeth87 | 0:77080c9376de | 35 | #define pHG 0x01 |
| chromaticdeth87 | 0:77080c9376de | 36 | #define ORPG 0x02 |
| chromaticdeth87 | 0:77080c9376de | 37 | #define mAOutput 0x04 |
| chromaticdeth87 | 0:77080c9376de | 38 | |
| chromaticdeth87 | 0:77080c9376de | 39 | //LevelOut LED Defines |
| chromaticdeth87 | 0:77080c9376de | 40 | #define LowLED 0x01 |
| chromaticdeth87 | 0:77080c9376de | 41 | #define MidLED 0x02 |
| chromaticdeth87 | 0:77080c9376de | 42 | #define HighLED 0x04 |
| chromaticdeth87 | 0:77080c9376de | 43 | |
| chromaticdeth87 | 0:77080c9376de | 44 | |
| chromaticdeth87 | 0:77080c9376de | 45 | |
| chromaticdeth87 | 0:77080c9376de | 46 | int main() |
| chromaticdeth87 | 0:77080c9376de | 47 | { |
| chromaticdeth87 | 0:77080c9376de | 48 | pc.baud(115200); |
| chromaticdeth87 | 0:77080c9376de | 49 | |
| chromaticdeth87 | 0:77080c9376de | 50 | //cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 51 | |
| chromaticdeth87 | 0:77080c9376de | 52 | |
| chromaticdeth87 | 0:77080c9376de | 53 | //initialize Calibration Data |
| chromaticdeth87 | 0:77080c9376de | 54 | //cal_init(); |
| chromaticdeth87 | 0:77080c9376de | 55 | |
| chromaticdeth87 | 0:77080c9376de | 56 | cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 57 | cal_factory(); |
| chromaticdeth87 | 0:77080c9376de | 58 | cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 59 | cal_init(); |
| chromaticdeth87 | 0:77080c9376de | 60 | cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 61 | g_cal.vis_cal_ppb = 2.0; |
| chromaticdeth87 | 0:77080c9376de | 62 | cal_save(); |
| chromaticdeth87 | 0:77080c9376de | 63 | cal_init(); |
| chromaticdeth87 | 0:77080c9376de | 64 | cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 65 | |
| chromaticdeth87 | 0:77080c9376de | 66 | //cal_init(); |
| chromaticdeth87 | 0:77080c9376de | 67 | //cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 68 | |
| chromaticdeth87 | 0:77080c9376de | 69 | |
| chromaticdeth87 | 0:77080c9376de | 70 | |
| chromaticdeth87 | 0:77080c9376de | 71 | |
| chromaticdeth87 | 0:77080c9376de | 72 | |
| chromaticdeth87 | 0:77080c9376de | 73 | //cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 74 | //cal_init(); |
| chromaticdeth87 | 0:77080c9376de | 75 | //cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 76 | //g_cal.vis_cal_ppb = 2.0; |
| chromaticdeth87 | 0:77080c9376de | 77 | //cal_save(); |
| chromaticdeth87 | 0:77080c9376de | 78 | // cal_test(); |
| chromaticdeth87 | 0:77080c9376de | 79 | |
| chromaticdeth87 | 0:77080c9376de | 80 | |
| chromaticdeth87 | 0:77080c9376de | 81 | |
| chromaticdeth87 | 0:77080c9376de | 82 | |
| chromaticdeth87 | 0:77080c9376de | 83 | } |