Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Enumerations | Functions
Pin Multiplexing

These routines are used for Pin Multiplexing and Mapping under Soletta. More...

Modules

 Pin Multiplexer Modules
 Defines the API that needs to be implemented by Pin Multiplexer modules under Soletta.
 

Enumerations

enum  sol_io_protocol {
  SOL_IO_AIO = 0x01, SOL_IO_GPIO = 0x02, SOL_IO_I2C = 0x04, SOL_IO_PWM = 0x08,
  SOL_IO_SPI = 0x10, SOL_IO_UART = 0x20
}
 Flags to describe pin capabilities (as the supported protocols). More...
 

Functions

int sol_pin_mux_map (const char *label, const enum sol_io_protocol prot,...)
 Maps a pin label to the parameters necessary so it works on the desired protocol. More...
 
bool sol_pin_mux_select_mux (const char *board)
 Select Pin Multiplexer instructions of a given board. More...
 
int sol_pin_mux_setup_aio (int device, int pin)
 Setup the given pin to operate as Analog I/O. More...
 
int sol_pin_mux_setup_gpio (uint32_t pin, const struct sol_gpio_config *config)
 Setup the given pin to operate in the given GPIO configuration. More...
 
int sol_pin_mux_setup_i2c (uint8_t bus)
 Setup the pins used of the given i2c bus number to operate in I2C mode. More...
 
int sol_pin_mux_setup_pwm (int device, int channel)
 Setup the given pin to operate as PWM. More...
 

Detailed Description

These routines are used for Pin Multiplexing and Mapping under Soletta.

Enumeration Type Documentation

Flags to describe pin capabilities (as the supported protocols).

Enumerator
SOL_IO_AIO 

AIO capability.

SOL_IO_GPIO 

GPIO capability.

SOL_IO_I2C 

I2C capability.

SOL_IO_PWM 

PWM capability.

SOL_IO_SPI 

SPI capability.

SOL_IO_UART 

UART capability.

Function Documentation

int sol_pin_mux_map ( const char *  label,
const enum sol_io_protocol  prot,
  ... 
)

Maps a pin label to the parameters necessary so it works on the desired protocol.

Find if a given pin labeled 'label' is capable of operate on protocol 'prot' and return the parameters needed to setup the protocol.

Parameters
labelThe label of the pin as see on the board
protProtocol on which the pin should operate
Returns
'0' on success, error code (always negative) otherwise.
bool sol_pin_mux_select_mux ( const char *  board)

Select Pin Multiplexer instructions of a given board.

Searches(and activate if found) for pin multiplexing instructions of the given board. Built-in Pin Multiplexers have priority over modules.

Parameters
boardThe board name being used
Returns
'true' on success, 'false' otherwise.
int sol_pin_mux_setup_aio ( int  device,
int  pin 
)

Setup the given pin to operate as Analog I/O.

If a pin multiplexer is loaded (from a successfully call to sol_pin_mux_select_mux), execute the instructions needed to configure 'device'/'pin' pair to operate as Analog I/O.

Parameters
devicethe aio device number.
pinthe aio pin number.
Returns
'0' on success, error code (always negative) otherwise.
int sol_pin_mux_setup_gpio ( uint32_t  pin,
const struct sol_gpio_config config 
)

Setup the given pin to operate in the given GPIO configuration.

If a pin multiplexer is loaded (from a successfully call to sol_pin_mux_select_mux), execute the instructions needed to configure 'pin' to operate as configured by 'config'.

Parameters
pinthe gpio pin number.
configDesired configuration for the pin.
Returns
'0' on success, error code (always negative) otherwise.
int sol_pin_mux_setup_i2c ( uint8_t  bus)

Setup the pins used of the given i2c bus number to operate in I2C mode.

If a pin multiplexer is loaded (from a successfully call to sol_pin_mux_select_mux), execute the instructions needed to configure the pins used by the given i2c bus to operate in I2C mode.

Parameters
busthe i2c bus number.
Returns
'0' on success, error code (always negative) otherwise.
int sol_pin_mux_setup_pwm ( int  device,
int  channel 
)

Setup the given pin to operate as PWM.

If a pin multiplexer is loaded (from a successfully call to sol_pin_mux_select_mux), execute the instructions needed to configure 'device'/'channel' pair to operate as PWM.

Parameters
devicethe pwm device number.
channelthe channel number on device.
Returns
'0' on success, error code (always negative) otherwise.