openiolink / io-link-master-shield-hat-sw

Software for the IO-Link Master Shield/Hat for Arduino and Raspberry Pi
Apache License 2.0
25 stars 6 forks source link

Rework on PIN Class #16

Open CrazyGecko opened 3 years ago

CrazyGecko commented 3 years ago

Actually there is a PIN object generated for every PIN. With some rework on the code, there is no need for the PIN object and the required function can be placed inline at compile time. This should reduce a big ammount of resource consumption and also reduces the execution time.

gammeter commented 3 years ago

Currently, there is an abstract PIN class Max14819::PIN from which HardwareRaspberry::PIN_raspi and HardwareArduino::PIN_arduino inherit. Only one of them gets compiled, because thery're part of the abstraction of different target hardware. The decision which one to compile is (or at least should be) bound to the selection of the target hardware platform at the beginning of the compilation.
Because of this, it's not appropriate to use polymorphism here.

Ideas to implement the above mentioned (where not already done) are to use one of the following:

This has to be discussed further.