Library for Bosch Sensortech BMI160 IMU
Dependents: MAX32630FTHR_BALANCE_BOT MPSMAX_copy MAX32630FTHR_BALANCE_BOT SELF_BALANCING_BOT
bmi160_spi.cpp@2:598e601e5846, 2016-12-08 (annotated)
- Committer:
- j3
- Date:
- Thu Dec 08 00:32:41 2016 +0000
- Revision:
- 2:598e601e5846
- Child:
- 3:e1770675eca4
Made BMI160 abstract base class and created derived classes BMI160_I2C and BMI160_SPI to support both interfaces.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 2:598e601e5846 | 1 | /********************************************************************** |
j3 | 2:598e601e5846 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
j3 | 2:598e601e5846 | 3 | * |
j3 | 2:598e601e5846 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
j3 | 2:598e601e5846 | 5 | * copy of this software and associated documentation files (the "Software"), |
j3 | 2:598e601e5846 | 6 | * to deal in the Software without restriction, including without limitation |
j3 | 2:598e601e5846 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
j3 | 2:598e601e5846 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
j3 | 2:598e601e5846 | 9 | * Software is furnished to do so, subject to the following conditions: |
j3 | 2:598e601e5846 | 10 | * |
j3 | 2:598e601e5846 | 11 | * The above copyright notice and this permission notice shall be included |
j3 | 2:598e601e5846 | 12 | * in all copies or substantial portions of the Software. |
j3 | 2:598e601e5846 | 13 | * |
j3 | 2:598e601e5846 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
j3 | 2:598e601e5846 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
j3 | 2:598e601e5846 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
j3 | 2:598e601e5846 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
j3 | 2:598e601e5846 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
j3 | 2:598e601e5846 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
j3 | 2:598e601e5846 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
j3 | 2:598e601e5846 | 21 | * |
j3 | 2:598e601e5846 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
j3 | 2:598e601e5846 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
j3 | 2:598e601e5846 | 24 | * Products, Inc. Branding Policy. |
j3 | 2:598e601e5846 | 25 | * |
j3 | 2:598e601e5846 | 26 | * The mere transfer of this software does not imply any licenses |
j3 | 2:598e601e5846 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
j3 | 2:598e601e5846 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
j3 | 2:598e601e5846 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
j3 | 2:598e601e5846 | 30 | * ownership rights. |
j3 | 2:598e601e5846 | 31 | **********************************************************************/ |
j3 | 2:598e601e5846 | 32 | |
j3 | 2:598e601e5846 | 33 | |
j3 | 2:598e601e5846 | 34 | #include "bmi160.h" |
j3 | 2:598e601e5846 | 35 | |
j3 | 2:598e601e5846 | 36 | |
j3 | 2:598e601e5846 | 37 | //***************************************************************************** |
j3 | 2:598e601e5846 | 38 | BMI160_SPI::BMI160_SPI(SPI &spiBus, DigitalOut &cs) |
j3 | 2:598e601e5846 | 39 | :m_spiBus(spiBus), m_cs(cs) |
j3 | 2:598e601e5846 | 40 | { |
j3 | 2:598e601e5846 | 41 | } |
j3 | 2:598e601e5846 | 42 | |
j3 | 2:598e601e5846 | 43 | |
j3 | 2:598e601e5846 | 44 | //***************************************************************************** |
j3 | 2:598e601e5846 | 45 | int32_t BMI160_SPI::readRegister(Registers reg, uint8_t *data) |
j3 | 2:598e601e5846 | 46 | { |
j3 | 2:598e601e5846 | 47 | int32_t rtnVal = -1; |
j3 | 2:598e601e5846 | 48 | |
j3 | 2:598e601e5846 | 49 | return rtnVal; |
j3 | 2:598e601e5846 | 50 | } |
j3 | 2:598e601e5846 | 51 | |
j3 | 2:598e601e5846 | 52 | |
j3 | 2:598e601e5846 | 53 | //***************************************************************************** |
j3 | 2:598e601e5846 | 54 | int32_t BMI160_SPI::writeRegister(Registers reg, const uint8_t data) |
j3 | 2:598e601e5846 | 55 | { |
j3 | 2:598e601e5846 | 56 | int32_t rtnVal = -1; |
j3 | 2:598e601e5846 | 57 | |
j3 | 2:598e601e5846 | 58 | return rtnVal; |
j3 | 2:598e601e5846 | 59 | } |
j3 | 2:598e601e5846 | 60 | |
j3 | 2:598e601e5846 | 61 | |
j3 | 2:598e601e5846 | 62 | //***************************************************************************** |
j3 | 2:598e601e5846 | 63 | int32_t BMI160_SPI::readBlock(Registers startReg, Registers stopReg, uint8_t *data) |
j3 | 2:598e601e5846 | 64 | { |
j3 | 2:598e601e5846 | 65 | int32_t rtnVal = -1; |
j3 | 2:598e601e5846 | 66 | |
j3 | 2:598e601e5846 | 67 | return rtnVal; |
j3 | 2:598e601e5846 | 68 | } |
j3 | 2:598e601e5846 | 69 | |
j3 | 2:598e601e5846 | 70 | |
j3 | 2:598e601e5846 | 71 | //***************************************************************************** |
j3 | 2:598e601e5846 | 72 | int32_t BMI160_SPI::writeBlock(Registers startReg, Registers stopReg, const uint8_t *data) |
j3 | 2:598e601e5846 | 73 | { |
j3 | 2:598e601e5846 | 74 | int32_t rtnVal = -1; |
j3 | 2:598e601e5846 | 75 | |
j3 | 2:598e601e5846 | 76 | return rtnVal; |
j3 | 2:598e601e5846 | 77 | } |