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