Interface: tos.chips.msp430.usart.HplMsp430Usart

interface HplMsp430Usart

Author:
Vlado Handziski <handzisk@tkn.tu-berlin.de>
Philipp Huppertz <huppertz@tkn.tu-berlin.de>

Commands
command void clrIntr() Clears both TX and RX interrupt pending flags
command void clrRxIntr() Clears RX interrupt pending flag
command void clrTxIntr() Clears TX interrupt pending flag
command void disableIntr()
command void disableRxIntr()
command void disableSpi() Disables the USART when in Spi mode.
command void disableTxIntr()
command void disableUart() Disables both the Rx and the Tx Uart modules.
command void disableUartRx() Disables the Uart RX module.
command void disableUartTx() Disables the Uart TX module.
command void enableIntr()
command void enableRxIntr()
command void enableSpi() Enables the USART when in Spi mode.
command void enableTxIntr()
command void enableUart() Enables both the Rx and the Tx Uart modules.
command void enableUartRx() Enables the Uart RX functionality of the USART module.
command void enableUartTx() Enables the Uart TX functionality of the USART module.
command msp430_usartmode_t getMode() Returns an enum value corresponding to the current mode of the USART module.
command uint16_t getUbr() Reads the UxBR0 and UxBR1 Baud Rate Control Registers
command msp430_uctl_t getUctl() Reads the UxCTL Control Register
command uint8_t getUmctl() Reads the UxMCTL Modulation Control Register
command msp430_urctl_t getUrctl() Reads the UxRCTL Receive Control Register
command msp430_utctl_t getUtctl() Reads the UxTCTL Transmit Control Register
command bool isRxIntrPending() TRUE if RX interrupt pending, flag must be cleared explicitly
command bool isSpi() Returns TRUE if the USART is set to Spi mode
command bool isTxEmpty() SUCCESS if the TX buffer is empty and all of the bits have been shifted out
command bool isTxIntrPending() TRUE if TX interrupt pending, flag must be cleared explicitly
command bool isUart() Returns TRUE if the USART is set to Uart mode (both RX and TX)
command bool isUartRx() Returns TRUE if the USART has Uart RX mode enabled
command bool isUartTx() Returns TRUE if the USART has Uart TX mode enabled
command void resetUsart(bool reset)
command uint8_t rx() Get current value from RX-buffer.
command void setModeSpi(msp430_spi_union_config_t *config) Switches USART to Spi mode.
command void setModeUart(msp430_uart_union_config_t *config) Switches USART to Uart mode (RX and TX enabled) Interrupts disabled by default.
command void setUbr(uint16_t ubr) Sets the UxBR0 and UxBR1 Baud Rate Control Registers
command void setUctl(msp430_uctl_t control) Sets the UxCTL Control Register
command void setUmctl(uint8_t umctl) Sets the UxMCTL Modulation Control Register
command void setUrctl(msp430_urctl_t control) Sets the UxRCTL Receive Control Register
command void setUtctl(msp430_utctl_t control) Sets the UxTCTL Transmit Control Register
command void tx(uint8_t data) Transmit a byte of data.

Commands - Details

clrIntr

command void clrIntr()

Clears both TX and RX interrupt pending flags

clrRxIntr

command void clrRxIntr()

Clears RX interrupt pending flag

clrTxIntr

command void clrTxIntr()

Clears TX interrupt pending flag

disableIntr

command void disableIntr()

disableRxIntr

command void disableRxIntr()

disableSpi

command void disableSpi()

Disables the USART when in Spi mode.

disableTxIntr

command void disableTxIntr()

disableUart

command void disableUart()

Disables both the Rx and the Tx Uart modules.

disableUartRx

command void disableUartRx()

Disables the Uart RX module.

disableUartTx

command void disableUartTx()

Disables the Uart TX module.

enableIntr

command void enableIntr()

enableRxIntr

command void enableRxIntr()

enableSpi

command void enableSpi()

Enables the USART when in Spi mode.

enableTxIntr

command void enableTxIntr()

enableUart

command void enableUart()

Enables both the Rx and the Tx Uart modules.

enableUartRx

command void enableUartRx()

Enables the Uart RX functionality of the USART module.

enableUartTx

command void enableUartTx()

Enables the Uart TX functionality of the USART module.

getMode

command msp430_usartmode_t getMode()

Returns an enum value corresponding to the current mode of the USART module.

getUbr

command uint16_t getUbr()

Reads the UxBR0 and UxBR1 Baud Rate Control Registers

getUctl

command msp430_uctl_t getUctl()

Reads the UxCTL Control Register

getUmctl

command uint8_t getUmctl()

Reads the UxMCTL Modulation Control Register

getUrctl

command msp430_urctl_t getUrctl()

Reads the UxRCTL Receive Control Register

getUtctl

command msp430_utctl_t getUtctl()

Reads the UxTCTL Transmit Control Register

isRxIntrPending

command bool isRxIntrPending()

TRUE if RX interrupt pending, flag must be cleared explicitly

isSpi

command bool isSpi()

Returns TRUE if the USART is set to Spi mode

isTxEmpty

command bool isTxEmpty()

SUCCESS if the TX buffer is empty and all of the bits have been shifted out

isTxIntrPending

command bool isTxIntrPending()

TRUE if TX interrupt pending, flag must be cleared explicitly

isUart

command bool isUart()

Returns TRUE if the USART is set to Uart mode (both RX and TX)

isUartRx

command bool isUartRx()

Returns TRUE if the USART has Uart RX mode enabled

isUartTx

command bool isUartTx()

Returns TRUE if the USART has Uart TX mode enabled

resetUsart

command void resetUsart(bool reset)

rx

command uint8_t rx()

Get current value from RX-buffer.

Returns:
SUCCESS always.

setModeSpi

command void setModeSpi(msp430_spi_union_config_t *config)

Switches USART to Spi mode.

setModeUart

command void setModeUart(msp430_uart_union_config_t *config)

Switches USART to Uart mode (RX and TX enabled) Interrupts disabled by default.

setUbr

command void setUbr(uint16_t ubr)

Sets the UxBR0 and UxBR1 Baud Rate Control Registers

setUctl

command void setUctl(msp430_uctl_t control)

Sets the UxCTL Control Register

setUmctl

command void setUmctl(uint8_t umctl)

Sets the UxMCTL Modulation Control Register

setUrctl

command void setUrctl(msp430_urctl_t control)

Sets the UxRCTL Receive Control Register

setUtctl

command void setUtctl(msp430_utctl_t control)

Sets the UxTCTL Transmit Control Register

tx

command void tx(uint8_t data)

Transmit a byte of data. When the transmission is completed, txDone is generated. Only then a new byte may be transmitted, otherwise the previous byte will be overwritten. The mode of transmission (Uart or Spi) depends on the current state of the USART, which must be managed by a higher layer.

Returns:
SUCCESS always.