示例#1
0
//TODO Consider using const UP = 1 instead of strings
//func SetButtonLamp(btn C.elev_button_type_t,floor C.int, value C.int){
func SetButtonLamp(direction string, floor int, value int) {
	if direction == "UP" {
		fmt.Println("goin' up")
		C.elev_set_button_lamp(C.BUTTON_CALL_UP, C.int(floor), C.int(value))
	} else if direction == "DOWN" {
		fmt.Println("goin' down")
		C.elev_set_button_lamp(C.BUTTON_CALL_DOWN, C.int(floor), C.int(value))
	} else if direction == "INT" {
		C.elev_set_button_lamp(C.BUTTON_COMMAND, C.int(floor), C.int(value))
	} else {
		//Trying to kick the shit out of software in case of wrong input
		fmt.Println("Panicking")
		panic(fmt.Sprintf("%v", direction))
	}
}
示例#2
0
func Elevator_set_button_lamp(button Button, floor int, value bool) {
	val := 0
	if value {
		val = 1
	}
	C.elev_set_button_lamp(C.elev_button_type_t(button), C.int(floor), C.int(val))
}
示例#3
0
// ButtonLightOff turns it off
func ButtonLightOff(floor Floor, dir Direction) {
	if floor == 0 && dir == DirectionDown {
		dir = DirectionUp
	} else if floor == NumFloors-1 && dir == DirectionUp {
		dir = DirectionDown
	}
	mutex.Lock()
	C.elev_set_button_lamp(C.elev_button_type_t(dir), C.int(floor), 0)
	mutex.Unlock()
}
示例#4
0
func Elev_set_button_lamp(button Elev_button_type_t, floor int, value int) {
	C.elev_set_button_lamp(C.elev_button_type_t(button), C.int(floor), C.int(value))
}
示例#5
0
func liftDriver_SetButtonLamp(button int, floor int, onOrOff bool) {
	C.elev_set_button_lamp(C.elev_button_type_t(button), C.int(floor), C.int(onOrOff))
}
示例#6
0
func LiftDriver_SetButtonLamp(button types.ButtonType, floor int, onOrOff int) {
	C.elev_set_button_lamp(C.elev_button_type_t(C.int(button)), C.int(floor), C.int(onOrOff))
}
示例#7
0
文件: driver.go 项目: audunel/TTK4145
func SetButtonLamp(button ButtonType, floor, value int) {
	C.elev_set_button_lamp(C.elev_button_type_t(button), C.int(floor), C.int(value))
}