![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
Header file of Generic Platform Drivers. More...
Header file of Generic Platform Drivers.
Copyright 2017(c) Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file platform_drivers.h.
Go to the source code of this file.
Data Structures | |
struct | i2c_init_param |
struct | i2c_desc |
struct | spi_init_param |
struct | spi_desc |
struct | gpio_desc |
Functions | |
int32_t | i2c_init (i2c_desc **desc, const struct i2c_init_param *param) |
Initialize the I2C communication peripheral. More... | |
int32_t | i2c_remove (i2c_desc *desc) |
Free the resources allocated by i2c_init(). More... | |
int32_t | i2c_write (i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit) |
Write data to a slave device. More... | |
int32_t | i2c_read (i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit) |
Read data from a slave device. More... | |
int32_t | spi_init (spi_desc **desc, const struct spi_init_param *param) |
Initialize the SPI communication peripheral. More... | |
int32_t | spi_remove (spi_desc *desc) |
Free the resources allocated by spi_init(). More... | |
int32_t | spi_write_and_read (spi_desc *desc, uint8_t *data, uint8_t bytes_number) |
Write and read data to/from SPI. More... | |
int32_t | gpio_get (gpio_desc **desc, uint8_t gpio_number) |
Obtain the GPIO decriptor. More... | |
int32_t | gpio_remove (gpio_desc *desc) |
Free the resources allocated by gpio_get(). More... | |
int32_t | gpio_direction_input (gpio_desc *desc) |
Enable the input direction of the specified GPIO. More... | |
int32_t | gpio_direction_output (gpio_desc *desc, uint8_t value) |
Enable the output direction of the specified GPIO. More... | |
int32_t | gpio_get_direction (gpio_desc *desc, uint8_t *direction) |
Get the direction of the specified GPIO. More... | |
int32_t | gpio_set_value (gpio_desc *desc, uint8_t value) |
Set the value of the specified GPIO. More... | |
int32_t | gpio_get_value (gpio_desc *desc, uint8_t *value) |
Get the value of the specified GPIO. More... | |
void | mdelay (uint32_t msecs) |
Generate miliseconds delay. More... | |
void | quikeval_set_mux (uint8_t mux) |
Sets the Linduino MUX that selects SPI or I2C for the quikeval port. More... | |
void | Wire_Connect () |
Connects and initializes I2C. More... | |
uint8_t | Wire_Write (unsigned char address, unsigned char *data, unsigned char length, unsigned char stop) |
Write I2C. More... | |
uint8_t | Wire_Read (unsigned char address, unsigned char *data, unsigned char length, unsigned char stop) |
Read I2C. More... | |
void | uartTX (char *buf) |
Enable SPI, matches spi_enable. More... | |
Macros | |
#define | SUCCESS 0 |
#define | FAILURE -1 |
#define | SPI_CPHA 0x01 |
#define | SPI_CPOL 0x02 |
#define | GPIO_OUT 0x01 |
#define | GPIO_IN 0x00 |
#define | GPIO_HIGH 0x01 |
#define | GPIO_LOW 0x00 |
#define | MUX_I2C 0 |
#define | MUX_SPI 1 |
Typedefs | |
typedef enum i2c_type | i2c_type |
typedef struct i2c_init_param | i2c_init_param |
typedef struct i2c_desc | i2c_desc |
typedef enum spi_type | spi_type |
typedef struct spi_init_param | spi_init_param |
Enumerations | |
enum | i2c_type { GENERIC_I2C } |
enum | spi_type { GENERIC_SPI } |
enum | gpio_type { GENERIC_GPIO } |
int32_t gpio_direction_input | ( | gpio_desc * | desc | ) |
Enable the input direction of the specified GPIO.
desc | - The GPIO descriptor. |
Definition at line 290 of file platform_drivers.cpp.
int32_t gpio_direction_output | ( | gpio_desc * | desc, |
uint8_t | value | ||
) |
Enable the output direction of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: GPIO_HIGH GPIO_LOW |
Definition at line 305 of file platform_drivers.cpp.
int32_t gpio_get | ( | gpio_desc ** | desc, |
uint8_t | gpio_number | ||
) |
Obtain the GPIO decriptor.
desc | - The GPIO descriptor. |
gpio_number | - The number of the GPIO. |
Definition at line 258 of file platform_drivers.cpp.
int32_t gpio_get_direction | ( | gpio_desc * | desc, |
uint8_t * | direction | ||
) |
Get the direction of the specified GPIO.
desc | - The GPIO descriptor. |
direction | - The direction. Example: GPIO_OUT GPIO_IN |
Definition at line 322 of file platform_drivers.cpp.
int32_t gpio_get_value | ( | gpio_desc * | desc, |
uint8_t * | value | ||
) |
Get the value of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: GPIO_HIGH GPIO_LOW |
Definition at line 360 of file platform_drivers.cpp.
int32_t gpio_remove | ( | gpio_desc * | desc | ) |
Free the resources allocated by gpio_get().
desc | - The SPI descriptor. |
Definition at line 276 of file platform_drivers.cpp.
int32_t gpio_set_value | ( | gpio_desc * | desc, |
uint8_t | value | ||
) |
Set the value of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: GPIO_HIGH GPIO_LOW |
Definition at line 344 of file platform_drivers.cpp.
int32_t i2c_init | ( | i2c_desc ** | desc, |
const struct i2c_init_param * | param | ||
) |
Initialize the I2C communication peripheral.
desc | - The I2C descriptor. |
init_param | - The structure that contains the I2C parameters. |
Definition at line 60 of file platform_drivers.cpp.
int32_t i2c_read | ( | i2c_desc * | desc, |
uint8_t * | data, | ||
uint8_t | bytes_number, | ||
uint8_t | stop_bit | ||
) |
Read data from a slave device.
desc | - The I2C descriptor. |
data | - Buffer that will store the received data. |
bytes_number | - Number of bytes to read. |
stop_bit | - Stop condition control. Example: 0 - A stop condition will not be generated; 1 - A stop condition will be generated. |
Definition at line 122 of file platform_drivers.cpp.
int32_t i2c_remove | ( | i2c_desc * | desc | ) |
Free the resources allocated by i2c_init().
desc | - The I2C descriptor. |
Definition at line 89 of file platform_drivers.cpp.
int32_t i2c_write | ( | i2c_desc * | desc, |
uint8_t * | data, | ||
uint8_t | bytes_number, | ||
uint8_t | stop_bit | ||
) |
Write data to a slave device.
desc | - The I2C descriptor. |
data | - Buffer that stores the transmission data. |
bytes_number | - Number of bytes to write. |
stop_bit | - Stop condition control. Example: 0 - A stop condition will not be generated; 1 - A stop condition will be generated. |
Definition at line 104 of file platform_drivers.cpp.
void mdelay | ( | uint32_t | msecs | ) |
Generate miliseconds delay.
msecs | - Delay in miliseconds. |
Definition at line 374 of file platform_drivers.cpp.
void quikeval_set_mux | ( | uint8_t | mux | ) |
Sets the Linduino MUX that selects SPI or I2C for the quikeval port.
mux | - New mux selection Example: MUX_I2C - Enable I2C MUX_SPI - Enable SPI |
Definition at line 465 of file platform_drivers.cpp.
int32_t spi_init | ( | spi_desc ** | desc, |
const struct spi_init_param * | param | ||
) |
Initialize the SPI communication peripheral.
desc | - The SPI descriptor. |
init_param | - The structure that contains the SPI parameters. |
Definition at line 147 of file platform_drivers.cpp.
int32_t spi_remove | ( | spi_desc * | desc | ) |
Free the resources allocated by spi_init().
desc | - The SPI descriptor. |
Definition at line 186 of file platform_drivers.cpp.
int32_t spi_write_and_read | ( | spi_desc * | desc, |
uint8_t * | data, | ||
uint8_t | bytes_number | ||
) |
Write and read data to/from SPI.
desc | - The SPI descriptor. |
data | - The buffer with the transmitted/received data. |
bytes_number | - Number of bytes to write/read. |
Definition at line 200 of file platform_drivers.cpp.
void uartTX | ( | char * | buf | ) |
Enable SPI, matches spi_enable.
Initialize SPI, matches spi_init
Connect to SPI, matches quikeval_spi_connect
Definition at line 483 of file platform_drivers.cpp.
void Wire_Connect | ( | ) |
Connects and initializes I2C.
Connects and initializes I2C.
Definition at line 390 of file platform_drivers.cpp.
uint8_t Wire_Read | ( | unsigned char | address, |
unsigned char * | data, | ||
unsigned char | length, | ||
unsigned char | stop | ||
) |
Read I2C.
Read I2C.
address | - Address of device |
data | - Data read back |
length | - Length of data byte array to read |
stop | - Stop bit |
Definition at line 436 of file platform_drivers.cpp.
uint8_t Wire_Write | ( | unsigned char | address, |
unsigned char * | data, | ||
unsigned char | length, | ||
unsigned char | stop | ||
) |
Write I2C.
Write I2C.
address | - Address of device |
data | - Data to write, includes command |
length | - Length of data byte array |
stop | - Stop bit |
Definition at line 406 of file platform_drivers.cpp.
#define FAILURE -1 |
Definition at line 55 of file platform_drivers.h.
#define GPIO_HIGH 0x01 |
Definition at line 63 of file platform_drivers.h.
#define GPIO_IN 0x00 |
Definition at line 61 of file platform_drivers.h.
#define GPIO_LOW 0x00 |
Definition at line 64 of file platform_drivers.h.
#define GPIO_OUT 0x01 |
Definition at line 60 of file platform_drivers.h.
#define MUX_I2C 0 |
Definition at line 66 of file platform_drivers.h.
#define MUX_SPI 1 |
Definition at line 67 of file platform_drivers.h.
#define SPI_CPHA 0x01 |
Definition at line 57 of file platform_drivers.h.
#define SPI_CPOL 0x02 |
Definition at line 58 of file platform_drivers.h.
#define SUCCESS 0 |
Definition at line 54 of file platform_drivers.h.
typedef struct i2c_init_param i2c_init_param |
typedef struct spi_init_param spi_init_param |
enum gpio_type |
Enumerator | |
---|---|
GENERIC_GPIO |
Definition at line 120 of file platform_drivers.h.
enum i2c_type |
Enumerator | |
---|---|
GENERIC_I2C |
Definition at line 73 of file platform_drivers.h.
enum spi_type |
Enumerator | |
---|---|
GENERIC_SPI |
Definition at line 91 of file platform_drivers.h.