A Class to interface to the BMA180 over SPI. More...
#include <bma180.h>
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< OneSub20Config > | Sub20Device_list |
sub_handle | subhndl |
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.
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
dMaxAcc_g | The maximum acceleration range of the sensor |
dBandwidth_Hz | The bandwidth of the sensor front-end |
bCalibrate | Requesting sensor calibration |
dRate_Hz | Sensor reading rate |
sSub20Serial | Requesting desired sub20 to be opened |
Definition at line 63 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 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
max_acceleration_g | The maximum acceleration range of the sensor |
dBandwidth_Hz | The bandwidth of the sensor front-end |
bCalibrate | Requesting sensor calibration |
dRate_Hz | Sensor reading rate |
sSub20Serial | Requesting desired sub20 to be opened |
Bma180::~Bma180 | ( | ) |
Destructor closing all open connections.
Closes open SPI connections and disables the Sub20 device. Disposes any dynamic structure in the heap.
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.
&list_meas | points 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.
&list_meas | points 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.
bool Bma180::bCalibrationCompleted [private] |
bool Bma180::bExecuteCalibration [private] |
bool Bma180::bSubDeviceConfigured [private] |
bool Bma180::bSubDeviceOpen [private] |
bma180_calibrate Bma180::calib_bma180 [private] |
char Bma180::chBW_selected [private] |
char Bma180::chMaxAccRange_selected [private] |
int Bma180::iCalib_CS [private] |
std::string Bma180::serial_number [private] |
std::string Bma180::strSerial [private] |
std::list< OneSub20Config > Bma180::Sub20Device_list [private] |
sub_handle Bma180::subhndl [private] |