//----------------------------------------------------------------- // Main //----------------------------------------------------------------- int main(void) { uint8_t uiResult; pllInit(); // Turn off analogue inputs ANSELB = PORTB_ANSEL; ANSELC = 0x0000; ANSELD = PORTD_ANSEL; ANSELE = 0x0000; ANSELG = 0x0000; memset(lastestDmxBuffer, 0, NUM_DIMMER_CHANNELS); memset(lastOutputBuffer, 0, NUM_DIMMER_CHANNELS); // Startup ioMuxInit(); eepromInit(); eepromLoad(); lcdInit(); buttonsInit(); uiInit(); ledsInit(); phaseAngleInit(); dmxInit(eepromGetDmxAddress()); // Timer 1 setup - overflow at 100Hz TMR1 = 0; PR1 = 25000; T1CON = 0x8010; // 1:8 prescale (2.5MHz) _T1IF = 0; while(1) { if(_T1IF) { // 100 Hz Timer stuff _T1IF = 0; buttonsCheck(); ledsCheck(); uiResult = uiCheck(); } else { uiResult = 0; } if(uiResult || dmxCheck()) { updateDimmers(); } lcdCheck(); } }
int main() { //set the system to use the PLL and crank the frequency up to 72Mhz (max for processor) pllInit(); //set up the timer used all over to wait for delays DelayTimerInit(); //set up the timer used to schedule ffts FFTTimerInit(); //set up pins for ads communication InitPinsForAdsCommunication(); //ads boots up with 250sps data ready pin, stop this stopAdsConversions(); //start up the uart - bluetooth connection. Do this last in case we get something right away uartInit(); LPC_IOCON->PIO3_2 = 0xD8; LPC_GPIO3->DIR |= (1<<2); LPC_GPIO3->DATA &= ~(1<<2); //pwup(); //pwdnTimerInit(); //startPwdnTimer(); while(1) { // event processing loop to deal with deadlocks if everything were to run straight from interrupts ProcessEvents(); //delay(60000); } }