summaryrefslogtreecommitdiff
path: root/app/platform/stm32f0-gcc/retarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/platform/stm32f0-gcc/retarget.cpp')
-rw-r--r--app/platform/stm32f0-gcc/retarget.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/platform/stm32f0-gcc/retarget.cpp b/app/platform/stm32f0-gcc/retarget.cpp
index 8b8160f..a6706d3 100644
--- a/app/platform/stm32f0-gcc/retarget.cpp
+++ b/app/platform/stm32f0-gcc/retarget.cpp
@@ -31,11 +31,11 @@ struct File
static constexpr size_t kFilesCount = 5;
static File files[5] {
- { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(USART1), },
- { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(USART1), },
- { FileType::kUARTDirect, 0, reinterpret_cast<void *>(USART1), },
- { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(USART3), },
- { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(USART4), },
+ { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(&g_uart1), }, // STDIN_FILENO
+ { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(&g_uart1), }, // STDOUT_FILENO
+ { FileType::kUARTDirect, 0, reinterpret_cast<void *>(&g_uart1), }, // STDERR_FILENO
+ { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(&g_uart3), }, // WIFI_FILENO
+ { FileType::kUART, O_NONBLOCK, reinterpret_cast<void *>(&g_uart4), }, // GPS_FILENO
};
int errno{};
@@ -91,10 +91,10 @@ extern "C" ssize_t read(int fd, void *buf, size_t nbytes)
size_t ret{};
switch (file->type) {
case FileType::kUART:
- ret = UARTRead(reinterpret_cast<USART_TypeDef*>(file->extra), buf, nbytes);
+ ret = UARTRead(reinterpret_cast<UART*>(file->extra), buf, nbytes);
break;
case FileType::kUARTDirect:
- ret = UARTReadDirect(reinterpret_cast<USART_TypeDef*>(file->extra), buf, nbytes);
+ ret = UARTReadDirect(reinterpret_cast<UART*>(file->extra), buf, nbytes);
break;
}
return ret;
@@ -110,10 +110,10 @@ extern "C" ssize_t write(int fd, const void *buf, size_t nbytes)
size_t ret{};
switch (file->type) {
case FileType::kUART:
- ret = UARTWrite(reinterpret_cast<USART_TypeDef*>(file->extra), buf, nbytes);
+ ret = UARTWrite(reinterpret_cast<UART*>(file->extra), buf, nbytes);
break;
case FileType::kUARTDirect:
- ret = UARTWriteDirect(reinterpret_cast<USART_TypeDef*>(file->extra), buf, nbytes);
+ ret = UARTWriteDirect(reinterpret_cast<UART*>(file->extra), buf, nbytes);
break;
}
return ret;