19#ifndef X1XX_PERIPH_CPU_H
20#define X1XX_PERIPH_CPU_H
25#include "periph_cpu_common.h"
41#define USART_MIN_BR_SPI 2
47#define USART_MIN_BR_UART 3
53#define HAVE_SPI_MODE_T
231#define PERIPH_SPI_NEEDS_INIT_CS
232#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
233#define PERIPH_SPI_NEEDS_TRANSFER_REG
234#define PERIPH_SPI_NEEDS_TRANSFER_REGS
320 return (usart_conf->
sfr->
IFG & mask) == mask;
357 uint8_t enable_mask);
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
Common macros and compiler attributes/pragmas configuration.
spi_mode_t
Support SPI modes.
@ SPI_MODE_0
CPOL=0, CPHA=0.
@ SPI_MODE_2
CPOL=1, CPHA=0.
@ SPI_MODE_1
CPOL=0, CPHA=1.
@ SPI_MODE_3
CPOL=1, CPHA=1.
const msp430_usart_spi_params_t usart1_as_spi
MSP430 x1xx USART1 in SPI configuration.
const msp430_usart_uart_params_t usart1_as_uart
MSP430 x1xx USART1 in UART configuration.
static void msp430_usart_clear_tx_irq_flag(const msp430_usart_params_t *usart_conf)
Clear the TX IRQ flag of the given USART.
static void msp430_usart_enable_tx_irq(const msp430_usart_params_t *usart_conf)
Enable the TX interrupt on the given USART.
static bool msp430_usart_get_tx_irq_flag(const msp430_usart_params_t *usart_conf)
Get the TX IRQ flag of the given USART.
static bool msp430_usart_get_rx_irq_flag(const msp430_usart_params_t *usart_conf)
Get the RX IRQ flag of the given USART.
const msp430_usart_spi_params_t usart0_as_spi
MSP430 x1xx USART0 in SPI configuration.
void msp430_usart_release(const msp430_usart_params_t *params)
Release exclusive access to an USART peripheral and turn it off again.
const msp430_usart_uart_params_t usart0_as_uart
MSP430 x1xx USART0 in UART configuration.
void msp430_usart_acquire(const msp430_usart_params_t *params, const msp430_usart_conf_t *conf, uint8_t enable_mask)
Get exclusive access to an USART peripheral and initialize it for operation as configured.
msp430_usart_clk_t
MSP430 x1xx USART clock source.
@ USART_CLK_UCLKI
UCLKI clock source (not supported yet)
@ USART_CLK_AUX
auxiliary clock source
@ USART_CLK_SUBMAIN
sub-system master clock source
static void msp430_usart_disable_rx_irq(const msp430_usart_params_t *usart_conf)
Disable the RX interrupt on the given USART.
static void msp430_usart_enable_rx_irq(const msp430_usart_params_t *usart_conf)
Enable the RX interrupt on the given USART.
static void msp430_usart_clear_rx_irq_flag(const msp430_usart_params_t *usart_conf)
Clear the RX IRQ flag of the given USART.
static void msp430_usart_disable_tx_irq(const msp430_usart_params_t *usart_conf)
Disable the TX interrupt on the given USART.
static bool msp430_usart_are_both_irq_flags_set(const msp430_usart_params_t *usart_conf)
Check if both TX and RX IRQ flags are set on the given USART.
msp430_usart_prescaler_t msp430_usart_prescale(uint32_t clock, uint16_t min_br)
Compute a suitable prescaler.
MSP430 x1xx USART configuration registers.
uint8_t ctl
USART control register.
msp430_usart_prescaler_t prescaler
Prescaler configuration.
MSP430 x1xx USART configuration.
uint8_t rx_irq_mask
The bitmask to enable the TX IRQ for this USART.
msp430_usart_t * dev
The USART device to use.
uint8_t tx_irq_mask
The bitmask to enable the TX IRQ for this USART.
msp430_usart_sfr_t * sfr
The corresponding SFR registers.
uint8_t num
Number of the USART.
MSP430 x1xx USART prescaler configuration.
msp430_usart_clk_t clk_source
Clock source to use.
uint8_t br0
What to write in the BR0 register.
uint8_t br1
What to write in the BR1 register.
uint8_t mctl
USART modulation control register.
USART Special Function Registers (SFR)
REG8 IE
USART Interrupt Enable Register.
REG8 IFG
USART Interrupt Flag Register.
MSP430 x1xx SPI configuration, CPU level.
uint8_t enable_mask
The bitmask to write to the SFR register to enable the USART device in SPI mode.
gpio_t mosi
COPI (MOSI) pin.
gpio_t miso
CIPO (MISO) pin.
msp430_usart_params_t usart_params
The USART parameters.
USART (UART, SPI and I2C) Registers.
MSP430 x1xx UART configuration, CPU level.
msp430_usart_params_t usart_params
The USART params.
uint8_t tx_enable_mask
The bitmask to write to the SFR register to enable the USART device in UART mode with TX enabled.
uint8_t rxtx_enable_mask
The bitmask to write to the SFR register to enable the USART device in UART mode with RX+TX enabled.
SPI device configuration.
const msp430_usart_spi_params_t * spi
The SPI configuration to use.
UART device configuration.
const msp430_usart_uart_params_t * uart
The UART configuration to use.
#define MHZ(x)
A macro to return the Hz in x MHz.
#define KHZ(x)
A macro to return the Hz in x kHz.
#define UXTCTL_SSEL_ACLK
Clock USART using auxiliary clock.
#define UXTCTL_SSEL_UCLKI
Clock USART using UCLKI clock.
#define UXTCTL_SSEL_SMCLK
Clock USART using sub-system master clock.