Use _BV macros, patch up others

master
Scott Lahteine 9 years ago
parent 209f5f21e0
commit ff13070b59

@ -217,12 +217,12 @@ void Stop();
* Debug flags - not yet widely applied
*/
enum DebugFlags {
DEBUG_ECHO = BIT(0),
DEBUG_INFO = BIT(1),
DEBUG_ERRORS = BIT(2),
DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4),
DEBUG_LEVELING = BIT(5)
DEBUG_ECHO = _BV(0),
DEBUG_INFO = _BV(1),
DEBUG_ERRORS = _BV(2),
DEBUG_DRYRUN = _BV(3),
DEBUG_COMMUNICATION = _BV(4),
DEBUG_LEVELING = _BV(5)
};
extern uint8_t marlin_debug_flags;

@ -79,7 +79,7 @@ void MarlinSerial::begin(long baud) {
#endif
if (useU2X) {
M_UCSRxA = BIT(M_U2Xx);
M_UCSRxA = _BV(M_U2Xx);
baud_setting = (F_CPU / 4 / baud - 1) / 2;
}
else {

@ -1608,8 +1608,8 @@ static void setup_for_endstop_move() {
enum ProbeAction {
ProbeStay = 0,
ProbeDeploy = BIT(0),
ProbeStow = BIT(1),
ProbeDeploy = _BV(0),
ProbeStow = _BV(1),
ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
};
@ -6461,33 +6461,33 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
return;
}
float nx, ny, ne, normalized_dist;
if (ix > pix && (x_splits) & BIT(ix)) {
if (ix > pix && TEST(x_splits, ix)) {
nx = mbl.get_x(ix);
normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
x_splits ^= BIT(ix);
CBI(x_splits, ix);
}
else if (ix < pix && (x_splits) & BIT(pix)) {
else if (ix < pix && TEST(x_splits, pix)) {
nx = mbl.get_x(pix);
normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
x_splits ^= BIT(pix);
CBI(x_splits, pix);
}
else if (iy > piy && (y_splits) & BIT(iy)) {
else if (iy > piy && TEST(y_splits, iy)) {
ny = mbl.get_y(iy);
normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
y_splits ^= BIT(iy);
CBI(y_splits, iy);
}
else if (iy < piy && (y_splits) & BIT(piy)) {
else if (iy < piy && TEST(y_splits, piy)) {
ny = mbl.get_y(piy);
normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
y_splits ^= BIT(piy);
CBI(y_splits, piy);
}
else {
// Already split on a border

@ -35,8 +35,8 @@
*/
static void spiInit(uint8_t spiRate) {
// See avr processor documentation
SPCR = BIT(SPE) | BIT(MSTR) | (spiRate >> 1);
SPSR = spiRate & 1 || spiRate == 6 ? 0 : BIT(SPI2X);
SPCR = _BV(SPE) | _BV(MSTR) | (spiRate >> 1);
SPSR = spiRate & 1 || spiRate == 6 ? 0 : _BV(SPI2X);
}
//------------------------------------------------------------------------------
/** SPI receive a byte */

@ -405,10 +405,10 @@ static inline __attribute__((always_inline))
void setPinMode(uint8_t pin, uint8_t mode) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (mode) {
*digitalPinMap[pin].ddr |= BIT(digitalPinMap[pin].bit);
SBI(*digitalPinMap[pin].ddr, digitalPinMap[pin].bit);
}
else {
*digitalPinMap[pin].ddr &= ~BIT(digitalPinMap[pin].bit);
CBI(*digitalPinMap[pin].ddr, digitalPinMap[pin].bit);
}
}
else {
@ -428,10 +428,10 @@ static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, uint8_t value) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (value) {
*digitalPinMap[pin].port |= BIT(digitalPinMap[pin].bit);
SBI(*digitalPinMap[pin].port, digitalPinMap[pin].bit);
}
else {
*digitalPinMap[pin].port &= ~BIT(digitalPinMap[pin].bit);
CBI(*digitalPinMap[pin].port, digitalPinMap[pin].bit);
}
}
else {

@ -364,7 +364,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
blocksPerCluster_ = fbs->sectorsPerCluster;
// determine shift that is same as multiply by blocksPerCluster_
clusterSizeShift_ = 0;
while (blocksPerCluster_ != BIT(clusterSizeShift_)) {
while (blocksPerCluster_ != _BV(clusterSizeShift_)) {
// error if not power of 2
if (clusterSizeShift_++ > 7) goto fail;
}

@ -22,9 +22,9 @@
#define BLEN_A 0
#define BLEN_B 1
#define BLEN_C 2
#define EN_A BIT(BLEN_A)
#define EN_B BIT(BLEN_B)
#define EN_C BIT(BLEN_C)
#define EN_A (_BV(BLEN_A))
#define EN_B (_BV(BLEN_B))
#define EN_C (_BV(BLEN_C))
#define LCD_CLICKED (buttons&EN_C)
#endif

@ -580,23 +580,23 @@ float junction_deviation = 0.1;
// Compute direction bits for this block
uint8_t db = 0;
#if ENABLED(COREXY)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
if (dz < 0) db |= BIT(Z_AXIS);
if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
if (dx < 0) SBI(db, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) SBI(db, Y_HEAD); // ...and Y
if (dz < 0) SBI(db, Z_AXIS);
if (dx + dy < 0) SBI(db, A_AXIS); // Motor A direction
if (dx - dy < 0) SBI(db, B_AXIS); // Motor B direction
#elif ENABLED(COREXZ)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
if (dx + dz < 0) db |= BIT(A_AXIS); // Motor A direction
if (dx - dz < 0) db |= BIT(C_AXIS); // Motor B direction
if (dx < 0) SBI(db, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) SBI(db, Y_AXIS);
if (dz < 0) SBI(db, Z_HEAD); // ...and Z
if (dx + dz < 0) SBI(db, A_AXIS); // Motor A direction
if (dx - dz < 0) SBI(db, C_AXIS); // Motor B direction
#else
if (dx < 0) db |= BIT(X_AXIS);
if (dy < 0) db |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_AXIS);
if (dx < 0) SBI(db, X_AXIS);
if (dy < 0) SBI(db, Y_AXIS);
if (dz < 0) SBI(db, Z_AXIS);
#endif
if (de < 0) db |= BIT(E_AXIS);
if (de < 0) SBI(db, E_AXIS);
block->direction_bits = db;
block->active_extruder = extruder;
@ -824,14 +824,14 @@ float junction_deviation = 0.1;
ys1 = axis_segment_time[Y_AXIS][1],
ys2 = axis_segment_time[Y_AXIS][2];
if ((direction_change & BIT(X_AXIS)) != 0) {
if (TEST(direction_change, X_AXIS)) {
xs2 = axis_segment_time[X_AXIS][2] = xs1;
xs1 = axis_segment_time[X_AXIS][1] = xs0;
xs0 = 0;
}
xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time;
if ((direction_change & BIT(Y_AXIS)) != 0) {
if (TEST(direction_change, Y_AXIS)) {
ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1];
ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0];
ys0 = 0;

@ -139,12 +139,12 @@ static void initISR(timer16_Sequence_t timer) {
TCCR1B = _BV(CS11); // set prescaler of 8
TCNT1 = 0; // clear the timer count
#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
TIFR |= _BV(OCF1A); // clear any pending interrupts;
TIMSK |= _BV(OCIE1A); // enable the output compare interrupt
SBI(TIFR, OCF1A); // clear any pending interrupts;
SBI(TIMSK, OCIE1A); // enable the output compare interrupt
#else
// here if not ATmega8 or ATmega128
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
TIMSK1 |= _BV(OCIE1A); // enable the output compare interrupt
SBI(TIFR1, OCF1A); // clear any pending interrupts;
SBI(TIMSK1, OCIE1A); // enable the output compare interrupt
#endif
#ifdef WIRING
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
@ -158,8 +158,8 @@ static void initISR(timer16_Sequence_t timer) {
TCCR3B = _BV(CS31); // set prescaler of 8
TCNT3 = 0; // clear the timer count
#ifdef __AVR_ATmega128__
TIFR |= _BV(OCF3A); // clear any pending interrupts;
ETIMSK |= _BV(OCIE3A); // enable the output compare interrupt
SBI(TIFR, OCF3A); // clear any pending interrupts;
SBI(ETIMSK, OCIE3A); // enable the output compare interrupt
#else
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
@ -195,21 +195,23 @@ static void finISR(timer16_Sequence_t timer) {
// Disable use of the given timer
#ifdef WIRING
if (timer == _timer1) {
CBI(
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
TIMSK1
#else
TIMSK
#endif
&= ~_BV(OCIE1A); // disable timer 1 output compare interrupt
, OCIE1A); // disable timer 1 output compare interrupt
timerDetach(TIMER1OUTCOMPAREA_INT);
}
else if (timer == _timer3) {
CBI(
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
TIMSK3
#else
ETIMSK
#endif
&= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
, OCIE3A); // disable the timer3 output compare A interrupt
timerDetach(TIMER3OUTCOMPAREA_INT);
}
#else //!WIRING

@ -242,8 +242,8 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
// Some useful constants
#define ENABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 |= BIT(OCIE1A)
#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
#define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A)
#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
void endstops_hit_on_purpose() {
endstop_hit_bits = 0;
@ -253,20 +253,20 @@ void checkHitEndstops() {
if (endstop_hit_bits) {
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
if (endstop_hit_bits & BIT(X_MIN)) {
if (TEST(endstop_hit_bits, X_MIN)) {
SERIAL_ECHOPAIR(" X:", (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
}
if (endstop_hit_bits & BIT(Y_MIN)) {
if (TEST(endstop_hit_bits, Y_MIN)) {
SERIAL_ECHOPAIR(" Y:", (float)endstops_trigsteps[Y_AXIS] / axis_steps_per_unit[Y_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
}
if (endstop_hit_bits & BIT(Z_MIN)) {
if (TEST(endstop_hit_bits, Z_MIN)) {
SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
}
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
if (endstop_hit_bits & BIT(Z_MIN_PROBE)) {
if (TEST(endstop_hit_bits, Z_MIN_PROBE)) {
SERIAL_ECHOPAIR(" Z_MIN_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
}
@ -309,7 +309,7 @@ inline void update_endstops() {
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
#define _AXIS(AXIS) AXIS ##_AXIS
#define _ENDSTOP_HIT(AXIS) endstop_hit_bits |= BIT(_ENDSTOP(AXIS, MIN))
#define _ENDSTOP_HIT(AXIS) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MIN))
#define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
// SET_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
@ -424,7 +424,7 @@ inline void update_endstops() {
if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_MIN);
SBI(endstop_hit_bits, Z_MIN);
if (!performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count;
}
@ -440,7 +440,7 @@ inline void update_endstops() {
if (TEST_ENDSTOP(Z_MIN_PROBE)) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_MIN_PROBE);
SBI(endstop_hit_bits, Z_MIN_PROBE);
}
#endif
}
@ -460,7 +460,7 @@ inline void update_endstops() {
if (z_test && current_block->steps[Z_AXIS] > 0) { // t_test = Z_MAX || Z2_MAX
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_MIN);
SBI(endstop_hit_bits, Z_MIN);
if (!performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count;
}
@ -1052,10 +1052,10 @@ void st_init() {
#endif
// waveform generation = 0100 = CTC
TCCR1B &= ~BIT(WGM13);
TCCR1B |= BIT(WGM12);
TCCR1A &= ~BIT(WGM11);
TCCR1A &= ~BIT(WGM10);
CBI(TCCR1B, WGM13);
SBI(TCCR1B, WGM12);
CBI(TCCR1A, WGM11);
CBI(TCCR1A, WGM10);
// output mode = 00 (disconnected)
TCCR1A &= ~(3 << COM1A0);
@ -1073,11 +1073,11 @@ void st_init() {
#if ENABLED(ADVANCE)
#if defined(TCCR0A) && defined(WGM01)
TCCR0A &= ~BIT(WGM01);
TCCR0A &= ~BIT(WGM00);
CBI(TCCR0A, WGM01);
CBI(TCCR0A, WGM00);
#endif
e_steps[0] = e_steps[1] = e_steps[2] = e_steps[3] = 0;
TIMSK0 |= BIT(OCIE0A);
SBI(TIMSK0, OCIE0A);
#endif //ADVANCE
enable_endstops(true); // Start with endstops active. After homing they can be disabled

@ -850,8 +850,8 @@ static void updateTemperaturesFromRawValues() {
void tp_init() {
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR = BIT(JTD);
MCUCR = BIT(JTD);
MCUCR = _BV(JTD);
MCUCR = _BV(JTD);
#endif
// Finish init of mult extruder arrays
@ -914,13 +914,13 @@ void tp_init() {
#endif //HEATER_0_USES_MAX6675
#ifdef DIDR2
#define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0)
#define ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin - 8); }while(0)
#else
#define ANALOG_SELECT(pin) do{ DIDR0 |= BIT(pin); }while(0)
#define ANALOG_SELECT(pin) do{ SBI(DIDR0, pin); }while(0)
#endif
// Set analog inputs
ADCSRA = BIT(ADEN) | BIT(ADSC) | BIT(ADIF) | 0x07;
ADCSRA = _BV(ADEN) | _BV(ADSC) | _BV(ADIF) | 0x07;
DIDR0 = 0;
#ifdef DIDR2
DIDR2 = 0;
@ -960,7 +960,7 @@ void tp_init() {
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
OCR0B = 128;
TIMSK0 |= BIT(OCIE0B);
SBI(TIMSK0, OCIE0B);
// Wait for temperature measurement to settle
delay(250);
@ -1160,13 +1160,14 @@ void disable_all_heaters() {
max6675_temp = 0;
#ifdef PRR
PRR &= ~BIT(PRSPI);
#elif defined(PRR0)
PRR0 &= ~BIT(PRSPI);
#endif
SPCR = BIT(MSTR) | BIT(SPE) | BIT(SPR0);
CBI(
#ifdef PRR
PRR
#elif defined(PRR0)
PRR0
#endif
, PRSPI);
SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
// enable TT_MAX6675
WRITE(MAX6675_SS, 0);
@ -1177,13 +1178,13 @@ void disable_all_heaters() {
// read MSB
SPDR = 0;
for (; (SPSR & BIT(SPIF)) == 0;);
for (; !TEST(SPSR, SPIF););
max6675_temp = SPDR;
max6675_temp <<= 8;
// read LSB
SPDR = 0;
for (; (SPSR & BIT(SPIF)) == 0;);
for (; !TEST(SPSR, SPIF););
max6675_temp |= SPDR;
// disable TT_MAX6675
@ -1256,7 +1257,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned char temp_count = 0;
static TempState temp_state = StartupDelay;
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
static unsigned char pwm_count = _BV(SOFT_PWM_SCALE);
// Static members for each heater
#if ENABLED(SLOW_PWM_HEATERS)
@ -1341,7 +1342,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif
pwm_count += BIT(SOFT_PWM_SCALE);
pwm_count += _BV(SOFT_PWM_SCALE);
pwm_count &= 0x7f;
#else // SLOW_PWM_HEATERS
@ -1423,7 +1424,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif //FAN_SOFT_PWM
pwm_count += BIT(SOFT_PWM_SCALE);
pwm_count += _BV(SOFT_PWM_SCALE);
pwm_count &= 0x7f;
// increment slow_pwm_count only every 64 pwm_count circa 65.5ms
@ -1449,9 +1450,9 @@ ISR(TIMER0_COMPB_vect) {
#endif // SLOW_PWM_HEATERS
#define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); ADCSRA |= BIT(ADSC)
#define SET_ADMUX_ADCSRA(pin) ADMUX = _BV(REFS0) | (pin & 0x07); SBI(ADCSRA, ADSC)
#ifdef MUX5
#define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#define START_ADC(pin) if (pin > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#else
#define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#endif

@ -1911,7 +1911,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
WRITE(SHIFT_LD, HIGH);
for (int8_t i = 0; i < 8; i++) {
newbutton_reprapworld_keypad >>= 1;
if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= BIT(7);
if (READ(SHIFT_OUT)) SBI(newbutton_reprapworld_keypad, 7);
WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW);
}
@ -1924,7 +1924,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
unsigned char tmp_buttons = 0;
for (int8_t i = 0; i < 8; i++) {
newbutton >>= 1;
if (READ(SHIFT_OUT)) newbutton |= BIT(7);
if (READ(SHIFT_OUT)) SBI(newbutton, 7);
WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW);
}

@ -63,19 +63,19 @@
void lcd_ignore_click(bool b=true);
#if ENABLED(NEWPANEL)
#define EN_C BIT(BLEN_C)
#define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A)
#define EN_C (_BV(BLEN_C))
#define EN_B (_BV(BLEN_B))
#define EN_A (_BV(BLEN_A))
#if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_UP (BIT(BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (BIT(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (BIT(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_DOWN (BIT(BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_LEFT (BIT(BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
@ -90,14 +90,14 @@
#endif //REPRAPWORLD_KEYPAD
#else
//atomic, do not change
#define B_LE BIT(BL_LE)
#define B_UP BIT(BL_UP)
#define B_MI BIT(BL_MI)
#define B_DW BIT(BL_DW)
#define B_RI BIT(BL_RI)
#define B_ST BIT(BL_ST)
#define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A)
#define B_LE (_BV(BL_LE))
#define B_UP (_BV(BL_UP))
#define B_MI (_BV(BL_MI))
#define B_DW (_BV(BL_DW))
#define B_RI (_BV(BL_RI))
#define B_ST (_BV(BL_ST))
#define EN_B (_BV(BLEN_B))
#define EN_A (_BV(BLEN_A))
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#endif//NEWPANEL

@ -20,13 +20,13 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#define BLEN_B 1
#define BLEN_A 0
#define EN_B BIT(BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A BIT(BLEN_A)
#define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A (_BV(BLEN_A))
#if defined(BTN_ENC) && BTN_ENC > -1
// encoder click is directly connected
#define BLEN_C 2
#define EN_C BIT(BLEN_C)
#define EN_C (_BV(BLEN_C))
#endif
//
@ -85,14 +85,14 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define EN_REPRAPWORLD_KEYPAD_F3 BIT((BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F2 BIT((BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F1 BIT((BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_UP BIT((BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_RIGHT BIT((BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE BIT((BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_DOWN BIT((BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_LEFT BIT((BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
//#define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
//#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
@ -113,12 +113,12 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#define BL_ST 2
//automatic, do not change
#define B_LE BIT(BL_LE)
#define B_UP BIT(BL_UP)
#define B_MI BIT(BL_MI)
#define B_DW BIT(BL_DW)
#define B_RI BIT(BL_RI)
#define B_ST BIT(BL_ST)
#define B_LE (_BV(BL_LE))
#define B_UP (_BV(BL_UP))
#define B_MI (_BV(BL_MI))
#define B_DW (_BV(BL_DW))
#define B_RI (_BV(BL_RI))
#define B_ST (_BV(BL_ST))
#define LCD_CLICKED (buttons&(B_MI|B_ST))
#endif

Loading…
Cancel
Save