From fd128b3c93e21f8c17e4f0299fa31afe1e5aad96 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 14 Oct 2017 19:05:10 -0500 Subject: [PATCH] Fix some AVR HAL code style --- Marlin/src/HAL/HAL_AVR/HAL_AVR.h | 11 +++-------- Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h | 5 +++-- Marlin/src/HAL/HAL_AVR/MarlinSerial.h | 6 +++--- Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h | 13 +++++-------- Marlin/src/HAL/HAL_AVR/ServoTimers.h | 9 +++++++-- Marlin/src/HAL/HAL_AVR/fastio_1280.h | 6 +++--- Marlin/src/HAL/HAL_AVR/fastio_1281.h | 6 +++--- Marlin/src/HAL/HAL_AVR/fastio_168.h | 6 +++--- Marlin/src/HAL/HAL_AVR/fastio_644.h | 6 +++--- Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h | 6 +++--- Marlin/src/HAL/HAL_AVR/fastio_AVR.h | 6 +++--- Marlin/src/HAL/HAL_AVR/math_AVR.h | 6 +++--- Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h | 4 ++++ Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h | 5 +++++ Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h | 6 +++--- Marlin/src/HAL/HAL_AVR/spi_pins.h | 6 +++--- Marlin/src/HAL/HAL_AVR/watchdog_AVR.h | 6 +++--- 17 files changed, 60 insertions(+), 53 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h b/Marlin/src/HAL/HAL_AVR/HAL_AVR.h index 95c0db5c6e..60a73581c0 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/HAL_AVR.h @@ -26,8 +26,8 @@ */ -#ifndef _HAL_AVR_H -#define _HAL_AVR_H +#ifndef _HAL_AVR_H_ +#define _HAL_AVR_H_ // -------------------------------------------------------------------------- // Includes @@ -153,9 +153,4 @@ inline void HAL_adc_init(void) { #define HAL_READ_ADC ADC - -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- - -#endif // _HAL_AVR_H +#endif // _HAL_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h b/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h index 0e430beea3..c20f58a9ae 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h @@ -20,7 +20,8 @@ * */ -#ifndef HAL_PINSDEBUG_AVR_H +#ifndef _HAL_PINSDEBUG_AVR_H_ +#define _HAL_PINSDEBUG_AVR_H_ void HAL_print_analog_pin(char buffer[], int8_t pin) { sprintf(buffer, "(A%2d) ", int(pin - analogInputToDigitalPin(0))); @@ -590,4 +591,4 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f } } -#endif //HAL_PINSDEBUG_AVR_H \ No newline at end of file +#endif // _HAL_PINSDEBUG_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h index a909ad98d6..e289e7cf1f 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h @@ -29,8 +29,8 @@ * Modified 01 October 2017 by Eduardo José Tagle (added XON/XOFF) */ -#ifndef MARLINSERIAL_H -#define MARLINSERIAL_H +#ifndef _MARLINSERIAL_H_ +#define _MARLINSERIAL_H_ #include "../../inc/MarlinConfig.h" @@ -181,4 +181,4 @@ extern HardwareSerial bluetoothSerial; #endif -#endif // MARLINSERIAL_H +#endif // _MARLINSERIAL_H_ diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h index a8bad153e2..f2b8233efa 100644 --- a/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h @@ -20,15 +20,13 @@ * */ +#ifndef _SANITYCHECK_AVR_8_BIT_H_ +#define _SANITYCHECK_AVR_8_BIT_H_ + /** * Test AVR specific configuration values for errors at compile-time. */ -/** - * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. - */ - - /** * Digipot requirement */ @@ -39,12 +37,9 @@ #endif #endif - - /** * Sanity checks for Spindle / Laser */ - #if ENABLED(SPINDLE_LASER_ENABLE) #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." @@ -100,3 +95,5 @@ #endif #endif #endif // SPINDLE_LASER_ENABLE + +#endif // _SANITYCHECK_AVR_8_BIT_H_ diff --git a/Marlin/src/HAL/HAL_AVR/ServoTimers.h b/Marlin/src/HAL/HAL_AVR/ServoTimers.h index 231d1a6d26..7d7c27515b 100644 --- a/Marlin/src/HAL/HAL_AVR/ServoTimers.h +++ b/Marlin/src/HAL/HAL_AVR/ServoTimers.h @@ -21,7 +21,7 @@ */ /* - Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. This library is free software; you can redistribute it and/or @@ -39,7 +39,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/* +#ifndef _SERVOTIMERS_H_ +#define _SERVOTIMERS_H_ + +/** * Defines for 16 bit timers used with Servo library * * If _useTimerX is defined then TimerX is a 16 bit timer on the current board @@ -88,3 +91,5 @@ typedef enum { #endif _Nbr_16timers } timer16_Sequence_t; + +#endif // _SERVOTIMERS_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_1280.h b/Marlin/src/HAL/HAL_AVR/fastio_1280.h index ed96002f27..aae91a104b 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1280.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1280.h @@ -28,8 +28,8 @@ * Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 */ -#ifndef _FASTIO_1280 -#define _FASTIO_1280 +#ifndef _FASTIO_1280_H_ +#define _FASTIO_1280_H_ #include "fastio_AVR.h" @@ -1112,4 +1112,4 @@ #define PL7_DDR DDRL #define PL7_PWM NULL -#endif // _FASTIO_1280 +#endif // _FASTIO_1280_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_1281.h b/Marlin/src/HAL/HAL_AVR/fastio_1281.h index 0bbea73ed6..59cfce889e 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1281.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1281.h @@ -28,8 +28,8 @@ * Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 */ -#ifndef _FASTIO_1281 -#define _FASTIO_1281 +#ifndef _FASTIO_1281_H_ +#define _FASTIO_1281_H_ #include "fastio_AVR.h" @@ -717,4 +717,4 @@ #define PG5_DDR DDRG #define PG5_PWM &OCR0B -#endif // _FASTIO_1281 +#endif // _FASTIO_1281_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_168.h b/Marlin/src/HAL/HAL_AVR/fastio_168.h index 89304defe2..cc78ee26c0 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_168.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_168.h @@ -28,8 +28,8 @@ * Marlin 08 09 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 */ -#ifndef _FASTIO_168 -#define _FASTIO_168 +#ifndef _FASTIO_168_H_ +#define _FASTIO_168_H_ #include "fastio_AVR.h" @@ -359,4 +359,4 @@ #define PD7_DDR DDRD #define PD7_PWM NULL -#endif // _FASTIO_168 +#endif // _FASTIO_168_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_644.h b/Marlin/src/HAL/HAL_AVR/fastio_644.h index c0a453397d..031aa133b6 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_644.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_644.h @@ -28,8 +28,8 @@ * Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 */ -#ifndef _FASTIO_644 -#define _FASTIO_644 +#ifndef _FASTIO_644_H_ +#define _FASTIO_644_H_ #include "fastio_AVR.h" @@ -528,4 +528,4 @@ #define PD7_DDR DDRD #define PD7_PWM OCR2A -#endif // _FASTIO_644 +#endif // _FASTIO_644_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h index 803944e4df..b9747decbd 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h @@ -29,8 +29,8 @@ * The pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3 */ -#ifndef _FASTIO_AT90USB -#define _FASTIO_AT90USB +#ifndef _FASTIO_AT90USB_H_ +#define _FASTIO_AT90USB_H_ #include "fastio_AVR.h" @@ -699,4 +699,4 @@ #define TIMER3B 4 #define TIMER3C 3 -#endif // _FASTIO_AT90USB +#endif // _FASTIO_AT90USB_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index 5e3292d822..eb4e883b63 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -26,8 +26,8 @@ * Contributed by Triffid_Hunter. Modified by Kliment and the Marlin team. */ -#ifndef _FASTIO_ARDUINO_H -#define _FASTIO_ARDUINO_H +#ifndef _FASTIO_ARDUINO_H_ +#define _FASTIO_ARDUINO_H_ #include #include "../../core/macros.h" @@ -323,4 +323,4 @@ typedef enum { // finally - the macro that tells us if a pin is an available hardware PWM #define USEABLE_HARDWARE_PWM(p) (PWM_PINS(p) && !PWM_CHK(p)) -#endif // _FASTIO_ARDUINO_H +#endif // _FASTIO_ARDUINO_H_ diff --git a/Marlin/src/HAL/HAL_AVR/math_AVR.h b/Marlin/src/HAL/HAL_AVR/math_AVR.h index 9d210eed38..e0feab034f 100644 --- a/Marlin/src/HAL/HAL_AVR/math_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/math_AVR.h @@ -20,8 +20,8 @@ * */ -#ifndef MATH_AVR_H -#define MATH_AVR_H +#ifndef _MATH_AVR_H_ +#define _MATH_AVR_H_ /** * Optimized math functions for AVR @@ -109,4 +109,4 @@ ) -#endif +#endif // _MATH_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h index bf8da829cc..20bdcc6845 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h @@ -24,6 +24,8 @@ * PWM print routines for Atmel 8 bit AVR CPUs */ +#ifndef _PINSDEBUG_AVR_8_BIT_ +#define _PINSDEBUG_AVR_8_BIT_ #define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \ || MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \ @@ -399,3 +401,5 @@ static void pwm_details(uint8_t pin) { #endif #define GET_PIN_INFO(pin) do{}while(0) + +#endif // _PINSDEBUG_AVR_8_BIT_ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h index 187c190f68..840e2a22e9 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h @@ -20,6 +20,9 @@ * */ +#ifndef _PINSDEBUG_TEENSYSUINO_H_ +#define _PINSDEBUG_TEENSYSUINO_H_ + // // some of the pin mapping functions of the Teensduino extension to the Arduino IDE // do not function the same as the other Arduino extensions @@ -108,3 +111,5 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { // disable the PWMs so we can use it as is // portModeRegister(pin) is OK + +#endif // _PINSDEBUG_TEENSYSUINO_H_ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h index 1a905bd463..95006ee7ef 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h @@ -25,8 +25,8 @@ * structurs for 2560 family boards that use morre than 70 pins */ -#ifndef __PINSDEBUG_PLUS_70_H__ -#define __PINSDEBUG_PLUS_70_H__ +#ifndef _PINSDEBUG_PLUS_70_H_ +#define _PINSDEBUG_PLUS_70_H_ #undef NUM_DIGITAL_PINS #if MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D @@ -338,4 +338,4 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = { */ -#endif // __PINSDEBUG_PLUS_70_H__ +#endif // _PINSDEBUG_PLUS_70_H_ diff --git a/Marlin/src/HAL/HAL_AVR/spi_pins.h b/Marlin/src/HAL/HAL_AVR/spi_pins.h index 9d67bad362..d4838956e7 100644 --- a/Marlin/src/HAL/HAL_AVR/spi_pins.h +++ b/Marlin/src/HAL/HAL_AVR/spi_pins.h @@ -20,8 +20,8 @@ * */ -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ +#ifndef _SPI_PINS_H_ +#define _SPI_PINS_H_ /** * Define SPI Pins: SCK, MISO, MOSI, SS @@ -67,4 +67,4 @@ #endif -#endif /* SPI_PINS_H_ */ +#endif // _SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h index a66feebeca..90c6185cb6 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h @@ -20,8 +20,8 @@ * */ -#ifndef WATCHDOG_AVR_H -#define WATCHDOG_AVR_H +#ifndef _WATCHDOG_AVR_H_ +#define _WATCHDOG_AVR_H_ #include @@ -32,4 +32,4 @@ void watchdog_init(); // first watchdog_init or AVR will go into emergency procedures. inline void watchdog_reset() { wdt_reset(); } -#endif // WATCHDOG_AVR_H +#endif // _WATCHDOG_AVR_H_