RobertBerger

Arduino/FreeRTOS-1

Sep 19th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.11 KB | None | 0 0
  1. /*
  2.  * Setup the systick timer to generate the tick interrupts at the required
  3.  * frequency.
  4.  */
  5. __attribute__(( weak )) void vPortSetupTimerInterrupt( void )
  6. {
  7.   // can't replace weak version in same file
  8.   sysTickEnabled = 1; // WHG for Arduino
  9.   return;  // WHG
  10.         /* Calculate the constants required to configure the tick interrupt. */
  11.         #if configUSE_TICKLESS_IDLE == 1
  12.         {
  13.                 ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ );
  14.                 xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;
  15.                 ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );
  16.         }
  17.         #endif /* configUSE_TICKLESS_IDLE */
  18.  
  19.         /* Configure SysTick to interrupt at the requested rate. */
  20.         portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;
  21.         portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT );
  22. }
  23. /*-----------------------------------------------------------*/
Add Comment
Please, Sign In to add comment