doxygen cleanup

pull/8510/head
paul-szczepanek-arm 2018-10-23 14:47:25 +01:00
parent ba23fef90b
commit 68929ce94b
1 changed files with 29 additions and 23 deletions

View File

@ -26,19 +26,18 @@
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \addtogroup drivers */
/** A SPI slave, used for communicating with a SPI Master device /** A SPI slave, used for communicating with a SPI Master device.
* *
* The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz.
* *
* @note Synchronization level: Not protected * @note Synchronization level: Not protected
* *
* Example: * Example of how to reply to a SPI master as slave:
* @code * @code
* // Reply to a SPI master as slave
* *
* #include "mbed.h" * #include "mbed.h"
* *
* SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel * SPISlave device(SPI_MOSI, SPI_MISO, SPI_SCLK, SPI_CS);
* *
* int main() { * int main() {
* device.reply(0x00); // Prime SPI with first reply * device.reply(0x00); // Prime SPI with first reply
@ -57,21 +56,21 @@ class SPISlave : private NonCopyable<SPISlave> {
public: public:
/** Create a SPI slave connected to the specified pins /** Create a SPI slave connected to the specified pins.
* *
* mosi or miso can be specified as NC if not used * @note Either mosi or miso can be specified as NC if not used.
* *
* @param mosi SPI Master Out, Slave In pin * @param mosi SPI Master Out, Slave In pin.
* @param miso SPI Master In, Slave Out pin * @param miso SPI Master In, Slave Out pin.
* @param sclk SPI Clock pin * @param sclk SPI Clock pin.
* @param ssel SPI chip select pin * @param ssel SPI Chip Select pin.
*/ */
SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel); SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel);
/** Configure the data transmission format /** Configure the data transmission format.
* *
* @param bits Number of bits per SPI frame (4 - 16) * @param bits Number of bits per SPI frame (4 - 16).
* @param mode Clock polarity and phase mode (0 - 3) * @param mode Clock polarity and phase mode (0 - 3).
* *
* @code * @code
* mode | POL PHA * mode | POL PHA
@ -84,40 +83,47 @@ public:
*/ */
void format(int bits, int mode = 0); void format(int bits, int mode = 0);
/** Set the spi bus clock frequency /** Set the SPI bus clock frequency.
* *
* @param hz SCLK frequency in hz (default = 1MHz) * @param hz Clock frequency in hz (default = 1MHz).
*/ */
void frequency(int hz = 1000000); void frequency(int hz = 1000000);
/** Polls the SPI to see if data has been received /** Polls the SPI to see if data has been received
* *
* @returns * @return Presence of received data.
* 0 if no data, * @retval 0 No data waiting.
* 1 otherwise * @retval 1 Data waiting.
*/ */
int receive(void); int receive(void);
/** Retrieve data from receive buffer as slave /** Retrieve data from receive buffer as slave.
* *
* @returns * @return The data in the receive buffer.
* the data in the receive buffer
*/ */
int read(void); int read(void);
/** Fill the transmission buffer with the value to be written out /** Fill the transmission buffer with the value to be written out
* as slave on the next received message from the master. * as slave on the next received message from the master.
* *
* @param value the data to be transmitted next * @param value The data to be transmitted next.
*/ */
void reply(int value); void reply(int value);
#if !defined(DOXYGEN_ONLY)
protected: protected:
/* Internal SPI object identifying the resources */
spi_t _spi; spi_t _spi;
/* How many bits in an SPI frame */
int _bits; int _bits;
/* Clock phase and polarity */
int _mode; int _mode;
/* Clock frequency */
int _hz; int _hz;
#endif //!defined(DOXYGEN_ONLY)
}; };
} // namespace mbed } // namespace mbed