cdms n bae
Dependencies: SDFileSystem mbed-rtos mbed
Fork of CDMS_RTOS by
Diff: hk.cpp
- Revision:
- 7:60e940b7a36b
- Parent:
- 6:ee97f01e6b7d
- Child:
- 8:4acac3bf5e9b
diff -r ee97f01e6b7d -r 60e940b7a36b hk.cpp --- a/hk.cpp Thu Feb 05 22:32:29 2015 +0000 +++ b/hk.cpp Thu Feb 05 23:19:46 2015 +0000 @@ -4,11 +4,11 @@ SDFileSystem sd(PTD6, PTD7, PTD5, D7,"sd"); -Timer t1; -DigitalOut interrupt(D9); -const int addr = 0x20; +//Timer t1; +//DigitalOut interrupt(D9); +//const int addr = 0x20; bool ack0; -I2C master (D14,D15); +//I2C master (D14,D15); void spiwrite(int a) { @@ -59,28 +59,10 @@ spiwrite(0x85); //write month to 01 spiwrite(0x86); //write year to 01 } -void storedata(char * data,int length) +void storedata(char * data) { - ack0 =true; - interrupt = 1; - t1.start(); - //wait_ms(20); - ack0 = master.read(addr|1,data,length); - t1.stop(); - - - if(!ack0) - { - printf("\n master has read %s from slave\n\r",data); - - } - //master.stop(); - printf("\n%d\n\r",t1.read_us()); - t1.reset(); - - interrupt=0; spi.format(8,3); spi.frequency(1000000);