Hi Fabian, On 12/22/2013 12:22 PM, Fabian Greif wrote:
I was wondering why we have the UART HAL layer for the STM32? What does it add apart from making the UART classes more complex?
I added this class because I was told not to add any controller specific interfaces to the Uart class implementing our common interface. Since we then had two Uart implementations for STM32 I used UartHal to implement the Uart functionality in order to avoid duplicate code. I needed this additional interface in order to implement a custom protocoll that uses a state machine in an interrupt routine. We need to think about how to handle extended capabilities of some controller ip that can not be included in our interfaces, because they can only represent a common denomiator. One approach is to make a separate class (a HAL class) that can be used by another class to implement the common interface. Or we can add an "extended capability" section to the classes that implement the common interface, in which controller specific methods are offered.
Background: Two days ago I did a small evening project to build a DMX512 light controller. In order to do that I needed a UART with two stopbits. As it was intended to be done fast, I copied the Usart1 class and was annoyed to have to figure out what class does what and to have to implement my changes in both classes.
Is this supported by all controllers that we use? Is this part of our interface? If not, should we add an option for 2 Stopbits to our interface? Kevin