Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
Murilo Belluzzo edited this page Sep 22, 2015 · 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.

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's I/O APIs that allows the execution of board specific code to do the necessary setup. The board specific code is provided through a special kind of module in Soletta that is called 'pinmux module'. This way, the multiplexer code needed for new boards can be fully developed and maintained in external repositories. All it is needed is to implement pinmux module API, install the module in the corrected path and provide Soletta with means to detected the board that will be explained below.

Board Detection

In order to determine which pinmux module needs to be load, Soletta makes use of a board detection infrastructure. This infrastructure searches for the board name in the following order:

  • SOL_BOARD_NAME environment variable (Linux)
  • BOARD_NAME value configured during the build
  • Detect the board by processing the rules found in 'board_detect.json' (Linux)

Board's name is then used to search for it's module. First, in the built-in modules list and then for /lib/soletta/modules/pin-mux/<board_name>.so.

Pin Mux Module Interface

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

Clone this wiki locally