Lucas Lim / Mbed 2 deprecated HSP_Temperature_Barometer_CS3237

Dependencies:   mbed

Committer:
lucaslwl
Date:
Mon Aug 26 08:11:41 2019 +0000
Revision:
22:5c07298d3383
Parent:
20:652f0bf256bd
add library folder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lucaslwl 20:652f0bf256bd 1 /*******************************************************************************
lucaslwl 20:652f0bf256bd 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
lucaslwl 20:652f0bf256bd 3 *
lucaslwl 20:652f0bf256bd 4 * Permission is hereby granted, free of charge, to any person obtaining a
lucaslwl 20:652f0bf256bd 5 * copy of this software and associated documentation files (the "Software"),
lucaslwl 20:652f0bf256bd 6 * to deal in the Software without restriction, including without limitation
lucaslwl 20:652f0bf256bd 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
lucaslwl 20:652f0bf256bd 8 * and/or sell copies of the Software, and to permit persons to whom the
lucaslwl 20:652f0bf256bd 9 * Software is furnished to do so, subject to the following conditions:
lucaslwl 20:652f0bf256bd 10 *
lucaslwl 20:652f0bf256bd 11 * The above copyright notice and this permission notice shall be included
lucaslwl 20:652f0bf256bd 12 * in all copies or substantial portions of the Software.
lucaslwl 20:652f0bf256bd 13 *
lucaslwl 20:652f0bf256bd 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
lucaslwl 20:652f0bf256bd 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
lucaslwl 20:652f0bf256bd 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
lucaslwl 20:652f0bf256bd 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
lucaslwl 20:652f0bf256bd 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
lucaslwl 20:652f0bf256bd 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
lucaslwl 20:652f0bf256bd 20 * OTHER DEALINGS IN THE SOFTWARE.
lucaslwl 20:652f0bf256bd 21 *
lucaslwl 20:652f0bf256bd 22 * Except as contained in this notice, the name of Maxim Integrated
lucaslwl 20:652f0bf256bd 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
lucaslwl 20:652f0bf256bd 24 * Products, Inc. Branding Policy.
lucaslwl 20:652f0bf256bd 25 *
lucaslwl 20:652f0bf256bd 26 * The mere transfer of this software does not imply any licenses
lucaslwl 20:652f0bf256bd 27 * of trade secrets, proprietary technology, copyrights, patents,
lucaslwl 20:652f0bf256bd 28 * trademarks, maskwork rights, or any other form of intellectual
lucaslwl 20:652f0bf256bd 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
lucaslwl 20:652f0bf256bd 30 * ownership rights.
lucaslwl 20:652f0bf256bd 31 *******************************************************************************
lucaslwl 20:652f0bf256bd 32 */
lucaslwl 20:652f0bf256bd 33 #ifndef _QUADSPIINTERFACE_H_
lucaslwl 20:652f0bf256bd 34 #define _QUADSPIINTERFACE_H_
lucaslwl 20:652f0bf256bd 35
lucaslwl 20:652f0bf256bd 36 #include "mbed.h"
lucaslwl 20:652f0bf256bd 37 #include "QuadSpi.h"
lucaslwl 20:652f0bf256bd 38
lucaslwl 20:652f0bf256bd 39 class QuadSpiInterface {
lucaslwl 20:652f0bf256bd 40 public:
lucaslwl 20:652f0bf256bd 41 /**
lucaslwl 20:652f0bf256bd 42 * @brief Constructor that accepts pin names for the QUAD SPI interface
lucaslwl 20:652f0bf256bd 43 * @param mosi master out slave in pin name
lucaslwl 20:652f0bf256bd 44 * @param miso master in slave out pin name
lucaslwl 20:652f0bf256bd 45 * @param sclk serial clock pin name
lucaslwl 20:652f0bf256bd 46 * @param cs chip select pin name
lucaslwl 20:652f0bf256bd 47 */
lucaslwl 20:652f0bf256bd 48 QuadSpiInterface(PinName mosi, PinName miso, PinName sclk, PinName cs);
lucaslwl 20:652f0bf256bd 49 /**
lucaslwl 20:652f0bf256bd 50 * @brief Transmit and recieve QUAD SPI data
lucaslwl 20:652f0bf256bd 51 * @param tx_buf pointer to transmit byte buffer
lucaslwl 20:652f0bf256bd 52 * @param tx_size number of bytes to transmit
lucaslwl 20:652f0bf256bd 53 * @param rx_buf pointer to the recieve buffer
lucaslwl 20:652f0bf256bd 54 * @param rx_size number of bytes to recieve
lucaslwl 20:652f0bf256bd 55 * @param last flag to indicate if this is the last QUAD SPI transaction for
lucaslwl 20:652f0bf256bd 56 * the current chip select cycle
lucaslwl 20:652f0bf256bd 57 */
lucaslwl 20:652f0bf256bd 58 int SPI_Transmit(const uint8_t *tx_buf, uint32_t tx_size, uint8_t *rx_buf,
lucaslwl 20:652f0bf256bd 59 uint32_t rx_size, int last = 1);
lucaslwl 20:652f0bf256bd 60
lucaslwl 20:652f0bf256bd 61 /**
lucaslwl 20:652f0bf256bd 62 * @brief Transmit and recieve Four Wrire SPI data
lucaslwl 20:652f0bf256bd 63 * @param tx_buf pointer to transmit byte buffer
lucaslwl 20:652f0bf256bd 64 * @param tx_size number of bytes to transmit
lucaslwl 20:652f0bf256bd 65 * @param rx_buf pointer to the recieve buffer
lucaslwl 20:652f0bf256bd 66 * @param rx_size number of bytes to recieve
lucaslwl 20:652f0bf256bd 67 * @param last flag to indicate if this is the last QUAD SPI transaction for
lucaslwl 20:652f0bf256bd 68 * the current chip select cycle
lucaslwl 20:652f0bf256bd 69 */
lucaslwl 20:652f0bf256bd 70 int SPI_Transmit4Wire(const uint8_t *tx_buf, uint32_t tx_size,
lucaslwl 20:652f0bf256bd 71 uint8_t *rx_buf, uint32_t rx_size, int last = 1);
lucaslwl 20:652f0bf256bd 72
lucaslwl 20:652f0bf256bd 73 private:
lucaslwl 20:652f0bf256bd 74 // QUAD SPI object
lucaslwl 20:652f0bf256bd 75 QuadSPI spi;
lucaslwl 20:652f0bf256bd 76 // chip select object
lucaslwl 20:652f0bf256bd 77 DigitalOut csPin;
lucaslwl 20:652f0bf256bd 78 };
lucaslwl 20:652f0bf256bd 79
lucaslwl 20:652f0bf256bd 80 #endif // _QUADSPIINTERFACE_H_
lucaslwl 20:652f0bf256bd 81