|
|
|
@ -51,7 +51,6 @@ typedef uint16_t hal_timer_t;
|
|
|
|
|
#define TEMP_TIMER_NUM 2 // index of timer to use for temperature
|
|
|
|
|
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (F_CPU) // frequency of timers peripherals
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE 36 // prescaler for setting stepper timer, 2Mhz
|
|
|
|
|
#define HAL_STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
|
|
|
|
@ -107,7 +106,7 @@ void HAL_timer_disable_interrupt(uint8_t timer_num);
|
|
|
|
|
* Todo: Look at that possibility later.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static void HAL_timer_set_count (uint8_t timer_num, uint32_t count) {
|
|
|
|
|
FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
|
|
|
|
|
switch (timer_num) {
|
|
|
|
|
case STEP_TIMER_NUM:
|
|
|
|
|
StepperTimer.pause();
|
|
|
|
@ -126,7 +125,7 @@ FORCE_INLINE static void HAL_timer_set_count (uint8_t timer_num, uint32_t count)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
|
|
|
|
|
FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
|
|
|
|
hal_timer_t temp;
|
|
|
|
|
switch (timer_num) {
|
|
|
|
|
case STEP_TIMER_NUM:
|
|
|
|
@ -142,7 +141,7 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
|
|
|
|
|
FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
|
|
|
|
|
hal_timer_t temp;
|
|
|
|
|
switch (timer_num) {
|
|
|
|
|
case STEP_TIMER_NUM:
|
|
|
|
@ -159,9 +158,9 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//void HAL_timer_isr_prologue (uint8_t timer_num);
|
|
|
|
|
//void HAL_timer_isr_prologue (const uint8_t timer_num);
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static void HAL_timer_isr_prologue(uint8_t timer_num) {
|
|
|
|
|
FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
|
|
|
|
switch (timer_num) {
|
|
|
|
|
case STEP_TIMER_NUM:
|
|
|
|
|
StepperTimer.pause();
|
|
|
|
|