示例#1
0
文件: pi.go 项目: rafkhan/pi
func callWiringSetup(flags int) error {
	if flags&SETUP_WIRING == SETUP_WIRING {
		C.wiringPiSetup()
		fmt.Println("testing")
		return nil

	} else if flags&SETUP_GPIO == SETUP_GPIO {
		C.wiringPiSetupGpio()
		return nil

	} else if flags&SETUP_PHYS == SETUP_PHYS {
		C.wiringPiSetupPhys()
		return nil

	} else if flags&SETUP_SYS == SETUP_SYS {
		C.wiringPiSetupSys()
		return nil

	} else {
		return errors.New("No setup flag set")
	}
}
示例#2
0
文件: rpi.go 项目: chenghuama/rpi
func WiringPiSetup() error {
	if -1 == int(C.wiringPiSetup()) {
		return errors.New("wiringPiSetup failed to call")
	}
	return nil
}
示例#3
0
文件: rpi.go 项目: vincentshi/rpi
func WiringPiSetup() {
	if -1 == int(C.wiringPiSetup()) {
		panic("Failed to setup Pi")
	}
}