mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
upm: fix pin and bus types to allow subplatform usage in C libs
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
a5680d9b9a
commit
b367a63010
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "a110x.h"
|
#include "a110x.h"
|
||||||
|
|
||||||
a110x_context a110x_init(uint8_t pin) {
|
a110x_context a110x_init(int pin) {
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct _a110x_context {
|
typedef struct _a110x_context {
|
||||||
mraa_gpio_context gpio;
|
mraa_gpio_context gpio;
|
||||||
uint8_t gpio_pin;
|
int gpio_pin;
|
||||||
bool isr_installed;
|
bool isr_installed;
|
||||||
} *a110x_context;
|
} *a110x_context;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ typedef struct _a110x_context {
|
|||||||
* @param pin GPIO pin to use
|
* @param pin GPIO pin to use
|
||||||
* @return device context pointer
|
* @return device context pointer
|
||||||
*/
|
*/
|
||||||
a110x_context a110x_init(uint8_t pin);
|
a110x_context a110x_init(int pin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A110X Initialization function
|
* A110X Initialization function
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "abp.h"
|
#include "abp.h"
|
||||||
|
|
||||||
abp_context abp_init(uint8_t bus, uint8_t dev_address){
|
abp_context abp_init(int bus, uint8_t dev_address){
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -60,7 +60,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct _abp_context {
|
typedef struct _abp_context {
|
||||||
mraa_i2c_context i2c;
|
mraa_i2c_context i2c;
|
||||||
uint8_t i2c_bus_number;
|
int i2c_bus_number;
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
int abp_pressure_max;
|
int abp_pressure_max;
|
||||||
int abp_pressure_min;
|
int abp_pressure_min;
|
||||||
@ -74,7 +74,7 @@ typedef struct _abp_context {
|
|||||||
* @param bus I2C bus to use
|
* @param bus I2C bus to use
|
||||||
* @return device context pointer
|
* @return device context pointer
|
||||||
*/
|
*/
|
||||||
abp_context abp_init(uint8_t bus, uint8_t dev_address);
|
abp_context abp_init(int bus, uint8_t dev_address);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ABP Close function
|
* ABP Close function
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "gp2y0a.h"
|
#include "gp2y0a.h"
|
||||||
|
|
||||||
gp2y0a_context gp2y0a_init(uint8_t pin, float a_ref){
|
gp2y0a_context gp2y0a_init(int pin, float a_ref){
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct _gp2y0a_context {
|
typedef struct _gp2y0a_context {
|
||||||
mraa_aio_context aio;
|
mraa_aio_context aio;
|
||||||
uint8_t pin;
|
int pin;
|
||||||
int a_res;
|
int a_res;
|
||||||
} *gp2y0a_context;
|
} *gp2y0a_context;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ typedef struct _gp2y0a_context {
|
|||||||
* @param pin Analog pin to use
|
* @param pin Analog pin to use
|
||||||
* @param a_ref reference voltage
|
* @param a_ref reference voltage
|
||||||
*/
|
*/
|
||||||
gp2y0a_context gp2y0a_init(uint8_t pin, float a_ref);
|
gp2y0a_context gp2y0a_init(int pin, float a_ref);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GP2Y0A close function
|
* GP2Y0A close function
|
||||||
|
@ -135,9 +135,9 @@ lcm1602_context lcm1602_i2c_init(int bus, int address, bool is_expander,
|
|||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcm1602_context lcm1602_gpio_init(uint8_t rs, uint8_t enable,
|
lcm1602_context lcm1602_gpio_init(int rs, int enable,
|
||||||
uint8_t d0, uint8_t d1, uint8_t d2,
|
int d0, int d1, int d2,
|
||||||
uint8_t d3, uint8_t num_columns,
|
int d3, uint8_t num_columns,
|
||||||
uint8_t num_rows)
|
uint8_t num_rows)
|
||||||
{
|
{
|
||||||
lcm1602_context dev =
|
lcm1602_context dev =
|
||||||
|
@ -115,9 +115,9 @@ extern "C" {
|
|||||||
* @param num_rows Number of rows the display has. Default 2.
|
* @param num_rows Number of rows the display has. Default 2.
|
||||||
* @return Device Ccontext, or NULL on error.
|
* @return Device Ccontext, or NULL on error.
|
||||||
*/
|
*/
|
||||||
lcm1602_context lcm1602_gpio_init(uint8_t rs, uint8_t enable,
|
lcm1602_context lcm1602_gpio_init(int rs, int enable,
|
||||||
uint8_t d0, uint8_t d1, uint8_t d2,
|
int d0, int d1, int d2,
|
||||||
uint8_t d3, uint8_t num_columns,
|
int d3, uint8_t num_columns,
|
||||||
uint8_t num_rows);
|
uint8_t num_rows);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "upm_types.h"
|
#include "upm_types.h"
|
||||||
|
|
||||||
led_context led_init(uint8_t pin){
|
led_context led_init(int pin){
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct _led_context {
|
typedef struct _led_context {
|
||||||
mraa_gpio_context gpio;
|
mraa_gpio_context gpio;
|
||||||
uint8_t led_pin;
|
int led_pin;
|
||||||
} *led_context;
|
} *led_context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +56,7 @@ typedef struct _led_context {
|
|||||||
* @param pin GPIO pin to use
|
* @param pin GPIO pin to use
|
||||||
* @return The sensor context
|
* @return The sensor context
|
||||||
*/
|
*/
|
||||||
led_context led_init(uint8_t pin);
|
led_context led_init(int pin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LED Initialization function
|
* LED Initialization function
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
static void my9221_lock_data(const my9221_context dev);
|
static void my9221_lock_data(const my9221_context dev);
|
||||||
static void my9221_send_16bit_block(const my9221_context dev, uint16_t data);
|
static void my9221_send_16bit_block(const my9221_context dev, uint16_t data);
|
||||||
|
|
||||||
my9221_context my9221_init(uint8_t dataPin, uint8_t clockPin,
|
my9221_context my9221_init(int dataPin, int clockPin,
|
||||||
int instances)
|
int instances)
|
||||||
{
|
{
|
||||||
if (instances < 1)
|
if (instances < 1)
|
||||||
|
@ -91,7 +91,7 @@ extern "C" {
|
|||||||
* least 1
|
* least 1
|
||||||
* @return Device context
|
* @return Device context
|
||||||
*/
|
*/
|
||||||
my9221_context my9221_init(uint8_t dataPin, uint8_t clockPin,
|
my9221_context my9221_init(int dataPin, int clockPin,
|
||||||
int instances);
|
int instances);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ upm_result_t rsc_add_dr_delay(rsc_context dev);
|
|||||||
|
|
||||||
void rsc_set_access_type(rsc_context dev, ACCESS_T type);
|
void rsc_set_access_type(rsc_context dev, ACCESS_T type);
|
||||||
|
|
||||||
rsc_context rsc_init(uint8_t bus, uint8_t cs_ee_pin, uint8_t cs_adc_pin) {
|
rsc_context rsc_init(int bus, int cs_ee_pin, int cs_adc_pin) {
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -53,7 +53,7 @@ typedef struct _rsc_context {
|
|||||||
mraa_spi_context spi;
|
mraa_spi_context spi;
|
||||||
mraa_gpio_context cs_ee;
|
mraa_gpio_context cs_ee;
|
||||||
mraa_gpio_context cs_adc;
|
mraa_gpio_context cs_adc;
|
||||||
uint8_t spi_bus_number;
|
int spi_bus_number;
|
||||||
float coeff_matrix[RSC_COEFF_T_ROW_NO][RSC_COEFF_T_COL_NO];
|
float coeff_matrix[RSC_COEFF_T_ROW_NO][RSC_COEFF_T_COL_NO];
|
||||||
PRESSURE_U unit;
|
PRESSURE_U unit;
|
||||||
PRESSURE_T type;
|
PRESSURE_T type;
|
||||||
@ -79,7 +79,7 @@ typedef struct _rsc_context {
|
|||||||
* @param cs_adc_pin The CS pin for accessing the ADC
|
* @param cs_adc_pin The CS pin for accessing the ADC
|
||||||
* @return The device context, or NULL if an error occurred.
|
* @return The device context, or NULL if an error occurred.
|
||||||
*/
|
*/
|
||||||
rsc_context rsc_init(uint8_t bus, uint8_t cs_ee_pin, uint8_t cs_adc_pin);
|
rsc_context rsc_init(int bus, int cs_ee_pin, int cs_adc_pin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RSC Close function
|
* RSC Close function
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
#define URM37_WAIT_TIMEOUT 1000
|
#define URM37_WAIT_TIMEOUT 1000
|
||||||
#define URM37_MAX_RETRIES 10
|
#define URM37_MAX_RETRIES 10
|
||||||
|
|
||||||
urm37_context urm37_init(uint8_t a_pin, uint8_t reset_pin,
|
urm37_context urm37_init(int a_pin, int reset_pin,
|
||||||
uint8_t trigger_pin, float a_ref,
|
int trigger_pin, float a_ref,
|
||||||
uint8_t uart_bus, bool analog_mode)
|
int uart_bus, bool analog_mode)
|
||||||
{
|
{
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
|
@ -76,9 +76,9 @@ typedef struct _urm37_context {
|
|||||||
* @param uart Default UART to use (0 or 1). Ignored in analog mode.
|
* @param uart Default UART to use (0 or 1). Ignored in analog mode.
|
||||||
* @param mode true for analog mode, false otherwise.
|
* @param mode true for analog mode, false otherwise.
|
||||||
*/
|
*/
|
||||||
urm37_context urm37_init(uint8_t a_pin, uint8_t reset_pin,
|
urm37_context urm37_init(int a_pin, int reset_pin,
|
||||||
uint8_t trigger_pin, float a_ref,
|
int trigger_pin, float a_ref,
|
||||||
uint8_t uart, bool analog_mode);
|
int uart, bool analog_mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URM37 sensor close function
|
* URM37 sensor close function
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "veml6070.h"
|
#include "veml6070.h"
|
||||||
|
|
||||||
veml6070_context veml6070_init(uint8_t bus) {
|
veml6070_context veml6070_init(int bus) {
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
@ -58,7 +58,7 @@ typedef struct _veml6070_context {
|
|||||||
mraa_i2c_context i2c_seq2;
|
mraa_i2c_context i2c_seq2;
|
||||||
uint8_t address_seq1;
|
uint8_t address_seq1;
|
||||||
uint8_t address_seq2;
|
uint8_t address_seq2;
|
||||||
uint8_t i2c_bus_number;
|
int i2c_bus_number;
|
||||||
} *veml6070_context;
|
} *veml6070_context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,7 +69,7 @@ typedef struct _veml6070_context {
|
|||||||
*
|
*
|
||||||
* @return device context pointer
|
* @return device context pointer
|
||||||
*/
|
*/
|
||||||
veml6070_context veml6070_init(uint8_t bus);
|
veml6070_context veml6070_init(int bus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VEML6070 Close function
|
* VEML6070 Close function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user