Reputation: 23
I am trying to make a layered architecture and apply hardware abstraction using the HAL concept (hardware abstraction layer).
But I have to stick to the common features only between MCUs, in order to make a generic interface that can be portable between different MCUs. So that I won't have to change the upper layer at all when I move to another MCU.
But I won't be able to use costum features that exist in a specific MCU while others don't have it.
So if there is a specific extra feature in a gpio module that exists in a specific MCU and I want to use it but it doesn't exist in HAL (because it's not a common feature). How can I make an interface for it?
Example:
I want to make a HAL that contains standard interface between atmega328p and Dspic33. Dspic33 has a feature in the Gpio which is Internal Pull Down. This feature does not exist in the atmega328p (so I can't include it in the HAL standard interface).
So if I want to use this uncommon feature how am I going to do that?
Upvotes: 1
Views: 202
Reputation: 26753
You can either or all of the following:
#ifdef
; which in turn would allow to skip implementing it on the environments which do not support the feature)Upvotes: 2