Go to the source code of this file.
Defines | |
#define | __MSP430_HAS_EUSCI_Ax__ |
#define | eSPI_CLOCKSOURCE_ACLK UCSSEL__ACLK |
#define | eSPI_CLOCKSOURCE_SMCLK UCSSEL__SMCLK |
#define | eSPI_MSB_FIRST UCMSB |
#define | eSPI_LSB_FIRST 0x00 |
#define | eSPI_BUSY UCBUSY |
#define | eSPI_NOT_BUSY 0x00 |
#define | eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT 0x00 |
#define | eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT UCCKPH |
#define | eSPI_3PIN UCMODE_0 |
#define | eSPI_4PIN_UCxSTE_ACTIVE_HIGH UCMODE_1 |
#define | eSPI_4PIN_UCxSTE_ACTIVE_LOW UCMODE_2 |
#define | eSPI_CLOCKPOLARITY_INACTIVITY_HIGH UCCKPL |
#define | eSPI_CLOCKPOLARITY_INACTIVITY_LOW 0x00 |
#define | eSPI_TRANSMIT_INTERRUPT UCTXIE |
#define | eSPI_RECEIVE_INTERRUPT UCRXIE |
#define | eSPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE UCSTEM |
#define | eSPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS 0x00 |
Functions | |
unsigned short | eSPI_masterInit (unsigned int baseAddress, unsigned char selectClockSource, unsigned long clockSourceFrequency, unsigned long desiredSpiClock, unsigned int msbFirst, unsigned int clockPhase, unsigned int clockPolarity, unsigned char spiMode) |
void | eSPI_select4PinFunctionality (unsigned int baseAddress, unsigned char select4PinFunctionality) |
void | eSPI_masterChangeClock (unsigned int baseAddress, unsigned long clockSourceFrequency, unsigned long desiredSpiClock) |
unsigned short | eSPI_slaveInit (unsigned int baseAddress, unsigned int msbFirst, unsigned int clockPhase, unsigned int clockPolarity) |
void | eSPI_changeClockPhasePolarity (unsigned int baseAddress, unsigned char clockPhase, unsigned char clockPolarity) |
void | eSPI_transmitData (unsigned int baseAddress, unsigned char transmitData) |
unsigned char | eSPI_receiveData (unsigned int baseAddress) |
void | eSPI_enableInterrupt (unsigned int baseAddress, unsigned char mask) |
void | eSPI_disableInterrupt (unsigned int baseAddress, unsigned char mask) |
unsigned char | eSPI_getInterruptStatus (unsigned int baseAddress, unsigned char mask) |
void | eSPI_enable (unsigned int baseAddress) |
void | eSPI_disable (unsigned int baseAddress) |
unsigned long | eSPI_getReceiveBufferAddressForDMA (unsigned int baseAddress) |
unsigned long | eSPI_getTransmitBufferAddressForDMA (unsigned int baseAddress) |
unsigned char | eSPI_isBusy (unsigned int baseAddress) |
void | eSPI_clearInterruptFlag (unsigned int baseAddress, unsigned char mask) |
#define __MSP430_HAS_EUSCI_Ax__ |
#define eSPI_CLOCKSOURCE_ACLK UCSSEL__ACLK |
Referenced by eSPI_masterInit().
#define eSPI_CLOCKSOURCE_SMCLK UCSSEL__SMCLK |
Referenced by eSPI_masterInit().
#define eSPI_MSB_FIRST UCMSB |
Referenced by eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_LSB_FIRST 0x00 |
Referenced by eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_BUSY UCBUSY |
#define eSPI_NOT_BUSY 0x00 |
#define eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT 0x00 |
Referenced by eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT UCCKPH |
Referenced by eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_3PIN UCMODE_0 |
Referenced by eSPI_masterInit().
#define eSPI_4PIN_UCxSTE_ACTIVE_HIGH UCMODE_1 |
Referenced by eSPI_masterInit().
#define eSPI_4PIN_UCxSTE_ACTIVE_LOW UCMODE_2 |
Referenced by eSPI_masterInit().
#define eSPI_CLOCKPOLARITY_INACTIVITY_HIGH UCCKPL |
Referenced by eSPI_changeClockPhasePolarity(), eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_CLOCKPOLARITY_INACTIVITY_LOW 0x00 |
Referenced by eSPI_changeClockPhasePolarity(), eSPI_masterInit(), and eSPI_slaveInit().
#define eSPI_TRANSMIT_INTERRUPT UCTXIE |
Referenced by eSPI_clearInterruptFlag(), eSPI_disableInterrupt(), eSPI_enableInterrupt(), and eSPI_getInterruptStatus().
#define eSPI_RECEIVE_INTERRUPT UCRXIE |
Referenced by eSPI_clearInterruptFlag(), eSPI_disableInterrupt(), eSPI_enableInterrupt(), and eSPI_getInterruptStatus().
#define eSPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE UCSTEM |
Referenced by eSPI_select4PinFunctionality().
#define eSPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS 0x00 |
Referenced by eSPI_select4PinFunctionality().
unsigned short eSPI_masterInit | ( | unsigned int | baseAddress, |
unsigned char | selectClockSource, | ||
unsigned long | clockSourceFrequency, | ||
unsigned long | desiredSpiClock, | ||
unsigned int | msbFirst, | ||
unsigned int | clockPhase, | ||
unsigned int | clockPolarity, | ||
unsigned char | spiMode | ||
) |
Initializes the SPI Master block.
baseAddress | is the base address of the I2C Master module. |
selectClockSource | selects Clock source. Valid values are eSPI_CLOCKSOURCE_ACLK eSPI_CLOCKSOURCE_SMCLK |
clockSourceFrequency | is the frequency of the slected clock source |
desiredSpiClock | is the desired clock rate for SPI communication |
msbFirst | controls the direction of the receive and transmit shift register. Valid values are eSPI_MSB_FIRST eSPI_LSB_FIRST [Default Value] |
clockPhase | is clock phase select. Valid values are eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default Value] eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT |
clockPolarity_InactivityHIGH | is clock polarity select. Valid values are eSPI_CLOCKPOLARITY_INACTIVITY_HIGH eSPI_CLOCKPOLARITY_INACTIVITY_LOW [Default Value] |
spiMode | is SPI mode select. Valid values are eSPI_3PIN [Default Value] eSPI_4PIN_UCxSTE_ACTIVE_HIGH eSPI_4PIN_UCxSTE_ACTIVE_LOW Upon successful initialization of the SPI master block, this function will have set the bus speed for the master, but the SPI Master block still remains disabled and must be enabled with eSPI_enable() |
Modified bits are UCCKPH, UCCKPL, UC7BIT, UCMSB,UCSSELx, UCSWRST bits of UCAxCTLW0 register
References ASSERT, eSPI_3PIN, eSPI_4PIN_UCxSTE_ACTIVE_HIGH, eSPI_4PIN_UCxSTE_ACTIVE_LOW, eSPI_CLOCKPOLARITY_INACTIVITY_HIGH, eSPI_CLOCKPOLARITY_INACTIVITY_LOW, eSPI_CLOCKSOURCE_ACLK, eSPI_CLOCKSOURCE_SMCLK, eSPI_LSB_FIRST, eSPI_MSB_FIRST, eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, HWREG, and STATUS_SUCCESS.
void eSPI_select4PinFunctionality | ( | unsigned int | baseAddress, |
unsigned char | select4PinFunctionality | ||
) |
Selects 4Pin Functionality
baseAddress | is the base address of the I2C Master module. |
select4PinFunctionality | selects Clock source. Valid values are eSPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS eSPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE This function should be invoked only in 4-wire mode. Invoking this function has no effect in 3-wire mode. |
Modified bits are UCSTEM bit of UCAxCTLW0 register
References ASSERT, eSPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE, eSPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS, and HWREG.
void eSPI_masterChangeClock | ( | unsigned int | baseAddress, |
unsigned long | clockSourceFrequency, | ||
unsigned long | desiredSpiClock | ||
) |
Initializes the SPI Master clock.At the end of this function call, SPI module is left enabled.
baseAddress | is the base address of the I2C Master module. |
clockSourceFrequency | is the frequency of the slected clock source |
desiredSpiClock | is the desired clock rate for SPI communication |
Modified bits are UCSWRST bit of UCAxCTLW0 register and UCAxBRW register
References HWREG.
unsigned short eSPI_slaveInit | ( | unsigned int | baseAddress, |
unsigned int | msbFirst, | ||
unsigned int | clockPhase, | ||
unsigned int | clockPolarity | ||
) |
Initializes the SPI Slave block.
baseAddress | is the base address of the SPI Slave module. |
msbFirst | controls the direction of the receive and transmit shift register. Valid values are eSPI_MSB_FIRST eSPI_LSB_FIRST [Default Value] |
clockPhase | is clock phase select. Valid values are eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default Value] eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT |
clockPolarity_InactivityHIGH | is clock polarity select. Valid values are eSPI_CLOCKPOLARITY_INACTIVITY_HIGH eSPI_CLOCKPOLARITY_INACTIVITY_LOW [Default Value] Upon successful initialization of the SPI slave block, this function will have initailized the slave block, but the SPI Slave block still remains disabled and must be enabled with eSPI_enable() |
Modified bits are UCMSB, UC7BIT, UCMST, UCCKPL, UCCKPH, UCMODE_3, UCSWRST bits of UCAxCTLW0
References ASSERT, eSPI_CLOCKPOLARITY_INACTIVITY_HIGH, eSPI_CLOCKPOLARITY_INACTIVITY_LOW, eSPI_LSB_FIRST, eSPI_MSB_FIRST, eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, HWREG, and STATUS_SUCCESS.
void eSPI_changeClockPhasePolarity | ( | unsigned int | baseAddress, |
unsigned char | clockPhase, | ||
unsigned char | clockPolarity | ||
) |
Changes the SPI colock phase and polarity.At the end of this function call, SPI module is left enabled.
baseAddress | is the base address of the I2C Master module. |
clockPhase | is clock phase select. Valid values are eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default Value] eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT |
clockPolarity_InactivityHIGH | is clock polarity select. Valid values are eSPI_CLOCKPOLARITY_INACTIVITY_HIGH eSPI_CLOCKPOLARITY_INACTIVITY_LOW [Default Value] |
Modified bits are UCSWRST, UCCKPH, UCCKPL, UCSWRST bits of UCAxCTLW0
References ASSERT, eSPI_CLOCKPOLARITY_INACTIVITY_HIGH, eSPI_CLOCKPOLARITY_INACTIVITY_LOW, and HWREG.
void eSPI_transmitData | ( | unsigned int | baseAddress, |
unsigned char | transmitData | ||
) |
Transmits a byte from the SPI Module.
baseAddress | is the base address of the SPI module. |
transmitData | data to be transmitted from the SPI module |
This function will place the supplied data into SPI trasmit data register to start transmission
Modified register is UCAxTXBUF
References HWREG.
unsigned char eSPI_receiveData | ( | unsigned int | baseAddress | ) |
Receives a byte that has been sent to the SPI Module.
baseAddress | is the base address of the SPI module. |
This function reads a byte of data from the SPI receive data Register.
References HWREG.
void eSPI_enableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Enables individual SPI interrupt sources.
baseAddress | is the base address of the SPI module. |
mask | is the bit mask of the interrupt sources to be enabled. |
Enables the indicated SPI interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The mask parameter is the logical OR of any of the following:
Modified registers are UCAxIFG and UCAxIE
References ASSERT, eSPI_RECEIVE_INTERRUPT, eSPI_TRANSMIT_INTERRUPT, and HWREG.
void eSPI_disableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Disables individual SPI interrupt sources.
baseAddress | is the base address of the SPI module. |
mask | is the bit mask of the interrupt sources to be disabled. |
Disables the indicated SPI interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The mask parameter is the logical OR of any of the following:
Modified register is UCAxIE
References ASSERT, eSPI_RECEIVE_INTERRUPT, eSPI_TRANSMIT_INTERRUPT, and HWREG.
unsigned char eSPI_getInterruptStatus | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Gets the current SPI interrupt status.
baseAddress | is the base address of the SPI module. |
mask | is the masked interrupt flag status to be returned. |
This returns the interrupt status for the SPI module based on which flag is passed. mask parameter can be either any of the following selection.
Modified registers are UCAxIFG.
References ASSERT, eSPI_RECEIVE_INTERRUPT, eSPI_TRANSMIT_INTERRUPT, and HWREG.
void eSPI_enable | ( | unsigned int | baseAddress | ) |
Enables the SPI block.
baseAddress | is the base address of the USCI SPI module. |
This will enable operation of the SPI block. Modified bits are UCSWRST bit of UCAxCTLW0 register.
References HWREG.
void eSPI_disable | ( | unsigned int | baseAddress | ) |
Disables the SPI block.
baseAddress | is the base address of the USCI SPI module. |
This will disable operation of the SPI block.
Modified bits are UCSWRST bit of UCAxCTLW0 register.
References HWREG.
unsigned long eSPI_getReceiveBufferAddressForDMA | ( | unsigned int | baseAddress | ) |
Returns the address of the RX Buffer of the SPI for the DMA module.
baseAddress | is the base address of the SPI module. |
Returns the address of the SPI RX Buffer. This can be used in conjunction with the DMA to store the received data directly to memory.
unsigned long eSPI_getTransmitBufferAddressForDMA | ( | unsigned int | baseAddress | ) |
Returns the address of the TX Buffer of the SPI for the DMA module.
baseAddress | is the base address of the SPI module. |
Returns the address of the SPI TX Buffer. This can be used in conjunction with the DMA to obtain transmitted data directly from memory.
unsigned char eSPI_isBusy | ( | unsigned int | baseAddress | ) |
Indicates whether or not the SPI bus is busy.
baseAddress | is the base address of the SPI module. |
This function returns an indication of whether or not the SPI bus is busy.This function checks the status of the bus via UCBBUSY bit
References HWREG.
void eSPI_clearInterruptFlag | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Clears the selected SPI interrupt status flag.
baseAddress | is the base address of the SPI module. |
mask | is the masked interrupt flag to be cleared. |
The mask parameter is the logical OR of any of the following:
References ASSERT, eSPI_RECEIVE_INTERRUPT, eSPI_TRANSMIT_INTERRUPT, and HWREG.