usart

package
v0.0.0-...-3d984ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package usart provides interface to Universal Synchronous Asynchronous Receiver Transmitter.

Peripheral: USART_Periph Universal Synchronous Asynchronous Receiver Transmitter. Instances:

USART2  mmap.USART2_BASE
USART3  mmap.USART3_BASE
UART4   mmap.UART4_BASE
UART5   mmap.UART5_BASE
USART1  mmap.USART1_BASE

Registers:

0x00 16  SR   Status register.
0x04 16  DR   Data register.
0x08 16  BRR  Baud rate register.
0x0C 16  CR1  Control register 1.
0x10 16  CR2  Control register 2.
0x14 16  CR3  Control register 3.
0x18 16  GTPR Guard time and prescaler register.

Import:

stm32/o/l1xx_md/mmap

Index

Constants

View Source
const (
	PEn   = 0
	FEn   = 1
	NEn   = 2
	OREn  = 3
	IDLEn = 4
	RXNEn = 5
	TCn   = 6
	TXEn  = 7
	LBDn  = 8
	CTSn  = 9
)
View Source
const (
	DIV_FRACTIONn = 0
	DIV_MANTISSAn = 4
)
View Source
const (
	SBKn    = 0
	RWUn    = 1
	REn     = 2
	TEn     = 3
	IDLEIEn = 4
	RXNEIEn = 5
	TCIEn   = 6
	TXEIEn  = 7
	PEIEn   = 8
	PSn     = 9
	PCEn    = 10
	WAKEn   = 11
	Mn      = 12
	UEn     = 13
	OVER8n  = 15
)
View Source
const (
	ADDn   = 0
	LBDLn  = 5
	LBDIEn = 6
	LBCLn  = 8
	CPHAn  = 9
	CPOLn  = 10
	CLKENn = 11
	STOPn  = 12
	LINENn = 14
)
View Source
const (
	EIEn    = 0
	IRENn   = 1
	IRLPn   = 2
	HDSELn  = 3
	NACKn   = 4
	SCENn   = 5
	DMARn   = 6
	DMATn   = 7
	RTSEn   = 8
	CTSEn   = 9
	CTSIEn  = 10
	ONEBITn = 11
)
View Source
const (
	PSCn = 0
	GTn  = 8
)

Variables

Functions

This section is empty.

Types

type BRR

type BRR uint16
const (
	DIV_FRACTION BRR = 0x0F << 0  //+ Fraction of USARTDIV.
	DIV_MANTISSA BRR = 0xFFF << 4 //+ Mantissa of USARTDIV.
)

func (BRR) Field

func (b BRR) Field(mask BRR) int

func (BRR) J

func (mask BRR) J(v int) BRR

type CR1

type CR1 uint16
const (
	SBK    CR1 = 0x01 << 0  //+ Send Break.
	RWU    CR1 = 0x01 << 1  //+ Receiver wakeup.
	RE     CR1 = 0x01 << 2  //+ Receiver Enable.
	TE     CR1 = 0x01 << 3  //+ Transmitter Enable.
	IDLEIE CR1 = 0x01 << 4  //+ IDLE Interrupt Enable.
	RXNEIE CR1 = 0x01 << 5  //+ RXNE Interrupt Enable.
	TCIE   CR1 = 0x01 << 6  //+ Transmission Complete Interrupt Enable.
	TXEIE  CR1 = 0x01 << 7  //+ PE Interrupt Enable.
	PEIE   CR1 = 0x01 << 8  //+ PE Interrupt Enable.
	PS     CR1 = 0x01 << 9  //+ Parity Selection.
	PCE    CR1 = 0x01 << 10 //+ Parity Control Enable.
	WAKE   CR1 = 0x01 << 11 //+ Wakeup method.
	M      CR1 = 0x01 << 12 //+ Word length.
	UE     CR1 = 0x01 << 13 //+ USART Enable.
	OVER8  CR1 = 0x01 << 15 //+ Oversampling by 8-bit mode.
)

func (CR1) Field

func (b CR1) Field(mask CR1) int

func (CR1) J

func (mask CR1) J(v int) CR1

type CR2

type CR2 uint16
const (
	ADD    CR2 = 0x0F << 0  //+ Address of the USART node.
	LBDL   CR2 = 0x01 << 5  //+ LIN Break Detection Length.
	LBDIE  CR2 = 0x01 << 6  //+ LIN Break Detection Interrupt Enable.
	LBCL   CR2 = 0x01 << 8  //+ Last Bit Clock pulse.
	CPHA   CR2 = 0x01 << 9  //+ Clock Phase.
	CPOL   CR2 = 0x01 << 10 //+ Clock Polarity.
	CLKEN  CR2 = 0x01 << 11 //+ Clock Enable.
	STOP   CR2 = 0x03 << 12 //+ STOP[1:0] bits (STOP bits).
	STOP_0 CR2 = 0x01 << 12 //  Bit 0.
	STOP_1 CR2 = 0x02 << 12 //  Bit 1.
	LINEN  CR2 = 0x01 << 14 //+ LIN mode enable.
)

