You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
719 B

8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "pru_time.h"
  2. near uint32_t coreTimeTicks = 0;
  3. near uint32_t coreTempTicks = 0;
  4. uint32_t getTimeTicks( void ){
  5. coreTempTicks = CT_CTRL.CYCLE;
  6. return coreTimeTicks;
  7. };
  8. void resetTimeTicks( void ){
  9. //CT_CTRL.CONTROL_bit.CTR_EN = 0;
  10. //CT_CTRL.CYCLE = 6; // Not nul because of operational delay
  11. //CT_CTRL.CONTROL_bit.CTR_EN = 1;
  12. CT_CTRL.CTRL_bit.COUNTER_ENABLE = 0;
  13. CT_CTRL.CYCLE = 6; // Not nul because of operational delay
  14. CT_CTRL.CTRL_bit.COUNTER_ENABLE = 1;
  15. coreTempTicks = CT_CTRL.CYCLE;
  16. coreTimeTicks = 0;
  17. };
  18. void waitTimeTicks( uint32_t Ticks ){
  19. near uint32_t TT;
  20. //TT = CT_CTRL.CYCLE + Ticks;
  21. //while( CT_CTRL.CYCLE < TT );
  22. TT = 0;
  23. while( TT < Ticks )TT++;
  24. };