hi,
i want to know about timer for ADC read in CC2540..
i set the timer for 4ms delay ,each time i read characterstics using UUID (0xB1FF) for LED ON and OFF ...
can u tell me how to set timer for LED blinking in cc2540 ?...
// makes sure LEDs are off
HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
// For keyfob board set GPIO pins into a power-optimized state
// Note that there is still some leakage current from the buzzer,
// accelerometer, LEDs, and buttons on the PCB.
P0SEL = 0; // Configure Port 0 as GPIO
P1SEL = 0x40; // Configure Port 1 as GPIO, except P1.6 for peripheral function for buzzer
P2SEL = 0; // Configure Port 2 as GPIO
P0DIR = 0xFC; // Port 0 pins P0.0 and P0.1 as input (buttons),
// all others (P0.2-P0.7) as output
P1DIR = 0xFF; // All port 1 pins (P1.0-P1.7) as output
P2DIR = 0x1F; // All port 1 pins (P2.0-P2.4) as output
P0 = 0x03; // All pins on port 0 to low except for P0.0 and P0.1 (buttons)
P1 = 0x00; // All pins on port 1 to low
P2 = 0; // All pins on port 2 to low
// initialize the ADC for battery reads
HalTimerInit();
HalAdcInit();
// Register for all key events - This app will handle all key events
RegisterForKeys( keyfobapp_TaskID );
// Setup a delayed profile startup
osal_start_timerEx( keyfobapp_TaskID, KEYFOB_START_DEVICE_EVT, STARTDELAY );
}
void HalTimerInit (void)
{
//uint16 compareValue=0xFFFF;
// Set prescaler divider value to 1 and free running mode
T1CTL|= 0x00;
// Set 0x0600 for 2ms timer interval
T1CC0L = 0x00;
T1CC0H = 0x06;
//start timer
T1CTL|=0x01;
//enable overflow interrupt ,Timer1 interrupt
T1STAT |= 0x00;
IEN1 |= 0x02;
}
HAL_ISR_FUNCTION(T1_ISR,T1_VECTOR)
{
//Function_todisplay();// Functiona has to called for every 2 sec
//Clear timer 1 interrupt enable
static uint8 TMR1_Count =0;
IEN1=0x00;
TMR1_Count++;
if(TMR1_Count ==2)
{
HalLedSet( (HAL_LED_1 ), HAL_LED_MODE_ON );
TMR1_Count=0;
}
}