MSP430™CapTIvateSoftwareLibraryAPIGuide 1_70_00_03

Data Structures | Macros | Enumerations | Functions | Variables
FunctionTimer

Timer based communication time-out management. More...

## Data Structures
struct | tFunctionTimer

## Macros
#define | HWREG16(x) (*((volatile uint16_t *)((uint16_t)x)))
#define | TIMER__CCR0_VECTOR (TIMER0_A0_VECTOR)
#define | TIMER__CCR1_VECTOR (TIMER0_A1_VECTOR)
#define | FUNCTIONTIMER__PERIPHERAL (TIMER_A0_BASE)
#define | FUNCTIONTIMER__CLOCK (TASSEL__ACLK)
#define | FUNCTIONTIMER__DIVIDER (ID__1)
#define | FUNCTIONTIMER__EXDIVIDER (TAIDEX_0)
#define | FUNCTIONTIMER__LPM_CLEAR (LPM3_bits)

## Enumerations
enum | tFunctionTimerSelection { eTimerDelayedFunction_A, eTimerDelayedFunction_B }
| enumerates the available function delays. More...

## Functions
void | Timer_startDelayedFunctionTimer (const tFunctionTimer *pFunctionTimer)
void | Timer_stopDelayedFunctionTimer (void)
| This function stops the Timer_A. More...
void | Timer_scheduleDelayedFunction (uint8_t ui8Function)
void | Timer_cancelDelayedFunction (uint8_t ui8Function)
__interrupt void | FunctionTimer_A_ISR (void)
__interrupt void | FunctionTimer_B_ISR (void)

## Variables
const tFunctionTimer * | g_pFunctionTimer

## Detailed Description

Timer based communication time-out management.

The function timer provides a mechanism to call a function in the foreground (from an ISR) after a specified delay, specified in timer cycles. One Timer_A instance is required. Up to two delayed functions may be registered at the same time (Function A and Function B) with each having a different delay. A Timer_A instance with at least a CCR0 and CCR1 unit is required.

Version
  VERSION Released on RELEASE_DATE

This is the function timer module definitions file. The function timer provides a mechanism to call a function in the foreground (from an ISR) after a specified delay, specified in timer cycles. One Timer_A instance is required. Up to two delayed functions may be registered at the same time (Function A and Function B) with each having a different delay. A Timer_A instance with at least a CCR0 and CCR1 unit is required.

Version
  VERSION Released on RELEASE_DATE

## Macro Definition Documentation

## § HWREG16

#define HWREG16 | ( |  | x | ) | (*((volatile uint16_t *)((uint16_t)x)))

Referenced by FunctionTimer_A_ISR(), FunctionTimer_B_ISR(), Timer_cancelDelayedFunction(), Timer_scheduleDelayedFunction(), Timer_startDelayedFunctionTimer(), and Timer_stopDelayedFunctionTimer().

## § TIMER__CCR0_VECTOR

#define TIMER__CCR0_VECTOR (TIMER0_A0_VECTOR)

## § TIMER__CCR1_VECTOR

#define TIMER__CCR1_VECTOR (TIMER0_A1_VECTOR)

## § FUNCTIONTIMER__PERIPHERAL

#define FUNCTIONTIMER__PERIPHERAL (TIMER_A0_BASE)

Referenced by FunctionTimer_A_ISR(), FunctionTimer_B_ISR(), Timer_cancelDelayedFunction(), Timer_scheduleDelayedFunction(), Timer_startDelayedFunctionTimer(), and Timer_stopDelayedFunctionTimer().

## § FUNCTIONTIMER__CLOCK

#define FUNCTIONTIMER__CLOCK (TASSEL__ACLK)

Referenced by Timer_startDelayedFunctionTimer().

## § FUNCTIONTIMER__DIVIDER

#define FUNCTIONTIMER__DIVIDER (ID__1)

