HAL driver with two different peripherals

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

HAL driver with two different peripherals

Post by Marco »

Hi,

I was wondering what would be the best/preferred way to implement a HAL driver which has two different hardware peripherals.

In my case a PWM driver for a PWM peripheral and a timer peripheral capable of generating PWM signals. If they will not exist in the application at the same time there is not really a problem, but what if they do have to exist both in the same application? Is it even possible in the current HAL?

Marco
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: HAL driver with two different peripherals

Post by Giovanni »

Hi,

It is possible, look at the ADC driver for the STM32F37x, it uses both the normal ADC and the SDADC, separately or at same time. A similar approach could be used for other peripherals. Start with looking at the configuration options and then the configuration structure.

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: HAL driver with two different peripherals

Post by Marco »

Ah yes i see, thanks for pointing me in the right direction.

Marco
Post Reply