mbed library sources, mbed-dev only for TYBLE16
Fork of mbed-dev by
Please refer flowing link.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/
Diff: drivers/SPI.h
- Revision:
- 167:e84263d55307
- Parent:
- 149:156823d33999
- Child:
- 168:9672193075cf
diff -r c97ed07ec1a8 -r e84263d55307 drivers/SPI.h --- a/drivers/SPI.h Thu Jun 08 15:02:37 2017 +0100 +++ b/drivers/SPI.h Wed Jun 21 17:46:44 2017 +0100 @@ -18,7 +18,7 @@ #include "platform/platform.h" -#if DEVICE_SPI +#if defined (DEVICE_SPI) || defined(DOXYGEN_ONLY) #include "platform/PlatformMutex.h" #include "hal/spi_api.h" @@ -34,16 +34,15 @@ namespace mbed { /** \addtogroup drivers */ -/** @{*/ /** A SPI Master, used for communicating with SPI slave devices * * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz * * Most SPI devices will also require Chip Select and Reset signals. These - * can be controlled using <DigitalOut> pins + * can be controlled using DigitalOut pins * - * @Note Synchronization level: Thread safe + * @note Synchronization level: Thread safe * * Example: * @code @@ -71,6 +70,7 @@ * * } * @endcode + * @ingroup drivers */ class SPI { @@ -115,9 +115,25 @@ * * @returns * Response from the SPI slave - */ + */ virtual int write(int value); + /** Write to the SPI Slave and obtain the response + * + * The total number of bytes sent and recieved will be the maximum of + * tx_length and rx_length. The bytes written will be padded with the + * value 0xff. + * + * @param tx_buffer Pointer to the byte-array of data to write to the device + * @param tx_length Number of bytes to write, may be zero + * @param rx_buffer Pointer to the byte-array of data to read from the device + * @param rx_length Number of bytes to read, may be zero + * @returns + * The number of bytes written and read from the device. This is + * maximum of tx_length and rx_length. + */ + virtual int write(const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length); + /** Acquire exclusive access to this SPI bus */ virtual void lock(void); @@ -261,5 +277,3 @@ #endif #endif - -/** @}*/