iomux

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lock

func Lock()

Lock disables write access to the IOMUX controller. It is typically used to prevent accidental changes to the electrical properties of the pins, as such a change can sometimes be destructive.

Use carefully!

Locked IOMUX prevents configuring pins. Try to keep the configuration of all pins and peripherals in one place. Remember that UsePin functions in HAL access IOMUX to set the correct alternate function for pin.

Write access to the locked IOMUX generates the BusFault exception which can be very dificult to debug so do not lock IOMUX during development. Lock it at the end of the testing stage and in the finished product.

Locked IOMUX may interfere with some debugger and programmer software and hardware.

func Unlock

func Unlock()

Unlock enables write access to the IOMUX controller.

Types

type AltFunc

type AltFunc int8

AltFunc represents a mux mode.

const (
	ALT   AltFunc = 0xf << 0 // Mux mode select field
	ALT0  AltFunc = 0x0 << 0 // Select ALT0 mux mode
	ALT1  AltFunc = 0x1 << 0 // Select ALT1 mux mode
	ALT2  AltFunc = 0x2 << 0 // Select ALT2 mux mode
	ALT3  AltFunc = 0x3 << 0 // Select ALT3 mux mode
	ALT4  AltFunc = 0x4 << 0 // Select ALT4 mux mode
	ALT5  AltFunc = 0x5 << 0 // Select ALT5 mux mode
	ALT6  AltFunc = 0x6 << 0 // Select ALT6 mux mode
	ALT7  AltFunc = 0x7 << 0 // Select ALT7 mux mode
	ALT8  AltFunc = 0x8 << 0 // Select ALT8 mux mode
	ALT9  AltFunc = 0x9 << 0 // Select ALT9 mux mode
	ALT10 AltFunc = 0xa << 0 // Select ALT10 mux mode

	SION AltFunc = 0x1 << 4 // Software Input On field

	GPIO = ALT5 // More readable alias for ALT5
)

type Config

type Config uint32
const (
	FastSR Config = 1 << 0 // Enable fast slew rate

	Drive  Config = 7 << 3 // Drive strength field
	Drive0 Config = 0 << 3 // Rout = ∞Ω (output driver disabled)
	Drive1 Config = 1 << 3 // Rout = R, R = 150Ω @ 3V3, R = 260Ω @ 1V8
	Drive2 Config = 2 << 3 // Rout = R / 2
	Drive3 Config = 3 << 3 // Rout = R / 3
	Drive4 Config = 4 << 3 // Rout = R / 4
	Drive5 Config = 5 << 3 // Rout = R / 5
	Drive6 Config = 6 << 3 // Rout = R / 6
	Drive7 Config = 7 << 3 // Rout = R / 7

	Speed       Config = 3 << 6 // Speed field
	SpeedLow    Config = 0 << 6 // Speed low (50MHz)
	SpeedMedium Config = 1 << 6 // Speed medium (100MHz)
	SpeedFast   Config = 2 << 6 // Speed fast (150MHz)
	SpeedMax    Config = 3 << 6 // Speed max (200MHz)

	OpenDrain Config = 1 << 11 // Enable open drain mode

	PK Config = 1 << 12 // Enable pull/keep mode

	Pull Config = 1 << 13 // Use pull mode instead of keep mode

	PullSel  Config = 3 << 14 // Select pull direction and strength
	Down100k Config = 0 << 14 // 100kΩ pull-down
	Up47k    Config = 1 << 14 //  47kΩ pull-up
	Up100k   Config = 2 << 14 // 100kΩ pull up
	Up22k    Config = 3 << 14 //  22kΩ pull up

	Hys Config = 1 << 16 //+ Enable hysteresis mode
)

type Pin

type Pin int16

Pin represents an I/O pin (pad).

const (
	EMC_00 Pin = iota
	EMC_01
	EMC_02
	EMC_03
	EMC_04
	EMC_05
	EMC_06
	EMC_07
	EMC_08
	EMC_09
	EMC_10
	EMC_11
	EMC_12
	EMC_13
	EMC_14
	EMC_15
	EMC_16
	EMC_17
	EMC_18
	EMC_19
	EMC_20
	EMC_21
	EMC_22
	EMC_23
	EMC_24
	EMC_25
	EMC_26
	EMC_27
	EMC_28
	EMC_29
	EMC_30
	EMC_31
	EMC_32
	EMC_33
	EMC_34
	EMC_35
	EMC_36
	EMC_37
	EMC_38
	EMC_39
	EMC_40
	EMC_41
	B0_00
	B0_01
	B0_02
	B0_03
	B0_04
	B0_05
	B0_06
	B0_07
	B0_08
	B0_09
	B0_10
	B0_11
	B0_12
	B0_13
	B0_14
	B0_15
	B1_00
	B1_01
	B1_02
	B1_03
	B1_04
	B1_05
	B1_06
	B1_07
	B1_08
	B1_09
	B1_10
	B1_11
	B1_12
	B1_13
	B1_14
	B1_15
	SD_B0_00
	SD_B0_01
	SD_B0_02
	SD_B0_03
	SD_B0_04
	SD_B0_05
	SD_B1_00
	SD_B1_01
	SD_B1_02
	SD_B1_03
	SD_B1_04
	SD_B1_05
	SD_B1_06
	SD_B1_07
	SD_B1_08
	SD_B1_09
	SD_B1_10
	SD_B1_11
)

func (Pin) AltFunc

func (p Pin) AltFunc() AltFunc

AltFunc returns a currently set muxmode for pin.

func (Pin) Config

func (p Pin) Config() Config

Config return pin configuration.

func (Pin) SetAltFunc

func (p Pin) SetAltFunc(af AltFunc)

SetAltFunc sets a mux mode for pin.

func (Pin) Setup

func (p Pin) Setup(cfg Config)

Setup configures pin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL