pi

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Index = &ice.Context{Name: "pi", Help: "开发板",
	Caches: map[string]*ice.Cache{},
	Configs: map[string]*ice.Config{
		"pi": {Name: "pi", Help: "pi", Value: kit.Data(kit.MDB_SHORT, "name")},
	},
	Commands: map[string]*ice.Command{
		"GPIO": {Name: "GPIO", Help: "GPIO", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			p := kit.Format("/sys/class/gpio/gpio%s", arg[0])
			if _, e := os.Stat(p); e != nil {
				if m.Warn(!os.IsNotExist(e), "%s", e) {
					return
				}
				m.Cmd("nfs.echo", "/sys/class/gpio/export", arg[0])
			}

			if len(arg) > 1 {
				m.Cmd("nfs.echo", path.Join(p, "direction"), "out")
				m.Cmd("nfs.echo", path.Join(p, "value"), arg[1])
			}
			m.Cmdy("nfs.cat", path.Join(p, "value"))
		}},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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