<<=
演算子と|=
演算子は Python を意味しますか? 私はそれらがビット単位の演算子だと思います。演算子|
(ビットごとの or) と<<
(ビットシフト) は知っていますが、. との組み合わせはわかりません=
。
このピースコードで見つけました。以下のコードはそのコードに属します。
commandout = adcnum
commandout |= 0x18 # start bit + single-ended bit
commandout <<= 3 # we only need to send 5 bits here
for i in range(5):
if (commandout & 0x80):
GPIO.output(mosipin, True)
else:
GPIO.output(mosipin, False)
commandout <<= 1
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)