Jump to content
43oh

Recommended Posts

Hi everyone. I just got a cc3200 launchpad and am coding on a Mac with Energia. I'm impressed with what this setup can do.

 

I'm trying to get a handle on how on how to how to use the timer functions to create one-shots or functions called at specific intervals. I can find references in Energia.h and driverlib/timer.h but no docs or samples. If anyone has any tips on getting started please pass them on, I'd appreciate it.

 

Looking forward to coding...

 

- eric

Link to post
Share on other sites

Welcome!

 

Next release 16 of Energia will bring RTOS to the CC3200 board.

 

Very easy to use a timer with the Clock library. 

 

Have a look at the example at Exploring RTOS and the Clock Library with a commented example.

myClockR.begin(clockFunctionR, 1000, 100);

This single line creates a clock with clockFunctionR. The function is called the first time after 1000 ms of delay, and then every 100 ms.

 

Have fun!

Link to post
Share on other sites

I did, in the meantime, manage to get an imperfect, but working Timer. The implementation uses timer.h, and sort of falls in between your 2 suggestions. 

 

void initTimer(unsigned hz) {
    PRCMPeripheralClkEnable(TASK_TIMER_PERIPHERAL, PRCM_RUN_MODE_CLK);
    PRCMPeripheralReset(TASK_TIMER_PERIPHERAL);
    TimerConfigure(TASK_TIMER_BASE_ADDR, TIMER_CFG_PERIODIC);
    TimerLoadSet(TASK_TIMER_BASE_ADDR, TIMER_A, msToClockTicks(hz,TASK_TIMER_PRESCALER));
    TimerIntRegister(TASK_TIMER_BASE_ADDR, TIMER_A, &handleTaskTimerInterrupt);
    TimerIntEnable(TASK_TIMER_BASE_ADDR, TIMER_TIMA_TIMEOUT);
    TimerEnable(TASK_TIMER_BASE_ADDR, TIMER_A);
}
 
I've found it a little hard to find documentation and sample code -- both of your examples were really helpful!
 
eric
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...