Data Structures | Macros | Typedefs | Functions
spi.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <msp.h>
#include "eusci.h"

Go to the source code of this file.

Data Structures

struct  _eUSCI_SPI_MasterConfig
 Type definition for _eUSCI_SPI_MasterConfig structure. More...
 
struct  _eUSCI_SPI_SlaveConfig
 Type definition for _eUSCI_SPI_SlaveConfig structure. More...
 

Macros

#define EUSCI_SPI_CLOCKSOURCE_ACLK   EUSCI_B_CTLW0_SSEL__ACLK
 
#define EUSCI_SPI_CLOCKSOURCE_SMCLK   EUSCI_B_CTLW0_SSEL__SMCLK
 
#define EUSCI_SPI_MSB_FIRST   EUSCI_B_CTLW0_MSB
 
#define EUSCI_SPI_LSB_FIRST   0x00
 
#define EUSCI_SPI_BUSY   EUSCI_A_STATW_BUSY
 
#define EUSCI_SPI_NOT_BUSY   0x00
 
#define EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT   0x00
 
#define EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT   EUSCI_B_CTLW0_CKPH
 
#define EUSCI_SPI_3PIN   EUSCI_B_CTLW0_MODE_0
 
#define EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH   EUSCI_B_CTLW0_MODE_1
 
#define EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW   EUSCI_B_CTLW0_MODE_2
 
#define EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH   EUSCI_B_CTLW0_CKPL
 
#define EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW   0x00
 
#define EUSCI_SPI_TRANSMIT_INTERRUPT   EUSCI_B__TXIE
 
#define EUSCI_SPI_RECEIVE_INTERRUPT   EUSCI_B__RXIE
 
#define EUSCI_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE   EUSCI_B_CTLW0_STEM
 
#define EUSCI_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS   0x00
 
#define EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT   0x00
 
#define EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT   UCCKPH
 
#define EUSCI_B_SPI_MSB_FIRST   UCMSB
 
#define EUSCI_B_SPI_LSB_FIRST   0x00
 
#define EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH   UCCKPL
 
#define EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW   0x00
 
#define EUSCI_B_SPI_CLOCKSOURCE_ACLK   UCSSEL__ACLK
 
#define EUSCI_B_SPI_CLOCKSOURCE_SMCLK   UCSSEL__SMCLK
 
#define EUSCI_B_SPI_3PIN   UCMODE_0
 
#define EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH   UCMODE_1
 
#define EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW   UCMODE_2
 
#define EUSCI_B_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS   0x00
 
#define EUSCI_B_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE   UCSTEM
 
#define EUSCI_B_SPI_TRANSMIT_INTERRUPT   UCTXIE
 
#define EUSCI_B_SPI_RECEIVE_INTERRUPT   UCRXIE
 
#define EUSCI_B_SPI_BUSY   UCBUSY
 
#define EUSCI_B_SPI_NOT_BUSY   0x00
 
#define EUSCI_A_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT   0x00
 
#define EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT   UCCKPH
 
#define EUSCI_A_SPI_MSB_FIRST   UCMSB
 
#define EUSCI_A_SPI_LSB_FIRST   0x00
 
#define EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_HIGH   UCCKPL
 
#define EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW   0x00
 
#define EUSCI_A_SPI_CLOCKSOURCE_ACLK   UCSSEL__ACLK
 
#define EUSCI_A_SPI_CLOCKSOURCE_SMCLK   UCSSEL__SMCLK
 
#define EUSCI_A_SPI_3PIN   UCMODE_0
 
#define EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_HIGH   UCMODE_1
 
#define EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_LOW   UCMODE_2
 
#define EUSCI_A_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS   0x00
 
#define EUSCI_A_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE   UCSTEM
 
#define EUSCI_A_SPI_TRANSMIT_INTERRUPT   UCTXIE
 
#define EUSCI_A_SPI_RECEIVE_INTERRUPT   UCRXIE
 
#define EUSCI_A_SPI_BUSY   UCBUSY
 
#define EUSCI_A_SPI_NOT_BUSY   0x00
 

Typedefs

typedef struct
_eUSCI_SPI_MasterConfig 
eUSCI_SPI_MasterConfig
 
typedef struct
_eUSCI_SPI_SlaveConfig 
eUSCI_SPI_SlaveConfig
 

Functions

bool SPI_initMaster (uint32_t moduleInstance, const eUSCI_SPI_MasterConfig *config)
 
void SPI_selectFourPinFunctionality (uint32_t moduleInstance, uint_fast8_t select4PinFunctionality)
 
void SPI_changeMasterClock (uint32_t moduleInstance, uint32_t clockSourceFrequency, uint32_t desiredSpiClock)
 
bool SPI_initSlave (uint32_t moduleInstance, const eUSCI_SPI_SlaveConfig *config)
 
void SPI_changeClockPhasePolarity (uint32_t moduleInstance, uint_fast16_t clockPhase, uint_fast16_t clockPolarity)
 
void SPI_transmitData (uint32_t moduleInstance, uint_fast8_t transmitData)
 
uint8_t SPI_receiveData (uint32_t moduleInstance)
 
void SPI_enableModule (uint32_t moduleInstance)
 
void SPI_disableModule (uint32_t moduleInstance)
 
uint32_t SPI_getReceiveBufferAddressForDMA (uint32_t moduleInstance)
 
uint32_t SPI_getTransmitBufferAddressForDMA (uint32_t moduleInstance)
 
uint_fast8_t SPI_isBusy (uint32_t moduleInstance)
 
void SPI_enableInterrupt (uint32_t moduleInstance, uint_fast8_t mask)
 
void SPI_disableInterrupt (uint32_t moduleInstance, uint_fast8_t mask)
 
