Private
Public Access
2
0

mraa.c: change pin initialization and fix Galileo Gen2 AIO

Add pin commands. Old mraa_setup_mux_mapped style is used for other boards
(pincmd = PINCMD_UNDEFINED) where pincmds are not defined.Remove useless
pullup_enable code, Galileo Gen2: review all pin mux and add commands Galileo
Gen2: remove doubled functionality: mraa_intel_galileo_gen2_i2c_init_pre and
mraa_intel_galileo_gen2_uart_init_pre. Galileo Gen2: fix "Invalid AIO pin
specified - do you have an ADC?" error. Galileo Gen2: pullup/pulldown
resistors are disabled during UART/GPIO/SPI/I2C/UIO initialization. Use
mraa_gpio_mode to enable resistors.

Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Eugene Bolshakov
2016-03-12 23:46:17 +03:00
committed by Brendan Le Foll
parent 6c83886a51
commit 95c259f6b2
3 changed files with 541 additions and 249 deletions

View File

@@ -164,13 +164,31 @@ typedef struct {
/*@}*/
} mraa_pincapabilities_t;
/**
* Pin commands definition for mraa_mux_t struc
*/
typedef enum {
PINCMD_UNDEFINED = 0, // do not modify, default command for zero value, used for backward compatibility with boards where pincmd is not defined (it will be deleted later)
PINCMD_SET_VALUE = 1, // set a pin's value
PINCMD_SET_DIRECTION = 2, // set a pin's direction (value like MRAA_GPIO_OUT, MRAA_GPIO_OUT_HIGH...)
PINCMD_SET_IN_VALUE = 3, // set input direction and value
PINCMD_SET_OUT_VALUE = 4, // set output direction and value
PINCMD_SET_MODE = 5, // set pin's mode
PINCMD_SKIP = 6 // just skip this command, do not apply pin and value
} pincmd_t;
/**
* A Structure representing a multiplexer and the required value
*/
typedef struct {
/*@{*/
unsigned int pin; /**< Raw GPIO pin id */
unsigned int value; /**< Raw GPIO value */
unsigned int pincmd; /**< Pin command pincmd_xxxx */
/**< At this time not all boards will support it -> TO DO */
unsigned int pin; /**< Raw GPIO pin id */
unsigned int value; /**< Raw GPIO value */
/*@}*/
} mraa_mux_t;
@@ -189,7 +207,6 @@ typedef struct {
unsigned int mux_total; /** Numfer of muxes needed for operation of pin */
mraa_mux_t mux[6]; /** Array holding information about mux */
unsigned int output_enable; /** Output Enable GPIO, for level shifting */
unsigned int pullup_enable; /** Pull-Up enable GPIO, inputs */
mraa_pin_cap_complex_t complex_cap;
/*@}*/
} mraa_pin_t;