Bioscara
DALSA's DIY SCARA Robot Arm.
Loading...
Searching...
No Matches
Functions
uI2C.cpp File Reference
#include "bioscara_arm_hardware_driver/uI2C.h"
#include "bioscara_arm_hardware_driver/common.h"
#include <lgpio.h>

Functions

int openI2CDevHandle (const int dev_addr)
 Initiates an I2C device on the bus.
 
int readFromI2CDev (const int dev_handle, const int reg, char *buffer, const int data_length)
 reads block of bytes from device to buffer
 
int writeToI2CDev (const int dev_handle, const int reg, char *tx_buffer, const int data_length, char *RFLAGS_buffer)
 writes block of bytes from buffer to device
 
int closeI2CDevHandle (int &dev_handle)
 close an I2C device on the bus
 

Function Documentation

◆ closeI2CDevHandle()

int closeI2CDevHandle ( int &  dev_handle)

close an I2C device on the bus

Parameters
dev_handledevice handle obtained from openI2CDevHandle
Returns
0 on OK, negative on error.

◆ openI2CDevHandle()

int openI2CDevHandle ( const int  dev_addr)

Initiates an I2C device on the bus.

Parameters
dev_addr7-bit device adress [0 - 0x7F]
Returns
the device handle, negative on error.

◆ readFromI2CDev()

int readFromI2CDev ( const int  dev_handle,
const int  reg,
char *  buffer,
const int  data_length 
)

reads block of bytes from device to buffer

Parameters
dev_handledevice handle obtained from openI2CDevHandle
regthe command/data register
bufferpointer to data buffer to hold received values
data_lengthnumber of bytes to read
Returns
number of bytes read, negative on error.

◆ writeToI2CDev()

int writeToI2CDev ( const int  dev_handle,
const int  reg,
char *  tx_buffer,
const int  data_length,
char *  RFLAGS_buffer 
)

writes block of bytes from buffer to device

Parameters
dev_handledevice handle obtained from openI2CDevHandle
regthe command/data register
tx_bufferpointer to data buffer holding the data to send
data_lengthnumber of bytes to send
RFLAGS_bufferbuffer to hold returned flags
Returns
0 on OK, negative on error.