A collection of Analog Devices drivers for the mbed platform

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADXL362_Diag.h Source File

ADXL362_Diag.h

00001 /**
00002 *   @file     adxl362_diag.h
00003 *   @brief    Header file for the ADXL362 wrapper used by the driver diag
00004 *   @author   Analog Devices Inc.
00005 *
00006 * For support please go to:
00007 * Github: https://github.com/analogdevicesinc/mbed-adi
00008 * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
00009 * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
00010 
00011 ********************************************************************************
00012 * Copyright 2016(c) Analog Devices, Inc.
00013 *
00014 * All rights reserved.
00015 *
00016 * Redistribution and use in source and binary forms, with or without
00017 * modification, are permitted provided that the following conditions are met:
00018 *  - Redistributions of source code must retain the above copyright
00019 *    notice, this list of conditions and the following disclaimer.
00020 *  - Redistributions in binary form must reproduce the above copyright
00021 *    notice, this list of conditions and the following disclaimer in
00022 *    the documentation and/or other materials provided with the
00023 *    distribution.
00024 *  - Neither the name of Analog Devices, Inc. nor the names of its
00025 *    contributors may be used to endorse or promote products derived
00026 *    from this software without specific prior written permission.
00027 *  - The use of this software may or may not infringe the patent rights
00028 *    of one or more patent holders.  This license does not release you
00029 *    from the requirement that you obtain separate licenses from these
00030 *    patent holders to use this software.
00031 *  - Use of the software either in source or binary form, must be run
00032 *    on or directly connected to an Analog Devices Inc. component.
00033 *
00034 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
00035 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
00036 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00037 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
00038 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00039 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
00040 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00041 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00042 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00043 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00044 *
00045 ********************************************************************************/
00046 #ifndef ADXL362_DIAG_H_
00047 #define ADXL362_DIAG_H_
00048 
00049 #include "ADXL362.h"
00050 
00051 class ADXL362_Diag
00052 {
00053 
00054 public:
00055     ADXL362_Diag(ADXL362& ad);
00056     /** Low level SPI bus comm methods */
00057     void reset(void);
00058     void write_reg(void);
00059     void read_reg(void);
00060     void scan(void);
00061     void read_status(void);
00062     void write_ctl(void);
00063     void write_ftl(void);
00064     void fifo_read_nr_of_entries(void);
00065     void fifo_setup(void);
00066     void fifo_read_u16(void);
00067     void fifo_scan(void);
00068     void intinit(void);
00069     void checkawake(void);
00070 
00071 
00072 private:
00073     ADXL362& dut;
00074 
00075     static const uint16_t INACT_VAL = 50;
00076     static const uint16_t INACT_TIMER = 50 * 10;
00077     static const uint16_t ACT_VAL = 50;
00078     static const uint8_t ACT_TIMER = 100;
00079     static const uint16_t SCAN_SENSOR_TIME = 500;
00080 };
00081 void rising_adxl362();
00082 void falling_adxl362();
00083 
00084 #endif /* ADXL362_DIAG_H_ */