MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
eusci_b_spi

Functions

void EUSCI_B_SPI_initMaster (uint16_t baseAddress, EUSCI_B_SPI_initMasterParam *param)
 Initializes the SPI Master block. More...
 
void EUSCI_B_SPI_select4PinFunctionality (uint16_t baseAddress, uint8_t select4PinFunctionality)
 Selects 4Pin Functionality. More...
 
void EUSCI_B_SPI_changeMasterClock (uint16_t baseAddress, EUSCI_B_SPI_changeMasterClockParam *param)
 Initializes the SPI Master clock. At the end of this function call, SPI module is left enabled. More...
 
void EUSCI_B_SPI_initSlave (uint16_t baseAddress, EUSCI_B_SPI_initSlaveParam *param)
 Initializes the SPI Slave block. More...
 
void EUSCI_B_SPI_changeClockPhasePolarity (uint16_t baseAddress, uint16_t clockPhase, uint16_t clockPolarity)
 Changes the SPI clock phase and polarity. At the end of this function call, SPI module is left enabled. More...
 
void EUSCI_B_SPI_transmitData (uint16_t baseAddress, uint8_t transmitData)
 Transmits a byte from the SPI Module. More...
 
uint8_t EUSCI_B_SPI_receiveData (uint16_t baseAddress)
 Receives a byte that has been sent to the SPI Module. More...
 
void EUSCI_B_SPI_enableInterrupt (uint16_t baseAddress, uint8_t mask)
 Enables individual SPI interrupt sources. More...
 
void EUSCI_B_SPI_disableInterrupt (uint16_t baseAddress, uint8_t mask)
 Disables individual SPI interrupt sources. More...
 
uint8_t EUSCI_B_SPI_getInterruptStatus (uint16_t baseAddress, uint8_t mask)
 Gets the current SPI interrupt status. More...
 
void EUSCI_B_SPI_clearInterrupt (uint16_t baseAddress, uint8_t mask)
 Clears the selected SPI interrupt status flag. More...
 
void EUSCI_B_SPI_enable (uint16_t baseAddress)
 Enables the SPI block. More...
 
void EUSCI_B_SPI_disable (uint16_t baseAddress)
 Disables the SPI block. More...
 
uint32_t EUSCI_B_SPI_getReceiveBufferAddress (uint16_t baseAddress)
 Returns the address of the RX Buffer of the SPI for the DMA module. More...
 
uint32_t EUSCI_B_SPI_getTransmitBufferAddress (uint16_t baseAddress)
 Returns the address of the TX Buffer of the SPI for the DMA module. More...
 
uint16_t EUSCI_B_SPI_isBusy (uint16_t baseAddress)
 Indicates whether or not the SPI bus is busy. More...
 

Detailed Description

Function Documentation

void EUSCI_B_SPI_changeClockPhasePolarity ( uint16_t  baseAddress,
uint16_t  clockPhase,
uint16_t  clockPolarity 
)

Changes the SPI clock phase and polarity. At the end of this function call, SPI module is left enabled.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
clockPhaseis clock phase select. Valid values are:
  • EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default]
  • EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT
clockPolarityis clock polarity select Valid values are:
  • EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH
  • EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default]

Modified bits are UCCKPL, UCCKPH and UCSWRST of UCAxCTLW0 register.

Returns
None
void EUSCI_B_SPI_changeMasterClock ( uint16_t  baseAddress,
EUSCI_B_SPI_changeMasterClockParam param 
)

Initializes the SPI Master clock. At the end of this function call, SPI module is left enabled.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
paramis the pointer to struct for master clock setting.

Modified bits are UCSWRST of UCAxCTLW0 register.

Returns
None

References EUSCI_B_SPI_changeMasterClockParam::clockSourceFrequency, and EUSCI_B_SPI_changeMasterClockParam::desiredSpiClock.

void EUSCI_B_SPI_clearInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Clears the selected SPI interrupt status flag.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
maskis the masked interrupt flag to be cleared. Mask value is the logical OR of any of the following:
  • EUSCI_B_SPI_TRANSMIT_INTERRUPT
  • EUSCI_B_SPI_RECEIVE_INTERRUPT

Modified bits of UCAxIFG register.

Returns
None
void EUSCI_B_SPI_disable ( uint16_t  baseAddress)

Disables the SPI block.

This will disable operation of the SPI block.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.

Modified bits are UCSWRST of UCAxCTLW0 register.

Returns
None
void EUSCI_B_SPI_disableInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Disables individual SPI interrupt sources.

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.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
maskis the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following:
  • EUSCI_B_SPI_TRANSMIT_INTERRUPT
  • EUSCI_B_SPI_RECEIVE_INTERRUPT

Modified bits of UCAxIE register.

Returns
None
void EUSCI_B_SPI_enable ( uint16_t  baseAddress)

Enables the SPI block.

This will enable operation of the SPI block.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.

