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