10ms reflex.
[goodfet] / shellcode / chipcon / cc1110 / crystal.c
1 #include <cc1110.h>
2 #include "cc1110-ext.h"
3
4 //! Start the crystal oscillator at 26MHz.
5 void main(){
6   // Turn both high speed oscillators on
7   SLEEP &= ~SLEEP_OSC_PD;
8   // Wait until xtal oscillator is stable
9   while( !(SLEEP & SLEEP_XOSC_S) ); 
10
11   
12   
13   // Select xtal osc, 26 MHz
14   // This doesn't work for the USB dongles.
15   CLKCON = 
16     (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC))
17     | CLKSPD_DIV_1;
18   
19   
20   /*
21   //Needed for CC1111?
22   CLKCON = 
23     (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC))
24     | CLKSPD_DIV_2;
25   */
26   
27   // Wait for change to take effect
28   while (CLKCON & CLKCON_OSC); 
29   // Turn off the RC osc.
30   SLEEP |= SLEEP_OSC_PD; 
31   
32   HALT;
33 }