uint_fast8_t SPI_getInterruptStatus (uint32_t moduleInstance, uint16_t mask)
 
uint_fast8_t SPI_getEnabledInterruptStatus (uint32_t moduleInstance)
 
void SPI_clearInterruptFlag (uint32_t moduleInstance, uint_fast8_t mask)
 
void SPI_registerInterrupt (uint32_t moduleInstance, void(*intHandler)(void))
 
void SPI_unregisterInterrupt (uint32_t moduleInstance)
 
void EUSCI_A_SPI_select4PinFunctionality (uint32_t baseAddress, uint8_t select4PinFunctionality)
 Selects 4Pin Functionality. More...
 
void EUSCI_A_SPI_masterChangeClock (uint32_t baseAddress, uint32_t clockSourceFrequency, uint32_t desiredSpiClock)
 Initializes the SPI Master clock. At the end of this function call, SPI module is left enabled. More...
 
bool EUSCI_A_SPI_slaveInit (uint32_t baseAddress, uint16_t msbFirst, uint16_t clockPhase, uint16_t clockPolarity, uint16_t spiMode)
 Initializes the SPI Slave block. More...
 
void EUSCI_A_SPI_changeClockPhasePolarity (uint32_t baseAddress, uint16_t clockPhase, uint16_t clockPolarity)
 Changes the SPI colock phase and polarity. At the end of this function call, SPI module is left enabled. More...
 
void EUSCI_A_SPI_transmitData (uint32_t baseAddress, uint8_t transmitData)
 Transmits a byte from the SPI Module. More...
 
uint8_t EUSCI_A_SPI_receiveData (uint32_t baseAddress)
 Receives a byte that has been sent to the SPI Module. More...
 
void EUSCI_A_SPI_enableInterrupt (uint32_t baseAddress, uint8_t mask)
 Enables individual SPI interrupt sources. More...
 
void EUSCI_A_SPI_disableInterrupt (uint32_t baseAddress, uint8_t mask)
 Disables individual SPI interrupt sources. More...
 
uint8_t EUSCI_A_SPI_getInterruptStatus (uint32_t baseAddress, uint8_t mask)
 Gets the current SPI interrupt status. More...
 
void EUSCI_A_SPI_clearInterruptFlag (uint32_t baseAddress, uint8_t mask)
 Clears the selected SPI interrupt status flag. More...
 
void EUSCI_A_SPI_enable (uint32_t baseAddress)
 Enables the SPI block. More...
 
void EUSCI_A_SPI_disable (uint32_t baseAddress)
 Disables the SPI block. More...
 
uint32_t EUSCI_A_SPI_getReceiveBufferAddressForDMA (uint32_t baseAddress)
 Returns the address of the RX Buffer of the SPI for the DMA module. More...
 
uint32_t EUSCI_A_SPI_getTransmitBufferAddressForDMA (uint32_t baseAddress)
 Returns the address of the TX Buffer of the SPI for the DMA module. More...
 
bool EUSCI_A_SPI_isBusy (uint32_t baseAddress)
 Indicates whether or not the SPI bus is busy. More...
 
void EUSCI_B_SPI_select4PinFunctionality (uint32_t baseAddress, uint8_t select4PinFunctionality)
 Selects 4Pin Functionality. More...
 
void EUSCI_B_SPI_masterChangeClock (uint32_t baseAddress, uint32_t clockSourceFrequency, uint32_t desiredSpiClock)
 Initializes the SPI Master clock. At the end of this function call, SPI module is left enabled. More...
 
bool EUSCI_B_SPI_slaveInit (uint32_t baseAddress, uint16_t msbFirst, uint16_t clockPhase, uint16_t clockPolarity, uint16_t spiMode)
 Initializes the SPI Slave block. More...
 
void EUSCI_B_SPI_changeClockPhasePolarity (uint32_t baseAddress, uint16_t clockPhase, uint16_t clockPolarity)
 Changes the SPI colock phase and polarity. At the end of this function call, SPI module is left enabled. More...
 
void EUSCI_B_SPI_transmitData (uint32_t baseAddress, uint8_t transmitData)
 Transmits a byte from the SPI Module. More...
 
uint8_t EUSCI_B_SPI_receiveData (uint32_t baseAddress)
 Receives a byte that has been sent to the SPI Module. More...
 
void EUSCI_B_SPI_enableInterrupt (uint32_t baseAddress, uint8_t mask)
 Enables individual SPI interrupt sources. More...
 
void EUSCI_B_SPI_disableInterrupt (uint32_t baseAddress, uint8_t mask)
 Disables individual SPI interrupt sources. More...
 
uint8_t EUSCI_B_SPI_getInterruptStatus (uint32_t baseAddress, uint8_t mask)
 Gets the current SPI interrupt status. More...
 
void EUSCI_B_SPI_clearInterruptFlag (uint32_t baseAddress, uint8_t mask)
 Clears the selected SPI interrupt status flag. More...
 
void EUSCI_B_SPI_enable (uint32_t baseAddress)
 Enables the SPI block. More...
 
void EUSCI_B_SPI_disable (uint32_t baseAddress)
 Disables the SPI block. More...
 
uint32_t EUSCI_B_SPI_getReceiveBufferAddressForDMA (uint32_t baseAddress)
 Returns the address of the RX Buffer of the SPI for the DMA module. More...
 
uint32_t EUSCI_B_SPI_getTransmitBufferAddressForDMA (uint32_t baseAddress)
 Returns the address of the TX Buffer of the SPI for the DMA module. More...
 
bool EUSCI_B_SPI_isBusy (uint32_t baseAddress)
 Indicates whether or not the SPI bus is busy. More...
 

Copyright 2016, Texas Instruments Incorporated