Example #1
0
void TIMER1_IRQHandler(void)
{
    if (Chip_TIMER_MatchPending(LPC_TIMER1, 0)) {
        Chip_TIMER_ClearMatch(LPC_TIMER1, 0);
        Board_LED_Set(0, 1);
    }
    if (Chip_TIMER_MatchPending(LPC_TIMER1, 1)) {
        Chip_TIMER_ClearMatch(LPC_TIMER1, 1);
        Board_LED_Set(0, 0);
    }
}
		void TIMER1_IRQHandler(void) {
			if(Chip_TIMER_MatchPending(LPC_TIMER1, 1)) {
				AdcEvent event = AdcEvent::ADC_SCAN;
				Chip_TIMER_ClearMatch(LPC_TIMER1, 1);
				xQueueSendToBackFromISR(event_queue, &event, 0);
			}
		}
Example #3
0
/**
 * @brief	Handle interrupt from 32-bit timer
 * @return	Nothing
 */
void TIMER0_IRQHandler(void)
{
	if (Chip_TIMER_MatchPending(LPC_TIMER0, 1)) {
		Chip_TIMER_ClearMatch(LPC_TIMER0, 1);
		Board_LED_Toggle(0);
	}
}
Example #4
0
/**
 * @details Timer interrupt to maintain Brusa communication timing
 */
void TIMER32_0_IRQHandler(void) {
	if (Chip_TIMER_MatchPending(LPC_TIMER32_0, 0)) {
		Chip_TIMER_ClearMatch(LPC_TIMER32_0, 0);

		brusa_message_send = true;
	}
}
Example #5
0
/**
 * @details Timer interrupt to request A123 MBB information
 */
void TIMER32_1_IRQHandler(void) {
	Chip_TIMER_ClearMatch(LPC_TIMER32_1, 0);
	// Update Battery Status
	if (RingBuffer_IsEmpty(&rx_buffer)) {
		// Send BCM_CMD
		mbb_cmd.request_type = BCM_REQUEST_TYPE_STD;
		mbb_cmd.request_id = 5;
		mbb_cmd.balance = out_state.balance;
		mbb_cmd.balance_target_mVolts = out_state.balance_mVolts;

		can_msg_obj.msgobj = BCM_STD_MSG_OBJ;
		MBB_MakeCMD(&mbb_cmd, &can_msg_obj);
		LPC_CCAN_API->can_transmit(&can_msg_obj);	

		new_std_msg_sent = true;
		if (std_msg_send_count++ == 4) {
			std_msg_send_count = 0;

			mbb_cmd.request_type = BCM_REQUEST_TYPE_EXT;
			can_msg_obj.msgobj = BCM_EXT_MSG_OBJ;
			mbb_cmd.request_id = 6;
			MBB_MakeCMD(&mbb_cmd, &can_msg_obj);
			LPC_CCAN_API->can_transmit(&can_msg_obj);

		}
	}
}
Example #6
0
/**
 * @brief	Handle interrupt from Timer 1
 * @return	Nothing
 */
void CT32B1_IRQHandler(void)
{
	if (Chip_TIMER_MatchPending(LPC_TIMER1, 1)) {
		Chip_TIMER_ClearMatch(LPC_TIMER1, 1);
		Board_LED_Toggle(1);
	}
}
Example #7
0
/*
 * @brief   Disables a compare match of a timer
 * @param   timerNumber:   Timer number, 0 to 3
 * @param   compareMatchNumber:   Compare match number, 1 to 3
 * @return   None
 */
