![FTDI FT51A Application Note Download Page 145](http://html1.mh-extra.com/html/ftdi/ft51a/ft51a_application-note_2341158145.webp)
Application Note
AN_289 FT51A Programming Guide
Version 1.0
Document Reference No.: FT_000962 Clearance No.: FTDI# 483
144
Copyright © 2015 Future Technology Devices International Limited
3.1.5.1
SPIM_configure_slave
File: ft51_spim_configure_slave.c
This function is used to configure the SPI Master to connect to a slave device with the required
communication properties. The master’s bit order, clock speed, clock mode and slave select idle
and polarity matched to the slave device.
3.1.5.2
SPIM_initialise_ints
File: ft51_spim_transceive_ints.c
This is called first to initialise the SPI Master to use interrupts.
3.1.5.3
SPIM_transceive_ints
File: ft51_spim_transceive_ints.c
A transaction sending data to and receiving data from the SPI Slave will be started. The call will
block until all data is sent (and received). Interrupts are used to wait for completion of the
transfers.
3.1.5.4
SPIM_initialise_DMA
File: ft51_spim_transceive_dma.c
Requires: ft51_dma_initialise.c, ft51_dma_acquire.c, ft51_dma_release.c
This is called first to initialise the SPI Master to use DMA.
It requires that the DMA library is included.
3.1.5.5
SPIM_transceive_DMA
File: ft51_spim_transceive_dma.c
Requires: ft51_dma_configure.c, ft51_dma_enable.c, ft51_dma_wait_on_complete.c
A transaction sending data to and receiving data from the SPI Slave will be started. The call will
block until all data is sent (and received). DMAs are used to wait for completion of the transfers.
It is necessary to include the DMA library.
3.1.6
I
2
C Master Library
The I
2
C Master library provides a simple read and write interface to the I
2
C Master peripheral.
There is a function to abstract setting the timer period register.
It is possible to use interrupt methods to perform both reads and write. This is not implemented in
this library.
Source Folder: i2c
3.1.6.1
I2C_master_initialise
File: ft51_i2c_master.c
This function will reset and initialise the I
2
C Master peripheral. By default a value of 0x40 is
programmed into the
I2CMTP
register resulting in a frequency of 36.9 kHz. A dummy slave address
(0x22) is programmed into the
I2CMSA
register.
3.1.6.2
I2C_master_set_timer
File: ft51_i2c_master.c
This function will change the setting of the
I2CMTP
register to change the frequency and the mode
of the I
2
C Master. High-speed mode can be selected along with the timer counter value.