bosch_drivers_common.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 //\Author Joshua Vasquez and Philip Roan, Robert Bosch LLC
00038 
00039 #ifndef BOSCH_DRIVERS_COMMON_H_
00040 #define BOSCH_DRIVERS_COMMON_H_
00041 
00042 #include <stdint.h>
00043 
00044 
00053 namespace bosch_drivers_common
00054 {
00058   enum Hardware_Interface { Sub20, Arduino, ArduinoROSSerial, Gumstix };
00059         
00060 
00067   enum interface_protocol { I2C, SPI, GPIO, RS232, RS485, ETHERNET, ETHERCAT, CAN, JTAG, PROFIBUS, MODBUS, USB, PWM, ENCODER, ADCONVERTER };
00068   
00069 
00070         
00080   static const uint8_t SPI_MODE_0 = 0x00;
00081   static const uint8_t SPI_MODE_1 = 0x01;
00082   static const uint8_t SPI_MODE_2 = 0x02;
00083   static const uint8_t SPI_MODE_3 = 0x03;
00084   
00085   static const uint8_t MSB_FIRST = 1;
00086   static const uint8_t LSB_FIRST = 0;
00087 
00088   static const uint8_t SPI_CLOCK_DIV_2   = 0x04;  
00089   static const uint8_t SPI_CLOCK_DIV_4   = 0x00;
00090   static const uint8_t SPI_CLOCK_DIV_8   = 0x05;
00091   static const uint8_t SPI_CLOCK_DIV_16  = 0x01;
00092   static const uint8_t SPI_CLOCK_DIV_32  = 0x06;
00093   static const uint8_t SPI_CLOCK_DIV_64  = 0x02;
00094   static const uint8_t SPI_CLOCK_DIV_128 = 0x03;
00095   //static const uint8_t SPI_CLOCK_DIV64 0x07;
00096 
00097   
00109   static const uint8_t SPI_READ_FLAG = 7;
00110   static const uint8_t SPI_WRITE_FLAG = 7;
00111   
00112   
00113   // \brief This constant is used to specify an SPI device with no chip select.
00114   static const uint8_t NULL_DEVICE = 0xFF;
00115 
00120   enum gpio_input_mode { FLOATING, PULLUP, PULLDOWN };
00121 
00126   enum motor_drive_mode { DRIVE, FREE_RUNNING, BRAKE };
00127 
00132   enum encoder_control { CREATE, DESTROY, SET_POSITION };
00133 }
00134 #endif // BOSCH_DRIVERS_COMMON_H_


bosch_drivers_common
Author(s): Joshua Vasquez, Philip Roan. Maintained by Philip Roan
autogenerated on Mon Oct 6 2014 10:09:38