/*********************************************************************//** * @brief Main I2S program body **********************************************************************/ int c_entry (void) { /* Main Program */ RIT_CMP_VAL value; PINSEL_CFG_Type PinCfg; // DeInit NVIC and SCBNVIC NVIC_DeInit(); NVIC_SCBDeInit(); /* Configure the NVIC Preemption Priority Bits: * two (2) bits of preemption priority, six (6) bits of sub-priority. * Since the Number of Bits used for Priority Levels is five (5), so the * actual bit number of sub-priority is three (3) */ NVIC_SetPriorityGrouping(0x05); // Set Vector table offset value #if (__RAM_MODE__==1) NVIC_SetVTOR(0x10000000); #else NVIC_SetVTOR(0x00000000); #endif debug_frmwrk_init(); _DBG(menu); value.CMPVAL = 10000000; value.COUNTVAL = 0x00000000; value.MASKVAL = 0x00000000; RIT_Init(LPC_RIT); RIT_TimerConfig(LPC_RIT,&value); RIT_TimerClearCmd(LPC_RIT,ENABLE); _DBG("The value compare is: "); _DBD32(value.CMPVAL); _DBG_(" system tick"); //Config P2.2 as GPO2.2 PinCfg.Funcnum = 0; PinCfg.OpenDrain = 0; PinCfg.Pinmode = 0; PinCfg.Portnum = 2; PinCfg.Pinnum = 2; PINSEL_ConfigPin(&PinCfg); //turn on LED2.2 GPIO_SetDir(2,(1<<2),1); GPIO_SetValue(2,(1<<2)); NVIC_EnableIRQ(RIT_IRQn); while(1); return 1; }
int _RIT_TimerClearCmd(uint8_t * args) { uint8_t * arg_ptr; LPC_RIT_TypeDef* RITx; FunctionalState NewState; if ((arg_ptr = (uint8_t *) strtok(NULL, " ")) == NULL) return 1; RITx = (LPC_RIT_TypeDef*) strtoul((char *) arg_ptr, NULL, 16); if ((arg_ptr = (uint8_t *) strtok(NULL, " ")) == NULL) return 1; NewState = (FunctionalState) strtoul((char *) arg_ptr, NULL, 16); RIT_TimerClearCmd(RITx, NewState); return 0; }