X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=shellcode%2Fchipcon%2Fcc1110%2Fcrystal.c;h=f32e755b9f9db452032b78d231f6d3e15f3a60e0;hp=36f929bf1121ccd3ebb0ef23d88bf6b20415be9f;hb=04e63f634d17c7dabe18bd9ce4e902b3df94cdca;hpb=ea807e987b960e8c237b1867cad899de5abbe5e7 diff --git a/shellcode/chipcon/cc1110/crystal.c b/shellcode/chipcon/cc1110/crystal.c index 36f929b..f32e755 100644 --- a/shellcode/chipcon/cc1110/crystal.c +++ b/shellcode/chipcon/cc1110/crystal.c @@ -3,9 +3,19 @@ //! Start the crystal oscillator at 26MHz. void main(){ - SLEEP &= ~SLEEP_OSC_PD; // Turn both high speed oscillators on - while( !(SLEEP & SLEEP_XOSC_S) ); // Wait until xtal oscillator is stable - CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1; // Select xtal osc, 26 MHz - while (CLKCON & CLKCON_OSC); // Wait for change to take effect - SLEEP |= SLEEP_OSC_PD; // Turn off the other high speed oscillator (the RC osc) + // Turn both high speed oscillators on + SLEEP &= ~SLEEP_OSC_PD; + // Wait until xtal oscillator is stable + while( !(SLEEP & SLEEP_XOSC_S) ); + + // Select xtal osc, 26 MHz + CLKCON = + (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) + | CLKSPD_DIV_1; + // Wait for change to take effect + while (CLKCON & CLKCON_OSC); + // Turn off the RC osc. + SLEEP |= SLEEP_OSC_PD; + + HALT; }