コード例 #1
0
ファイル: spi_message.c プロジェクト: cydvicious/rone
/*
 * @brief Disable MSP430 interrupt.
 *
 * @returns void
 */
void msp430InterruptDisable(void) {
	volatile uint8 i;
	if (MSPSPIState == MSPSPI_STATE_DESELECT_SPI) {
		i++;
	}
    MAP_TimerIntDisable(TIMER1_BASE, TIMER_TIMB_TIMEOUT);
}
コード例 #2
0
//****************************************************************************
//
//! The delay function uses timer to implement the delay time in milliseconds
//!
//! \param time in millisecond
//
//!  \return void
//****************************************************************************
static void delay(int time_ms)
{
    // Initialize Timer 0B as one-shot down counter.
    MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralReset(PRCM_TIMERA0);
    MAP_TimerConfigure(TIMERA0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_ONE_SHOT);
    MAP_TimerPrescaleSet(TIMERA0_BASE, TIMER_B, PRESCALE);
    //Load the value in milisecond
    MAP_TimerLoadSet(TIMERA0_BASE, TIMER_B, MILLISECONDS_TO_TICKS(time_ms));
    // Enable the timer
    MAP_TimerEnable(TIMERA0_BASE, TIMER_B);
    //Stall during debug
    MAP_TimerControlStall(TIMERA0_BASE, TIMER_B, 1);
    // Enable interrupt upon Time-out
    MAP_TimerIntEnable(TIMERA0_BASE, TIMER_TIMB_TIMEOUT);
    // Clear Interrupt Flag
    MAP_TimerIntClear(TIMERA0_BASE, MAP_TimerIntStatus(TIMERA0_BASE, true));
    //Wait until timer time-out
    while (MAP_TimerIntStatus(TIMERA0_BASE, true) != TIMER_TIMB_TIMEOUT){}
    //Disable the timer
    MAP_TimerDisable(TIMERA0_BASE, TIMER_B);
    //Disable Interrupt
    MAP_TimerIntDisable(TIMERA0_BASE, TIMER_TIMB_TIMEOUT);
    MAP_TimerIntUnregister(TIMERA0_BASE, TIMER_B);
}
コード例 #3
0
ファイル: Tone.cpp プロジェクト: Aginorty/Energia
void noTone(uint8_t pin)
{
	uint8_t timer = digitalPinToTimer(pin);
	if(timer != tone_timer || timer == NOT_ON_TIMER)
		return;

	/* For whatever reason disabling a not enabled
	 * interrupt lands us in the FalutIsr.
	 * Work around is to check if the timer is running */
	if(tone_state == 2) {
		MAP_TimerIntDisable(TIMERA0_BASE, TIMER_TIMB_TIMEOUT);
		MAP_TimerDisable(TIMERA0_BASE, TIMER_B);
	}

	uint32_t base = TIMERA0_BASE + ((timer/2) << 12);
	uint16_t timerab = timer % 2 ? TIMER_B : TIMER_A;
	MAP_TimerDisable(base, timerab);

	tone_state = 0;
	current_pin = 0;
	g_duration = 0;

	pinMode(pin, OUTPUT);
	digitalWrite(pin, LOW);
}
コード例 #4
0
ファイル: Tone.cpp プロジェクト: Aginorty/Energia
void ToneIntHandler(void)
{
	MAP_TimerIntClear(TIMERA0_BASE, TIMER_B);

	if(--g_duration <= 0) {
		MAP_TimerIntDisable(TIMERA0_BASE, TIMER_TIMB_TIMEOUT);
		MAP_TimerDisable(TIMERA0_BASE, TIMER_B);
		noTone(current_pin);
	}
}
コード例 #5
0
ファイル: timer_if.c プロジェクト: Mindtribe/Leash-Debugger
//*****************************************************************************
//
//!    De-Initialize the timer
//!
//! \param uiGPTBaseAddr
//! \param ulTimer
//!
//! This function 
//!        1. disable the timer interrupts
//!        2. unregister the timer interrupt
//!
//!    \return None.
//
//*****************************************************************************
void Timer_IF_DeInit(unsigned long ulBase,unsigned long ulTimer)
{
    //
    // Disable the timer interrupt
    //
    MAP_TimerIntDisable(ulBase,TIMER_TIMA_TIMEOUT|TIMER_TIMB_TIMEOUT);
    //
    // Unregister the timer interrupt
    //
    MAP_TimerIntUnregister(ulBase,ulTimer);
}
コード例 #6
0
ファイル: hw_timer32.c プロジェクト: ArduCAM/Energia
static i32 hwt32_stop(struct hw_timer32* hwt)
{
        u32 status = 0;

        MAP_TimerDisable(hwt->base_addr, TIMER_A);
        MAP_TimerIntDisable(hwt->base_addr, hwt->irq_mask);

        status = MAP_TimerIntStatus(hwt->base_addr, true);
        MAP_TimerIntClear(hwt->base_addr, status);

        TimerValueSet(hwt->base_addr,TIMER_A,0x0);

        hwt32_set_op_mode(hwt, HW_TIMER_NOT_USED);

        hwt->irq_mask    = 0;
        hwt->n_rollovers = 0;
        hwt->sw_early_ro = false;

        hwt->mtone_expy.hi_32 = 0;
        hwt->mtone_expy.lo_32 = 0;

        return 0;
}
コード例 #7
0
ファイル: main.c プロジェクト: HogieRoll/occusensorplatform
//*****************************************************************************
//
//! \PerformIntTest
//!
//! Performs the repeated steps in running each test scenario.
//!
//! \param ucPriorityA0 is the interrupt priority to be used for Timer A0
//! \param ucPriorityA1 is the interrupt priority to be used for Timer A1
//! \param ucPriorityA2 is the interrupt priority to be used for Timer A2
//!
//! This function performs all the steps which are common to each test scenario
//! inside function InterruptTest.
//!
//! \return None.
//
//*****************************************************************************
tBoolean
PerformIntTest(unsigned long ulPriBits, unsigned char ucPriorityA0,
       unsigned char ucPriorityA1,unsigned char ucPriorityA2)
{
    tBoolean bRetcode;
    unsigned long ulStatus;
    
    //
    // Set the appropriate interrupt priorities.
    //
    MAP_IntPriorityGroupingSet(ulPriBits);
    MAP_IntPrioritySet(INT_TIMERA0A, ucPriorityA0);
    MAP_IntPrioritySet(INT_TIMERA1A, ucPriorityA1);
    MAP_IntPrioritySet(INT_TIMERA2A, ucPriorityA2);
    
    //
    // Clear any pending timer interrupts
    //
    ulStatus = MAP_TimerIntStatus(TIMERA0_BASE, false);
    MAP_TimerIntClear(TIMERA0_BASE, ulStatus);
    ulStatus = MAP_TimerIntStatus(TIMERA1_BASE, false);
    MAP_TimerIntClear(TIMERA1_BASE, ulStatus);
    ulStatus = MAP_TimerIntStatus(TIMERA2_BASE, false);
    MAP_TimerIntClear(TIMERA2_BASE, ulStatus);
    
    //
    // Clear all the counters and flags used by the interrupt handlers.
    //
    g_ulA0IntCount = 0;
    g_ulA1IntCount = 0;
    g_ulA2IntCount=0;
    g_bA1CountChanged = false;
    
    //
    // Enable three timer interrupts
    //
    MAP_TimerIntEnable(TIMERA0_BASE, TIMER_TIMA_TIMEOUT);
    MAP_TimerIntEnable(TIMERA1_BASE, TIMER_TIMA_TIMEOUT);
    MAP_TimerIntEnable(TIMERA2_BASE, TIMER_TIMA_TIMEOUT);
    
    //
    // Enable Timer A0
    //
    MAP_TimerEnable(TIMERA0_BASE, TIMER_A);
    
    //
    // Wait for Timer 0/A to fire.
    //
    bRetcode = UTUtilsWaitForCount(&g_ulA0IntCount, 1,
                                       ((SLOW_TIMER_DELAY_uS*3)/1000));
       
  
    //
    // Stop All timers and disable their interrupts
    //
    MAP_TimerDisable(TIMERA2_BASE, TIMER_A);
    MAP_TimerDisable(TIMERA1_BASE, TIMER_A);
    MAP_TimerDisable(TIMERA0_BASE, TIMER_A);
    MAP_TimerIntDisable(TIMERA2_BASE, TIMER_TIMA_TIMEOUT);
    MAP_TimerIntDisable(TIMERA1_BASE, TIMER_TIMA_TIMEOUT);
    MAP_TimerIntDisable(TIMERA0_BASE, TIMER_TIMA_TIMEOUT);

    return(bRetcode);
}
コード例 #8
0
// turn off the interrupts but don't turn of the timer because may
// be in use for pwm.
void OneMsTaskTimer::stop() {
  // disable interrupt
  MAP_TimerIntDisable(g_ulBase, TIMER_TIMA_TIMEOUT);
  MAP_TimerDisable(g_ulBase, TIMER_A);
}