CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
Diff: cdms_rtc.h
- Revision:
- 93:4d76de54a699
- Parent:
- 52:0bd68655c651
- Child:
- 96:4ca92f9775e0
diff -r bce22b38c440 -r 4d76de54a699 cdms_rtc.h --- a/cdms_rtc.h Sat Jan 23 12:59:06 2016 +0000 +++ b/cdms_rtc.h Sun Jan 24 09:30:22 2016 +0000 @@ -1,5 +1,6 @@ void FCTN_CDMS_INIT_RTC() { + SPI_mutex.lock(); gCS_RTC=1; spi.format(8,0); spi.frequency(1000000); @@ -74,10 +75,12 @@ spi.write(0x01); //set year to 00(2000) gCS_RTC=1; printf("\n\r rtc initalised \n"); + SPI_mutex.unlock(); } uint64_t FCTN_CDMS_RD_RTC() { + SPI_mutex.lock(); uint8_t response; printf("\n\r Entered rtc\n"); gCS_RTC=1; @@ -145,4 +148,5 @@ //printf("\n\r%x%x", (int)(time >> 32), (int)(time)); printf("\n\r0x%016llx\n\r", time); return time; + SPI_mutex.unlock(); } \ No newline at end of file