int main(){ int i = 0; PLL_Init(); SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // 50 MHz DisableInterrupts(); SYSCTL_RCGC1_R |= SYSCTL_RCGC1_TIMER0;// activate timer0 SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF+SYSCTL_RCGC2_GPIOG; // activate ports F and G Output_Init(); SysTick_InitSeconds(1); PolledButtons_Init(); EnableInterrupts(); displayMode = 0; ringAlarms = 0; timeMode = 0; while(1){ if (ringAlarms && !soundPlaying && (alarmActive || timeMode == 4)) { playSound(); } else if ((ringAlarms==0 || !alarmActive) && soundPlaying) { stopSound(); } if(displayMode==0) { displayClock(); } else if(displayMode==1){ displaySet(); } } }
int main(void){ //PLL_Init(); //16MHZ bus clock //when PLL is on, nothing works HeartBeat_Init(); //SysTick_Init(); PolledButtons_Init(); // initialize interrupts and ports DAC_Init(1024); // initialize with command: Vout = Vref // DAC_Init(0x1000); // initialize with command: Vout = Vref //Timer0A_Init(dt[0]); Board_Init(); //Initalize the On Board Switches Switch_Init2(); //i used the board switches because our switches were doing the thing //where they worked for a bit then they stopped working again lenPush = 1; int instrument = 0; while(1){ if(mode){ resetSwitches(); if (instrument == 0){ Music_Play(Wave[0], 32, strobePtr, 35); instrument += 1; } else if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); instrument += 1; } else if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); instrument = 0; } } else if(play){ resetSwitches(); if (instrument == 0){ Music_Play(Wave[0], 64, strobePtr, 35); } if (instrument == 1){ Music_Play(Trumpet[0], 32, strobePtr, 35); } if (instrument == 2){ Music_Play(Flute[0], 32, strobePtr, 35); } } } }