func (CR2) Field

func (b CR2) Field(mask CR2) int

func (CR2) J

func (mask CR2) J(v int) CR2

type CR3

type CR3 uint16
const (
	EIE    CR3 = 0x01 << 0  //+ Error Interrupt Enable.
	IREN   CR3 = 0x01 << 1  //+ IrDA mode Enable.
	IRLP   CR3 = 0x01 << 2  //+ IrDA Low-Power.
	HDSEL  CR3 = 0x01 << 3  //+ Half-Duplex Selection.
	NACK   CR3 = 0x01 << 4  //+ Smartcard NACK enable.
	SCEN   CR3 = 0x01 << 5  //+ Smartcard mode enable.
	DMAR   CR3 = 0x01 << 6  //+ DMA Enable Receiver.
	DMAT   CR3 = 0x01 << 7  //+ DMA Enable Transmitter.
	RTSE   CR3 = 0x01 << 8  //+ RTS Enable.
	CTSE   CR3 = 0x01 << 9  //+ CTS Enable.
	CTSIE  CR3 = 0x01 << 10 //+ CTS Interrupt Enable.
	ONEBIT CR3 = 0x01 << 11 //+ One sample bit method enable.
)

func (CR3) Field

func (b CR3) Field(mask CR3) int

func (CR3) J

func (mask CR3) J(v int) CR3

type DR

type DR uint16

func (DR) Field

func (b DR) Field(mask DR) int

func (DR) J

func (mask DR) J(v int) DR

type GTPR

type GTPR uint16
const (
	PSC   GTPR = 0xFF << 0 //+ PSC[7:0] bits (Prescaler value).
	PSC_0 GTPR = 0x01 << 0 //  Bit 0.
	PSC_1 GTPR = 0x02 << 0 //  Bit 1.
	PSC_2 GTPR = 0x04 << 0 //  Bit 2.
	PSC_3 GTPR = 0x08 << 0 //  Bit 3.
	PSC_4 GTPR = 0x10 << 0 //  Bit 4.
	PSC_5 GTPR = 0x20 << 0 //  Bit 5.
	PSC_6 GTPR = 0x40 << 0 //  Bit 6.
	PSC_7 GTPR = 0x80 << 0 //  Bit 7.
	GT    GTPR = 0xFF << 8 //+ Guard time value.
)

func (GTPR) Field

func (b GTPR) Field(mask GTPR) int

func (GTPR) J

func (mask GTPR) J(v int) GTPR

type RBRR

type RBRR struct{ mmio.U16 }

func (*RBRR) Bits

func (r *RBRR) Bits(mask BRR) BRR

func (*RBRR) ClearBits

func (r *RBRR) ClearBits(mask BRR)

func (*RBRR) Load

func (r *RBRR) Load() BRR

func (*RBRR) SetBits

func (r *RBRR) SetBits(mask BRR)

func (*RBRR) Store

func (r *RBRR) Store(b BRR)

func (*RBRR) StoreBits

func (r *RBRR) StoreBits(mask, b BRR)

type RCR1

type RCR1 struct{ mmio.U16 }

func (*RCR1) Bits

func (r *RCR1) Bits(mask CR1) CR1

func (*RCR1) ClearBits

func (r *RCR1) ClearBits(mask CR1)

func (*RCR1) Load

func (r *RCR1) Load() CR1

func (*RCR1) SetBits

func (r *RCR1) SetBits(mask CR1)

func (*RCR1) Store

func (r *RCR1) Store(b CR1)

func (*RCR1) StoreBits

func (r *RCR1) StoreBits(mask, b CR1)

type RCR2

type RCR2 struct{ mmio.U16 }

func (*RCR2) Bits

func (r *RCR2) Bits(mask CR2) CR2

func (*RCR2) ClearBits

func (r *RCR2) ClearBits(mask CR2)

func (*RCR2) Load

func (r *RCR2) Load() CR2

func (*RCR2) SetBits

func (r *RCR2) SetBits(mask CR2)

func (*RCR2) Store

func (r *RCR2) Store(b CR2)

func (*RCR2) StoreBits

func (r *RCR2) StoreBits(mask, b CR2)

type RCR3

type RCR3 struct{ mmio.U16 }

func (*RCR3) Bits

func (r *RCR3) Bits(mask CR3) CR3

