Owen Piette
/
TickerFreadTest
Testing to see if fread blocks Ticker(). It does.
Revision 0:8d0e8caaf3e4, committed 2010-10-05
- Comitter:
- opiette
- Date:
- Tue Oct 05 03:47:18 2010 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 05 03:47:18 2010 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); +Ticker tick; +LocalFileSystem sd("sd"); + +void flash(void){ + if (led1 == 1) + led1 = 0; + else + led1=1; +} + + +int main() { + + FILE* fp = fopen("/sd/test.wav","rb"); +tick.attach_us(&flash, 1000); + + while(1) { + led2 = 1; + wait_ms(1000); + led2 = 0; + + char* buffer; + buffer = (char*)malloc(8000); + + led3 = 1; + wait_ms(1000); + led3 = 0; + + fread(buffer, 1, 8000, fp); + + led4 = 1; + wait_ms(1000); + led4 = 0; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 05 03:47:18 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e