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-modules.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 <stdarg.h>
22 
23 #include "sol-common-buildopts.h"
24 #include "sol-gpio.h"
25 #include "sol-pin-mux.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
48 typedef struct sol_pin_mux {
49 #ifndef SOL_NO_API_VERSION
50 #define SOL_PIN_MUX_API_VERSION (2)
51  uint16_t api_version;
52 #endif
53  const char *plat_name;
61  int (*init)(void);
62 
68  void (*shutdown)(void);
69 
83  int (*pin_map)(const char *label, const enum sol_io_protocol prot, va_list args);
84 
96  int (*aio)(int device, int pin);
97 
109  int (*gpio)(uint32_t pin, const struct sol_gpio_config *config);
110 
121  int (*i2c)(uint8_t bus);
122 
134  int (*pwm)(int device, int channel);
135 
136 } sol_pin_mux;
137 
143 #ifdef SOL_PIN_MUX_MODULE_EXTERNAL
144 #define SOL_PIN_MUX_DECLARE(_NAME, decl ...) \
145  SOL_API const struct sol_pin_mux SOL_PIN_MUX = { \
146  SOL_SET_API_VERSION(SOL_PIN_MUX_API_VERSION, ) \
147  decl \
148  }
149 #else
150 #define SOL_PIN_MUX_DECLARE(_NAME, decl ...) \
151  SOL_API const struct sol_pin_mux SOL_PIN_MUX_ ## _NAME = { \
152  SOL_SET_API_VERSION(SOL_PIN_MUX_API_VERSION, ) \
153  decl \
154  }
155 #endif
156 
161 #ifdef __cplusplus
162 }
163 #endif
int(* i2c)(uint8_t bus)
Callback to setup the pins used of the given i2c bus number to operate in I2C mode.
Definition: sol-pin-mux-modules.h:121
int(* init)(void)
Called after the module is successfully load by Soletta to allow it to do any initialization it may r...
Definition: sol-pin-mux-modules.h:61
These routines are used for Pin Multiplexing and Mapping under Soletta.
const char * plat_name
Name of this multiplexer target platform.
Definition: sol-pin-mux-modules.h:53
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
struct sol_pin_mux sol_pin_mux
Structure defining the API of a Pin Multiplexer module.
void(* shutdown)(void)
Called before the module is unloaded.
Definition: sol-pin-mux-modules.h:68
These routines are used for GPIO access under Soletta.
int(* pin_map)(const char *label, const enum sol_io_protocol prot, va_list args)
Callback to map a pin label to the parameters necessary so it works on the desired protocol...
Definition: sol-pin-mux-modules.h:83
int(* gpio)(uint32_t pin, const struct sol_gpio_config *config)
Callback to setup the given pin to operate in the given GPIO configuration.
Definition: sol-pin-mux-modules.h:109
int(* aio)(int device, int pin)
Callback to setup the given pin to operate as Analog I/O.
Definition: sol-pin-mux-modules.h:96
Structure defining the API of a Pin Multiplexer module.
Definition: sol-pin-mux-modules.h:48
uint16_t api_version
API version.
Definition: sol-pin-mux-modules.h:51
int(* pwm)(int device, int channel)
Callback to setup the given pin to operate as PWM.
Definition: sol-pin-mux-modules.h:134