Clean up trailing spaces

This commit is contained in:
Scott Lahteine 2017-10-26 23:33:43 -05:00
parent 7fad26549b
commit ada90f7335
5 changed files with 29 additions and 30 deletions

View File

@ -102,7 +102,7 @@ void HardwareSerial::begin(uint32_t baudrate) {
// Initialize eripheral with given to corresponding parameter // Initialize eripheral with given to corresponding parameter
UART_Init(UARTx, &UARTConfigStruct); UART_Init(UARTx, &UARTConfigStruct);
// Enable and reset the TX and RX FIFOs // Enable and reset the TX and RX FIFOs
UART_FIFOConfigStructInit(&FIFOConfig); UART_FIFOConfigStructInit(&FIFOConfig);
UART_FIFOConfig(UARTx, &FIFOConfig); UART_FIFOConfig(UARTx, &FIFOConfig);
@ -113,7 +113,7 @@ void HardwareSerial::begin(uint32_t baudrate) {
// Configure Interrupts // Configure Interrupts
UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE);
UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE);
if (UARTx == LPC_UART0) if (UARTx == LPC_UART0)
NVIC_EnableIRQ(UART0_IRQn); NVIC_EnableIRQ(UART0_IRQn);
else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1)
@ -135,13 +135,13 @@ int HardwareSerial::peek() {
/* Temporarily lock out UART receive interrupts during this read so the UART receive /* Temporarily lock out UART receive interrupts during this read so the UART receive
interrupt won't cause problems with the index values */ interrupt won't cause problems with the index values */
UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE);
if (RxQueueReadPos != RxQueueWritePos) if (RxQueueReadPos != RxQueueWritePos)
byte = RxBuffer[RxQueueReadPos]; byte = RxBuffer[RxQueueReadPos];
/* Re-enable UART interrupts */ /* Re-enable UART interrupts */
UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE);
return byte; return byte;
} }
@ -151,7 +151,7 @@ int HardwareSerial::read() {
/* Temporarily lock out UART receive interrupts during this read so the UART receive /* Temporarily lock out UART receive interrupts during this read so the UART receive
interrupt won't cause problems with the index values */ interrupt won't cause problems with the index values */
UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE);
if (RxQueueReadPos != RxQueueWritePos) { if (RxQueueReadPos != RxQueueWritePos) {
byte = RxBuffer[RxQueueReadPos]; byte = RxBuffer[RxQueueReadPos];
RxQueueReadPos = (RxQueueReadPos + 1) % RX_BUFFER_SIZE; RxQueueReadPos = (RxQueueReadPos + 1) % RX_BUFFER_SIZE;
@ -159,7 +159,7 @@ int HardwareSerial::read() {
/* Re-enable UART interrupts */ /* Re-enable UART interrupts */
UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE);
return byte; return byte;
} }
@ -170,7 +170,7 @@ size_t HardwareSerial::write(uint8_t send) {
/* If the Tx Buffer is full, wait for space to clear */ /* If the Tx Buffer is full, wait for space to clear */
if ((TxQueueWritePos+1) % TX_BUFFER_SIZE == TxQueueReadPos) flushTX(); if ((TxQueueWritePos+1) % TX_BUFFER_SIZE == TxQueueReadPos) flushTX();
/* Temporarily lock out UART transmit interrupts during this read so the UART transmit interrupt won't /* Temporarily lock out UART transmit interrupts during this read so the UART transmit interrupt won't
cause problems with the index values */ cause problems with the index values */
UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE);
@ -180,7 +180,7 @@ size_t HardwareSerial::write(uint8_t send) {
fifolvl = *(reinterpret_cast<volatile uint32_t *>(&((LPC_UART1_TypeDef *) UARTx)->FIFOLVL)); fifolvl = *(reinterpret_cast<volatile uint32_t *>(&((LPC_UART1_TypeDef *) UARTx)->FIFOLVL));
else else
fifolvl = *(reinterpret_cast<volatile uint32_t *>(&UARTx->FIFOLVL)); fifolvl = *(reinterpret_cast<volatile uint32_t *>(&UARTx->FIFOLVL));
/* If the queue is empty and there's space in the FIFO, immediately send the byte */ /* If the queue is empty and there's space in the FIFO, immediately send the byte */
if (TxQueueWritePos == TxQueueReadPos && fifolvl < UART_TX_FIFO_SIZE) { if (TxQueueWritePos == TxQueueReadPos && fifolvl < UART_TX_FIFO_SIZE) {
bytes = UART_Send(UARTx, &send, 1, BLOCKING); bytes = UART_Send(UARTx, &send, 1, BLOCKING);
@ -191,10 +191,10 @@ size_t HardwareSerial::write(uint8_t send) {
TxQueueWritePos = (TxQueueWritePos+1) % TX_BUFFER_SIZE; TxQueueWritePos = (TxQueueWritePos+1) % TX_BUFFER_SIZE;
bytes++; bytes++;
} }
/* Re-enable the TX Interrupt */ /* Re-enable the TX Interrupt */
UART_IntConfig(UARTx, UART_INTCFG_THRE, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_THRE, ENABLE);
return bytes; return bytes;
#else #else
return UART_Send(UARTx, &send, 1, BLOCKING); return UART_Send(UARTx, &send, 1, BLOCKING);
@ -251,7 +251,7 @@ void HardwareSerial::IRQHandler() {
return; return;
} }
} }
if ( IIRValue == UART_IIR_INTID_RDA ) /* Receive Data Available */ if ( IIRValue == UART_IIR_INTID_RDA ) /* Receive Data Available */
{ {
/* Clear the FIFO */ /* Clear the FIFO */
@ -278,7 +278,7 @@ void HardwareSerial::IRQHandler() {
/* Wait for FIFO buffer empty */ /* Wait for FIFO buffer empty */
while (UART_CheckBusy(UARTx) == SET); while (UART_CheckBusy(UARTx) == SET);
/* Transfer up to UART_TX_FIFO_SIZE bytes of data */ /* Transfer up to UART_TX_FIFO_SIZE bytes of data */
for (int i = 0; i < UART_TX_FIFO_SIZE && TxQueueWritePos != TxQueueReadPos; i++) { for (int i = 0; i < UART_TX_FIFO_SIZE && TxQueueWritePos != TxQueueReadPos; i++) {
/* Move a piece of data into the transmit FIFO */ /* Move a piece of data into the transmit FIFO */
@ -287,7 +287,7 @@ void HardwareSerial::IRQHandler() {
else else
break; break;
} }
/* If there is no more data to send, disable the transmit interrupt - else enable it or keep it enabled */ /* If there is no more data to send, disable the transmit interrupt - else enable it or keep it enabled */
if (TxQueueWritePos == TxQueueReadPos) if (TxQueueWritePos == TxQueueReadPos)
UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE);

View File

@ -163,7 +163,7 @@ constexpr bool INTERRUPT_PIN(const pin_t p) {
#define NUM_ANALOG_INPUTS 8 #define NUM_ANALOG_INPUTS 8
#endif #endif
constexpr pin_t adc_pin_table[] = { constexpr pin_t adc_pin_table[] = {
P0_23, P0_24, P0_25, P0_26, P1_30, P1_31, P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
#if SERIAL_PORT != 0 #if SERIAL_PORT != 0
P0_3, P0_2 P0_3, P0_2
@ -214,5 +214,5 @@ const pin_t pin_map[] = {
int16_t GET_PIN_MAP_INDEX(pin_t pin); int16_t GET_PIN_MAP_INDEX(pin_t pin);
int16_t PARSED_PIN_INDEX(char code, int16_t dval = 0); int16_t PARSED_PIN_INDEX(char code, int16_t dval = 0);
#endif // __HAL_PINMAPPING_H__ #endif // __HAL_PINMAPPING_H__

View File

@ -329,23 +329,22 @@ void Max7219_idle_tasks() {
#if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE) #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE)
static millis_t next_blink = 0; static millis_t next_blink = 0;
if (ELAPSED(millis(), next_blink)) { if (ELAPSED(millis(), next_blink)) {
Max7219_LED_Toggle(7, 7); Max7219_LED_Toggle(7, 7);
next_blink = millis() + 750; next_blink = millis() + 750;
} }
#endif #endif
#ifdef MAX7219_DEBUG_STEPPER_HEAD #ifdef MAX7219_DEBUG_STEPPER_HEAD
static int16_t last_head_cnt=0; static int16_t last_head_cnt=0;
if (last_head_cnt != head) { if (last_head_cnt != head) {
if ( last_head_cnt < 8) if (last_head_cnt < 8)
Max7219_LED_Off( last_head_cnt, MAX7219_DEBUG_STEPPER_HEAD); Max7219_LED_Off( last_head_cnt, MAX7219_DEBUG_STEPPER_HEAD);
else else
Max7219_LED_Off( last_head_cnt-8, MAX7219_DEBUG_STEPPER_HEAD+1); Max7219_LED_Off( last_head_cnt-8, MAX7219_DEBUG_STEPPER_HEAD+1);
last_head_cnt = head; last_head_cnt = head;
if ( head < 8) if (head < 8)
Max7219_LED_On(head, MAX7219_DEBUG_STEPPER_HEAD); Max7219_LED_On(head, MAX7219_DEBUG_STEPPER_HEAD);
else else
Max7219_LED_On(head-8, MAX7219_DEBUG_STEPPER_HEAD+1); Max7219_LED_On(head-8, MAX7219_DEBUG_STEPPER_HEAD+1);
@ -355,13 +354,13 @@ void Max7219_idle_tasks() {
#ifdef MAX7219_DEBUG_STEPPER_TAIL #ifdef MAX7219_DEBUG_STEPPER_TAIL
static int16_t last_tail_cnt=0; static int16_t last_tail_cnt=0;
if (last_tail_cnt != tail) { if (last_tail_cnt != tail) {
if ( last_tail_cnt < 8) if (last_tail_cnt < 8)
Max7219_LED_Off( last_tail_cnt, MAX7219_DEBUG_STEPPER_TAIL); Max7219_LED_Off( last_tail_cnt, MAX7219_DEBUG_STEPPER_TAIL);
else else
Max7219_LED_Off( last_tail_cnt-8, MAX7219_DEBUG_STEPPER_TAIL+1); Max7219_LED_Off( last_tail_cnt-8, MAX7219_DEBUG_STEPPER_TAIL+1);
last_tail_cnt = tail; last_tail_cnt = tail;
if ( tail < 8) if (tail < 8)
Max7219_LED_On(tail, MAX7219_DEBUG_STEPPER_TAIL); Max7219_LED_On(tail, MAX7219_DEBUG_STEPPER_TAIL);
else else
Max7219_LED_On(tail-8, MAX7219_DEBUG_STEPPER_TAIL+1); Max7219_LED_On(tail-8, MAX7219_DEBUG_STEPPER_TAIL+1);
@ -381,10 +380,10 @@ void Max7219_idle_tasks() {
en = max(current_depth, last_depth); en = max(current_depth, last_depth);
if (current_depth < last_depth) if (current_depth < last_depth)
for (uint8_t i = st; i <= en; i++) // clear the highest order LEDs for (uint8_t i = st; i <= en; i++) // clear the highest order LEDs
Max7219_LED_Off(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); Max7219_LED_Off(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
else else
for (uint8_t i = st; i <= en; i++) // set the LEDs to current depth for (uint8_t i = st; i <= en; i++) // set the LEDs to current depth
Max7219_LED_On(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); Max7219_LED_On(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
last_depth = current_depth; last_depth = current_depth;
} }

View File

@ -3749,9 +3749,9 @@ void kill_screen(const char* lcd_msg) {
void lcd_sdcard_menu() { void lcd_sdcard_menu() {
ENCODER_DIRECTION_MENUS(); ENCODER_DIRECTION_MENUS();
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
if (ELAPSED(millis(), assume_print_finished)) { // if the printer has been busy printing, lcd_sdcard_menu() should not if (ELAPSED(millis(), assume_print_finished)) { // if the printer has been busy printing, lcd_sdcard_menu() should not
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // have been active for 5 seconds. In this case, restore the previous lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // have been active for 5 seconds. In this case, restore the previous
encoderPosition = saved_encoderPosition; // encoderPosition to the last selected item. encoderPosition = saved_encoderPosition; // encoderPosition to the last selected item.
assume_print_finished = millis() + 5000; assume_print_finished = millis() + 5000;
@ -3759,7 +3759,7 @@ void kill_screen(const char* lcd_msg) {
saved_encoderPosition = encoderPosition; saved_encoderPosition = encoderPosition;
defer_return_to_status = true; defer_return_to_status = true;
#endif #endif
const uint16_t fileCnt = card.getnrfilenames(); const uint16_t fileCnt = card.getnrfilenames();
START_MENU(); START_MENU();
MENU_BACK(MSG_MAIN); MENU_BACK(MSG_MAIN);
@ -4780,7 +4780,7 @@ void lcd_update() {
if (currentScreen == lcd_status_screen || defer_return_to_status) if (currentScreen == lcd_status_screen || defer_return_to_status)
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
if (currentScreen != lcd_sdcard_menu) // lcd_sdcard_menu() does not time out if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) if (currentScreen != lcd_sdcard_menu) // lcd_sdcard_menu() does not time out if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; // When the printer finishes a file, it will wait with the file selected for return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; // When the printer finishes a file, it will wait with the file selected for
#else // a re-print. #else // a re-print.
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
#endif #endif

View File

@ -39,7 +39,7 @@
// Servos // Servos
// //
#define SERVO0_PIN 53 #define SERVO0_PIN 53
// //
// Limit Switches // Limit Switches
// //