CPU specific definitions for internal peripheral handling.
More...
CPU specific definitions for internal peripheral handling.
- Author
- Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Definition in file periph_cpu.h.
#include <stdbool.h>
#include "compiler_hints.h"
#include "periph_cpu_common.h"
#include "macros/units.h"
Go to the source code of this file.
|
#define | HAVE_SPI_MODE_T |
| MSP430 x1xx has a custom spi_mode_t.
|
|
enum | spi_mode_t {
SPI_MODE_0 = (UCCKPH)
, SPI_MODE_1 = 0
, SPI_MODE_2 = (UCCKPL | UCCKPH)
, SPI_MODE_3 = (UCCKPL)
,
SPI_MODE_0 = (CKPH)
, SPI_MODE_1 = 0
, SPI_MODE_2 = (CKPL | CKPH)
, SPI_MODE_3 = (CKPL)
,
SPI_MODE_0 = 0
, SPI_MODE_1
, SPI_MODE_2
, SPI_MODE_3
} |
| Support SPI modes. More...
|
|
|
#define | HAVE_SPI_CLK_T |
| MSP430 x1xx has a custom spi_clock_t.
|
|
enum | spi_clk_t {
SPI_CLK_100KHZ = 100000U
, SPI_CLK_400KHZ = 400000U
, SPI_CLK_1MHZ = 1000000U
, SPI_CLK_5MHZ = 5000000U
,
SPI_CLK_10MHZ = 10000000U
, SPI_CLK_100KHZ = KHZ(100)
, SPI_CLK_400KHZ = KHZ(400)
, SPI_CLK_1MHZ = MHZ(1)
,
SPI_CLK_5MHZ = MHZ(5)
, SPI_CLK_10MHZ = MHZ(10)
, SPI_CLK_100KHZ = 100000
, SPI_CLK_400KHZ = 400000
,
SPI_CLK_1MHZ = 1000000
, SPI_CLK_5MHZ = 5000000
, SPI_CLK_10MHZ = SPI_CLK_5MHZ
, SPI_CLK_100KHZ = KHZ(100)
,
SPI_CLK_400KHZ = KHZ(400)
, SPI_CLK_1MHZ = MHZ(1)
, SPI_CLK_5MHZ = MHZ(5)
, SPI_CLK_10MHZ = SPI_CLK_5MHZ
,
SPI_CLK_100KHZ = 0
, SPI_CLK_400KHZ
, SPI_CLK_1MHZ
, SPI_CLK_5MHZ
,
SPI_CLK_10MHZ
} |
| Support SPI clock frequencies. More...
|
|
◆ msp430_usart_clk_t
MSP430 x1xx USART clock source.
The UC
Enumerator |
---|
USART_CLK_UCLKI | UCLKI clock source (not supported yet)
|
USART_CLK_AUX | auxiliary clock source
|
USART_CLK_SUBMAIN | sub-system master clock source
|
Definition at line 107 of file periph_cpu.h.
◆ spi_clk_t
Support SPI clock frequencies.
Enumerator |
---|
SPI_CLK_100KHZ | drive the SPI bus with 100KHz
|
SPI_CLK_400KHZ | drive the SPI bus with 400KHz
|
SPI_CLK_1MHZ | drive the SPI bus with 1MHz
|
SPI_CLK_5MHZ | drive the SPI bus with 5MHz
|
SPI_CLK_10MHZ | drive the SPI bus with 10MHz
|
SPI_CLK_100KHZ | drive the SPI bus with 100KHz
|
SPI_CLK_400KHZ | drive the SPI bus with 400KHz
|
SPI_CLK_1MHZ | drive the SPI bus with 1MHz
|
SPI_CLK_5MHZ | drive the SPI bus with 5MHz
|
SPI_CLK_10MHZ | drive the SPI bus with 10MHz
|
SPI_CLK_100KHZ | 100 kHz
|
SPI_CLK_400KHZ | 400 kHz
|
SPI_CLK_1MHZ | 1 MHz
|
SPI_CLK_5MHZ | 5 MHz
|
SPI_CLK_10MHZ | 10 MHz not supported, falling back to 5 MHz
|
SPI_CLK_100KHZ | 100 kHz
|
SPI_CLK_400KHZ | 400 kHz
|
SPI_CLK_1MHZ | 1 MHz
|
SPI_CLK_5MHZ | 5 MHz
|
SPI_CLK_10MHZ | 10 MHz not supported, falling back to 5 MHz
|
SPI_CLK_100KHZ | drive the SPI bus with 100KHz
|
SPI_CLK_400KHZ | drive the SPI bus with 400KHz
|
SPI_CLK_1MHZ | drive the SPI bus with 1MHz
|
SPI_CLK_5MHZ | drive the SPI bus with 5MHz
|
SPI_CLK_10MHZ | drive the SPI bus with 10MHz
|
Definition at line 78 of file periph_cpu.h.
◆ spi_mode_t
Support SPI modes.
Field | Name | Description |
CKPH | Clock phase select | 0 = capture on second edge, 1 = capture on first |
CKPL | Clock polarity select | 0 = clock is idle-low, 1 = clock is high idle-high |
Enumerator |
---|
SPI_MODE_0 | CPOL=0, CPHA=0.
|
SPI_MODE_1 | CPOL=0, CPHA=1.
|
SPI_MODE_2 | CPOL=1, CPHA=0.
|
SPI_MODE_3 | CPOL=1, CPHA=1.
|
SPI_MODE_0 | CPOL=0, CPHA=0.
|
SPI_MODE_1 | CPOL=0, CPHA=1.
|
SPI_MODE_2 | CPOL=1, CPHA=0.
|
SPI_MODE_3 | CPOL=1, CPHA=1.
|
SPI_MODE_0 | CPOL=0, CPHA=0.
|
SPI_MODE_1 | CPOL=0, CPHA=1.
|
SPI_MODE_2 | CPOL=1, CPHA=0.
|
SPI_MODE_3 | CPOL=1, CPHA=1.
|
Definition at line 62 of file periph_cpu.h.
◆ msp430_usart_acquire()
Get exclusive access to an USART peripheral and initialize it for operation as configured.
- Parameters
-
[in] | params | Static USART configuration |
[in] | conf | Dynamic USART configuration |
[in] | enable_mask | Bitmask to write to the SFR register to enable the peripheral in the intended mode. |
- Warning
- The freshly acquired USART will still be placed in software reset when this function returns. The caller is expected to finish configuration such as configuring GPIOs connected to the USART suitably, clearing error flags, setting up IRQ handlers etc. and finally releasing the USART from reset.
◆ msp430_usart_are_both_irq_flags_set()
Check if both TX and RX IRQ flags are set on the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
- Return values
-
true | The interrupt flag both TX and RX is set |
false | Either TX IRQ flag not set, or RX not set, or neither set |
Definition at line 317 of file periph_cpu.h.
◆ msp430_usart_clear_rx_irq_flag()
Clear the RX IRQ flag of the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
Definition at line 336 of file periph_cpu.h.
◆ msp430_usart_clear_tx_irq_flag()
Clear the TX IRQ flag of the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
Definition at line 327 of file periph_cpu.h.
◆ msp430_usart_disable_rx_irq()
Disable the RX interrupt on the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
- Warning
- This will not work while the peripheral is still under reset, as the IRQ configuration is constantly reset while the software reset bit is set.
Definition at line 284 of file periph_cpu.h.
◆ msp430_usart_disable_tx_irq()
Disable the TX interrupt on the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the TX IRQ on |
- Warning
- This will not work while the peripheral is still under reset, as the IRQ configuration is constantly reset while the software reset bit is set.
Definition at line 271 of file periph_cpu.h.
◆ msp430_usart_enable_rx_irq()
Enable the RX interrupt on the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to enable the RX IRQ on |
- Warning
- This will not work while the peripheral is still under reset, as the IRQ configuration is constantly reset while the software reset bit is set.
Definition at line 258 of file periph_cpu.h.
◆ msp430_usart_enable_tx_irq()
Enable the TX interrupt on the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to enable the TX IRQ on |
- Warning
- This will not work while the peripheral is still under reset, as the IRQ configuration is constantly reset while the software reset bit is set.
Definition at line 245 of file periph_cpu.h.
◆ msp430_usart_get_rx_irq_flag()
Get the RX IRQ flag of the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
- Return values
-
true | The interrupt flag is set |
false | The interrupt flag is NOT set |
Definition at line 306 of file periph_cpu.h.
◆ msp430_usart_get_tx_irq_flag()
Get the TX IRQ flag of the given USART.
- Parameters
-
[in] | usart_conf | USART config of the USART to disable the RX IRQ on |
- Return values
-
true | The interrupt flag is set |
false | The interrupt flag is NOT set |
Definition at line 295 of file periph_cpu.h.
◆ msp430_usart_prescale()
Compute a suitable prescaler.
- Parameters
-
- Returns
- Suitable prescaler config
- Note
- If the board has an auxiliary clock generated from a 32,678 Hz watch crystal with no clock divider, the auxiliary clock is used for symbol rates of 9,600 Bd, 4,800 Bd, 2,400 Bd, and 1,200 Bd. For every other symbol rate the subsystem main clock is used instead.
- Warning
- This will compute the prescaler generating the frequency closest to
clock
. It may generate a frequency higher than requested, if this is closer to the target frequency than the next lower frequency. This makes bit-timings better in UART
-
The mctl
struct
field in the result may be non-zero. Callers must clear this, if the intend to use the USART in modes other than UART.
◆ msp430_usart_release()
Release exclusive access to an USART peripheral and turn it off again.
- Parameters
-
[in] | params | Configuration specifying the USART to release |