pcduino

package module
v0.0.0-...-a8201df Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2015 License: MIT Imports: 5 Imported by: 0

README

golang-pcduino

A golang package for accessing the pins on the pcDuino microcontroller.

Documentation

Index

Constants

View Source
const (
	GPIO_PIN_PATH  string = "/sys/devices/virtual/misc/gpio/pin/"
	GPIO_MODE_PATH string = "/sys/devices/virtual/misc/gpio/mode/"
	GPIO_PREFIX    string = "gpio"
)

GPIO Path of pcDuino

View Source
const (
	GPIO0  int = iota
	GPIO1  int = iota
	GPIO2  int = iota
	GPIO3  int = iota
	GPIO4  int = iota
	GPIO5  int = iota
	GPIO6  int = iota
	GPIO7  int = iota
	GPIO8  int = iota
	GPIO9  int = iota
	GPIO10 int = iota
	GPIO11 int = iota
	GPIO12 int = iota
	GPIO13 int = iota
	GPIO14 int = iota
	GPIO15 int = iota
	GPIO16 int = iota
	GPIO17 int = iota
	GPIO18 int = iota
	GPIO19 int = iota
	GPIO20 int = iota
	GPIO21 int = iota
	GPIO22 int = iota
	GPIO23 int = iota
)
View Source
const (
	SPI_CS     int = GPIO10
	SPI_MOSI   int = GPIO11
	SPI_MISO   int = GPIO12
	SPI_CLK    int = GPIO13
	SPIEX_CS   int = GPIO20
	SPIEX_MOSI int = GPIO21
	SPIEX_MISO int = GPIO22
	SPIEX_CLK  int = GPIO23
)
View Source
const (
	MAX_GPIO_NUM      int = 23
	MAX_GPIO_MODE_NUM int = 8
	MAX_PWM_NUM       int = 5
	MAX_ADC_NUM       int = 11
)

Variables

This section is empty.

Functions

func SetupUART

func SetupUART(baud int) (io.ReadWriteCloser, error)

Types

type GpioDrive

type GpioDrive struct {
	// contains filtered or unexported fields
}

func OpenPin

func OpenPin(pinNum int) (gd *GpioDrive, err error)

Open a GPIO Port with pinNum

func (*GpioDrive) Close

func (gd *GpioDrive) Close() error

func (*GpioDrive) Read

func (gd *GpioDrive) Read(p []byte) (n int, err error)

func (*GpioDrive) SetLevel

func (gd *GpioDrive) SetLevel(il IOLEVEL) (n int, err error)

func (*GpioDrive) SetMode

func (gd *GpioDrive) SetMode(pm PINMODE) (n int, err error)

func (*GpioDrive) Write

func (gd *GpioDrive) Write(p []byte) (n int, err error)

type IOLEVEL

type IOLEVEL string
const (
	// Low represents 0.
	LOW IOLEVEL = "0"

	// High represents 1.
	HIGH IOLEVEL = "1"
)

type PINMODE

type PINMODE string
const (
	IN       PINMODE = "0"
	OUT      PINMODE = "1"
	IO_SPI   PINMODE = "2"
	IO_SPIEX PINMODE = "3"
	IO_UART  PINMODE = "3"
)

5 mode in GPIO pins

type UART

type UART interface {
	SetupUART(int)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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