#if defined => #ifdef / PIN_EXISTS

This commit is contained in:
Scott Lahteine 2017-03-20 15:47:51 -05:00
parent e244399766
commit cd882b88db
9 changed files with 23 additions and 23 deletions

View file

@ -89,7 +89,7 @@ FORCE_INLINE void store_char(unsigned char c) {
} }
} }
#if defined(M_USARTx_UDRE_vect) #ifdef M_USARTx_UDRE_vect
ISR(M_USARTx_UDRE_vect) { ISR(M_USARTx_UDRE_vect) {
_tx_udr_empty_irq(); _tx_udr_empty_irq();
} }
@ -97,7 +97,7 @@ FORCE_INLINE void store_char(unsigned char c) {
#endif // TX_BUFFER_SIZE #endif // TX_BUFFER_SIZE
#if defined(M_USARTx_RX_vect) #ifdef M_USARTx_RX_vect
ISR(M_USARTx_RX_vect) { ISR(M_USARTx_RX_vect) {
unsigned char c = M_UDRx; unsigned char c = M_UDRx;
store_char(c); store_char(c);

View file

@ -10212,35 +10212,35 @@ void prepare_move_to_destination() {
void setPwmFrequency(uint8_t pin, int val) { void setPwmFrequency(uint8_t pin, int val) {
val &= 0x07; val &= 0x07;
switch (digitalPinToTimer(pin)) { switch (digitalPinToTimer(pin)) {
#if defined(TCCR0A) #ifdef TCCR0A
case TIMER0A: case TIMER0A:
case TIMER0B: case TIMER0B:
// TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02)); // TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02));
// TCCR0B |= val; // TCCR0B |= val;
break; break;
#endif #endif
#if defined(TCCR1A) #ifdef TCCR1A
case TIMER1A: case TIMER1A:
case TIMER1B: case TIMER1B:
// TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); // TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
// TCCR1B |= val; // TCCR1B |= val;
break; break;
#endif #endif
#if defined(TCCR2) #ifdef TCCR2
case TIMER2: case TIMER2:
case TIMER2: case TIMER2:
TCCR2 &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); TCCR2 &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
TCCR2 |= val; TCCR2 |= val;
break; break;
#endif #endif
#if defined(TCCR2A) #ifdef TCCR2A
case TIMER2A: case TIMER2A:
case TIMER2B: case TIMER2B:
TCCR2B &= ~(_BV(CS20) | _BV(CS21) | _BV(CS22)); TCCR2B &= ~(_BV(CS20) | _BV(CS21) | _BV(CS22));
TCCR2B |= val; TCCR2B |= val;
break; break;
#endif #endif
#if defined(TCCR3A) #ifdef TCCR3A
case TIMER3A: case TIMER3A:
case TIMER3B: case TIMER3B:
case TIMER3C: case TIMER3C:
@ -10248,7 +10248,7 @@ void prepare_move_to_destination() {
TCCR3B |= val; TCCR3B |= val;
break; break;
#endif #endif
#if defined(TCCR4A) #ifdef TCCR4A
case TIMER4A: case TIMER4A:
case TIMER4B: case TIMER4B:
case TIMER4C: case TIMER4C:
@ -10256,7 +10256,7 @@ void prepare_move_to_destination() {
TCCR4B |= val; TCCR4B |= val;
break; break;
#endif #endif
#if defined(TCCR5A) #ifdef TCCR5A
case TIMER5A: case TIMER5A:
case TIMER5B: case TIMER5B:
case TIMER5C: case TIMER5C:

View file

@ -700,7 +700,7 @@ static bool pwm_status(uint8_t pin) {
#if defined(TCCR3A) && defined(COM3A1) #if defined(TCCR3A) && defined(COM3A1)
PWM_CASE(3,A); PWM_CASE(3,A);
PWM_CASE(3,B); PWM_CASE(3,B);
#if defined(COM3C1) #ifdef COM3C1
PWM_CASE(3,C); PWM_CASE(3,C);
#endif #endif
#endif #endif
@ -829,14 +829,14 @@ static void pwm_details(uint8_t pin) {
else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt(); else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt();
else can_be_used(); else can_be_used();
break; break;
#if defined(COM3C1) #ifdef COM3C1
case TIMER3C: case TIMER3C:
TIMER_PREFIX(3,C,3); TIMER_PREFIX(3,C,3);
if (WGM_TEST2) err_is_counter(); if (WGM_TEST2) err_is_counter();
else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt(); else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt();
else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt(); else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt();
else can_be_used(); else can_be_used();
break; break;
#endif #endif
#endif #endif

View file

@ -26,7 +26,7 @@
#define BOARD_NAME "Melzi" #define BOARD_NAME "Melzi"
#if defined(__AVR_ATmega1284P__) #ifdef __AVR_ATmega1284P__
#define LARGE_FLASH true #define LARGE_FLASH true
#endif #endif

View file

@ -26,7 +26,7 @@
#define BOARD_NAME "Melzi ATmega1284" #define BOARD_NAME "Melzi ATmega1284"
#if defined(__AVR_ATmega1284P__) #ifdef __AVR_ATmega1284P__
#define LARGE_FLASH true #define LARGE_FLASH true
#endif #endif

View file

@ -34,7 +34,7 @@
#define BOARD_NAME "Sanguinololu 1.2" #define BOARD_NAME "Sanguinololu 1.2"
#if defined(__AVR_ATmega1284P__) #ifdef __AVR_ATmega1284P__
#define LARGE_FLASH true #define LARGE_FLASH true
#endif #endif

View file

@ -26,7 +26,7 @@
#define BOARD_NAME "STB V1.1" #define BOARD_NAME "STB V1.1"
#if defined(__AVR_ATmega1284P__) #ifdef __AVR_ATmega1284P__
#define LARGE_FLASH true #define LARGE_FLASH true
#endif #endif

View file

@ -455,7 +455,7 @@ void Planner::check_axes_activity() {
#if FAN_COUNT > 0 #if FAN_COUNT > 0
#if defined(FAN_MIN_PWM) #ifdef FAN_MIN_PWM
#define CALC_FAN_SPEED(f) (tail_fan_speed[f] ? ( FAN_MIN_PWM + (tail_fan_speed[f] * (255 - FAN_MIN_PWM)) / 255 ) : 0) #define CALC_FAN_SPEED(f) (tail_fan_speed[f] ? ( FAN_MIN_PWM + (tail_fan_speed[f] * (255 - FAN_MIN_PWM)) / 255 ) : 0)
#else #else
#define CALC_FAN_SPEED(f) tail_fan_speed[f] #define CALC_FAN_SPEED(f) tail_fan_speed[f]

View file

@ -161,7 +161,7 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#include <LCD.h> #include <LCD.h>
#include <LiquidCrystal_SR.h> #include <LiquidCrystal_SR.h>
#define LCD_CLASS LiquidCrystal_SR #define LCD_CLASS LiquidCrystal_SR
#if defined(SR_STROBE_PIN) #if PIN_EXISTS(SR_STROBE)
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN); LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN);
#else #else
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN); LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);