Put FORCE_INLINE before static

This commit is contained in:
Scott Lahteine 2017-12-08 00:37:09 -06:00
parent 43ea265b78
commit de3d3b9cb1
9 changed files with 42 additions and 42 deletions

View file

@ -121,10 +121,10 @@
FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; } FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
#endif #endif
static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); } FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); }
static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); } FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
static FORCE_INLINE void print(const char* str) { write(str); } FORCE_INLINE static void print(const char* str) { write(str); }
static void print(char, int = BYTE); static void print(char, int = BYTE);
static void print(unsigned char, int = BYTE); static void print(unsigned char, int = BYTE);

View file

@ -87,17 +87,17 @@ extern const tTimerConfig TimerConfig[];
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); 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 uint32_t count) { FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
const tTimerConfig *pConfig = &TimerConfig[timer_num]; const tTimerConfig *pConfig = &TimerConfig[timer_num];
pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count; pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
const tTimerConfig *pConfig = &TimerConfig[timer_num]; const tTimerConfig *pConfig = &TimerConfig[timer_num];
return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC; return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
} }
static FORCE_INLINE uint32_t HAL_timer_get_current_count(const uint8_t timer_num) { FORCE_INLINE static uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
const tTimerConfig *pConfig = &TimerConfig[timer_num]; const tTimerConfig *pConfig = &TimerConfig[timer_num];
return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV; return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
} }
@ -107,7 +107,7 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num);
//void HAL_timer_isr_prologue(const uint8_t timer_num); //void HAL_timer_isr_prologue(const uint8_t timer_num);
static FORCE_INLINE void HAL_timer_isr_prologue(const uint8_t timer_num) { FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
const tTimerConfig *pConfig = &TimerConfig[timer_num]; const tTimerConfig *pConfig = &TimerConfig[timer_num];
// Reading the status register clears the interrupt flag // Reading the status register clears the interrupt flag
pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR; pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;

View file

@ -107,10 +107,10 @@ public:
FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; } FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
#endif #endif
static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); } FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); }
static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); } FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
static FORCE_INLINE void print(const char* str) { write(str); } FORCE_INLINE static void print(const char* str) { write(str); }
static void print(char, int = BYTE); static void print(char, int = BYTE);
static void print(unsigned char, int = BYTE); static void print(unsigned char, int = BYTE);

View file

