Lin Team / Mbed 2 deprecated AD7190_LoRa

Dependencies:   mbed

Committer:
peng103617
Date:
Thu Aug 06 06:52:19 2020 +0000
Revision:
0:0e20215b178e
AD7190_LoRa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
peng103617 0:0e20215b178e 1 /***************************************************************************//**
peng103617 0:0e20215b178e 2 * @file Communication.h
peng103617 0:0e20215b178e 3 * @brief Header file of Communication Driver.
peng103617 0:0e20215b178e 4 * @author DBogdan (dragos.bogdan@analog.com)
peng103617 0:0e20215b178e 5 ********************************************************************************
peng103617 0:0e20215b178e 6 * Copyright 2012-2015(c) Analog Devices, Inc.
peng103617 0:0e20215b178e 7 *
peng103617 0:0e20215b178e 8 * All rights reserved.
peng103617 0:0e20215b178e 9 *
peng103617 0:0e20215b178e 10 * Redistribution and use in source and binary forms, with or without
peng103617 0:0e20215b178e 11 * modification, are permitted provided that the following conditions are met:
peng103617 0:0e20215b178e 12 * - Redistributions of source code must retain the above copyright
peng103617 0:0e20215b178e 13 * notice, this list of conditions and the following disclaimer.
peng103617 0:0e20215b178e 14 * - Redistributions in binary form must reproduce the above copyright
peng103617 0:0e20215b178e 15 * notice, this list of conditions and the following disclaimer in
peng103617 0:0e20215b178e 16 * the documentation and/or other materials provided with the
peng103617 0:0e20215b178e 17 * distribution.
peng103617 0:0e20215b178e 18 * - Neither the name of Analog Devices, Inc. nor the names of its
peng103617 0:0e20215b178e 19 * contributors may be used to endorse or promote products derived
peng103617 0:0e20215b178e 20 * from this software without specific prior written permission.
peng103617 0:0e20215b178e 21 * - The use of this software may or may not infringe the patent rights
peng103617 0:0e20215b178e 22 * of one or more patent holders. This license does not release you
peng103617 0:0e20215b178e 23 * from the requirement that you obtain separate licenses from these
peng103617 0:0e20215b178e 24 * patent holders to use this software.
peng103617 0:0e20215b178e 25 * - Use of the software either in source or binary form, must be run
peng103617 0:0e20215b178e 26 * on or directly connected to an Analog Devices Inc. component.
peng103617 0:0e20215b178e 27 *
peng103617 0:0e20215b178e 28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
peng103617 0:0e20215b178e 29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
peng103617 0:0e20215b178e 30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
peng103617 0:0e20215b178e 31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
peng103617 0:0e20215b178e 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
peng103617 0:0e20215b178e 33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
peng103617 0:0e20215b178e 34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
peng103617 0:0e20215b178e 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
peng103617 0:0e20215b178e 36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
peng103617 0:0e20215b178e 37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
peng103617 0:0e20215b178e 38 *
peng103617 0:0e20215b178e 39 *******************************************************************************/
peng103617 0:0e20215b178e 40 #ifndef _COMMUNICATION_H_
peng103617 0:0e20215b178e 41 #define _COMMUNICATION_H_
peng103617 0:0e20215b178e 42
peng103617 0:0e20215b178e 43 /******************************************************************************/
peng103617 0:0e20215b178e 44 /* Include Files */
peng103617 0:0e20215b178e 45 /******************************************************************************/
peng103617 0:0e20215b178e 46 #include "mbed.h"
peng103617 0:0e20215b178e 47 /******************************************************************************/
peng103617 0:0e20215b178e 48 /* Functions Prototypes */
peng103617 0:0e20215b178e 49 /******************************************************************************/
peng103617 0:0e20215b178e 50
peng103617 0:0e20215b178e 51 #define AD7190_READ_BUFFER_SIZE 16
peng103617 0:0e20215b178e 52
peng103617 0:0e20215b178e 53 extern SPI spi; // mosi, miso, sclk
peng103617 0:0e20215b178e 54 extern DigitalOut cs;
peng103617 0:0e20215b178e 55 extern Serial pc;
peng103617 0:0e20215b178e 56
peng103617 0:0e20215b178e 57 /*! Initializes the SPI communication peripheral. */
peng103617 0:0e20215b178e 58 unsigned char SPI_Init(unsigned char lsbFirst,
peng103617 0:0e20215b178e 59 unsigned long clockFreq,
peng103617 0:0e20215b178e 60 unsigned char clockPol,
peng103617 0:0e20215b178e 61 unsigned char clockEdg);
peng103617 0:0e20215b178e 62
peng103617 0:0e20215b178e 63 /*! Initializes the SPI communication peripheral. */
peng103617 0:0e20215b178e 64 unsigned char SPI_Init(unsigned char lsbFirst,
peng103617 0:0e20215b178e 65 unsigned long clockFreq,
peng103617 0:0e20215b178e 66 unsigned char clockPol,
peng103617 0:0e20215b178e 67 unsigned char clockEdg);
peng103617 0:0e20215b178e 68
peng103617 0:0e20215b178e 69 /*! Reads data from SPI. */
peng103617 0:0e20215b178e 70 unsigned char SPI_Read(unsigned char* data,
peng103617 0:0e20215b178e 71 unsigned char bytesNumber);
peng103617 0:0e20215b178e 72
peng103617 0:0e20215b178e 73 /*! Writes data to SPI. */
peng103617 0:0e20215b178e 74 unsigned char SPI_Write(unsigned char* data,
peng103617 0:0e20215b178e 75 unsigned char bytesNumber);
peng103617 0:0e20215b178e 76
peng103617 0:0e20215b178e 77 #endif /* _COMMUNICATION_H_ */