Fix name collision. timer_t => hal_timer_t

2.0.x
Scott Lahteine 7 years ago
parent c8dfa26bc8
commit 2246316605

@ -66,7 +66,7 @@
// Types
// --------------------------------------------------------------------------
typedef uint16_t timer_t;
typedef uint16_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFF
typedef int8_t pin_t;

@ -40,7 +40,7 @@
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint32_t timer_t;
typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
#define STEP_TIMER_NUM 3 // index of timer to use for stepper
@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint
pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
}
static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
const tTimerConfig *pConfig = &TimerConfig[timer_num];
return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
}

@ -40,7 +40,7 @@
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint32_t timer_t;
typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
@ -77,7 +77,7 @@ typedef uint32_t timer_t;
void HAL_timer_init(void);
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const timer_t count) {
static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
switch (timer_num) {
case 0:
LPC_TIM0->MR0 = count;
@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const time
}
}
static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
switch (timer_num) {
case 0: return LPC_TIM0->MR0;
case 1: return LPC_TIM1->MR0;
@ -100,7 +100,7 @@ static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
return 0;
}
static FORCE_INLINE timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
switch (timer_num) {
case 0: return LPC_TIM0->TC;
case 1: return LPC_TIM1->TC;

@ -43,7 +43,7 @@
*/
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint16_t timer_t;
typedef uint16_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFF
#define STEP_TIMER_NUM 5 // index of timer to use for stepper
@ -126,8 +126,8 @@ static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count)
}
}
static FORCE_INLINE timer_t HAL_timer_get_count (uint8_t timer_num) {
timer_t temp;
static FORCE_INLINE hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
hal_timer_t temp;
switch (timer_num) {
case STEP_TIMER_NUM:
temp = StepperTimer.getCompare(STEP_TIMER_CHAN);
@ -142,8 +142,8 @@ static FORCE_INLINE timer_t HAL_timer_get_count (uint8_t timer_num) {
return temp;
}
static FORCE_INLINE timer_t HAL_timer_get_current_count(uint8_t timer_num) {
timer_t temp;
static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
hal_timer_t temp;
switch (timer_num) {
case STEP_TIMER_NUM:
temp = StepperTimer.getCount();

@ -40,7 +40,7 @@
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint32_t timer_t;
typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
#define STEP_TIMER_NUM 0
@ -82,7 +82,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint
}
}
static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
switch(timer_num) {
case 0: return FTM0_C0V;
case 1: return FTM1_C0V;

@ -120,9 +120,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
#if ENABLED(LIN_ADVANCE)
constexpr timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
constexpr hal_timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
timer_t Stepper::nextMainISR = 0,
hal_timer_t Stepper::nextMainISR = 0,
Stepper::nextAdvanceISR = ADV_NEVER,
Stepper::eISR_Rate = ADV_NEVER;
@ -137,9 +137,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
* This fix isn't perfect and may lose steps - but better than locking up completely
* in future the planner should slow down if advance stepping rate would be too high
*/
FORCE_INLINE timer_t adv_rate(const int steps, const timer_t timer, const uint8_t loops) {
FORCE_INLINE hal_timer_t adv_rate(const int steps, const hal_timer_t timer, const uint8_t loops) {
if (steps) {
const timer_t rate = (timer * loops) / abs(steps);
const hal_timer_t rate = (timer * loops) / abs(steps);
//return constrain(rate, 1, ADV_NEVER - 1)
return rate ? rate : 1;
}
@ -157,9 +157,9 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
long Stepper::counter_m[MIXING_STEPPERS];
#endif
timer_t Stepper::acc_step_rate; // needed for deceleration start point
hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point
uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
timer_t Stepper::OCR1A_nominal;
hal_timer_t Stepper::OCR1A_nominal;
volatile long Stepper::endstops_trigsteps[XYZ];
@ -341,7 +341,7 @@ HAL_STEP_TIMER_ISR {
void Stepper::isr() {
timer_t ocr_val;
hal_timer_t ocr_val;
#define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
#define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms
@ -677,7 +677,7 @@ void Stepper::isr() {
NOMORE(acc_step_rate, current_block->nominal_rate);
// step_rate to timer interval
const timer_t timer = calc_timer(acc_step_rate);
const hal_timer_t timer = calc_timer(acc_step_rate);
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
_NEXT_ISR(ocr_val);
@ -699,7 +699,7 @@ void Stepper::isr() {
#endif // LIN_ADVANCE
}
else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
timer_t step_rate;
hal_timer_t step_rate;
#ifdef CPU_32_BIT
MultiU32X24toH32(step_rate, deceleration_time, current_block->acceleration_rate);
#else
@ -714,7 +714,7 @@ void Stepper::isr() {
step_rate = current_block->final_rate;
// step_rate to timer interval
const timer_t timer = calc_timer(step_rate);
const hal_timer_t timer = calc_timer(step_rate);
SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL
_NEXT_ISR(ocr_val);
@ -754,7 +754,7 @@ void Stepper::isr() {
#if DISABLED(LIN_ADVANCE)
#ifdef CPU_32_BIT
// Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
hal_timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
stepper_timer_current_count = HAL_timer_get_current_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US;
HAL_timer_set_count(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count));
#else

@ -97,7 +97,7 @@ class Stepper {
static volatile uint32_t step_events_completed; // The number of step events executed in the current block
#if ENABLED(LIN_ADVANCE)
static timer_t nextMainISR, nextAdvanceISR, eISR_Rate;
static hal_timer_t nextMainISR, nextAdvanceISR, eISR_Rate;
#define _NEXT_ISR(T) nextMainISR = T
static volatile int e_steps[E_STEPPERS];
@ -112,9 +112,9 @@ class Stepper {
static long acceleration_time, deceleration_time;
//unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
static timer_t acc_step_rate; // needed for deceleration start point
static hal_timer_t acc_step_rate; // needed for deceleration start point
static uint8_t step_loops, step_loops_nominal;
static timer_t OCR1A_nominal;
static hal_timer_t OCR1A_nominal;
static volatile long endstops_trigsteps[XYZ];
static volatile long endstops_stepsTotal, endstops_stepsDone;
@ -277,8 +277,8 @@ class Stepper {
private:
static FORCE_INLINE timer_t calc_timer(timer_t step_rate) {
timer_t timer;
static FORCE_INLINE hal_timer_t calc_timer(hal_timer_t step_rate) {
hal_timer_t timer;
NOMORE(step_rate, MAX_STEP_FREQUENCY);

Loading…
Cancel
Save