Example usage

#include "mcc_generated_files/spi/mssp2.h"

//INITIALISE
	SPI2_Open(HOST_CONFIG);			//HOST_CONFIG is the configuration we selected in MCC
	

//TRANSFER
	uint8_t RxData[2];
	IO_AD7478_CS = 0;

	RxData[0] = SPI2_ByteExchange(0x00);
	RxData[1] = SPI2_ByteExchange(0x00);

	IO_AD7478_CS = 1;

How we define it for use in our libraries

#define IO_EXPANDER_SPI_WRITE_BYTE(TxData)					SPI2_ByteExchange(TxData)
#define IO_EXPANDER_SPI_READ_BYTE(RxData)					RxData = SPI2_ByteExchange(0x00)
#define IO_EXPANDER_SPI_WRITE_READ_BYTE(TxData, RxData)		RxData = SPI2_ByteExchange(TxData)
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *