for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RESET_functions.h Source File

RESET_functions.h

00001 
00002 void RESET_COMRX();
00003 void RESET_RTC();
00004 
00005 void RESET_COMRX()
00006 {
00007     gPC.printf("\r COM RX resetting\n");
00008     COM_RX_CNTRL = 0;
00009     wait_ms(10);
00010     COM_RX_CNTRL =1;
00011 }
00012 
00013 void RESET_RTC()
00014 {
00015     gPC.printf("Resetting RTC");
00016     gCS_RTC=1;
00017     gCS_RTC=0;
00018     spi.write(0x81); //register address with write flag
00019     spi.write(0x80);//enabling stop bit in the seconds register
00020  
00021     gCS_RTC=1;
00022     gCS_RTC=0;
00023     spi.write(0x81);
00024     spi.write(0x00);//disabling the stop bit to restart the oscillator 
00025 
00026     wait_ms(4000);
00027     //clearing the halt bit 
00028     gCS_RTC=1;
00029     gCS_RTC=0;
00030     spi.write(0x8C);
00031     spi.write(0x00);
00032      
00033     //clearing the OF bit 
00034     gCS_RTC=1;
00035     gCS_RTC=0;
00036     spi.write(0x8F);
00037     spi.write(0x00);
00038 }