| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef PLATFORMS_STM_DISCO_FLETCH_SRC_UART_H_ | 5 #ifndef PLATFORMS_STM_DISCO_DARTINO_SRC_UART_H_ |
| 6 #define PLATFORMS_STM_DISCO_FLETCH_SRC_UART_H_ | 6 #define PLATFORMS_STM_DISCO_DARTINO_SRC_UART_H_ |
| 7 | 7 |
| 8 #include <inttypes.h> | 8 #include <inttypes.h> |
| 9 | 9 |
| 10 #include <cmsis_os.h> | 10 #include <cmsis_os.h> |
| 11 #include <stm32f7xx_hal.h> | 11 #include <stm32f7xx_hal.h> |
| 12 | 12 |
| 13 #include "platforms/stm/disco_fletch/src/circular_buffer.h" | 13 #include "platforms/stm/disco_dartino/src/circular_buffer.h" |
| 14 | 14 |
| 15 // Interface to the universal asynchronous receiver/transmitter | 15 // Interface to the universal asynchronous receiver/transmitter |
| 16 // (UART). | 16 // (UART). |
| 17 class Uart { | 17 class Uart { |
| 18 public: | 18 public: |
| 19 // Access the UART on the first UART port. | 19 // Access the UART on the first UART port. |
| 20 Uart(); | 20 Uart(); |
| 21 | 21 |
| 22 // Start processing the UART. | 22 // Start processing the UART. |
| 23 void Start(); | 23 void Start(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 UART_HandleTypeDef* uart_; | 45 UART_HandleTypeDef* uart_; |
| 46 int error_count_; | 46 int error_count_; |
| 47 osSemaphoreDef(semaphore_def_); | 47 osSemaphoreDef(semaphore_def_); |
| 48 osSemaphoreId(semaphore_); | 48 osSemaphoreId(semaphore_); |
| 49 | 49 |
| 50 // Receive status. | 50 // Receive status. |
| 51 uint8_t rx_data_; // The one byte received at the time. | 51 uint8_t rx_data_; // The one byte received at the time. |
| 52 CircularBuffer* rx_buffer_; | 52 CircularBuffer* rx_buffer_; |
| 53 | 53 |
| 54 // Transmit status. | 54 // Transmit status. |
| 55 fletch::Mutex* tx_mutex_; | 55 dartino::Mutex* tx_mutex_; |
| 56 uint8_t tx_data_[kTxBlockSize]; // Buffer send to the HAL. | 56 uint8_t tx_data_[kTxBlockSize]; // Buffer send to the HAL. |
| 57 bool tx_pending_; | 57 bool tx_pending_; |
| 58 CircularBuffer* tx_buffer_; | 58 CircularBuffer* tx_buffer_; |
| 59 | 59 |
| 60 friend void __UartTask(const void*); | 60 friend void __UartTask(const void*); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 #endif // PLATFORMS_STM_DISCO_FLETCH_SRC_UART_H_ | 63 #endif // PLATFORMS_STM_DISCO_DARTINO_SRC_UART_H_ |
| OLD | NEW |