Classes | Public Member Functions | Private Member Functions | Private Attributes
Bma180 Class Reference

A Class to interface to the BMA180 over SPI. More...

#include <bma180.h>

List of all members.

Classes

struct  OneBma180Config
struct  OneSub20Config

Public Member Functions

 Bma180 (double, double, bool, double, std::string)
 Constructor initializes Sub20 device and BMA180ies.
 Bma180 (double max_acceleration_g, double dBandwidth_Hz, bool bCalibrate, double dRate_Hz, std::string sSub20Serial)
 Constructor initializes Sub20 device and BMA180ies.
void GetMeasurements (std::list< OneBma180Meas > &)
 Polls one measurement from all BMA180 defined in std::list<OneMultBmaMeas>&.
void GetMeasurements (std::list< OneBma180Meas > &)
 Polls one measurement from all BMA180 defined in std::list<OneMultBmaMeas>&.
 ~Bma180 ()
 Destructor closing all open connections.
 ~Bma180 ()
 Destructor closing all open connections.

Private Member Functions

double bma180data_to_double (char, char, bma180_cmd::eSensorType, int *, double)
 Converts BMA180 formatted data into double.
double bma180data_to_double (char, char, bma180_cmd::eSensorType, int *, double)
 Converts BMA180 formatted data into double.
unsigned short bma180data_to_uint (char, char, bma180_cmd::eSensorType)
 Converts BMA180 formatted data into an unsigned int.
unsigned short bma180data_to_uint (char, char, bma180_cmd::eSensorType)
 Converts BMA180 formatted data into an unsigned int.
void confsens_on_sub20 (OneSub20Config *, char, char)
 Configures specified BMA180 according to the default or user settings.
void confsens_on_sub20 (OneSub20Config *, char, char)
 Configures specified BMA180 according to the default or user settings.
bool read_biassettings (sub_handle, int, unsigned short *, unsigned short *, unsigned short *)
 Reads the stored bias settings of the BMA180.
bool read_biassettings (sub_handle, int, unsigned short *, unsigned short *, unsigned short *)
 Reads the stored bias settings of the BMA180.
bool read_byte_eeprom_sub20 (char, char *, unsigned short, sub_handle)
 Reads a byte from the EEPROM.
bool read_byte_eeprom_sub20 (char, char *, unsigned short, sub_handle)
 Reads a byte from the EEPROM.
bool set_biassettings (sub_handle, int, unsigned short, unsigned short, unsigned short, bool)
 Stores estimated biases into the BMA180 image.
bool set_biassettings (sub_handle, int, unsigned short, unsigned short, unsigned short, bool)
 Stores estimated biases into the BMA180 image.
void set_calibstatus (bool bCalibrate)
 Sets the calibration status of the object.
void set_calibstatus (bool bCalibrate)
 Sets the calibration status of the object.
bool write_bit_eeprom_sub20 (char, unsigned short, unsigned short, char, unsigned short, sub_handle)
 Writes specified bits into the eeprom image.
bool write_bit_eeprom_sub20 (char, unsigned short, unsigned short, char, unsigned short, sub_handle)
 Writes specified bits into the eeprom image.

Private Attributes

bool bCalibrationCompleted
bool bExecuteCalibration
bool bSubDeviceConfigured
bool bSubDeviceOpen
bma180_calibrate calib_bma180
char chBW_selected
char chMaxAccRange_selected
int iCalib_CS
std::string serial_number
std::string strSerial
std::list< OneSub20ConfigSub20Device_list
sub_handle subhndl

Detailed Description

A Class to interface to the BMA180 over SPI.

This class interfaces with Bosch BMA180 over SPI using an XDIMAX Sub20 interface device. The class allows multiple Sub20 devices to be connected. Each Sub20 device can handle up to 5 BMA 180ies. The class independently detects a BMA180 connected.

Definition at line 135 of file bma180.h.


Constructor & Destructor Documentation

Bma180::Bma180 ( double  dMaxAcc_g,
double  dBandwidth_Hz,
bool  bCalibrate,
double  dRate_Hz,
std::string  sSub20Serial 
)

Constructor initializes Sub20 device and BMA180ies.

Detects connected Sub20 devices and BMA180ies. Initializes the Sub20 device and loads configures the BMA180 with the specified bandwidth and max acceleration range. On request it performs sensor calibration

Parameters:
dMaxAcc_gThe maximum acceleration range of the sensor
dBandwidth_HzThe bandwidth of the sensor front-end
bCalibrateRequesting sensor calibration
dRate_HzSensor reading rate
sSub20SerialRequesting desired sub20 to be opened

Definition at line 63 of file bma180.cpp.

Destructor closing all open connections.

Closes open SPI connections and disables the Sub20 device. Disposes any dynamic structure in the heap.

Definition at line 184 of file bma180.cpp.

Bma180::Bma180 ( double  max_acceleration_g,
double  dBandwidth_Hz,
bool  bCalibrate,
double  dRate_Hz,
std::string  sSub20Serial 
)

Constructor initializes Sub20 device and BMA180ies.

Detects connected Sub20 devices and BMA180ies. Initializes the Sub20 device and loads configures the BMA180 with the specified bandwidth and max acceleration range. On request it performs sensor calibration

Parameters:
max_acceleration_gThe maximum acceleration range of the sensor
dBandwidth_HzThe bandwidth of the sensor front-end
bCalibrateRequesting sensor calibration
dRate_HzSensor reading rate
sSub20SerialRequesting desired sub20 to be opened

Destructor closing all open connections.

Closes open SPI connections and disables the Sub20 device. Disposes any dynamic structure in the heap.


Member Function Documentation

double Bma180::bma180data_to_double ( char  chMSB,
char  chLSB,
bma180_cmd::eSensorType  eSensor,
int *  raw,
double  dAccScale 
) [private]

