bma180_parameters.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2012, Robert Bosch LLC.
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/or other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the Robert Bosch nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  *********************************************************************/
00036 
00037 /*********************************************************************
00038  *
00039  * Disclaimer
00040  *
00041  * This source code is not officially released or supported by Bosch Sensortec.
00042  * Please contact the listed authors with bugs or other modifications.
00043  * If you would like the official Bosch Sensortec drivers, please contact:
00044  * contact@bosch-sensortec.com
00045  *
00046  *********************************************************************/
00047 
00048 //\Author Joshua Vasquez and Philip Roan, Robert Bosch LLC
00049 
00050 
00051 #ifndef BMA180_PARAMETERS_H_
00052 #define BMA180_PARAMETERS_H_
00053 
00054 // ROS headers for debugging output
00055 #include <ros/console.h>
00056 
00057 #include <bosch_drivers_parameters.hpp>
00058 #include <bosch_drivers_hardware_interface.hpp>
00059 
00060 using namespace bosch_drivers_common;
00061 
00062 class BMA180Parameters: public Parameters
00063 {
00064 public:
00065   
00069   enum accel_range
00070   {
00072     RANGE_1 = 0x00,
00074     RANGE_1_5 = 0x01,
00076     RANGE_2 = 0x02,
00078     RANGE_3 = 0x03,
00080     RANGE_4 = 0x04,
00082     RANGE_8 = 0x05,
00084     RANGE_16 = 0x06
00085   };
00086   
00090   enum bandwidth 
00091   {
00092     BW_10,
00093     BW_20,
00094     BW_40,
00095     BW_75,
00096     BW_150,
00097     BW_300,
00098     BW_600,
00099     BW_1200,
00100     BW_HIGH_PASS,
00101     BW_BAND_PASS
00102   };
00103   
00104   BMA180Parameters();
00105   ~BMA180Parameters();
00106 
00107   bool setProtocol( interface_protocol protocol );
00108   bool setFrequency( int frequency );
00109   bool setPin( uint8_t pin );       
00110   
00114   bool setSlaveAddressBit( bool choice );
00115 
00119   bool setAccelRange( accel_range new_range ); 
00120   
00124   void setBandwidth( bandwidth bw );
00125   void setPreCalOffsets( bool choice );
00126   
00127   
00128   double getSensitivity(); // returns sensitivity
00129   interface_protocol getProtocol();
00130   int getFrequency();
00131   int* getFlags();
00132   int getPin();  // SPI, GPIO only
00133   uint8_t getSlaveAddressBit();
00134 
00135 
00136 protected:
00140   bool setByteOrder( uint8_t value );
00144   bool setSpiMode( uint8_t mode );
00145 
00146   // int frequency_;
00147   // int pin_;
00148   // int flags_;
00149   uint8_t slave_address_bit_;
00150   double sensitivity_;
00151   accel_range accel_range_;
00152   bandwidth bandwidth_;
00153   bool useFilter_;
00154   bool offsetsEnabled_;
00155 };
00156 
00157 #endif // BMA180_PARAMETERS_H_


bma180_driver
Author(s): Joshua Vasquez, Philip Roan. Maintained by Philip Roan
autogenerated on Sat Dec 28 2013 16:49:14