From 1a827d5b6832743bea273948bf3d7c13039a2b97 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 09:29:41 -0600 Subject: [PATCH] Opening brace tweaks --- .../HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp | 29 +++++++------------ .../u8g_com_HAL_LPC1768_hw_spi.cpp | 12 +++----- .../u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 6 ++-- ...LPC1768_ssd_sw_i2c.cpp under construction | 6 ++-- .../u8g_com_HAL_LPC1768_st7920_hw_spi.cpp | 12 +++----- .../u8g_com_HAL_LPC1768_st7920_sw_spi.cpp | 12 +++----- .../u8g_com_HAL_LPC1768_sw_spi.cpp | 12 +++----- Marlin/src/gcode/feature/trinamic/M122.cpp | 9 ++---- .../u8g_dev_ssd1306_sh1106_128x64_I2C.cpp | 6 ++-- .../lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 6 ++-- .../lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 6 ++-- 11 files changed, 39 insertions(+), 77 deletions(-) diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 1de01fee9..557165296 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -61,13 +61,11 @@ #include #include "../../core/macros.h" - void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) { PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1, g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT } - void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level) { volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort; uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin; @@ -75,7 +73,6 @@ else port->PIO_CODR = mask; } - #define nop() __asm__ __volatile__("nop;\n\t":::) void __delay_4cycles(uint32_t cy) __attribute__ ((weak)); @@ -102,8 +99,7 @@ FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle Pio *SCK_pPio, *MOSI_pPio; uint32_t SCK_dwMask, MOSI_dwMask; - static void spiSend_sw_DUE(uint8_t val) // 800KHz - { + static void spiSend_sw_DUE(uint8_t val) { // 800KHz for (uint8_t i = 0; i < 8; i++) { if (val & 0x80) MOSI_pPio->PIO_SODR = MOSI_dwMask; @@ -119,8 +115,7 @@ FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle static uint8_t rs_last_state = 255; - static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) - { + static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) { uint8_t i; if ( rs != rs_last_state) { // time to send a command/data byte @@ -142,10 +137,8 @@ FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle } - uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) - { - switch(msg) - { + uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { + switch (msg) { case U8G_COM_MSG_INIT: SCK_pPio = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].pPort; SCK_dwMask = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].ulPin; @@ -184,22 +177,18 @@ FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val); break; - case U8G_COM_MSG_WRITE_SEQ: - { + case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } } break; - case U8G_COM_MSG_WRITE_SEQ_P: - { + case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } @@ -208,5 +197,7 @@ FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle } return 1; } + #pragma GCC reset_options + #endif //ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp index c7771eeb3..53a4f3454 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -118,22 +118,18 @@ spiSend((uint8_t)arg_val); break; - case U8G_COM_MSG_WRITE_SEQ: - { + case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { spiSend(*ptr++); arg_val--; } } break; - case U8G_COM_MSG_WRITE_SEQ_P: - { + case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { spiSend(*ptr++); arg_val--; } diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index 514bfa587..483b68837 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -160,8 +160,7 @@ return u8g_i2c_stop(), 0; { register uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { if ( u8g_i2c_send_byte(*ptr++) == 0 ) return u8g_i2c_stop(), 0; arg_val--; @@ -176,8 +175,7 @@ return u8g_i2c_stop(), 0; { register uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 ) return 0; ptr++; diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction index 876c8db7a..8a048630e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction @@ -239,8 +239,7 @@ void u8g_i2c_init_sw(uint8_t clock_option) { return u8g_i2c_stop_sw(), 0; { register uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { if ( u8g_i2c_send_byte_sw(*ptr++) == 0 ) return u8g_i2c_stop_sw(), 0; arg_val--; @@ -255,8 +254,7 @@ void u8g_i2c_init_sw(uint8_t clock_option) { return u8g_i2c_stop_sw(), 0; { register uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { if ( u8g_i2c_send_byte_sw(u8g_pgm_read(ptr)) == 0 ) return 0; ptr++; diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp index f07dbef16..dbec34f94 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp @@ -136,22 +136,18 @@ u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val); break; - case U8G_COM_MSG_WRITE_SEQ: - { + case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } } break; - case U8G_COM_MSG_WRITE_SEQ_P: - { + case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp index 0f861c96b..8f7236e17 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp @@ -170,22 +170,18 @@ u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val); break; - case U8G_COM_MSG_WRITE_SEQ: - { + case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } } break; - case U8G_COM_MSG_WRITE_SEQ_P: - { + case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t*) arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++); arg_val--; } diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp index 88601adcd..6e6ba7b39 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -150,22 +150,18 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val); break; - case U8G_COM_MSG_WRITE_SEQ: - { + case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++); arg_val--; } } break; - case U8G_COM_MSG_WRITE_SEQ_P: - { + case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t *)arg_ptr; - while( arg_val > 0 ) - { + while (arg_val > 0) { u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr)); ptr++; arg_val--; diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 0302a8d63..f566ba881 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -110,8 +110,7 @@ static void drv_status_print_hex(const char name[], const uint32_t drv_status) { #if ENABLED(HAVE_TMC2208) static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { switch(i) { - case TMC_TSTEP: - { + case TMC_TSTEP: { uint32_t data = 0; st.TSTEP(&data); MYSERIAL.print(data); @@ -159,14 +158,12 @@ static void tmc_status(TMC &st, TMC_AxisEnum axis, const TMC_debug_enum i, const case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; - case TMC_TPWMTHRS: - { + case TMC_TPWMTHRS: { uint32_t tpwmthrs_val = st.TPWMTHRS(); SERIAL_ECHO(tpwmthrs_val); } break; - case TMC_TPWMTHRS_MMS: - { + case TMC_TPWMTHRS_MMS: { uint32_t tpwmthrs_val = st.TPWMTHRS(); tpwmthrs_val ? SERIAL_ECHO(12650000UL * st.microsteps() / (256 * tpwmthrs_val * spmm)) : SERIAL_ECHO('-'); } diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index 040d19541..efec51a72 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -128,8 +128,7 @@ uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m break; case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); u8g_SetAddress(u8g, dev, 0); // instruction mode u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire); @@ -202,8 +201,7 @@ uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t break; case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); u8g_SetAddress(u8g, dev, 0); // instruction mode u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire); diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index 891db0077..491efbb49 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -149,8 +149,7 @@ uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo break; case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start); u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (ST7565R) */ @@ -187,8 +186,7 @@ uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, break; case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start); diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp index a4963e040..deec8b215 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -99,8 +99,7 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo break; case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { uint8_t y, i; uint8_t *ptr; u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); @@ -149,8 +148,7 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, case U8G_DEV_MSG_STOP: break; - case U8G_DEV_MSG_PAGE_NEXT: - { + case U8G_DEV_MSG_PAGE_NEXT: { uint8_t y, i; uint8_t *ptr; u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);