func (*RCR3) ClearBits

func (r *RCR3) ClearBits(mask CR3)

func (*RCR3) Load

func (r *RCR3) Load() CR3

func (*RCR3) SetBits

func (r *RCR3) SetBits(mask CR3)

func (*RCR3) Store

func (r *RCR3) Store(b CR3)

func (*RCR3) StoreBits

func (r *RCR3) StoreBits(mask, b CR3)

type RDR

type RDR struct{ mmio.U16 }

func (*RDR) Bits

func (r *RDR) Bits(mask DR) DR

func (*RDR) ClearBits

func (r *RDR) ClearBits(mask DR)

func (*RDR) Load

func (r *RDR) Load() DR

func (*RDR) SetBits

func (r *RDR) SetBits(mask DR)

func (*RDR) Store

func (r *RDR) Store(b DR)

func (*RDR) StoreBits

func (r *RDR) StoreBits(mask, b DR)

type RGTPR

type RGTPR struct{ mmio.U16 }

func (*RGTPR) Bits

func (r *RGTPR) Bits(mask GTPR) GTPR

func (*RGTPR) ClearBits

func (r *RGTPR) ClearBits(mask GTPR)

func (*RGTPR) Load

func (r *RGTPR) Load() GTPR

func (*RGTPR) SetBits

func (r *RGTPR) SetBits(mask GTPR)

func (*RGTPR) Store

func (r *RGTPR) Store(b GTPR)

func (*RGTPR) StoreBits

func (r *RGTPR) StoreBits(mask, b GTPR)

type RMBRR

type RMBRR struct{ mmio.UM16 }

func (RMBRR) Load

func (rm RMBRR) Load() BRR

func (RMBRR) Store

func (rm RMBRR) Store(b BRR)

type RMCR1

type RMCR1 struct{ mmio.UM16 }

func (RMCR1) Load

func (rm RMCR1) Load() CR1

func (RMCR1) Store

func (rm RMCR1) Store(b CR1)

type RMCR2

type RMCR2 struct{ mmio.UM16 }

func (RMCR2) Load

func (rm RMCR2) Load() CR2

func (RMCR2) Store

func (rm RMCR2) Store(b CR2)

type RMCR3

type RMCR3 struct{ mmio.UM16 }

func (RMCR3) Load

func (rm RMCR3) Load() CR3

func (RMCR3) Store

func (rm RMCR3) Store(b CR3)

type RMDR

type RMDR struct{ mmio.UM16 }

func (RMDR) Load

func (rm RMDR) Load() DR

func (RMDR) Store

func (rm RMDR) Store(b DR)

type RMGTPR

type RMGTPR struct{ mmio.UM16 }

func (RMGTPR) Load

func (rm RMGTPR) Load() GTPR

func (RMGTPR) Store

func (rm RMGTPR) Store(b GTPR)

type RMSR

type RMSR struct{ mmio.UM16 }

func (RMSR) Load

func (rm RMSR) Load() SR

func (RMSR) Store

func (rm RMSR) Store(b SR)

type RSR

type RSR struct{ mmio.U16 }

func (*RSR) Bits

func (r *RSR) Bits(mask SR) SR

func (*RSR) ClearBits

func (r *RSR) ClearBits(mask SR)

func (*RSR) Load

func (r *RSR) Load() SR

func (*RSR) SetBits

func (r *RSR) SetBits(mask SR)

func (*RSR) Store

func (r *RSR) Store(b SR)

func (*RSR) StoreBits

func (r *RSR) StoreBits(mask, b SR)

type SR

type SR uint16
const (
	PE   SR = 0x01 << 0 //+ Parity Error.
	FE   SR = 0x01 << 1 //+ Framing Error.
	NE   SR = 0x01 << 2 //+ Noise Error Flag.
	ORE  SR = 0x01 << 3 //+ OverRun Error.
	IDLE SR = 0x01 << 4 //+ IDLE line detected.
	RXNE SR = 0x01 << 5 //+ Read Data Register Not Empty.
	TC   SR = 0x01 << 6 //+ Transmission Complete.
	TXE  SR = 0x01 << 7 //+ Transmit Data Register Empty.
	LBD  SR = 0x01 << 8 //+ LIN Break Detection Flag.
	CTS  SR = 0x01 << 9 //+ CTS Flag.
)

func (SR) Field

func (b SR) Field(mask SR) int

func (SR) J

func (mask SR) J(v int) SR

type USART_Periph

type USART_Periph struct {
	SR RSR

	DR RDR

	BRR RBRR

	CR1 RCR1

	CR2 RCR2

	CR3 RCR3

	GTPR RGTPR
	// contains filtered or unexported fields
}

