Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Committer:
mahphalke
Date:
Tue Jul 13 13:58:07 2021 +0530
Revision:
17:af1f2416dd26
Restructured the directory- Removed inc/ and src/ folders and moved all source/header files at root

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mahphalke 17:af1f2416dd26 1 /***************************************************************************//**
mahphalke 17:af1f2416dd26 2 * @file spi_extra.h
mahphalke 17:af1f2416dd26 3 * @brief: Header containing extra types required for SPI interface
mahphalke 17:af1f2416dd26 4 ********************************************************************************
mahphalke 17:af1f2416dd26 5 * Copyright (c) 2021 Analog Devices, Inc.
mahphalke 17:af1f2416dd26 6 * All rights reserved.
mahphalke 17:af1f2416dd26 7 *
mahphalke 17:af1f2416dd26 8 * This software is proprietary to Analog Devices, Inc. and its licensors.
mahphalke 17:af1f2416dd26 9 * By using this software you agree to the terms of the associated
mahphalke 17:af1f2416dd26 10 * Analog Devices Software License Agreement.
mahphalke 17:af1f2416dd26 11 *******************************************************************************/
mahphalke 17:af1f2416dd26 12
mahphalke 17:af1f2416dd26 13 #ifndef SPI_EXTRA_H
mahphalke 17:af1f2416dd26 14 #define SPI_EXTRA_H
mahphalke 17:af1f2416dd26 15
mahphalke 17:af1f2416dd26 16 // Platform support needs to be C-compatible to work with other drivers
mahphalke 17:af1f2416dd26 17 #ifdef __cplusplus
mahphalke 17:af1f2416dd26 18 extern "C"
mahphalke 17:af1f2416dd26 19 {
mahphalke 17:af1f2416dd26 20 #endif
mahphalke 17:af1f2416dd26 21
mahphalke 17:af1f2416dd26 22 /******************************************************************************/
mahphalke 17:af1f2416dd26 23 /***************************** Include Files **********************************/
mahphalke 17:af1f2416dd26 24 /******************************************************************************/
mahphalke 17:af1f2416dd26 25 #include <stdio.h>
mahphalke 17:af1f2416dd26 26 #include <stdbool.h>
mahphalke 17:af1f2416dd26 27
mahphalke 17:af1f2416dd26 28 /******************************************************************************/
mahphalke 17:af1f2416dd26 29 /********************** Macros and Constants Definitions **********************/
mahphalke 17:af1f2416dd26 30 /******************************************************************************/
mahphalke 17:af1f2416dd26 31
mahphalke 17:af1f2416dd26 32 /******************************************************************************/
mahphalke 17:af1f2416dd26 33 /********************** Variables and User defined data types *****************/
mahphalke 17:af1f2416dd26 34 /******************************************************************************/
mahphalke 17:af1f2416dd26 35
mahphalke 17:af1f2416dd26 36 /*
mahphalke 17:af1f2416dd26 37 * Note: The structure members are not strongly typed, as this file is included
mahphalke 17:af1f2416dd26 38 * in application specific '.c' files. The mbed code structure does not
mahphalke 17:af1f2416dd26 39 * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files.
mahphalke 17:af1f2416dd26 40 * All the members are hence typecasted to mbed specific type during
mahphalke 17:af1f2416dd26 41 * spi init and read/write operations.
mahphalke 17:af1f2416dd26 42 **/
mahphalke 17:af1f2416dd26 43
mahphalke 17:af1f2416dd26 44 /**
mahphalke 17:af1f2416dd26 45 * @struct mbed_spi_init_param
mahphalke 17:af1f2416dd26 46 * @brief Structure holding the SPI init parameters for mbed platform.
mahphalke 17:af1f2416dd26 47 */
mahphalke 17:af1f2416dd26 48 typedef struct mbed_spi_init_param {
mahphalke 17:af1f2416dd26 49 uint8_t spi_miso_pin; // SPI MISO pin (PinName)
mahphalke 17:af1f2416dd26 50 uint8_t spi_mosi_pin; // SPI MOSI pin (PinName)
mahphalke 17:af1f2416dd26 51 uint8_t spi_clk_pin; // SPI CLK pin (PinName)
mahphalke 17:af1f2416dd26 52 bool use_sw_csb; // Software/Hardware control of CSB pin
mahphalke 17:af1f2416dd26 53 } mbed_spi_init_param;
mahphalke 17:af1f2416dd26 54
mahphalke 17:af1f2416dd26 55 /**
mahphalke 17:af1f2416dd26 56 * @struct mbed_spi_desc
mahphalke 17:af1f2416dd26 57 * @brief SPI specific descriptor for the mbed platform.
mahphalke 17:af1f2416dd26 58 */
mahphalke 17:af1f2416dd26 59 typedef struct mbed_spi_desc {
mahphalke 17:af1f2416dd26 60 void *spi_port; // SPI port instance (mbed::SPI)
mahphalke 17:af1f2416dd26 61 void *csb_gpio; // SPI chip select gpio instance (DigitalOut)
mahphalke 17:af1f2416dd26 62 bool use_sw_csb; // Software/Hardware control of CSB pin
mahphalke 17:af1f2416dd26 63 } mbed_spi_desc;
mahphalke 17:af1f2416dd26 64
mahphalke 17:af1f2416dd26 65 /******************************************************************************/
mahphalke 17:af1f2416dd26 66 /************************ Functions Declarations ******************************/
mahphalke 17:af1f2416dd26 67 /******************************************************************************/
mahphalke 17:af1f2416dd26 68
mahphalke 17:af1f2416dd26 69
mahphalke 17:af1f2416dd26 70 #ifdef __cplusplus // Closing extern c
mahphalke 17:af1f2416dd26 71 }
mahphalke 17:af1f2416dd26 72 #endif
mahphalke 17:af1f2416dd26 73
mahphalke 17:af1f2416dd26 74 #endif /* SPI_EXTRA_H */