Skip to content
Snippets Groups Projects
Commit 6370560d authored by Emilio Corigliano's avatar Emilio Corigliano
Browse files

[USART] Improved USART driver

- Checked and fixed the baudrate calculation and used `getAPBPeripheralsClock`;
- Removed init method: Some checks are present only as asserts, but the most part of the initialization is performed in the constructor. This usually won't be an issue till we don't try to create a non supported USART (an assert is used to check for this). Removing the init method we delete the issue on forgetting to initialize the bus;
- Changed interface for read: USART and STM32SerialWrapper have `readBlocking` (waits for at least one byte to be received) while only USART has the non-blocking `read` method that returns true if the driver received something and false otherwise; Also, both methods are overloaded to support or not the return of the number of bytes read;
- Removed pins from the `USART.h` file;
- Avoided internally initializing pins in the STM32SerialWrapper driver. We will always have to initialize them externally;
- Enhanced the ifdefs present in the driver to address peripherals and not targets;
- Now baudrate is passed as an integer, so the driver is not limited to the standard baudrates. Anyway the list of default baudrate values is present in the documentation;
- Removed all the other wrappers of the miosix serial driver so that all the codebase uses the USART driver;
- Enhanced documentation;
- Small code refactoring
- Enhanced ISR code
parent 3b23ba74
Loading
Showing
with 432 additions and 1171 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment