當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.io_read_bit函數代碼示例

本文整理匯總了Golang中C.io_read_bit函數的典型用法代碼示例。如果您正苦於以下問題:Golang io_read_bit函數的具體用法?Golang io_read_bit怎麽用?Golang io_read_bit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了io_read_bit函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: GetFloorSignal

func GetFloorSignal() int {
	if C.io_read_bit(C.SENSOR_FLOOR1) != 0 {
		return 0
	} else if C.io_read_bit(C.SENSOR_FLOOR2) != 0 {
		return 1
	} else if C.io_read_bit(C.SENSOR_FLOOR3) != 0 {
		return 2
	} else if C.io_read_bit(C.SENSOR_FLOOR4) != 0 {
		return 3
	} else {
		return -1
	}
}
開發者ID:larstokle,項目名稱:sanntids-oving,代碼行數:13,代碼來源:driver.go

示例2: createIntButtonListener

func createIntButtonListener(ch chan int) {
	//TODO think about fault tolerance here
	var prevStateIntBtn1 int = 0
	var StateIntBtn1 int = 0
	var prevStateIntBtn2 int = 0
	var StateIntBtn2 int = 0
	var prevStateIntBtn3 int = 0
	var StateIntBtn3 int = 0
	var prevStateIntBtn4 int = 0
	var StateIntBtn4 int = 0
	for {
		time.Sleep(time.Millisecond * 10)

		StateIntBtn1 = int(C.io_read_bit(C.FLOOR_COMMAND1))
		if StateIntBtn1 != prevStateIntBtn1 {
			prevStateIntBtn1 = StateIntBtn1
			if StateIntBtn1 == 1 {
				ch <- INT_BTN_1
			}
		}

		StateIntBtn2 = int(C.io_read_bit(C.FLOOR_COMMAND2))
		if StateIntBtn2 != prevStateIntBtn2 {
			prevStateIntBtn2 = StateIntBtn2
			if StateIntBtn2 == 1 {
				ch <- INT_BTN_2
			}
		}

		StateIntBtn3 = int(C.io_read_bit(C.FLOOR_COMMAND3))
		if StateIntBtn3 != prevStateIntBtn3 {
			prevStateIntBtn3 = StateIntBtn3
			if StateIntBtn3 == 1 {
				ch <- INT_BTN_3
			}
		}

		StateIntBtn4 = int(C.io_read_bit(C.FLOOR_COMMAND4))
		if StateIntBtn4 != prevStateIntBtn4 {
			prevStateIntBtn4 = StateIntBtn4
			if StateIntBtn4 == 1 {
				ch <- INT_BTN_4
			}
		}
	}
}
開發者ID:TorChrEriksen,項目名稱:TTK4145,代碼行數:46,代碼來源:driverInterface.go

示例3: IoReadBit

func IoReadBit(channel int) bool {
	var i int = int(C.io_read_bit(C.int(channel)))
	if i == 1 {
		return true
	} else {
		return false
	}
}
開發者ID:sanntidT19,項目名稱:Sanntid2016,代碼行數:8,代碼來源:io.go

示例4: RunBottomFloor

func RunBottomFloor() {
	if GetFloorSignal() != 0 {
		C.io_set_bit(C.MOTORDIR)
		//time.Sleep(time.Second * 1)
		C.io_write_analog(C.MOTOR, 2800)
		for C.io_read_bit(C.SENSOR_FLOOR1) == 0 {
			SetFloorIndicator(GetFloorSignal())
			time.Sleep(time.Millisecond * 200)
		}
		SetFloorIndicator(GetFloorSignal())
		C.io_write_analog(C.MOTOR, 0)
	}
}
開發者ID:larstokle,項目名稱:sanntids-oving,代碼行數:13,代碼來源:driver.go

示例5: ReadButton

func ReadButton(button int, floor int) bool {
	if floor < 0 || floor >= N_FLOORS || button < 0 || button > N_BUTTON_TYPES {
		return false
	}

	var BTN_CHANNELS = [N_FLOORS][N_BUTTON_TYPES]int{
		{C.BUTTON_UP1, C.BUTTON_DOWN1, C.BUTTON_COMMAND1},
		{C.BUTTON_UP2, C.BUTTON_DOWN2, C.BUTTON_COMMAND2},
		{C.BUTTON_UP3, C.BUTTON_DOWN3, C.BUTTON_COMMAND3},
		{C.BUTTON_UP4, C.BUTTON_DOWN4, C.BUTTON_COMMAND4}}

	return (int(C.io_read_bit(C.int(BTN_CHANNELS[floor][button]))) != 0)
}
開發者ID:larstokle,項目名稱:SanntidsHeis,代碼行數:13,代碼來源:driver.go