void Timer_DisableCompareMatch(uint8_t timerNumber, uint8_t compareMatchNumber){
   
   timer_dd[timerNumber].timerCompareMatchFunctionPointer[compareMatchNumber] = errorOcurred;

   Chip_TIMER_ClearMatch(timer_sd[timerNumber].name, compareMatchNumber);
   Chip_TIMER_MatchDisableInt(timer_sd[timerNumber].name, compareMatchNumber);
}
void AVALON_PWM_SetDuty(AVALON_PWM_e pwm, unsigned char duty)
{
	if ((pwm >= AVALON_PWM_GREEN) && (pwm < AVALON_PWM_MAX)) {
		Chip_TIMER_ClearMatch(LPC_TIMER16_0, pwm);
		Chip_TIMER_ExtMatchControlSet(LPC_TIMER16_0, 1, TIMER_EXTMATCH_SET, (int8_t)pwm);
		Chip_TIMER_SetMatch(LPC_TIMER16_0, pwm, (uint32_t)duty);
	}
}
Example #9
0
int main(void)
{
    int duty = 100;

    initHardware();

    while(1) {
        pausems(1000);

        duty += 100;
        if(duty == 1000) duty = 100;

        Chip_TIMER_SetMatch(LPC_TIMER1, 1, duty);
        Chip_TIMER_Reset(LPC_TIMER1);
        Chip_TIMER_ClearMatch(LPC_TIMER1, 1);
        Chip_TIMER_ClearMatch(LPC_TIMER1, 0);
    }
}
Example #10
0
void
timer32_0_handler (void)
{
  if (Chip_TIMER_MatchPending(LPC_TIMER32_0, 0)) {
    Chip_TIMER_ClearMatch(LPC_TIMER32_0, 0);

    transmit_call = true;
  }
}
Example #11
0
/**
 * @brief	Handle interrupt from 32-bit timer
 * @return	Nothing
 */
void TIMER32_0_IRQHandler(void)
{
	if (Chip_TIMER_MatchPending(LPC_TIMER32_0, 1))
	{
		Chip_TIMER_ClearMatch(LPC_TIMER32_0, 1);
		////////////////////////////////////////////////////////
		// SHOULD BE Added DHCP Timer Handler your 1s tick timer
		DHCP_time_handler(); 	// for DHCP timeout counter
		////////////////////////////////////////////////////////
	}
}
Example #12
0
void
timer32_0_handler (void)
{
  static uint32_t pos = 0;

  if (Chip_TIMER_MatchPending(LPC_TIMER32_0, 1)) {
    Chip_TIMER_ClearMatch(LPC_TIMER32_0, 1);

    Chip_GPIO_SetPinState (LPC_GPIO, LED_STATUS_PORT, LED_STATUS_PIN, (blink_mask & (1 << (pos++ & 0x1F))));
  }
}
Example #13
0
/*fixme __attribute__ ((section(".after_vectors")))*/
void TIMER3_IRQHandler(void){
   
   uint8_t compareMatchNumber = 0;

   for(compareMatchNumber = TIMERCOMPAREMATCH0 ; compareMatchNumber <= TIMERCOMPAREMATCH3 ; compareMatchNumber++ ){
      if (Chip_TIMER_MatchPending(LPC_TIMER3, compareMatchNumber)){
         /*Run the functions saved in the timer dynamic data structure*/
         (*timer_dd[TIMER3].timerCompareMatchFunctionPointer[compareMatchNumber])();
         Chip_TIMER_ClearMatch(LPC_TIMER3, compareMatchNumber);
      }
   }
}
Example #14
0
void
call_transmit_delay (uint32_t seconds)
{
  NVIC_DisableIRQ (TIMER_32_0_IRQn);

  transmit_call = false;

  Chip_TIMER_Reset (LPC_TIMER32_0);
  Chip_TIMER_ClearMatch(LPC_TIMER32_0, 0);
  Chip_TIMER_SetMatch (LPC_TIMER32_0, 0, seconds);
  NVIC_ClearPendingIRQ (TIMER_32_0_IRQn);

  NVIC_EnableIRQ (TIMER_32_0_IRQn);
}
Example #15
0
void
call_transmit_if_needed (void)
{
  NVIC_DisableIRQ (TIMER_32_0_IRQn);

  if (transmit_call) {
    DBG (DBG_LEVEL_INFO, "Transmitting station ID (%s)", CALL_STRING);
    tx_enable ();
    while (!tx_is_ready ());
    morse_send (CALL_STRING, strlen (CALL_STRING));
    systick_delay (CALL_POST_DELAY_MS);
    tx_disable ();

    transmit_call = false;

    Chip_TIMER_Reset (LPC_TIMER32_0);
    Chip_TIMER_ClearMatch(LPC_TIMER32_0, 0);
    Chip_TIMER_SetMatch (LPC_TIMER32_0, 0, CALL_INTERVAL_SEC);
    NVIC_ClearPendingIRQ (TIMER_32_0_IRQn);
  }

  NVIC_EnableIRQ (TIMER_32_0_IRQn);
}