[USART] Enhanced USART driver with fixes and added features
This merge request closes #115 (closed), #101 (closed) and #99 (closed).
- Checked and fixed the baudrate calculation (issue #99 (closed)) and used the correct
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-blockingread
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
Edited by Emilio Corigliano