-
Notifications
You must be signed in to change notification settings - Fork 242
Improved CMSIS USART compatibility #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ | |
| */ | ||
|
|
||
| #include "uart_cmsis_transport.h" | ||
| #include "board.h" | ||
| #include <cstdio> | ||
|
|
||
| using namespace erpc; | ||
|
|
@@ -41,6 +40,7 @@ using namespace erpc; | |
|
|
||
| static volatile bool s_isTransferReceiveCompleted = false; | ||
| static volatile bool s_isTransferSendCompleted = false; | ||
| constexpr auto kStatus_Success = ARM_DRIVER_OK; | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////// | ||
| // Code | ||
|
|
@@ -74,6 +74,13 @@ erpc_status_t UartTransport::init() | |
| { | ||
| erpc_status_t status = (*m_uartDrv).Initialize(TransferCallback); | ||
| (*m_uartDrv).PowerControl(ARM_POWER_FULL); | ||
|
|
||
| /*Configure the USART to 9600 Bits/sec */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These settings are application specific and should be set before calling constructor of this class.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure that Control configuration has any guarantee of functioning before Initialize is called it seems to me that maybe the m_uartDrv should be initialized and then passed to the constructor removing the need for init. |
||
| m_uartDrv->Control(ARM_USART_MODE_ASYNCHRONOUS | ARM_USART_DATA_BITS_8 | ARM_USART_PARITY_NONE | ARM_USART_STOP_BITS_1 | ARM_USART_FLOW_CONTROL_NONE, 9600); | ||
|
|
||
| /* Enable Receiver and Transmitter lines */ | ||
| m_uartDrv->Control(ARM_USART_CONTROL_TX, 1); | ||
| m_uartDrv->Control(ARM_USART_CONTROL_RX, 1); | ||
|
|
||
| return status != kStatus_Success ? kErpcStatus_InitFailed : kErpcStatus_Success; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use ARM_DRIVER_OK here instead of kStatus_Success. kStatus_Success is redundant from older times. I would also change status variable type from erpc_status_t to int32_t as in CMSIS driver is used. |
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not use c++11 specific code.