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)
 Constructor initializes Sub20 device and BMA180ies.
void GetMeasurements (std::list< OneBma180Meas > &)
 Polls one measurement from all BMA180 defined in std::list<OneBma180Meas>&.
 ~Bma180 ()
 Destructor closing all open connections.

Private Member Functions

double bma180data_to_double (char, char, bma180_cmd::eSensorType, 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.
void confsens_on_sub20 (OneSub20Config *, char, char)
 Configures specified BMA180 according to the deafult 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_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.
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.

Private Attributes

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

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 116 of file bma180.h.


Constructor & Destructor Documentation

Bma180::Bma180 ( double  dMaxAcc_g,
double  dBandwidth_Hz,
bool  bCalibrate 
)

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 perfroms sensor calibration

Parameters:
dMaxAcc_g The maximum acceleration range of the sensor
dBandwidth_Hz The bandwidth of the sensor front-end
bCalibrate Requesting sensor calibration

Definition at line 39 of file bma180.cpp.

Bma180::~Bma180 (  ) 

Destructor closing all open connections.

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

Definition at line 142 of file bma180.cpp.


Member Function Documentation

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

Converts BMA180 formatted data into double.

Definition at line 325 of file bma180.cpp.

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 369 of file bma180.cpp.

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

Configures specified BMA180 according to the deafult or user settings.

Definition at line 483 of file bma180.cpp.

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

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

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_meas points onto the std::list containing the connected devices

Definition at line 153 of file bma180.cpp.

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 579 of file bma180.cpp.

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 396 of file bma180.cpp.

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 635 of file bma180.cpp.

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

Sets the calibration status of the object.

Definition at line 720 of file bma180.cpp.

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 423 of file bma180.cpp.


Member Data Documentation

Definition at line 174 of file bma180.h.

Definition at line 173 of file bma180.h.

Definition at line 185 of file bma180.h.

bool Bma180::bSubDeviceOpen [private]

Definition at line 184 of file bma180.h.

Definition at line 175 of file bma180.h.

char Bma180::chBW_selected [private]

Definition at line 179 of file bma180.h.

Definition at line 178 of file bma180.h.

sub_handle Bma180::fd [private]

Definition at line 183 of file bma180.h.

int Bma180::iCalib_CS [private]

Definition at line 180 of file bma180.h.

std::string Bma180::strSerial [private]

Definition at line 186 of file bma180.h.

Definition at line 170 of file bma180.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator


bma180
Author(s): mil1pal
autogenerated on Fri Jan 11 09:40:58 2013