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
sol-pin-mux.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <stdint.h>
22 
23 #include "sol-gpio.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
45  SOL_IO_AIO = 0x01,
46  SOL_IO_GPIO = 0x02,
47  SOL_IO_I2C = 0x04,
48  SOL_IO_PWM = 0x08,
49  SOL_IO_SPI = 0x10,
50  SOL_IO_UART = 0x20,
51 };
52 
63 bool sol_pin_mux_select_mux(const char *board);
64 
76 int sol_pin_mux_map(const char *label, const enum sol_io_protocol prot, ...);
77 
89 int sol_pin_mux_setup_aio(int device, int pin);
90 
102 int sol_pin_mux_setup_gpio(uint32_t pin, const struct sol_gpio_config *config);
103 
115 int sol_pin_mux_setup_i2c(uint8_t bus);
116 
128 int sol_pin_mux_setup_pwm(int device, int channel);
129 
134 #ifdef __cplusplus
135 }
136 #endif
bool sol_pin_mux_select_mux(const char *board)
Select Pin Multiplexer instructions of a given board.
int sol_pin_mux_setup_pwm(int device, int channel)
Setup the given pin to operate as PWM.
sol_io_protocol
Flags to describe pin capabilities (as the supported protocols).
Definition: sol-pin-mux.h:44
Structure to hold the configuration of a GPIO device.
Definition: sol-gpio.h:150
GPIO capability.
Definition: sol-pin-mux.h:46
UART capability.
Definition: sol-pin-mux.h:50
These routines are used for GPIO access under Soletta.
int sol_pin_mux_setup_aio(int device, int pin)
Setup the given pin to operate as Analog I/O.
SPI capability.
Definition: sol-pin-mux.h:49
I2C capability.
Definition: sol-pin-mux.h:47
AIO capability.
Definition: sol-pin-mux.h:45
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. ...
int sol_pin_mux_setup_i2c(uint8_t bus)
Setup the pins used of the given i2c bus number to operate in I2C mode.
PWM capability.
Definition: sol-pin-mux.h:48
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.