oh my god it works
This commit is contained in:
parent
6c833f5ea7
commit
21e77639a8
2
main.c
2
main.c
|
@ -24,7 +24,7 @@
|
|||
|
||||
void Init_LEDs (void) {
|
||||
/* Enable clock for PORT B module */
|
||||
SIM_SCGC4 |= SIM_SCGC5_PORTB_MASK;
|
||||
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;
|
||||
|
||||
/* Select PORT B Pin 8 for GPIO to red LED */
|
||||
PORTB_PCR(POS_RED) = PORT_PCR_SET_GPIO;
|
||||
|
|
|
@ -19,14 +19,14 @@ void SystemInit()
|
|||
OSC0_CR = OSC_CR_ERCLKEN_MASK; // external ref clock
|
||||
MCG_C1 = MCG_C1_IRCLKEN_MASK;
|
||||
|
||||
while (MCG_S & MCG_S_OSCINIT0_MASK); // wait for osc to become stable
|
||||
while (!(MCG_S & MCG_S_IREFST_MASK)); // wait for FLL and external clock to match
|
||||
while (!(MCG_S & MCG_S_OSCINIT0_MASK)); // wait for osc to become stable
|
||||
while (MCG_S & MCG_S_IREFST_MASK); // wait for FLL and external clock to match
|
||||
|
||||
// preserve FCTRIM and SCFTRIM
|
||||
MCG_C4 = ((MCG_C4 & -MCG_C4_DRST_DRS_MASK) | MCG_C4_DC0_25PMAX_MID);
|
||||
|
||||
// wait for output of FLL to be selected
|
||||
while (!(MCG_S & MCG_S_CLKST_MASK));
|
||||
while (MCG_S & MCG_S_CLKST_MASK);
|
||||
|
||||
/****************************/
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue