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 execute the needed setup, so it's transparent to the application developer.

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 of them. 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 framework called 'pin-mux module'. This way, the multiplexer code needed for new boards can be fully developed and maintained in external repositories. The following steps are required for a new 'pin-mux' module implementation:

  • to implement the 'pin-mux' module API
  • to install the module in the correct path following the name convention described on board detection section.

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 the declaration of required symbols an easy task. Such symbols are required by Soletta framework in order to load the new module.

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

Clone this wiki locally