Now you can use NC as InterruptIn
Fork of X_NUCLEO_6180XA1 by
x_nucleo_6180xa1.cpp@10:4954b09b72d8, 2015-10-06 (annotated)
- Committer:
- gallonm
- Date:
- Tue Oct 06 09:03:10 2015 +0200
- Revision:
- 10:4954b09b72d8
- Parent:
- 2:7684e0b4e40e
- Child:
- 12:71d589e6fd2c
Fitted all api files (reinserted original api files)
Modified file platform.h and removed vl6180x_appcfg.h from the include
Modified value of the define SINGLE_DEVICE_DRIVER
Updated file stmpe1600_class.h
Fitted the ReadID function and I2C functions (read and write)
Updated file vl6180x_class.cpp
Introduced functions InitSensor and StartMeasurement
Fitted the constructor and the destructor of x_nucleo_6180xa1
Added the instance to create a singleton object
Introduced InitBoard function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gallonm | 10:4954b09b72d8 | 1 | /** |
gallonm | 10:4954b09b72d8 | 2 | ****************************************************************************** |
gallonm | 10:4954b09b72d8 | 3 | * @file x_nucleo_6180xa1.cpp |
gallonm | 10:4954b09b72d8 | 4 | * @author AST / EST |
gallonm | 10:4954b09b72d8 | 5 | * @version V0.0.1 |
gallonm | 10:4954b09b72d8 | 6 | * @date 13-April-2015 |
gallonm | 10:4954b09b72d8 | 7 | * @brief Implementation file for the X_NUCLEO_VL6180XA1 singleton class |
gallonm | 10:4954b09b72d8 | 8 | ****************************************************************************** |
gallonm | 10:4954b09b72d8 | 9 | * @attention |
gallonm | 10:4954b09b72d8 | 10 | * |
gallonm | 10:4954b09b72d8 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
gallonm | 10:4954b09b72d8 | 12 | * |
gallonm | 10:4954b09b72d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
gallonm | 10:4954b09b72d8 | 14 | * are permitted provided that the following conditions are met: |
gallonm | 10:4954b09b72d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
gallonm | 10:4954b09b72d8 | 16 | * this list of conditions and the following disclaimer. |
gallonm | 10:4954b09b72d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
gallonm | 10:4954b09b72d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
gallonm | 10:4954b09b72d8 | 19 | * and/or other materials provided with the distribution. |
gallonm | 10:4954b09b72d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
gallonm | 10:4954b09b72d8 | 21 | * may be used to endorse or promote products derived from this software |
gallonm | 10:4954b09b72d8 | 22 | * without specific prior written permission. |
gallonm | 10:4954b09b72d8 | 23 | * |
gallonm | 10:4954b09b72d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
gallonm | 10:4954b09b72d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
gallonm | 10:4954b09b72d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
gallonm | 10:4954b09b72d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
gallonm | 10:4954b09b72d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
gallonm | 10:4954b09b72d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
gallonm | 10:4954b09b72d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
gallonm | 10:4954b09b72d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
gallonm | 10:4954b09b72d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
gallonm | 10:4954b09b72d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
gallonm | 10:4954b09b72d8 | 34 | * |
gallonm | 10:4954b09b72d8 | 35 | ****************************************************************************** |
gallonm | 10:4954b09b72d8 | 36 | */ |
gallonm | 10:4954b09b72d8 | 37 | |
gallonm | 10:4954b09b72d8 | 38 | |
gallonm | 10:4954b09b72d8 | 39 | /* Includes ------------------------------------------------------------------*/ |
gallonm | 10:4954b09b72d8 | 40 | #include "x_nucleo_6180xa1.h" |
gallonm | 10:4954b09b72d8 | 41 | |
gallonm | 10:4954b09b72d8 | 42 | /* Static variables ----------------------------------------------------------*/ |
gallonm | 10:4954b09b72d8 | 43 | X_NUCLEO_6180XA1* X_NUCLEO_6180XA1::_instance = NULL; |
gallonm | 10:4954b09b72d8 | 44 | |
gallonm | 10:4954b09b72d8 | 45 | |
gallonm | 10:4954b09b72d8 | 46 | X_NUCLEO_6180XA1* X_NUCLEO_6180XA1::Instance(DevI2C *ext_i2c) |
gallonm | 10:4954b09b72d8 | 47 | { |
gallonm | 10:4954b09b72d8 | 48 | if(_instance==NULL) |
gallonm | 10:4954b09b72d8 | 49 | _instance=new X_NUCLEO_6180XA1(ext_i2c); |
gallonm | 10:4954b09b72d8 | 50 | else |
gallonm | 10:4954b09b72d8 | 51 | error("Failed to init X_NUCLEO_6180XA1 board!\n"); |
gallonm | 10:4954b09b72d8 | 52 | return _instance; |
gallonm | 10:4954b09b72d8 | 53 | } |
gallonm | 10:4954b09b72d8 | 54 | |
gallonm | 10:4954b09b72d8 | 55 | |
gallonm | 10:4954b09b72d8 | 56 | int X_NUCLEO_6180XA1::InitBoard() |
gallonm | 10:4954b09b72d8 | 57 | { |
gallonm | 10:4954b09b72d8 | 58 | int status; |
gallonm | 10:4954b09b72d8 | 59 | |
gallonm | 10:4954b09b72d8 | 60 | status=sensor_top->InitSensor(NEW_SENSOR_TOP_ADDRESS); |
gallonm | 10:4954b09b72d8 | 61 | if(status) |
gallonm | 10:4954b09b72d8 | 62 | { |
gallonm | 10:4954b09b72d8 | 63 | delete[] sensor_top; |
gallonm | 10:4954b09b72d8 | 64 | delete[] gpio0_top; |
gallonm | 10:4954b09b72d8 | 65 | sensor_top=NULL; |
gallonm | 10:4954b09b72d8 | 66 | gpio0_top=NULL; |
gallonm | 10:4954b09b72d8 | 67 | } |
gallonm | 10:4954b09b72d8 | 68 | |
gallonm | 10:4954b09b72d8 | 69 | //stessa cosa per left, bottom e right |
gallonm | 10:4954b09b72d8 | 70 | } |
gallonm | 10:4954b09b72d8 | 71 | |
gallonm | 10:4954b09b72d8 | 72 |