mbed-os
Fork of mbed-os by
features/unsupported/tests/mbed/fs/main.cpp@0:f269e3021894, 2016-10-23 (annotated)
- Committer:
- elessair
- Date:
- Sun Oct 23 15:10:02 2016 +0000
- Revision:
- 0:f269e3021894
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #include "mbed.h" |
elessair | 0:f269e3021894 | 2 | #include "rtos.h" |
elessair | 0:f269e3021894 | 3 | #include "SDFileSystem.h" |
elessair | 0:f269e3021894 | 4 | |
elessair | 0:f269e3021894 | 5 | #define FILE_LOC "/sd/test.txt" |
elessair | 0:f269e3021894 | 6 | |
elessair | 0:f269e3021894 | 7 | Serial pc(USBTX, USBRX); |
elessair | 0:f269e3021894 | 8 | Serial gps(p28, p27); |
elessair | 0:f269e3021894 | 9 | Serial test(p9,p10); |
elessair | 0:f269e3021894 | 10 | |
elessair | 0:f269e3021894 | 11 | SDFileSystem sd(p11, p12, p13, p14, "sd"); |
elessair | 0:f269e3021894 | 12 | |
elessair | 0:f269e3021894 | 13 | DigitalOut myled(LED1); |
elessair | 0:f269e3021894 | 14 | DigitalOut sdled(LED2); |
elessair | 0:f269e3021894 | 15 | |
elessair | 0:f269e3021894 | 16 | void sd_thread(void const *argument) { |
elessair | 0:f269e3021894 | 17 | while (true) { |
elessair | 0:f269e3021894 | 18 | sdled = !sdled; |
elessair | 0:f269e3021894 | 19 | FILE *fp = NULL; |
elessair | 0:f269e3021894 | 20 | fp = fopen(FILE_LOC, "w"); |
elessair | 0:f269e3021894 | 21 | if( fp != NULL ) fclose(fp); |
elessair | 0:f269e3021894 | 22 | Thread::wait(1000); |
elessair | 0:f269e3021894 | 23 | } |
elessair | 0:f269e3021894 | 24 | } |
elessair | 0:f269e3021894 | 25 | |
elessair | 0:f269e3021894 | 26 | int main() { |
elessair | 0:f269e3021894 | 27 | Thread sdTask(sd_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE * 2.25); |
elessair | 0:f269e3021894 | 28 | while (true) { |
elessair | 0:f269e3021894 | 29 | myled = !myled; |
elessair | 0:f269e3021894 | 30 | Thread::wait(1000); |
elessair | 0:f269e3021894 | 31 | } |
elessair | 0:f269e3021894 | 32 | } |