Referenced by Timer_startDelayedFunctionTimer().

## § FUNCTIONTIMER__EXDIVIDER

#define FUNCTIONTIMER__EXDIVIDER (TAIDEX_0)

Referenced by Timer_startDelayedFunctionTimer().

## § FUNCTIONTIMER__LPM_CLEAR

#define FUNCTIONTIMER__LPM_CLEAR (LPM3_bits)

Referenced by FunctionTimer_A_ISR(), and FunctionTimer_B_ISR().

## Enumeration Type Documentation

## § tFunctionTimerSelection

enum tFunctionTimerSelection

enumerates the available function delays.

Enumerator
eTimerDelayedFunction_A |
eTimerDelayedFunction_B |

## Function Documentation

## § Timer_startDelayedFunctionTimer()

void Timer_startDelayedFunctionTimer | ( | const tFunctionTimer * | pFunctionTimer | ) |

This function registers the tFunctionTimer configuration structure with the module, so that the module knows the delays and function pointers. It then starts the Timer_A instance counting in continuous mode.

Parameters

  pFunctionTimer | is a pointer to the function timer configuration structure to use.

Returns
  none

References FUNCTIONTIMER__CLOCK, FUNCTIONTIMER__DIVIDER, FUNCTIONTIMER__EXDIVIDER, FUNCTIONTIMER__PERIPHERAL, HWREG16, and Timer_stopDelayedFunctionTimer().

Referenced by I2CSlave_openPort().

## § Timer_stopDelayedFunctionTimer()

void Timer_stopDelayedFunctionTimer | ( | void |  | ) |

This function stops the Timer_A.

Parameters
  none

Returns
  none

References FUNCTIONTIMER__PERIPHERAL, and HWREG16.

Referenced by I2CSlave_closePort(), and Timer_startDelayedFunctionTimer().

## § Timer_scheduleDelayedFunction()

void Timer_scheduleDelayedFunction | ( | uint8_t | ui8Function | ) |

This function starts the delay for the passed function (A or B), which will then be called after the expiration of the delay.

Parameters

  ui8Function | specifies the function to schedule (A or B).

Returns
  none

References eTimerDelayedFunction_A, eTimerDelayedFunction_B, FUNCTIONTIMER__PERIPHERAL, HWREG16, tFunctionTimer::ui16FunctionDelay_A, and tFunctionTimer::ui16FunctionDelay_B.

Referenced by I2CSlave_setRequestFlag().

## § Timer_cancelDelayedFunction()

void Timer_cancelDelayedFunction | ( | uint8_t | ui8Function | ) |

This function cancels a scheduled function if the delay has not already expired. If the delay has expired, this function has no effect.

Parameters

  ui8Function | specifies the function to cancel (A or B).

Returns
  none

References eTimerDelayedFunction_A, eTimerDelayedFunction_B, FUNCTIONTIMER__PERIPHERAL, and HWREG16.

Referenced by I2CSlave_setRequestFlag().

## § FunctionTimer_A_ISR()

__interrupt void FunctionTimer_A_ISR | ( | void |  | ) |

References FUNCTIONTIMER__LPM_CLEAR, FUNCTIONTIMER__PERIPHERAL, HWREG16, and tFunctionTimer::pbFunction_A.

## § FunctionTimer_B_ISR()

__interrupt void FunctionTimer_B_ISR | ( | void |  | ) |

References FUNCTIONTIMER__LPM_CLEAR, FUNCTIONTIMER__PERIPHERAL, HWREG16, and tFunctionTimer::pbFunction_B.

## Variable Documentation

## § g_pFunctionTimer

const tFunctionTimer* g_pFunctionTimer

const g_pFunctionTimer stores a pointer to the current tFunctionTimer instance associated with this module. The memory pointed to by this variable must not be modified between when Timer_startDelayedFunctionTimer() is called and Timer_stopDelayedFunctionTimer() is called.

© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale