This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc1310怎么产生定时器中断,在RTOS系统中?

Other Parts Discussed in Thread: CC1310

我现在想要一个1s的定时器中断,在cc1310中并且在RTOS系统中怎么产生

  • cc1310属于无线系列芯片,请到以下论坛咨询。

    硬件, 射频和私有技术

  • HI,请参考:
    // Convenience macro to make the code more readable
    // Set Clock.tickPeriod in the .cfg file
    #define Clock_convertSecondsToTicks(seconds) \
        (((seconds) * 1000000) / (Clock_tickPeriod))
    
    
    // Solution 1
    // ----------
    // Reserve memory for the clock object
    Clock_Struct clock;
    
    uint32_t timeoutTicks = Clock_convertSecondsToTicks(30);
    
    // Create a one-shot timer
    Clock_construct(&clock, &Serial_TimerCallback, timeoutTicks, NULL);
    // Start the timer
    Clock_start(Clock_handle(&clock));
    
    // Solution 2
    // ----------
    uint32_t timeoutTicks = Clock_convertSecondsToTicks(30);
    
    // Create a one-shot timer somewhere on the heap
    Clock_Handle clock = Clock_create(&Serial_TimerCallback, timeoutTicks, NULL, NULL);
    
    // Start the timer
    Clock_start(clock);
    
    // Solution 3
    // ----------
    // Create a static clock object in the .cfg file
    // The init code is automatically generated by xdctools
    var clock0Params = new Clock.Params();
    clock0Params.instance.name = "clock";
    Program.global.clock = Clock.create("&Serial_TimerCallback", 30, clock0Params);
    
    // Start the clock somewhere in your program
    extern const Clock_Handle clock;
    Clock_start(clock);