Browse Source

Detab some HAL files

Scott Lahteine 7 years ago
parent
commit
3319765034

+ 35
- 35
Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp View File

89
     PINSEL_ConfigPin(&PinCfg);
89
     PINSEL_ConfigPin(&PinCfg);
90
   }
90
   }
91
 
91
 
92
-	/* Initialize UART Configuration parameter structure to default state:
93
-	 * Baudrate = 9600bps
94
-	 * 8 data bit
95
-	 * 1 Stop bit
96
-	 * None parity
97
-	 */
98
-	UART_ConfigStructInit(&UARTConfigStruct);
99
-
100
-	// Re-configure baudrate
101
-	UARTConfigStruct.Baud_rate = baudrate;
102
-
103
-	// Initialize eripheral with given to corresponding parameter
92
+  /* Initialize UART Configuration parameter structure to default state:
93
+   * Baudrate = 9600bps
94
+   * 8 data bit
95
+   * 1 Stop bit
96
+   * None parity
97
+   */
98
+  UART_ConfigStructInit(&UARTConfigStruct);
99
+
100
+  // Re-configure baudrate
101
+  UARTConfigStruct.Baud_rate = baudrate;
102
+
103
+  // Initialize eripheral with given to corresponding parameter
104
   UART_Init(UARTx, &UARTConfigStruct);
104
   UART_Init(UARTx, &UARTConfigStruct);
105
 
105
 
106
   // Enable and reset the TX and RX FIFOs
106
   // Enable and reset the TX and RX FIFOs
107
   UART_FIFOConfigStructInit(&FIFOConfig);
107
   UART_FIFOConfigStructInit(&FIFOConfig);
108
   UART_FIFOConfig(UARTx, &FIFOConfig);
108
   UART_FIFOConfig(UARTx, &FIFOConfig);
109
 
109
 
110
-	// Enable UART Transmit
110
+  // Enable UART Transmit
111
   UART_TxCmd(UARTx, ENABLE);
111
   UART_TxCmd(UARTx, ENABLE);
112
 
112
 
113
   // Configure Interrupts
113
   // Configure Interrupts
234
   uint8_t LSRValue, byte;
234
   uint8_t LSRValue, byte;
235
 
235
 
236
   IIRValue = UART_GetIntId(UARTx);
236
   IIRValue = UART_GetIntId(UARTx);
237
-  IIRValue &= UART_IIR_INTID_MASK;		/* check bit 1~3, interrupt identification */
237
+  IIRValue &= UART_IIR_INTID_MASK;    /* check bit 1~3, interrupt identification */
238
 
238
 
239
-  if ( IIRValue == UART_IIR_INTID_RLS )		/* Receive Line Status */
239
+  if ( IIRValue == UART_IIR_INTID_RLS )   /* Receive Line Status */
240
   {
240
   {
241
     LSRValue = UART_GetLineStatus(UARTx);
241
     LSRValue = UART_GetLineStatus(UARTx);
242
 
242
 
246
       /* There are errors or break interrupt */
246
       /* There are errors or break interrupt */
247
       /* Read LSR will clear the interrupt */
247
       /* Read LSR will clear the interrupt */
248
       Status = LSRValue;
248
       Status = LSRValue;
249
-      byte = UART_ReceiveByte(UARTx);		/* Dummy read on RX to clear
249
+      byte = UART_ReceiveByte(UARTx);   /* Dummy read on RX to clear
250
                                            interrupt, then bail out */
250
                                            interrupt, then bail out */
251
       return;
251
       return;
252
     }
252
     }
253
   }
253
   }
254
 
254
 
255
-  if ( IIRValue == UART_IIR_INTID_RDA )	/* Receive Data Available */
255
+  if ( IIRValue == UART_IIR_INTID_RDA ) /* Receive Data Available */
256
   {
256
   {
257
     /* Clear the FIFO */
257
     /* Clear the FIFO */
258
     while ( UART_Receive(UARTx, &byte, 1, NONE_BLOCKING) ) {
258
     while ( UART_Receive(UARTx, &byte, 1, NONE_BLOCKING) ) {
265
         break;
265
         break;
266
     }
266
     }
267
   }
267
   }
268
-  else if ( IIRValue == UART_IIR_INTID_CTI )	/* Character timeout indicator */
268
+  else if ( IIRValue == UART_IIR_INTID_CTI )  /* Character timeout indicator */
269
   {
269
   {
270
     /* Character Time-out indicator */
270
     /* Character Time-out indicator */
271
-    Status |= 0x100;		/* Bit 9 as the CTI error */
271
+    Status |= 0x100;    /* Bit 9 as the CTI error */
272
   }
272
   }
273
 
273
 
274
   #if TX_BUFFER_SIZE > 0
274
   #if TX_BUFFER_SIZE > 0
302
 #endif
302
 #endif
303
 
303
 
304
 /*****************************************************************************
304
 /*****************************************************************************
305
-** Function name:		UART0_IRQHandler
305
+** Function name:   UART0_IRQHandler
306
 **
306
 **
307
-** Descriptions:		UART0 interrupt handler
307
+** Descriptions:    UART0 interrupt handler
308
 **
308
 **
309
-** parameters:			None
310
-** Returned value:		None
309
+** parameters:      None
310
+** Returned value:  None
311
 **
311
 **
312
 *****************************************************************************/
