Public Member Functions | Private Member Functions | Private Attributes
ArduinoInterface Class Reference

#include <arduino_interface.hpp>

Inheritance diagram for ArduinoInterface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ArduinoInterface (std::string dev_port)
 The arduino hardware interface. Each arduino connected to your computer needs its own instance of this class. The Serial number is the manner by which we differentiate between arduino devices.
std::string getID ()
bool initialize ()
ssize_t read (int device_address, interface_protocol protocol, int frequency, int *flags, uint8_t reg_address, uint8_t *data, size_t num_bytes)
bool supportedProtocol (interface_protocol protocol)
 Returns true if the input protocol is supported by the hardware interface.
ssize_t write (int device_address, interface_protocol protocol, int frequency, int *flags, uint8_t reg_address, uint8_t *data, size_t num_bytes)
 ~ArduinoInterface ()
 destructor

Private Member Functions

ssize_t arduinoAdcRead (uint8_t pin, uint8_t *data)
ssize_t arduinoAdcWrite (uint8_t *voltage)
ssize_t arduinoEncoderRead (int *pin, uint8_t *data)
ssize_t arduinoEncoderWrite (int *flags, uint8_t *data)
ssize_t arduinoGpioRead (uint8_t flags, uint8_t pin, uint8_t *value)
ssize_t arduinoGpioWrite (uint8_t pin, bool value)
ssize_t arduinoI2cRead (uint8_t device_address, uint32_t frequency, uint8_t reg_address, uint8_t *data, size_t num_bytes)
ssize_t arduinoI2cWrite (uint8_t device_address, uint32_t frequency, uint8_t reg_address, uint8_t *data, size_t num_bytes)
ssize_t arduinoPwmWrite (uint32_t frequency, uint8_t reg_address, uint8_t data)
ssize_t arduinoSpiRead (uint8_t frequency, uint8_t flags, uint8_t reg_address, uint8_t *data, size_t num_bytes)
ssize_t arduinoSpiWrite (uint8_t frequency, uint8_t flags, uint8_t reg_address, uint8_t *data, size_t num_bytes)
bool waitOnBytes (int num_bytes)

Private Attributes

uint16_t _reference_voltage
 stores the selected reference voltage for the ADC in milli volts [mV]
int baud_rate_
 Baud rate at which the serial communication takes place.
bool connection_failure_
uint8_t data_packet_
 Contains used protocol and whether or not a read or write command is about to be requested.
int file_descriptor_
 The file descriptor that handles serial communications.
bool is_initialized_
 True if hardware has already been initialized to prevent re-opening the serial port.
std::string port_name_
uniserialserial_port_
 Serial port where the Arduino can be found.
double timeout_
 The time to wait (in seconds) for acknowledgement of a serial command by the Arduino.

Detailed Description

Definition at line 53 of file arduino_interface.hpp.


Constructor & Destructor Documentation

ArduinoInterface::ArduinoInterface ( std::string  dev_port)

The arduino hardware interface. Each arduino connected to your computer needs its own instance of this class. The Serial number is the manner by which we differentiate between arduino devices.

An instance of this class will relay information from the program to the Arduino and vice versa. Specifically: inputs: communication protocol (only when first initializing a sub20_interface.) address, read or write command to the sensor outputs: raw data (in bytes) from the sensor. constructor

Parameters:
std::stringdev_port the name of the port from the /dev directory.

Definition at line 44 of file arduino_interface.cpp.

destructor

Definition at line 61 of file arduino_interface.cpp.


Member Function Documentation

ssize_t ArduinoInterface::arduinoAdcRead ( uint8_t  pin,
uint8_t *  data 
) [private]

Definition at line 813 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoAdcWrite ( uint8_t *  voltage) [private]

Definition at line 888 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoEncoderRead ( int *  pin,
uint8_t *  data 
) [private]

Definition at line 664 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoEncoderWrite ( int *  flags,
uint8_t *  data 
) [private]

Definition at line 699 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoGpioRead ( uint8_t  flags,
uint8_t  pin,
uint8_t *  value 
) [private]

Definition at line 583 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoGpioWrite ( uint8_t  pin,
bool  value 
) [private]

Definition at line 529 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoI2cRead ( uint8_t  device_address,
uint32_t  frequency,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
) [private]

Definition at line 419 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoI2cWrite ( uint8_t  device_address,
uint32_t  frequency,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
) [private]

Definition at line 284 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoPwmWrite ( uint32_t  frequency,
uint8_t  reg_address,
uint8_t  data 
) [private]

Definition at line 476 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoSpiRead ( uint8_t  frequency,
uint8_t  flags,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
) [private]

Definition at line 379 of file arduino_interface.cpp.

ssize_t ArduinoInterface::arduinoSpiWrite ( uint8_t  frequency,
uint8_t  flags,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
) [private]

Definition at line 340 of file arduino_interface.cpp.

std::string ArduinoInterface::getID ( ) [virtual]
Returns:
the way the sensor identifies itself

Implements bosch_drivers_common::bosch_hardware_interface.

Definition at line 251 of file arduino_interface.cpp.

bool ArduinoInterface::initialize ( ) [virtual]
ssize_t ArduinoInterface::read ( int  device_address,
interface_protocol  protocol,
int  frequency,
int *  flags,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
)

Definition at line 104 of file arduino_interface.cpp.

Returns true if the input protocol is supported by the hardware interface.

Parameters:
interface_protocolprotocol the input protocol.
Returns:
true, if the hardware interface supports reading and writing on that particular protocol.

Definition at line 224 of file arduino_interface.cpp.

bool ArduinoInterface::waitOnBytes ( int  num_bytes) [private]

Definition at line 260 of file arduino_interface.cpp.

ssize_t ArduinoInterface::write ( int  device_address,
interface_protocol  protocol,
int  frequency,
int *  flags,
uint8_t  reg_address,
uint8_t *  data,
size_t  num_bytes 
)

Definition at line 160 of file arduino_interface.cpp.


Member Data Documentation

stores the selected reference voltage for the ADC in milli volts [mV]

Definition at line 190 of file arduino_interface.hpp.

Baud rate at which the serial communication takes place.

Warning:
This value should not be changed after it is set in the constructor.If it is changed, however, it must also be redefined in the Arduino sketch.

Definition at line 160 of file arduino_interface.hpp.

Definition at line 162 of file arduino_interface.hpp.

uint8_t ArduinoInterface::data_packet_ [private]

Contains used protocol and whether or not a read or write command is about to be requested.

This information allows the Arduino to prepare to send the following data according to the input parameters of data_packet_ . The read/write flag is saved in the lowest bit while the upper 7 bits are reserved for the used protocol

Definition at line 185 of file arduino_interface.hpp.

The file descriptor that handles serial communications.

Definition at line 151 of file arduino_interface.hpp.

True if hardware has already been initialized to prevent re-opening the serial port.

Definition at line 174 of file arduino_interface.hpp.

std::string ArduinoInterface::port_name_ [private]

Definition at line 146 of file arduino_interface.hpp.

Serial port where the Arduino can be found.

This is the serial port that the particular Arduino uses to communicate with the computer.

Definition at line 145 of file arduino_interface.hpp.

double ArduinoInterface::timeout_ [private]

The time to wait (in seconds) for acknowledgement of a serial command by the Arduino.

Definition at line 168 of file arduino_interface.hpp.


The documentation for this class was generated from the following files:


arduino_interface
Author(s): Joshua Vasquez and Philip Roan. Maintained by Philip Roan
autogenerated on Sat Dec 28 2013 16:49:06