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