312
 *****************************************************************************/
313
 void UART0_IRQHandler (void)
313
 void UART0_IRQHandler (void)
316
 }
316
 }
317
 
317
 
318
 /*****************************************************************************
318
 /*****************************************************************************
319
-** Function name:		UART1_IRQHandler
319
+** Function name:   UART1_IRQHandler
320
 **
320
 **
321
-** Descriptions:		UART1 interrupt handler
321
+** Descriptions:    UART1 interrupt handler
322
 **
322
 **
323
-** parameters:			None
324
-** Returned value:		None
323
+** parameters:      None
324
+** Returned value:  None
325
 **
325
 **
326
 *****************************************************************************/
326
 *****************************************************************************/
327
 void UART1_IRQHandler (void)
327
 void UART1_IRQHandler (void)
330
 }
330
 }
331
 
331
 
332
 /*****************************************************************************
332
 /*****************************************************************************
333
-** Function name:		UART2_IRQHandler
333
+** Function name:   UART2_IRQHandler
334
 **
334
 **
335
-** Descriptions:		UART2 interrupt handler
335
+** Descriptions:    UART2 interrupt handler
336
 **
336
 **
337
-** parameters:			None
338
-** Returned value:		None
337
+** parameters:      None
338
+** Returned value:  None
339
 **
339
 **
340
 *****************************************************************************/
340
 *****************************************************************************/
341
 void UART2_IRQHandler (void)
341
 void UART2_IRQHandler (void)
344
 }
344
 }
345
 
345
 
346
 /*****************************************************************************
346
 /*****************************************************************************
347
-** Function name:		UART3_IRQHandler
347
+** Function name:   UART3_IRQHandler
348
 **
348
 **
349
-** Descriptions:		UART3 interrupt handler
349
+** Descriptions:    UART3 interrupt handler
350
 **
350
 **
351
-** parameters:			None
352
-** Returned value:		None
351
+** parameters:      None
352
+** Returned value:  None
353
 **
353
 **
354
 *****************************************************************************/
354
 *****************************************************************************/
355
 void UART3_IRQHandler (void)
355
 void UART3_IRQHandler (void)

+ 29
- 29
Marlin/src/HAL/HAL_STM32F1/persistent_store_impl.cpp View File

49
 char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
49
 char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
50
 
50
 
51
 bool access_start() {
51
 bool access_start() {
52
-	if (!card.cardOK) return false;
53
-	int16_t bytes_read = 0;
54
-	const char eeprom_zero = 0xFF;
55
-	card.openFile((char *)CONFIG_FILE_NAME,true);
56
-	bytes_read = card.read (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
57
-	if (bytes_read == -1) return false;
58
-	for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++) {
59
-		HAL_STM32F1_eeprom_content[bytes_read] = eeprom_zero;
60
-	}
61
-	card.closefile();
62
-	return true;
52
+  if (!card.cardOK) return false;
53
+  int16_t bytes_read = 0;
54
+  const char eeprom_zero = 0xFF;
55
+  card.openFile((char *)CONFIG_FILE_NAME,true);
56
+  bytes_read = card.read (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
57
+  if (bytes_read == -1) return false;
58
+  for (; bytes_read < HAL_STM32F1_EEPROM_SIZE; bytes_read++) {
59
+    HAL_STM32F1_eeprom_content[bytes_read] = eeprom_zero;
60
+  }
61
+  card.closefile();
62
+  return true;
63
 }
63
 }
64
 
64
 
65
 
65
 
66
 bool access_finish(){
66
 bool access_finish(){
67
-	if (!card.cardOK) return false;
68
-	int16_t bytes_written = 0;
69
-	card.openFile((char *)CONFIG_FILE_NAME,true);
70
-	bytes_written = card.write (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
71
-	card.closefile();
72
-	return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
67
+  if (!card.cardOK) return false;
68
+  int16_t bytes_written = 0;
69
+  card.openFile((char *)CONFIG_FILE_NAME,true);
70
+  bytes_written = card.write (HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
71
+  card.closefile();
72
+  return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
73
 }
73
 }
74
 
74
 
75
 bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
75
 bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
76
-	for (int i = 0; i < size; i++) {
77
-		HAL_STM32F1_eeprom_content [pos + i] = value[i];
78
-	}
79
-	crc16(crc, value, size);
80
-	pos += size;
81
-	return false;
76
+  for (int i = 0; i < size; i++) {
77
+    HAL_STM32F1_eeprom_content [pos + i] = value[i];
78
+  }
79
+  crc16(crc, value, size);
80
+  pos += size;
81
+  return false;
82
 }
82
 }
83
 
83
 
84
 bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
84
 bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
85
-	for (int i = 0; i < size; i++) {
86
-		value[i] = HAL_STM32F1_eeprom_content [pos + i];
87
-	}
88
-	crc16(crc, value, size);
89
-	pos += size;
90
-        return false;
85
+  for (int i = 0; i < size; i++) {
86
+    value[i] = HAL_STM32F1_eeprom_content [pos + i];
87
+  }
88
+  crc16(crc, value, size);
89
+  pos += size;
90
+  return false;
91
 }
91
 }
92
 
92
 
93
 } // PersistentStore::
93
 } // PersistentStore::

Loading…
Cancel
Save