// every ~15.25us void ADC_DMA_HANDLER(void) { register uint32_t flag = ADC_DMA_ISR; register unsigned long *s, *a; register uint16_t *w; int i; // clear intr flags ADC_DMA_CR = (uint32_t)ADC_DMA_FLAGS; // second half? w = ((flag & ADC_DMA_TC_FLAG) == RESET) ? adcDMAData.adc123Raw1 : adcDMAData.adc123Raw2; // accumulate totals s = adcData.interrupt123Sums; *s++ += (w[36] + w[39] + w[42] + w[45]); // rateX *s++ += (w[1] + w[4] + w[7] + w[10]); // rateY *s++ += (w[2] + w[5] + w[8] + w[11]); // rateZ *s++ += (w[0] + w[3] + w[6] + w[9]); // magX *s++ += (w[12] + w[15] + w[18] + w[21]); // magY *s++ += (w[24] + w[27] + w[30] + w[33]); // magZ *s++ += (w[14]); // temp1 *s++ += (w[32]); // Vin *s++ += (w[13] + w[16] + w[19] + w[22]); // accX *s++ += (w[25] + w[28] + w[31] + w[34]); // accY *s++ += (w[37] + w[40] + w[43] + w[46]); // accZ *s++ += (w[20] + w[23] + w[26] + w[29]); // press1 *s++ += (w[38] + w[41] + w[44] + w[47]); // press2 *s++ += (w[17]); // temp2 *s += (w[35]); // temp3 if (++adcData.sample == ADC_SAMPLES) { register unsigned long micros = timerMicros(); adcData.sample = 0; if (++adcData.loops & 0x01) { if (ADC_MAG_SIGN) { digitalLo(adcData.magSetReset); } else { digitalHi(adcData.magSetReset); } } s = adcData.interrupt123Sums; a = (unsigned long *)adcData.adcSums; for (i = 0; i < ADC_SENSORS; i++) { *a++ = *s; *s++ = 0; } adcData.sampleTime = micros - adcData.lastSample; adcData.lastSample = micros; CoEnterISR(); isr_SetFlag(adcData.adcFlag); CoExitISR(); } }
/** ******************************************************************************* * @brief EXTI15_10_IRQHandler(Vector :56, PC13) * @param[in] None * @param[out] None * @retval None * * @details This is external interrupt handler,Use to add time when setting time. ******************************************************************************* */ void EXTI15_10_IRQHandler(void) { CoEnterISR(); isr_SetFlag(button_add_flg); EXTI_ClearITPendingBit(EXTI_Line13); CoExitISR(); }
/** ******************************************************************************* * @brief EXTI0_IRQHandler(Vector :22, PA0) * @param[in] None * @param[out] None * @retval None * * @details This is external interrupt handler,use to select to set hour, * minute,second. ******************************************************************************* */ void EXTI0_IRQHandler(void) { CoEnterISR(); isr_SetFlag(button_sel_flg); EXTI_ClearITPendingBit(EXTI_Line0); CoExitISR(); }
void TIMER32_0_IRQHandler() { static unsigned int duty_counter_r = 0; static unsigned int duty_counter_g = 0; static unsigned int duty_counter_b = 0; static unsigned int bl_duty_counter = 0; static unsigned int period_counter = 0; static int activity_counter = 0; CoEnterISR(); TIM_ClearIntPending(LPC_TMR32B0, TIM_MR0_INT); // 39.0625us activity indicator (for calibration) GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN); if( period_counter -- > 0 ) { if( duty_counter_r -- == 0 ) GPIO_ResetBits(RED_PORT, RED_PIN); if( duty_counter_g -- == 0 ) GPIO_ResetBits(GREEN_PORT, GREEN_PIN); if( duty_counter_b -- == 0 ) GPIO_ResetBits(BLUE_PORT, BLUE_PIN); if (bl_duty_counter-- == 0) GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN); } else { if( activity_counter ++ >= TICKS_PER_SECOND ) { activity_counter = 0; GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN); //if( device_mode == AMBIENT_TEMPERATURE ) // PLUGIN_Temperature_Update(); } SEQ_Tick(); duty_counter_r = SEQ_CurrentRed(); duty_counter_r == 0 ? GPIO_ResetBits(RED_PORT, RED_PIN) : GPIO_SetBits(RED_PORT, RED_PIN); duty_counter_g = SEQ_CurrentGreen(); duty_counter_g == 0 ? GPIO_ResetBits(GREEN_PORT, GREEN_PIN ) : GPIO_SetBits(GREEN_PORT, GREEN_PIN ); duty_counter_b = SEQ_CurrentBlue(); duty_counter_b == 0 ? GPIO_ResetBits(BLUE_PORT, BLUE_PIN ) : GPIO_SetBits(BLUE_PORT, BLUE_PIN ); bl_duty_counter = backlite_power; bl_duty_counter == 0 ? GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN) : GPIO_SetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN); period_counter = 255; } CoExitISR(); }
extern "C" void DMA1_Stream7_IRQHandler() { // DMA1_Stream7->CR &= ~DMA_SxCR_EN ; // Disable DMA DMA1_Stream7->CR &= ~DMA_SxCR_TCIE ; // Stop interrupt DMA1->HIFCR = DMA_HIFCR_CTCIF7 | DMA_HIFCR_CHTIF7 | DMA_HIFCR_CTEIF7 | DMA_HIFCR_CDMEIF7 | DMA_HIFCR_CFEIF7 ; // Write ones to clear flags SPI3->CR2 &= ~SPI_CR2_TXDMAEN ; DmaDebugNDTR = DMA1_Stream7->NDTR ; DmaDone = 1 ; DmaDebugCount += 1 ; if ( Main_running ) { CoEnterISR() ; // Enter the interrupt isr_SetFlag( LcdFlag ) ; // Tell task transfer finished CoExitISR() ; // Exit the interrupt } }
void DIMU_ISR(void) { // CC2 is used for IMU period timing if (TIM_GetITStatus(DIMU_TIM, TIM_IT_CC2) != RESET) { DIMU_TIM->SR = (uint16_t)~TIM_IT_CC2; // set next alarm dImuData.nextPeriod += DIMU_INNER_PERIOD; DIMU_TIM->CCR2 = dImuData.nextPeriod; CoEnterISR(); isr_SetFlag(dImuData.flag); CoExitISR(); } else if (TIM_GetITStatus(DIMU_TIM, TIM_IT_CC1) != RESET) { DIMU_TIM->SR = (uint16_t)~TIM_IT_CC1; // Disable the Interrupt DIMU_TIM->DIER &= (uint16_t)~TIM_IT_CC1; dImuData.alarm1Callback(dImuData.alarm1Parameter); } }
/** ******************************************************************************* * @brief RTC_IRQHandler(Vector :19, RTC) * @param[in] None * @param[out] None * @retval None * * @details This is RTC interrupt handler,Use to post mailbox to 'time_display' * task. ******************************************************************************* */ void RTC_IRQHandler (void) { CoEnterISR(); /* Tell CooCox that we are starting an ISR. */ time[0]++; if (time[0] == 60) { time[0] = 0; time[1]++; if (time[1] == 60) { time[1] = 0; time[2]++; if (time[2] == 24) time[2] = 0; } } isr_PostMail (mbox0,time); RTC->CRL &= ~(unsigned short)1<<0; CoExitISR(); }