示例6: Io_read_bit

func Io_read_bit(channel int) int {
	return int(C.io_read_bit(C.int(channel)))
}
開發者ID:CzarXerxes,項目名稱:Sanntid,代碼行數:3,代碼來源:io.go

示例7: ioReadBit

func ioReadBit(channel int) bool {
	return int(C.io_read_bit(C.int(channel))) != 0
}
開發者ID:eleneme,項目名稱:sanntid,代碼行數:3,代碼來源:io.go

示例8: IO_Read_Bit

func IO_Read_Bit(channel int) int {
	return C.io_read_bit(C.int(channel))
}
開發者ID:pigswillfly,項目名稱:RealTime,代碼行數:3,代碼來源:io.go

示例9: IO_Read_Bit

func IO_Read_Bit(channel int) bool {
	return int(C.io_read_bit(C.int(channel))) != 0
}
開發者ID:magnucha,項目名稱:TTK4145-Sanntid,代碼行數:3,代碼來源:io.go

示例10: createExtButtonListener

func createExtButtonListener(ch chan int) {
	var prevStateExtBtn1Up int = 0
	var StateExtBtn1Up int = 0
	var prevStateExtBtn2Up int = 0
	var StateExtBtn2Up int = 0
	var prevStateExtBtn2Down int = 0
	var StateExtBtn2Down int = 0
	var prevStateExtBtn3Up int = 0
	var StateExtBtn3Up int = 0
	var prevStateExtBtn3Down int = 0
	var StateExtBtn3Down int = 0
	var prevStateExtBtn4Down int = 0
	var StateExtBtn4Down int = 0
	for {
		time.Sleep(time.Millisecond * 10)

		StateExtBtn1Up = int(C.io_read_bit(C.FLOOR_UP1))
		if StateExtBtn1Up != prevStateExtBtn1Up {
			prevStateExtBtn1Up = StateExtBtn1Up
			if StateExtBtn1Up == 1 {
				ch <- EXT_BTN_1_UP
			}
		}

		StateExtBtn2Up = int(C.io_read_bit(C.FLOOR_UP2))
		if StateExtBtn2Up != prevStateExtBtn2Up {
			prevStateExtBtn2Up = StateExtBtn2Up
			if StateExtBtn2Up == 1 {
				ch <- EXT_BTN_2_UP
			}
		}

		StateExtBtn2Down = int(C.io_read_bit(C.FLOOR_DOWN2))
		if StateExtBtn2Down != prevStateExtBtn2Down {
			prevStateExtBtn2Down = StateExtBtn2Down
			if StateExtBtn2Down == 1 {
				ch <- EXT_BTN_2_DOWN
			}
		}

		StateExtBtn3Up = int(C.io_read_bit(C.FLOOR_UP3))
		if StateExtBtn3Up != prevStateExtBtn3Up {
			prevStateExtBtn3Up = StateExtBtn3Up
			if StateExtBtn3Up == 1 {
				ch <- EXT_BTN_3_UP
			}
		}

		StateExtBtn3Down = int(C.io_read_bit(C.FLOOR_DOWN3))
		if StateExtBtn3Down != prevStateExtBtn3Down {
			prevStateExtBtn3Down = StateExtBtn3Down
			if StateExtBtn3Down == 1 {
				ch <- EXT_BTN_3_DOWN
			}
		}

		StateExtBtn4Down = int(C.io_read_bit(C.FLOOR_DOWN4))
		if StateExtBtn4Down != prevStateExtBtn4Down {
			prevStateExtBtn4Down = StateExtBtn4Down
			if StateExtBtn4Down == 1 {
				ch <- EXT_BTN_4_DOWN
			}
		}
	}
}
開發者ID:TorChrEriksen,項目名稱:TTK4145,代碼行數:65,代碼來源:driverInterface.go

示例11: io_readBit

func io_readBit(channel int) int {
	n, err := C.io_read_bit(C.int(channel))
	checkError(err)
	return int(n)
}
開發者ID:lauritsriple,項目名稱:TTK4145-Sanntid,代碼行數:5,代碼來源:io.go

示例12: Io_ReadBit

func Io_ReadBit(channel int) bool {
	n, err := C.io_read_bit(C.int(channel))
	checkError(err)
	return citob(n)
}
開發者ID:lauritsriple,項目名稱:TTK4145-Sanntid,代碼行數:5,代碼來源:io.go

示例13: IoReadBit

func IoReadBit(channel int) bool {
	return bool(int(C.io_read_bit(C.int(channel))) != 0)
}
開發者ID:magnuram,項目名稱:Awesome-real-time-geeks,代碼行數:3,代碼來源:io.go


注:本文中的C.io_read_bit函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。