Converts BMA180 formatted data into double.

Definition at line 396 of file bma180.cpp.

double Bma180::bma180data_to_double ( char  ,
char  ,
bma180_cmd::eSensorType  ,
int *  ,
double   
) [private]

Converts BMA180 formatted data into double.

unsigned short Bma180::bma180data_to_uint ( char  chMSB,
char  chLSB,
bma180_cmd::eSensorType  eSensor 
) [private]

Converts BMA180 formatted data into an unsigned int.

Definition at line 444 of file bma180.cpp.

unsigned short Bma180::bma180data_to_uint ( char  ,
char  ,
bma180_cmd::eSensorType   
) [private]

Converts BMA180 formatted data into an unsigned int.

void Bma180::confsens_on_sub20 ( OneSub20Config pOneSub20Conf,
char  chFullscale,
char  chBandwidth 
) [private]

Configures specified BMA180 according to the default or user settings.

Definition at line 560 of file bma180.cpp.

void Bma180::confsens_on_sub20 ( OneSub20Config ,
char  ,
char   
) [private]

Configures specified BMA180 according to the default or user settings.

void Bma180::GetMeasurements ( std::list< OneBma180Meas > &  list_meas)

Polls one measurement from all BMA180 defined in std::list<OneMultBmaMeas>&.

Iterates through all detected BMA180ies on all connected Sub20 devices and sends a measurement request to the respective sensor. In case of calibration request, any received measurement is used to calibrate the sensor. NOTE: As the EEPROM can only handle a limited amount of write cycles, the calibration routine only allows one Sub20 device to be connected for the calibration mode to be executed successfully.

Parameters:
&list_measpoints onto the std::list containing the connected devices

Definition at line 201 of file bma180.cpp.

void Bma180::GetMeasurements ( std::list< OneBma180Meas > &  )

Polls one measurement from all BMA180 defined in std::list<OneMultBmaMeas>&.

Iterates through all detected BMA180ies on all connected Sub20 devices and sends a measurement request to the respective sensor. In case of calibration request, any received measurement is used to calibrate the sensor. NOTE: As the EEPROM can only handle a limited amount of write cycles, the calibration routine only allows one Sub20 device to be connected for the calibration mode to be executed successfully.

Parameters:
&list_measpoints onto the std::list containing the connected devices
bool Bma180::read_biassettings ( sub_handle  handle_sub20,
int  iChipSelect,
unsigned short *  uiBiasX,
unsigned short *  uiBiasY,
unsigned short *  uiBiasZ 
) [private]

Reads the stored bias settings of the BMA180.

Definition at line 662 of file bma180.cpp.

bool Bma180::read_biassettings ( sub_handle  ,
int  ,
unsigned short *  ,
unsigned short *  ,
unsigned short *   
) [private]

Reads the stored bias settings of the BMA180.

bool Bma180::read_byte_eeprom_sub20 ( char  chADR,
char *  pchREGISTER,
unsigned short  iChipSelect,
sub_handle  sub_h 
) [private]

Reads a byte from the EEPROM.

Definition at line 468 of file bma180.cpp.

bool Bma180::read_byte_eeprom_sub20 ( char  ,
char *  ,
unsigned  short,
sub_handle   
) [private]

Reads a byte from the EEPROM.

bool Bma180::set_biassettings ( sub_handle  handle_sub20,
int  iChipSelect,
unsigned short  uiBiasX,
unsigned short  uiBiasY,
unsigned short  uiBiasZ,
bool  bWriteEEPROM 
) [private]

Stores estimated biases into the BMA180 image.

Definition at line 723 of file bma180.cpp.

bool Bma180::set_biassettings ( sub_handle  ,
int  ,
unsigned  short,
unsigned  short,
unsigned  short,
bool   
) [private]

Stores estimated biases into the BMA180 image.

void Bma180::set_calibstatus ( bool  bCalibrate) [private]

Sets the calibration status of the object.

Definition at line 811 of file bma180.cpp.

void Bma180::set_calibstatus ( bool  bCalibrate) [private]

Sets the calibration status of the object.

bool Bma180::write_bit_eeprom_sub20 ( char  chADR,
unsigned short  iLSBOfByte,
unsigned short  iNumOfBits,
char  chBitSeq,
unsigned short  iChipSelect,
sub_handle  sub_h 
) [private]

Writes specified bits into the eeprom image.

Definition at line 497 of file bma180.cpp.

bool Bma180::write_bit_eeprom_sub20 ( char  ,
unsigned  short,
unsigned  short,
char  ,
unsigned  short,
sub_handle   
) [private]

Writes specified bits into the eeprom image.


Member Data Documentation

Definition at line 195 of file bma180.h.

Definition at line 194 of file bma180.h.

Definition at line 206 of file bma180.h.

bool Bma180::bSubDeviceOpen [private]

Definition at line 205 of file bma180.h.

Definition at line 196 of file bma180.h.

char Bma180::chBW_selected [private]

Definition at line 200 of file bma180.h.

Definition at line 199 of file bma180.h.

int Bma180::iCalib_CS [private]

Definition at line 201 of file bma180.h.

std::string Bma180::serial_number [private]

Definition at line 214 of file bma180s.h.

std::string Bma180::strSerial [private]

Definition at line 207 of file bma180.h.

std::list< OneSub20Config > Bma180::Sub20Device_list [private]

Definition at line 191 of file bma180.h.

sub_handle Bma180::subhndl [private]

Definition at line 204 of file bma180.h.


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


bma180
Author(s): Lukas Marti, Nikhil Deshpande, Philip Roan (Maintained by Philip Roan)
autogenerated on Sat Dec 28 2013 16:50:12