Modified bits are UCSWRST of UCAxCTLW0 register.

Returns
None
void EUSCI_B_SPI_enableInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Enables individual SPI interrupt sources.

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. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
maskis the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following:
  • EUSCI_B_SPI_TRANSMIT_INTERRUPT
  • EUSCI_B_SPI_RECEIVE_INTERRUPT

Modified bits of UCAxIFG register and bits of UCAxIE register.

Returns
None
uint8_t EUSCI_B_SPI_getInterruptStatus ( uint16_t  baseAddress,
uint8_t  mask 
)

Gets the current SPI interrupt status.

This returns the interrupt status for the SPI module based on which flag is passed.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
maskis the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
  • EUSCI_B_SPI_TRANSMIT_INTERRUPT
  • EUSCI_B_SPI_RECEIVE_INTERRUPT
Returns
Logical OR of any of the following:
  • EUSCI_B_SPI_TRANSMIT_INTERRUPT
  • EUSCI_B_SPI_RECEIVE_INTERRUPT
    indicating the status of the masked interrupts
uint32_t EUSCI_B_SPI_getReceiveBufferAddress ( uint16_t  baseAddress)

Returns the address of the RX Buffer of the SPI for the DMA 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.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
Returns
the address of the RX Buffer
uint32_t EUSCI_B_SPI_getTransmitBufferAddress ( uint16_t  baseAddress)

Returns the address of the TX Buffer of the SPI for the DMA 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.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
Returns
the address of the TX Buffer
void EUSCI_B_SPI_initMaster ( uint16_t  baseAddress,
EUSCI_B_SPI_initMasterParam param 
)

Initializes the SPI Master block.

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 EUSCI_B_SPI_enable()

Parameters
baseAddressis the base address of the EUSCI_B_SPI Master module.
paramis the pointer to struct for master initialization.

Modified bits are UCCKPH, UCCKPL, UC7BIT, UCMSB, UCSSELx and UCSWRST of UCAxCTLW0 register.

Returns
STATUS_SUCCESS

References EUSCI_B_SPI_initMasterParam::clockPhase, EUSCI_B_SPI_initMasterParam::clockPolarity, EUSCI_B_SPI_initMasterParam::clockSourceFrequency, EUSCI_B_SPI_initMasterParam::desiredSpiClock, EUSCI_B_SPI_initMasterParam::msbFirst, EUSCI_B_SPI_initMasterParam::selectClockSource, and EUSCI_B_SPI_initMasterParam::spiMode.

void EUSCI_B_SPI_initSlave ( uint16_t  baseAddress,
EUSCI_B_SPI_initSlaveParam param 
)

Initializes the SPI Slave block.

Upon successful initialization of the SPI slave block, this function will have initialized the slave block, but the SPI Slave block still remains disabled and must be enabled with EUSCI_B_SPI_enable()

Parameters
baseAddressis the base address of the EUSCI_B_SPI Slave module.
paramis the pointer to struct for slave initialization.

Modified bits are UCMSB, UCMST, UC7BIT, UCCKPL, UCCKPH, UCMODE and UCSWRST of UCAxCTLW0 register.

Returns
STATUS_SUCCESS

References EUSCI_B_SPI_initSlaveParam::clockPhase, EUSCI_B_SPI_initSlaveParam::clockPolarity, EUSCI_B_SPI_initSlaveParam::msbFirst, and EUSCI_B_SPI_initSlaveParam::spiMode.

uint16_t EUSCI_B_SPI_isBusy ( uint16_t  baseAddress)

Indicates whether or not the SPI bus is busy.

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

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
Returns
One of the following:
  • EUSCI_B_SPI_BUSY
  • EUSCI_B_SPI_NOT_BUSY
    indicating if the EUSCI_B_SPI is busy
uint8_t EUSCI_B_SPI_receiveData ( uint16_t  baseAddress)

Receives a byte that has been sent to the SPI Module.

This function reads a byte of data from the SPI receive data Register.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
Returns
Returns the byte received from by the SPI module, cast as an uint8_t.
void EUSCI_B_SPI_select4PinFunctionality ( uint16_t  baseAddress,
uint8_t  select4PinFunctionality 
)

Selects 4Pin Functionality.

This function should be invoked only in 4-wire mode. Invoking this function has no effect in 3-wire mode.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
select4PinFunctionalityselects 4 pin functionality Valid values are:
  • EUSCI_B_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS
  • EUSCI_B_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE

Modified bits are UCSTEM of UCAxCTLW0 register.

Returns
None
void EUSCI_B_SPI_transmitData ( uint16_t  baseAddress,
uint8_t  transmitData 
)

Transmits a byte from the SPI Module.

This function will place the supplied data into SPI transmit data register to start transmission.

Parameters
baseAddressis the base address of the EUSCI_B_SPI module.
transmitDatadata to be transmitted from the SPI module
Returns
None

Copyright 2015, Texas Instruments Incorporated