Shouldn't be a problem to create a `const` object that contains information 
about the registers or file-like objects (for Linux) relevant to the specific 
bus. Then `init` can do some some work on those registers/file-like objects.

Some devices have configurable sercoms 
(<https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/overview>)
 which can be configured as either spi/i2c/uart at runtime. Maybe in this case 
a macro could be used to "configure" the sercom once (at compile time) as 
either spi/etc and generate the appropriate `const` object.

"Configure" here meaning to instantiate a `const` object, which is either `I2C` 
or `SPI` etc with a reference to the sercom specific registers. Not doing any 
actual hardware work (obviously, it's a macro, but I wanted to clarify).

Reply via email to