| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions | Variables
platform_drivers.cpp File Reference

Go to the source code of this file.

## 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 | Wire_Connect ()
| Connects to I2C device. More...
uint8_t | Wire_Write (unsigned char address, unsigned char *data, unsigned char length, unsigned char stop)
| Write to I2C device. More...
uint8_t | Wire_Read (unsigned char address, unsigned char *data, unsigned char length, unsigned char stop)
| Read from I2C device. More...
void | quikeval_set_mux (uint8_t mux)
| Sets the Linduino MUX that selects SPI or I2C for the quikeval port. More...
void | uartTX (char *buf)
| Enable SPI, matches spi_enable. More...

## Variables
const uint8_t | arduino_spi_modes [4]

## Function Documentation

## ◆ gpio_direction_input()

int32_t gpio_direction_input | ( | gpio_desc * | desc | ) |

Enable the input direction of the specified GPIO.

Parameters

  desc | - The GPIO descriptor.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 290 of file platform_drivers.cpp.

## ◆ gpio_direction_output()

int32_t gpio_direction_output | ( | gpio_desc * | desc,
|  | uint8_t | value
| ) |  |

Enable the output direction of the specified GPIO.

Parameters

  desc | - The GPIO descriptor.
  value | - The value. Example: GPIO_HIGH GPIO_LOW

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 305 of file platform_drivers.cpp.

## ◆ gpio_get()

int32_t gpio_get | ( | gpio_desc ** | desc,
|  | uint8_t | gpio_number
| ) |  |

Obtain the GPIO decriptor.

Parameters

  desc | - The GPIO descriptor.
  gpio_number | - The number of the GPIO.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 258 of file platform_drivers.cpp.

## ◆ gpio_get_direction()

int32_t gpio_get_direction | ( | gpio_desc * | desc,
|  | uint8_t * | direction
| ) |  |

Get the direction of the specified GPIO.

Parameters

  desc | - The GPIO descriptor.
  direction | - The direction. Example: GPIO_OUT GPIO_IN

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 322 of file platform_drivers.cpp.

## ◆ gpio_get_value()

int32_t gpio_get_value | ( | gpio_desc * | desc,
|  | uint8_t * | value
| ) |  |

Get the value of the specified GPIO.

Parameters

  desc | - The GPIO descriptor.
  value | - The value. Example: GPIO_HIGH GPIO_LOW

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 360 of file platform_drivers.cpp.

## ◆ gpio_remove()

int32_t gpio_remove | ( | gpio_desc * | desc | ) |

Free the resources allocated by gpio_get().

Parameters

  desc | - The SPI descriptor.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 276 of file platform_drivers.cpp.

## ◆ gpio_set_value()

int32_t gpio_set_value | ( | gpio_desc * | desc,
|  | uint8_t | value
| ) |  |

Set the value of the specified GPIO.

Parameters

  desc | - The GPIO descriptor.
  value | - The value. Example: GPIO_HIGH GPIO_LOW

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 344 of file platform_drivers.cpp.

## ◆ i2c_init()

int32_t i2c_init | ( | i2c_desc ** | desc,
|  | const struct i2c_init_param * | param
| ) |  |

Initialize the I2C communication peripheral.

Parameters

  desc | - The I2C descriptor.
  init_param | - The structure that contains the I2C parameters.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 60 of file platform_drivers.cpp.

## ◆ i2c_read()

int32_t i2c_read | ( | i2c_desc * | desc,
|  | uint8_t * | data,
|  | uint8_t | bytes_number,
|  | uint8_t | stop_bit
| ) |  |

Read data from a slave device.

Parameters

  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.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 122 of file platform_drivers.cpp.

## ◆ i2c_remove()

int32_t i2c_remove | ( | i2c_desc * | desc | ) |

Free the resources allocated by i2c_init().

Parameters

  desc | - The I2C descriptor.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 89 of file platform_drivers.cpp.

## ◆ i2c_write()

int32_t i2c_write | ( | i2c_desc * | desc,
|  | uint8_t * | data,
|  | uint8_t | bytes_number,
|  | uint8_t | stop_bit
| ) |  |

Write data to a slave device.

Parameters

  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.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 104 of file platform_drivers.cpp.

## ◆ mdelay()

void mdelay | ( | uint32_t | msecs | ) |

Generate miliseconds delay.

Parameters

  msecs | - Delay in miliseconds.

Returns
  None.

Definition at line 374 of file platform_drivers.cpp.

## ◆ quikeval_set_mux()

void quikeval_set_mux | ( | uint8_t | mux | ) |

Sets the Linduino MUX that selects SPI or I2C for the quikeval port.

Parameters

  mux | - New mux selection Example: MUX_I2C - Enable I2C MUX_SPI - Enable SPI

Definition at line 465 of file platform_drivers.cpp.

## ◆ spi_init()

int32_t spi_init | ( | spi_desc ** | desc,
|  | const struct spi_init_param * | param
| ) |  |

Initialize the SPI communication peripheral.

Parameters

  desc | - The SPI descriptor.
  init_param | - The structure that contains the SPI parameters.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 147 of file platform_drivers.cpp.

## ◆ spi_remove()

int32_t spi_remove | ( | spi_desc * | desc | ) |

Free the resources allocated by spi_init().

Parameters

  desc | - The SPI descriptor.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 186 of file platform_drivers.cpp.

## ◆ spi_write_and_read()

int32_t spi_write_and_read | ( | spi_desc * | desc,
|  | uint8_t * | data,
|  | uint8_t | bytes_number
| ) |  |

Write and read data to/from SPI.

Parameters

  desc | - The SPI descriptor.
  data | - The buffer with the transmitted/received data.
  bytes_number | - Number of bytes to write/read.

Returns
  SUCCESS in case of success, FAILURE otherwise.

Definition at line 200 of file platform_drivers.cpp.

## ◆ uartTX()

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.

## ◆ Wire_Connect()

void Wire_Connect | ( |  | ) |

Connects to I2C device.

Connects and initializes I2C.

Definition at line 390 of file platform_drivers.cpp.

## ◆ Wire_Read()

uint8_t Wire_Read | ( | unsigned char | address,
|  | unsigned char * | data,
|  | unsigned char | length,
|  | unsigned char | stop
| ) |  |

Read from I2C device.

Read I2C.

Parameters

  address | - Address of device
  data | - Data read back
  length | - Length of data byte array to read
  stop | - Stop bit

Returns
  Number of read bytes

Definition at line 436 of file platform_drivers.cpp.

## ◆ Wire_Write()

uint8_t Wire_Write | ( | unsigned char | address,
|  | unsigned char * | data,
|  | unsigned char | length,
|  | unsigned char | stop
| ) |  |

Write to I2C device.

Write I2C.

Parameters

  address | - Address of device
  data | - Data to write, includes command
  length | - Length of data byte array
  stop | - Stop bit

Returns
  Transmission acknowledged by device

Definition at line 406 of file platform_drivers.cpp.

## Variable Documentation

## ◆ arduino_spi_modes

const uint8_t arduino_spi_modes[4]

Initial value:
= {
SPI_MODE0,
SPI_MODE1,
SPI_MODE2,
SPI_MODE3
}

Definition at line 132 of file platform_drivers.cpp.