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
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: BeforeHash
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave

View File

@ -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);

View File

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

View File

@ -2,7 +2,7 @@
#include <inttypes.h>
#ifdef __AVR__
#include <avr/io.h>
#include <avr/io.h>
#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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]));