func (*USART_Periph) ADD

func (p *USART_Periph) ADD() RMCR2

func (*USART_Periph) BaseAddr

func (p *USART_Periph) BaseAddr() uintptr

func (*USART_Periph) CLKEN

func (p *USART_Periph) CLKEN() RMCR2

func (*USART_Periph) CPHA

func (p *USART_Periph) CPHA() RMCR2

func (*USART_Periph) CPOL

func (p *USART_Periph) CPOL() RMCR2

func (*USART_Periph) CTS

func (p *USART_Periph) CTS() RMSR

func (*USART_Periph) CTSE

func (p *USART_Periph) CTSE() RMCR3

func (*USART_Periph) CTSIE

func (p *USART_Periph) CTSIE() RMCR3

func (*USART_Periph) DIV_FRACTION

func (p *USART_Periph) DIV_FRACTION() RMBRR

func (*USART_Periph) DIV_MANTISSA

func (p *USART_Periph) DIV_MANTISSA() RMBRR

func (*USART_Periph) DMAR

func (p *USART_Periph) DMAR() RMCR3

func (*USART_Periph) DMAT

func (p *USART_Periph) DMAT() RMCR3

func (*USART_Periph) EIE

func (p *USART_Periph) EIE() RMCR3

func (*USART_Periph) FE

func (p *USART_Periph) FE() RMSR

func (*USART_Periph) GT

func (p *USART_Periph) GT() RMGTPR

func (*USART_Periph) HDSEL

func (p *USART_Periph) HDSEL() RMCR3

func (*USART_Periph) IDLE

func (p *USART_Periph) IDLE() RMSR

func (*USART_Periph) IDLEIE

func (p *USART_Periph) IDLEIE() RMCR1

func (*USART_Periph) IREN

func (p *USART_Periph) IREN() RMCR3

func (*USART_Periph) IRLP

func (p *USART_Periph) IRLP() RMCR3

func (*USART_Periph) LBCL

func (p *USART_Periph) LBCL() RMCR2

func (*USART_Periph) LBD

func (p *USART_Periph) LBD() RMSR

func (*USART_Periph) LBDIE

func (p *USART_Periph) LBDIE() RMCR2

func (*USART_Periph) LBDL

func (p *USART_Periph) LBDL() RMCR2

func (*USART_Periph) LINEN

func (p *USART_Periph) LINEN() RMCR2

func (*USART_Periph) M

func (p *USART_Periph) M() RMCR1

func (*USART_Periph) NACK

func (p *USART_Periph) NACK() RMCR3

func (*USART_Periph) NE

func (p *USART_Periph) NE() RMSR

func (*USART_Periph) ONEBIT

func (p *USART_Periph) ONEBIT() RMCR3

func (*USART_Periph) ORE

func (p *USART_Periph) ORE() RMSR

func (*USART_Periph) OVER8

func (p *USART_Periph) OVER8() RMCR1

func (*USART_Periph) PCE

func (p *USART_Periph) PCE() RMCR1

func (*USART_Periph) PE

func (p *USART_Periph) PE() RMSR

func (*USART_Periph) PEIE

func (p *USART_Periph) PEIE() RMCR1

func (*USART_Periph) PS

func (p *USART_Periph) PS() RMCR1

func (*USART_Periph) PSC

func (p *USART_Periph) PSC() RMGTPR

func (*USART_Periph) RE

func (p *USART_Periph) RE() RMCR1

func (*USART_Periph) RTSE

func (p *USART_Periph) RTSE() RMCR3

func (*USART_Periph) RWU

func (p *USART_Periph) RWU() RMCR1

func (*USART_Periph) RXNE

func (p *USART_Periph) RXNE() RMSR

func (*USART_Periph) RXNEIE

func (p *USART_Periph) RXNEIE() RMCR1

func (*USART_Periph) SBK

func (p *USART_Periph) SBK() RMCR1

func (*USART_Periph) SCEN

func (p *USART_Periph) SCEN() RMCR3

func (*USART_Periph) STOP

func (p *USART_Periph) STOP() RMCR2

func (*USART_Periph) TC

func (p *USART_Periph) TC() RMSR

func (*USART_Periph) TCIE

func (p *USART_Periph) TCIE() RMCR1

func (*USART_Periph) TE

func (p *USART_Periph) TE() RMCR1

func (*USART_Periph) TXE

func (p *USART_Periph) TXE() RMSR

func (*USART_Periph) TXEIE

func (p *USART_Periph) TXEIE() RMCR1

func (*USART_Periph) UE

func (p *USART_Periph) UE() RMCR1

func (*USART_Periph) WAKE

func (p *USART_Periph) WAKE() RMCR1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