Introduce I/O transactions at a slower clock speed
This commit is contained in:
parent
c618e058dd
commit
1eaa9c3c38
@ -7,6 +7,7 @@ import spidev
|
|||||||
|
|
||||||
IO_DELAY = (1.0 / 25.0)
|
IO_DELAY = (1.0 / 25.0)
|
||||||
MPD_DELAY = 0.5
|
MPD_DELAY = 0.5
|
||||||
|
SPI_SPEED = 600000
|
||||||
|
|
||||||
class display(object):
|
class display(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -132,8 +133,10 @@ class radioserv:
|
|||||||
while True:
|
while True:
|
||||||
self.disp_mgr.animate(1)
|
self.disp_mgr.animate(1)
|
||||||
self.disp_mgr.render()
|
self.disp_mgr.render()
|
||||||
|
rdata = self.spi.xfer([100, 101, 102, 103], 100000, 1)
|
||||||
|
print(rdata)
|
||||||
data = list(self.disp_mgr.get_image())
|
data = list(self.disp_mgr.get_image())
|
||||||
self.spi.xfer(data)
|
rdata = self.spi.xfer(data, SPI_SPEED, 1)
|
||||||
await self.io_event.wait()
|
await self.io_event.wait()
|
||||||
self.io_event.clear()
|
self.io_event.clear()
|
||||||
|
|
||||||
@ -195,7 +198,7 @@ class radioserv:
|
|||||||
# Connect to SPI
|
# Connect to SPI
|
||||||
self.spi = spidev.SpiDev()
|
self.spi = spidev.SpiDev()
|
||||||
self.spi.open(0, 0)
|
self.spi.open(0, 0)
|
||||||
self.spi.max_speed_hz = 500000
|
self.spi.max_speed_hz = SPI_SPEED
|
||||||
self.spi.mode = 0b00
|
self.spi.mode = 0b00
|
||||||
|
|
||||||
# Connect to MPD
|
# Connect to MPD
|
||||||
@ -217,7 +220,7 @@ class radioserv:
|
|||||||
mpd_task = asyncio.create_task(self.mpd_main())
|
mpd_task = asyncio.create_task(self.mpd_main())
|
||||||
|
|
||||||
# TODO: Wait for exit condition (shutdown command)
|
# TODO: Wait for exit condition (shutdown command)
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(6000)
|
||||||
|
|
||||||
io_timer_task.cancel()
|
io_timer_task.cancel()
|
||||||
io_task.cancel()
|
io_task.cancel()
|
||||||
|
Loading…
Reference in New Issue
Block a user