Disable preprocessor code indentation

pull/48/head
Alan Dragomirecký 2021-07-07 15:51:27 +02:00 committed by Alan Dragomirecký
parent f95c47638d
commit 9448c04b36
8 changed files with 33 additions and 34 deletions

View File

@ -75,7 +75,7 @@ IncludeCategories:
Priority: 1 Priority: 1
IncludeIsMainRegex: '(Test)?$' IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false IndentCaseLabels: false
IndentPPDirectives: BeforeHash IndentPPDirectives: None
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave JavaScriptQuotes: Leave

View File

@ -22,8 +22,7 @@ void SHR16::Init() {
void SHR16::Write(uint16_t v) { void SHR16::Write(uint16_t v) {
using namespace hal::gpio; using namespace hal::gpio;
WritePin(SHR16_LATCH, Level::low); 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_DATA, (Level)((m & v) != 0));
WritePin(SHR16_CLOCK, Level::high); WritePin(SHR16_CLOCK, Level::high);
WritePin(SHR16_CLOCK, Level::low); WritePin(SHR16_CLOCK, Level::low);

View File

@ -3,7 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#ifndef __AVR__ #ifndef __AVR__
#include <limits> #include <limits>
#endif #endif
/// A generic circular index class which can be used to build circular buffers /// A generic circular index class which can be used to build circular buffers

View File

@ -2,7 +2,7 @@
#include <inttypes.h> #include <inttypes.h>
#ifdef __AVR__ #ifdef __AVR__
#include <avr/io.h> #include <avr/io.h>
#endif #endif
namespace hal { namespace hal {
@ -78,17 +78,17 @@ __attribute__((always_inline)) inline void Init(const GPIO_pin portPin, GPIO_Ini
} }
#ifdef __AVR__ #ifdef __AVR__
#define GPIOA ((hal::gpio::GPIO_TypeDef *)&PINA) #define GPIOA ((hal::gpio::GPIO_TypeDef *)&PINA)
#define GPIOB ((hal::gpio::GPIO_TypeDef *)&PINB) #define GPIOB ((hal::gpio::GPIO_TypeDef *)&PINB)
#define GPIOC ((hal::gpio::GPIO_TypeDef *)&PINC) #define GPIOC ((hal::gpio::GPIO_TypeDef *)&PINC)
#define GPIOD ((hal::gpio::GPIO_TypeDef *)&PIND) #define GPIOD ((hal::gpio::GPIO_TypeDef *)&PIND)
#define GPIOE ((hal::gpio::GPIO_TypeDef *)&PINE) #define GPIOE ((hal::gpio::GPIO_TypeDef *)&PINE)
#define GPIOF ((hal::gpio::GPIO_TypeDef *)&PINF) #define GPIOF ((hal::gpio::GPIO_TypeDef *)&PINF)
#define GPIOG ((hal::gpio::GPIO_TypeDef *)&PING) #define GPIOG ((hal::gpio::GPIO_TypeDef *)&PING)
#define GPIOH ((hal::gpio::GPIO_TypeDef *)&PINH) #define GPIOH ((hal::gpio::GPIO_TypeDef *)&PINH)
#define GPIOJ ((hal::gpio::GPIO_TypeDef *)&PINJ) #define GPIOJ ((hal::gpio::GPIO_TypeDef *)&PINJ)
#define GPIOK ((hal::gpio::GPIO_TypeDef *)&PINK) #define GPIOK ((hal::gpio::GPIO_TypeDef *)&PINK)
#define GPIOL ((hal::gpio::GPIO_TypeDef *)&PINL) #define GPIOL ((hal::gpio::GPIO_TypeDef *)&PINL)
#else #else
// stub entries // stub entries
@ -104,16 +104,16 @@ extern hal::gpio::GPIO_TypeDef _GPIOJ;
extern hal::gpio::GPIO_TypeDef _GPIOK; extern hal::gpio::GPIO_TypeDef _GPIOK;
extern hal::gpio::GPIO_TypeDef _GPIOL; extern hal::gpio::GPIO_TypeDef _GPIOL;
#define GPIOA (&::_GPIOA) #define GPIOA (&::_GPIOA)
#define GPIOB (&::_GPIOB) #define GPIOB (&::_GPIOB)
#define GPIOC (&::_GPIOC) #define GPIOC (&::_GPIOC)
#define GPIOD (&::_GPIOD) #define GPIOD (&::_GPIOD)
#define GPIOE (&::_GPIOE) #define GPIOE (&::_GPIOE)
#define GPIOF (&::_GPIOF) #define GPIOF (&::_GPIOF)
#define GPIOG (&::_GPIOG) #define GPIOG (&::_GPIOG)
#define GPIOH (&::_GPIOH) #define GPIOH (&::_GPIOH)
#define GPIOJ (&::_GPIOJ) #define GPIOJ (&::_GPIOJ)
#define GPIOK (&::_GPIOK) #define GPIOK (&::_GPIOK)
#define GPIOL (&::_GPIOL) #define GPIOL (&::_GPIOL)
#endif #endif

View File

@ -13,8 +13,7 @@ namespace hal {
namespace progmem { namespace progmem {
/// read a 16bit word from 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__ #ifndef __AVR__
return *addr; return *addr;
#else #else

View File

@ -12,7 +12,7 @@ namespace hal {
namespace usart { namespace usart {
constexpr uint16_t UART_BAUD_SELECT(uint32_t baudRate, uint32_t xtalCpu) { 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 { class USART {
@ -88,7 +88,8 @@ public:
husart->UCSRxB &= ~(1 << 5); // disable UDRE interrupt 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: private:
// IO base address // IO base address

View File

@ -2,7 +2,7 @@
#include "config.h" #include "config.h"
#define _STR(x) #x #define _STR(x) #x
#define STR(x) _STR(x) #define STR(x) _STR(x)
const char project_version[] = STR(FW_VERSION); 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) #if (PRINTER_TYPE == PRINTER_PRUSA_MINI)
const char project_firmware_name[] = "Buddy_MINI"; const char project_firmware_name[] = "Buddy_MINI";
#else #else
#error "unknown printer type" #error "unknown printer type"
#endif #endif

View File

@ -7,7 +7,7 @@ namespace pm = hal::progmem;
TEST_CASE("progmem::read_word", "[progmem]") { TEST_CASE("progmem::read_word", "[progmem]") {
// create a PROGMEM array // 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 // ensure it can be read correctly
REQUIRE(0 == pm::read_word(&arr[0])); REQUIRE(0 == pm::read_word(&arr[0]));