diff --git a/.clang-format b/.clang-format index 65fa90c..15b1947 100644 --- a/.clang-format +++ b/.clang-format @@ -75,7 +75,7 @@ IncludeCategories: Priority: 1 IncludeIsMainRegex: '(Test)?$' IndentCaseLabels: false -IndentPPDirectives: BeforeHash +IndentPPDirectives: None IndentWidth: 4 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave diff --git a/src/hal/avr/shr16.cpp b/src/hal/avr/shr16.cpp index 28565ee..46856a8 100644 --- a/src/hal/avr/shr16.cpp +++ b/src/hal/avr/shr16.cpp @@ -22,8 +22,7 @@ void SHR16::Init() { void SHR16::Write(uint16_t v) { using namespace hal::gpio; WritePin(SHR16_LATCH, Level::low); - for (uint16_t m = 0x8000; m; m >>= 1) - { + for (uint16_t m = 0x8000; m; m >>= 1) { WritePin(SHR16_DATA, (Level)((m & v) != 0)); WritePin(SHR16_CLOCK, Level::high); WritePin(SHR16_CLOCK, Level::low); diff --git a/src/hal/circular_buffer.h b/src/hal/circular_buffer.h index 3c96faa..7e8249a 100644 --- a/src/hal/circular_buffer.h +++ b/src/hal/circular_buffer.h @@ -3,7 +3,7 @@ #include #include #ifndef __AVR__ - #include +#include #endif /// A generic circular index class which can be used to build circular buffers diff --git a/src/hal/gpio.h b/src/hal/gpio.h index 1db8454..e29546d 100644 --- a/src/hal/gpio.h +++ b/src/hal/gpio.h @@ -2,7 +2,7 @@ #include #ifdef __AVR__ - #include +#include #endif namespace hal { @@ -78,17 +78,17 @@ __attribute__((always_inline)) inline void Init(const GPIO_pin portPin, GPIO_Ini } #ifdef __AVR__ - #define GPIOA ((hal::gpio::GPIO_TypeDef *)&PINA) - #define GPIOB ((hal::gpio::GPIO_TypeDef *)&PINB) - #define GPIOC ((hal::gpio::GPIO_TypeDef *)&PINC) - #define GPIOD ((hal::gpio::GPIO_TypeDef *)&PIND) - #define GPIOE ((hal::gpio::GPIO_TypeDef *)&PINE) - #define GPIOF ((hal::gpio::GPIO_TypeDef *)&PINF) - #define GPIOG ((hal::gpio::GPIO_TypeDef *)&PING) - #define GPIOH ((hal::gpio::GPIO_TypeDef *)&PINH) - #define GPIOJ ((hal::gpio::GPIO_TypeDef *)&PINJ) - #define GPIOK ((hal::gpio::GPIO_TypeDef *)&PINK) - #define GPIOL ((hal::gpio::GPIO_TypeDef *)&PINL) +#define GPIOA ((hal::gpio::GPIO_TypeDef *)&PINA) +#define GPIOB ((hal::gpio::GPIO_TypeDef *)&PINB) +#define GPIOC ((hal::gpio::GPIO_TypeDef *)&PINC) +#define GPIOD ((hal::gpio::GPIO_TypeDef *)&PIND) +#define GPIOE ((hal::gpio::GPIO_TypeDef *)&PINE) +#define GPIOF ((hal::gpio::GPIO_TypeDef *)&PINF) +#define GPIOG ((hal::gpio::GPIO_TypeDef *)&PING) +#define GPIOH ((hal::gpio::GPIO_TypeDef *)&PINH) +#define GPIOJ ((hal::gpio::GPIO_TypeDef *)&PINJ) +#define GPIOK ((hal::gpio::GPIO_TypeDef *)&PINK) +#define GPIOL ((hal::gpio::GPIO_TypeDef *)&PINL) #else // stub entries @@ -104,16 +104,16 @@ extern hal::gpio::GPIO_TypeDef _GPIOJ; extern hal::gpio::GPIO_TypeDef _GPIOK; extern hal::gpio::GPIO_TypeDef _GPIOL; - #define GPIOA (&::_GPIOA) - #define GPIOB (&::_GPIOB) - #define GPIOC (&::_GPIOC) - #define GPIOD (&::_GPIOD) - #define GPIOE (&::_GPIOE) - #define GPIOF (&::_GPIOF) - #define GPIOG (&::_GPIOG) - #define GPIOH (&::_GPIOH) - #define GPIOJ (&::_GPIOJ) - #define GPIOK (&::_GPIOK) - #define GPIOL (&::_GPIOL) +#define GPIOA (&::_GPIOA) +#define GPIOB (&::_GPIOB) +#define GPIOC (&::_GPIOC) +#define GPIOD (&::_GPIOD) +#define GPIOE (&::_GPIOE) +#define GPIOF (&::_GPIOF) +#define GPIOG (&::_GPIOG) +#define GPIOH (&::_GPIOH) +#define GPIOJ (&::_GPIOJ) +#define GPIOK (&::_GPIOK) +#define GPIOL (&::_GPIOL) #endif diff --git a/src/hal/progmem.h b/src/hal/progmem.h index 9f0bf8c..1feb2f9 100644 --- a/src/hal/progmem.h +++ b/src/hal/progmem.h @@ -13,8 +13,7 @@ namespace hal { namespace progmem { /// read a 16bit word from PROGMEM -static inline uint16_t read_word(const uint16_t* addr) -{ +static inline uint16_t read_word(const uint16_t *addr) { #ifndef __AVR__ return *addr; #else diff --git a/src/hal/usart.h b/src/hal/usart.h index 6f204dc..d7c2771 100644 --- a/src/hal/usart.h +++ b/src/hal/usart.h @@ -12,7 +12,7 @@ namespace hal { namespace usart { constexpr uint16_t UART_BAUD_SELECT(uint32_t baudRate, uint32_t xtalCpu) { - return (((double)(xtalCpu))/(((double)(baudRate))*8.0)-1.0+0.5); + return (((double)(xtalCpu)) / (((double)(baudRate)) * 8.0) - 1.0 + 0.5); } class USART { @@ -88,7 +88,8 @@ public: husart->UCSRxB &= ~(1 << 5); // disable UDRE interrupt } - USART(hal::usart::USART::USART_TypeDef *husart) : husart(husart) {}; + USART(hal::usart::USART::USART_TypeDef *husart) + : husart(husart) {}; private: // IO base address diff --git a/src/version.c b/src/version.c index 20bd1c0..a39c0ea 100644 --- a/src/version.c +++ b/src/version.c @@ -2,7 +2,7 @@ #include "config.h" #define _STR(x) #x -#define STR(x) _STR(x) +#define STR(x) _STR(x) const char project_version[] = STR(FW_VERSION); @@ -17,5 +17,5 @@ const int project_build_number = FW_BUILD_NUMBER; #if (PRINTER_TYPE == PRINTER_PRUSA_MINI) const char project_firmware_name[] = "Buddy_MINI"; #else - #error "unknown printer type" +#error "unknown printer type" #endif diff --git a/tests/unit/hal/progmem/test_progmem.cpp b/tests/unit/hal/progmem/test_progmem.cpp index ab0da9a..14bf9c5 100644 --- a/tests/unit/hal/progmem/test_progmem.cpp +++ b/tests/unit/hal/progmem/test_progmem.cpp @@ -7,7 +7,7 @@ namespace pm = hal::progmem; TEST_CASE("progmem::read_word", "[progmem]") { // create a PROGMEM array - const uint16_t arr[2] PROGMEM = {0, 1}; + const uint16_t arr[2] PROGMEM = { 0, 1 }; // ensure it can be read correctly REQUIRE(0 == pm::read_word(&arr[0]));