/***************************************************************************** */
/* This function is used to transfer a word (4 to 16 bits) to AND from a device
* As the SPI bus is full duplex, data can flow in both directions, but the clock is
- * always provided by the master. The SPI clock cannont be activated without sending
+ * always provided by the master. The SPI clock cannot be activated without sending
* data, which means we must send data to the device when we want to read data from
* the device.
* Note : the SSP device number is not checked, thus a value above the number of SSP
* pointed by "data_out" for each frame. If NULL, then the content of data_in
* will be used.
* data_in : buffer for read data. If NULL, read data will be discarded.
+ * width : used to differentiate between size up to 8 bits and above 8 bits.
+ * Use LPC_SSP_WORD_LEN(x) macro.
* Returns the number of data words transfered or negative value on error.
* As the SPI bus is full duplex, data can flow in both directions, but the clock is
* always provided by the master. The SPI clock cannont be activated without sending
int spi_transfer_multiple_frames(uint8_t ssp_num, void* data_out, void* data_in, int size, int width);
+#define LPC_SSP_WORD_LEN(x) (x)
+#define LPC_SSP_MHz(x) ((x) * 1000 * 1000)
/***************************************************************************** */
void ssp_clk_update(void);
* Parameters :
* frame_type is SPI, TI or MICROWIRE (use apropriate defines for this one).
* LPC_SSP_FRAME_SPI - LPC_SSP_FRAME_TI - LPC_SSP_FRAME_MICROWIRE).
- * data_width is a number between 4 and 16.
- * rate : The bit rate, in Hz.
+ * data_width is a number between 4 and 16. Use LPC_SSP_WORD_LEN(x) macro for this one.
+ * rate : The bit rate, in Hz. Use LPC_SSP_MHz(x) macro to get Hz from MHz value.
* The SPI Chip Select is not handled by the SPI driver in master SPI mode as it's
* handling highly depends on the device on the other end of the wires. Use a GPIO
* to activate the device's chip select (usually active low)