Private
Public Access
2
0

maa: change the linking of maa and make gpio functions match maa_ spec

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-04-27 23:11:31 +01:00
parent a28d538321
commit ed0a1f6085
14 changed files with 79 additions and 57 deletions

View File

@@ -20,8 +20,9 @@
#include <stdio.h>
typedef struct gpio_struct
{
#include "maa.h"
typedef struct {
int pin;
int pinMap;
char path[64];
@@ -31,11 +32,11 @@ typedef struct gpio_struct
typedef char gpio_mode_t[16];
typedef char gpio_dir_t[16];
void gpio_init(gpio_t *gpio, int pin);
int gpio_set(int pin);
void gpio_mode(gpio_t *gpio, gpio_mode_t mode);
void gpio_dir(gpio_t *gpio, gpio_dir_t dir);
maa_result_t maa_gpio_init(gpio_t *gpio, int pin);
int maa_gpio_set(int pin);
void maa_gpio_mode(gpio_t *gpio, gpio_mode_t mode);
void maa_gpio_dir(gpio_t *gpio, gpio_dir_t dir);
void gpio_close(gpio_t *gpio);
int gpio_read(gpio_t *gpio);
void gpio_write(gpio_t *gpio, int value);
void maa_gpio_close(gpio_t *gpio);
int maa_gpio_read(gpio_t *gpio);
void maa_gpio_write(gpio_t *gpio, int value);

View File

@@ -21,6 +21,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include "maa.h"
#include "gpio.h"
typedef struct {
@@ -30,7 +32,7 @@ typedef struct {
gpio_t gpio;
} i2c_t;
int maa_i2c_init(i2c_t* dev);
maa_result_t maa_i2c_init(i2c_t* dev);
/** Set the frequency of the I2C interface
*

View File

@@ -24,10 +24,21 @@
#pragma once
#include "i2c.h"
#include "gpio.h"
#include "pwm.h"
#define MAA_LIBRARY_VERSION 1
int maa_get_version();
typedef enum {
MAA_SUCCESS = 0,
MAA_ERROR_FEATURE_NOT_IMPLEMENTED = 1,
MAA_ERROR_FEATURE_NOT_SUPPORTED = 2,
MAA_ERROR_INVALID_VERBOSITY_LEVEL = 3,
MAA_ERROR_INVALID_PARAMETER = 4,
MAA_ERROR_INVALID_HANDLE = 5,
MAA_ERROR_NO_RESOURCES = 6,
MAA_ERROR_INVALID_RESOURCE = 7,
MAA_ERROR_INVALID_QUEUE_TYPE = 8,
MAA_ERROR_NO_DATA_AVAILABLE = 9,
MAA_ERROR_UNSPECIFIED = 99
} maa_result_t;
maa_result_t maa_get_version();

View File

@@ -21,12 +21,14 @@
#include <stdio.h>
#include <fcntl.h>
#include "maa.h"
typedef struct {
int chipid, pin;
FILE *duty_fp;
} pwm_t;
int maa_pwm_init(pwm_t* pwm, int chipin, int pin);
maa_result_t maa_pwm_init(pwm_t* pwm, int chipin, int pin);
/** Set the ouput duty-cycle percentage, as a float
*