Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
Bruno Dilly edited this page Jun 16, 2016 · 14 revisions

Pin Multiplexer

Due to size and spec restrictions, is common to have a physical I/O pin shared by the different I/O protocols provided by IoT boards. When that is the case, in order to make use of a given pin, it is necessary to execute some additional steps to configure the pin to work on the desired mode. It would cumbersome for a programmer to do it for all pins in all boards in all projects, so that's the job of a Pin Multiplexer. For example, when a Soletta™ Framework application uses the pin number 3 as PWM, behind the scenes a pin multiplexer for that specific board first checks if it is possible to use such pin as PWM and, if it is, execute the needed setup, so the application doesn't have to worry about that.

How it's done in Soletta

Since the multiplexer implementation differs a lot between boards, it would be practically impossible to add support for all. Instead, entry points were added in Soletta framework's I/O APIs that allows the execution of board specific code to do the necessary setup. This code is provided through a special kind of module in Soletta called 'pin-mux module'. This way, the multiplexer code needed for new boards can be fully developed and maintained in external repositories. All that is needed to implement the 'pin-mux' module API, install the module in the corrected path and provide Soletta with means to detected the board to which the module was developed.

In Linux, this folder is usually <DESTDIR>/lib/modules/pin-mux.

Pin Mux Module Interface (API)

The interface that needs to be implemented by a pin-mux module can be found in 'sol-pin-mux-modules.h' file. A macro is provided to make easier to declare the correct symbol that is needed, so the module can be successfully loaded by Soletta library.

Soletta maintains the pin-mux implementation for some boards that can serve as example for those trying to do a custom pin-mux module. You can find them here.

Board Detection

See Board Detection for a detailed info about the detection process and how to make Soletta detect a new board.

Soletta uses the board name to search for the proper pin-mux module. First, in the built-in modules list (modules compiled within Soletta) and then it tries <DESTDIR>/lib/soletta/modules/pin-mux/<board_name>.so.

Clone this wiki locally