Select Git revision
hal_f2_timerA0.c
hal_f2_timerA0.c 8.53 KiB
/******************************************************************************
* Filename: hal_f2_timerA0.c
*
* Description: Timer abstration layer api
*
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*******************************************************************************/
#if defined (__MSP430G2553__)
#include "msp430.h"
#include "hal_timer.h"
unsigned char volatile timer_event;
unsigned long volatile time_counter = 0;
/******************************************************************************
* @fn hal_timer_init
*
* @brief Start packet timer using Timer using ACLK as reference
*
*
* input parameters
*
* @param unsigned int master_count - master packet timer value
*
* output parameters
*
* @return void
*
*/
void hal_timer_init(unsigned int master_count) {
// Start Timer 0 using the ACLK as a source (this enables the use of
// various low power modes). Timer 0 will be used to keep RF burst time
TACCR0 = master_count - 1; // Seting for MASTER SCHEDULE
TACCR1 = 0; // will be used for burst alignnment
TACCR2 = 0; // will be used for expiration counter
TACTL = TASSEL_1 + MC_1 + TACLR + ID_0;// ACLK, Up to CCR0, clear TB0R, div/1
return;
}