/* * Common IO - basic V1.0.0 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * http://aws.amazon.com/freertos * http://www.FreeRTOS.org */ /** * @file iot_spi.h * @brief File for the APIs of SPI called by application layer. */ #ifndef _IOT_SPI_H_ #define _IOT_SPI_H_ /* Standard includes. */ #include /** * @defgroup iot_spi SPI Abstraction APIs. * @{ */ /** * @brief The return codes for the methods in SPI. */ #define IOT_SPI_SUCCESS ( 0 ) /*!< SPI operation completed successfully. */ #define IOT_SPI_INVALID_VALUE ( 1 ) /*!< At least one parameter is invalid. */ #define IOT_SPI_WRITE_FAILED ( 2 ) /*!< SPI driver returns error when performing write operation. */ #define IOT_SPI_READ_FAILED ( 3 ) /*!< SPI driver returns error when performing read operation. */ #define IOT_SPI_TRANSFER_ERROR ( 4 ) /*!< SPI driver returns error when performing transfer. */ #define IOT_SPI_BUS_BUSY ( 5 ) /*!< SPI bus is busy at current time. */ #define IOT_SPI_NOTHING_TO_CANCEL ( 6 ) /*!< No ongoing operation when cancel operation is performed. */ #define IOT_SPI_FUNCTION_NOT_SUPPORTED ( 7 ) /*!< SPI operation is not supported. */ /** * @brief The SPI return status from Async operations. */ typedef enum { eSPISuccess = IOT_SPI_SUCCESS, /*!< SPI operation completed successfully. */ eSPIWriteError = IOT_SPI_WRITE_FAILED, /*!< SPI driver returns error when performing write operation. */ eSPIReadError = IOT_SPI_READ_FAILED, /*!< SPI driver returns error when performing read operation. */ eSPITransferError = IOT_SPI_TRANSFER_ERROR, /*!< SPI driver returns error when performing transfer. */ } IotSPITransactionStatus_t; /** * @brief The SPI Modes denoting the clock polarity * and clock phase. */ typedef enum { eSPIMode0, /*!< CPOL = 0 and CPHA = 0 */ eSPIMode1, /*!< CPOL = 0 and CPHA = 1 */ eSPIMode2, /*!< CPOL = 1 and CPHA = 0 */ eSPIMode3, /*!