mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Change how spi is called.
Signed-off-by: jayofelony <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -52,10 +52,10 @@ class RaspberryPi:
|
|||||||
import spidev
|
import spidev
|
||||||
import gpiozero
|
import gpiozero
|
||||||
|
|
||||||
self.SPI = spidev.SpiDev()
|
self.SPI = spidev.SpiDev(0, 0)
|
||||||
self.GPIO_RST_PIN = gpiozero.LED(self.RST_PIN)
|
self.GPIO_RST_PIN = gpiozero.LED(self.RST_PIN)
|
||||||
self.GPIO_DC_PIN = gpiozero.LED(self.DC_PIN)
|
self.GPIO_DC_PIN = gpiozero.LED(self.DC_PIN)
|
||||||
self.GPIO_CS_PIN = gpiozero.LED(self.CS_PIN)
|
# self.GPIO_CS_PIN = gpiozero.LED(self.CS_PIN)
|
||||||
self.GPIO_PWR_PIN = gpiozero.LED(self.PWR_PIN)
|
self.GPIO_PWR_PIN = gpiozero.LED(self.PWR_PIN)
|
||||||
self.GPIO_BUSY_PIN = gpiozero.Button(self.BUSY_PIN, pull_up=False)
|
self.GPIO_BUSY_PIN = gpiozero.Button(self.BUSY_PIN, pull_up=False)
|
||||||
|
|
||||||
@ -70,11 +70,11 @@ class RaspberryPi:
|
|||||||
self.GPIO_DC_PIN.on()
|
self.GPIO_DC_PIN.on()
|
||||||
else:
|
else:
|
||||||
self.GPIO_DC_PIN.off()
|
self.GPIO_DC_PIN.off()
|
||||||
elif pin == self.CS_PIN:
|
# elif pin == self.CS_PIN:
|
||||||
if value:
|
# if value:
|
||||||
self.GPIO_CS_PIN.on()
|
# self.GPIO_CS_PIN.on()
|
||||||
else:
|
# else:
|
||||||
self.GPIO_CS_PIN.off()
|
# self.GPIO_CS_PIN.off()
|
||||||
elif pin == self.PWR_PIN:
|
elif pin == self.PWR_PIN:
|
||||||
if value:
|
if value:
|
||||||
self.GPIO_PWR_PIN.on()
|
self.GPIO_PWR_PIN.on()
|
||||||
@ -88,8 +88,8 @@ class RaspberryPi:
|
|||||||
return self.RST_PIN.value
|
return self.RST_PIN.value
|
||||||
elif pin == self.DC_PIN:
|
elif pin == self.DC_PIN:
|
||||||
return self.DC_PIN.value
|
return self.DC_PIN.value
|
||||||
elif pin == self.CS_PIN:
|
# elif pin == self.CS_PIN:
|
||||||
return self.CS_PIN.value
|
# return self.CS_PIN.value
|
||||||
elif pin == self.PWR_PIN:
|
elif pin == self.PWR_PIN:
|
||||||
return self.PWR_PIN.value
|
return self.PWR_PIN.value
|
||||||
|
|
||||||
@ -149,13 +149,14 @@ class RaspberryPi:
|
|||||||
|
|
||||||
self.GPIO_RST_PIN.off()
|
self.GPIO_RST_PIN.off()
|
||||||
self.GPIO_DC_PIN.off()
|
self.GPIO_DC_PIN.off()
|
||||||
|
# self.GPIO_CS_PIN.off()
|
||||||
self.GPIO_PWR_PIN.off()
|
self.GPIO_PWR_PIN.off()
|
||||||
logger.debug("close 5V, Module enters 0 power consumption ...")
|
logger.debug("close 5V, Module enters 0 power consumption ...")
|
||||||
|
|
||||||
if cleanup:
|
if cleanup:
|
||||||
self.GPIO_RST_PIN.close()
|
self.GPIO_RST_PIN.close()
|
||||||
self.GPIO_DC_PIN.close()
|
self.GPIO_DC_PIN.close()
|
||||||
self.GPIO_CS_PIN.close()
|
# self.GPIO_CS_PIN.close()
|
||||||
self.GPIO_PWR_PIN.close()
|
self.GPIO_PWR_PIN.close()
|
||||||
self.GPIO_BUSY_PIN.close()
|
self.GPIO_BUSY_PIN.close()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user