Rev 6 | Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6 | Rev 7 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | usart_ctl uc2; |
18 | usart_ctl uc2; |
19 | #endif |
19 | #endif |
20 | #if defined SERIAL_UART3 |
20 | #if defined SERIAL_UART3 |
21 | usart_ctl uc3; |
21 | usart_ctl uc3; |
22 | #endif |
22 | #endif |
- | 23 | #if defined SERIAL_UART4 |
|
- | 24 | usart_ctl uc4; |
|
- | 25 | #endif |
|
- | 26 | #if defined SERIAL_UART5 |
|
- | 27 | usart_ctl uc5; |
|
- | 28 | #endif |
|
- | 29 | ||
23 | 30 | ||
24 | /* returns the number of characters received by the Rx USART */ |
31 | /* returns the number of characters received by the Rx USART */ |
25 | uint16_t |
32 | uint16_t |
26 | SerialCharsReceived (usart_ctl *instance) |
33 | SerialCharsReceived (usart_ctl *instance) |
27 | { |
34 | { |
Line 44... | Line 51... | ||
44 | __HAL_UART_ENABLE_IT (instance->Handle, UART_IT_RXNE); |
51 | __HAL_UART_ENABLE_IT (instance->Handle, UART_IT_RXNE); |
45 | 52 | ||
46 | return result; |
53 | return result; |
47 | } |
54 | } |
48 | 55 | ||
- | 56 | uint16_t SerialTransmitSpace(usart_ctl * instance) |
|
- | 57 | { |
|
- | 58 | return TX_USART_BUFF_SIZ- instance->tx_usart_count; |
|
- | 59 | } |
|
- | 60 | ||
- | 61 | ||
- | 62 | ||
49 | inline uint8_t |
63 | inline uint8_t |
50 | PollSerial (usart_ctl *instance) |
64 | PollSerial (usart_ctl *instance) |
51 | { |
65 | { |
52 | uint8_t rc; |
66 | uint8_t rc; |
53 | 67 | ||
Line 287... | Line 301... | ||
287 | __disable_irq (); |
301 | __disable_irq (); |
288 | HAL_UART_Init (ctl->Handle); |
302 | HAL_UART_Init (ctl->Handle); |
289 | __enable_irq (); |
303 | __enable_irq (); |
290 | } |
304 | } |
291 | 305 | ||
- | 306 | void sendString(usart_ctl *ctl, char *string, int length) |
|
- | 307 | { |
|
- | 308 | int i; |
|
- | 309 | for (i = 0; i < length; i++) |
|
- | 310 | PutCharSerial(ctl, string[i]); |
|
- | 311 | } |
|
- | 312 | ||
- | 313 | ||
292 | 314 | ||
293 | 315 | ||
294 | ///////////////////////////////////////////////////////// |
316 | ///////////////////////////////////////////////////////// |
295 | /// Moved from generated code to avoid crappy HAL handler |
317 | /// Moved from generated code to avoid crappy HAL handler |
296 | #if defined SERIAL_UART1 |
318 | #if defined SERIAL_UART1 |
Line 309... | Line 331... | ||
309 | void USART3_IRQHandler(void) |
331 | void USART3_IRQHandler(void) |
310 | { |
332 | { |
311 | UART_IRQHandler(&uc3); |
333 | UART_IRQHandler(&uc3); |
312 | } |
334 | } |
313 | #endif |
335 | #endif |
- | 336 | #if defined SERIAL_UART4 |
|
- | 337 | void UART4_IRQHandler(void) |
|
- | 338 | { |
|
- | 339 | UART_IRQHandler(&uc4); |
|
- | 340 | } |
|
- | 341 | #endif |
|
- | 342 | #if defined SERIAL_UART5 |
|
- | 343 | void UART5_IRQHandler(void) |
|
- | 344 | { |
|
- | 345 | UART_IRQHandler(&uc5); |
|
- | 346 | } |
|
- | 347 | #endif |