@ -77,7 +77,7 @@ typedef uint32_t hal_timer_t;
void HAL_timer_init(void); void HAL_timer_init(void);
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); 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 hal_timer_t count) { FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
switch (timer_num) { switch (timer_num) {
case 0: case 0:
LPC_TIM0->MR0 = count; LPC_TIM0->MR0 = count;
@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const hal_
} }
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
switch (timer_num) { switch (timer_num) {
case 0: return LPC_TIM0->MR0; case 0: return LPC_TIM0->MR0;
case 1: return LPC_TIM1->MR0; case 1: return LPC_TIM1->MR0;
@ -100,7 +100,7 @@ static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
return 0; return 0;
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
switch (timer_num) { switch (timer_num) {
case 0: return LPC_TIM0->TC; case 0: return LPC_TIM0->TC;
case 1: return LPC_TIM1->TC; case 1: return LPC_TIM1->TC;

View file

@ -107,7 +107,7 @@ void HAL_timer_disable_interrupt(uint8_t timer_num);
* Todo: Look at that possibility later. * Todo: Look at that possibility later.
*/ */
static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count) { FORCE_INLINE static void HAL_timer_set_count (uint8_t timer_num, uint32_t count) {
switch (timer_num) { switch (timer_num) {
case STEP_TIMER_NUM: case STEP_TIMER_NUM:
StepperTimer.pause(); StepperTimer.pause();
@ -126,7 +126,7 @@ static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count)
} }
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_count (uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
hal_timer_t temp; hal_timer_t temp;
switch (timer_num) { switch (timer_num) {
case STEP_TIMER_NUM: case STEP_TIMER_NUM:
@ -142,7 +142,7 @@ static FORCE_INLINE hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
return temp; return temp;
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
hal_timer_t temp; hal_timer_t temp;
switch (timer_num) { switch (timer_num) {
case STEP_TIMER_NUM: case STEP_TIMER_NUM:
@ -161,7 +161,7 @@ static FORCE_INLINE 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 (uint8_t timer_num);
static FORCE_INLINE void HAL_timer_isr_prologue(uint8_t timer_num) { FORCE_INLINE static void HAL_timer_isr_prologue(uint8_t timer_num) {
switch (timer_num) { switch (timer_num) {
case STEP_TIMER_NUM: case STEP_TIMER_NUM:
StepperTimer.pause(); StepperTimer.pause();

View file

@ -75,14 +75,14 @@ typedef uint32_t hal_timer_t;
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); 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 uint32_t count) { FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
switch(timer_num) { switch(timer_num) {
case 0: FTM0_C0V = count; break; case 0: FTM0_C0V = count; break;
case 1: FTM1_C0V = count; break; case 1: FTM1_C0V = count; break;
} }
} }
static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
switch(timer_num) { switch(timer_num) {
case 0: return FTM0_C0V; case 0: return FTM0_C0V;
case 1: return FTM1_C0V; case 1: return FTM1_C0V;
@ -90,7 +90,7 @@ static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
return 0; return 0;
} }
static FORCE_INLINE uint32_t HAL_timer_get_current_count(const uint8_t timer_num) { FORCE_INLINE static uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
switch(timer_num) { switch(timer_num) {
case 0: return FTM0_CNT; case 0: return FTM0_CNT;
case 1: return FTM1_CNT; case 1: return FTM1_CNT;

View file

@ -282,7 +282,7 @@ public:
static void process_parsed_command(); static void process_parsed_command();
static void process_next_command(); static void process_next_command();
static FORCE_INLINE void home_all_axes() { G28(true); } FORCE_INLINE static void home_all_axes() { G28(true); }
/** /**
* Multi-stepper support for M92, M201, M203 * Multi-stepper support for M92, M201, M203

View file

@ -392,7 +392,7 @@ class Planner {
* fr_mm_s - (target) speed of the move (mm/s) * fr_mm_s - (target) speed of the move (mm/s)
* extruder - target extruder * extruder - target extruder
*/ */
static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) { FORCE_INLINE static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
#if PLANNER_LEVELING && IS_CARTESIAN #if PLANNER_LEVELING && IS_CARTESIAN
apply_leveling(rx, ry, rz); apply_leveling(rx, ry, rz);
#endif #endif
@ -408,7 +408,7 @@ class Planner {
* fr_mm_s - (target) speed of the move (mm/s) * fr_mm_s - (target) speed of the move (mm/s)
* extruder - target extruder * extruder - target extruder
*/ */
static FORCE_INLINE void buffer_line_kinematic(const float cart[XYZE], const float &fr_mm_s, const uint8_t extruder) { FORCE_INLINE static void buffer_line_kinematic(const float cart[XYZE], const float &fr_mm_s, const uint8_t extruder) {
#if PLANNER_LEVELING #if PLANNER_LEVELING
float raw[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] }; float raw[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] };
apply_leveling(raw); apply_leveling(raw);
@ -432,7 +432,7 @@ class Planner {
* *
* Clears previous speed values. * Clears previous speed values.
*/ */
static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) { FORCE_INLINE static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
#if PLANNER_LEVELING && IS_CARTESIAN #if PLANNER_LEVELING && IS_CARTESIAN
apply_leveling(rx, ry, rz); apply_leveling(rx, ry, rz);
#endif #endif
@ -440,8 +440,8 @@ class Planner {
} }
static void set_position_mm_kinematic(const float position[NUM_AXIS]); static void set_position_mm_kinematic(const float position[NUM_AXIS]);
static void set_position_mm(const AxisEnum axis, const float &v); static void set_position_mm(const AxisEnum axis, const float &v);
static FORCE_INLINE void set_z_position_mm(const float &z) { set_position_mm(Z_AXIS, z); } FORCE_INLINE static void set_z_position_mm(const float &z) { set_position_mm(Z_AXIS, z); }
static FORCE_INLINE void set_e_position_mm(const float &e) { set_position_mm(AxisEnum(E_AXIS), e); } FORCE_INLINE static void set_e_position_mm(const float &e) { set_position_mm(AxisEnum(E_AXIS), e); }
/** /**
* Sync from the stepper positions. (e.g., after an interrupted move) * Sync from the stepper positions. (e.g., after an interrupted move)

View file

@ -199,7 +199,7 @@ class Stepper {
// SCARA AB axes are in degrees, not mm // SCARA AB axes are in degrees, not mm
// //
#if IS_SCARA #if IS_SCARA
static FORCE_INLINE float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); } FORCE_INLINE static float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); }
#endif #endif
// //
@ -221,7 +221,7 @@ class Stepper {
// //
// The direction of a single motor // The direction of a single motor
// //
static FORCE_INLINE bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); } FORCE_INLINE static bool motor_direction(AxisEnum axis) { return TEST(last_direction_bits, axis); }
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
static void digitalPotWrite(const int16_t address, const int16_t value); static void digitalPotWrite(const int16_t address, const int16_t value);
@ -235,21 +235,21 @@ class Stepper {
#endif #endif
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)
static FORCE_INLINE void set_homing_flag_x(const bool state) { performing_homing = state; } FORCE_INLINE static void set_homing_flag_x(const bool state) { performing_homing = state; }
static FORCE_INLINE void set_x_lock(const bool state) { locked_x_motor = state; } FORCE_INLINE static void set_x_lock(const bool state) { locked_x_motor = state; }
static FORCE_INLINE void set_x2_lock(const bool state) { locked_x2_motor = state; } FORCE_INLINE static void set_x2_lock(const bool state) { locked_x2_motor = state; }
#endif #endif
#if ENABLED(Y_DUAL_ENDSTOPS) #if ENABLED(Y_DUAL_ENDSTOPS)
static FORCE_INLINE void set_homing_flag_y(const bool state) { performing_homing = state; } FORCE_INLINE static void set_homing_flag_y(const bool state) { performing_homing = state; }
static FORCE_INLINE void set_y_lock(const bool state) { locked_y_motor = state; } FORCE_INLINE static void set_y_lock(const bool state) { locked_y_motor = state; }
static FORCE_INLINE void set_y2_lock(const bool state) { locked_y2_motor = state; } FORCE_INLINE static void set_y2_lock(const bool state) { locked_y2_motor = state; }
#endif #endif
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
static FORCE_INLINE void set_homing_flag_z(const bool state) { performing_homing = state; } FORCE_INLINE static void set_homing_flag_z(const bool state) { performing_homing = state; }
static FORCE_INLINE void set_z_lock(const bool state) { locked_z_motor = state; } FORCE_INLINE static void set_z_lock(const bool state) { locked_z_motor = state; }
static FORCE_INLINE void set_z2_lock(const bool state) { locked_z2_motor = state; } FORCE_INLINE static void set_z2_lock(const bool state) { locked_z2_motor = state; }
#endif #endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
@ -268,7 +268,7 @@ class Stepper {
// //
// Triggered position of an axis in mm (not core-savvy) // Triggered position of an axis in mm (not core-savvy)
// //
static FORCE_INLINE float triggered_position_mm(AxisEnum axis) { FORCE_INLINE static float triggered_position_mm(AxisEnum axis) {
return endstops_trigsteps[axis] * planner.steps_to_mm[axis]; return endstops_trigsteps[axis] * planner.steps_to_mm[axis];
} }
@ -278,7 +278,7 @@ class Stepper {
private: private:
static FORCE_INLINE hal_timer_t calc_timer(hal_timer_t step_rate) { FORCE_INLINE static hal_timer_t calc_timer(hal_timer_t step_rate) {
hal_timer_t timer; hal_timer_t timer;
NOMORE(step_rate, MAX_STEP_FREQUENCY); NOMORE(step_rate, MAX_STEP_FREQUENCY);
@ -347,7 +347,7 @@ class Stepper {
// Initialize the trapezoid generator from the current block. // Initialize the trapezoid generator from the current block.
// Called whenever a new block begins. // Called whenever a new block begins.
static FORCE_INLINE void trapezoid_generator_reset() { FORCE_INLINE static void trapezoid_generator_reset() {
static int8_t last_extruder = -1; static int8_t last_extruder = -1;