Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
#
# This file is part of LiteX.
#
# Copyright (c) 2026 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
import unittest
from migen import *
from litex.gen import *
from litex.soc.cores.spilcd import SPILCD, get_st7789_init_sequence
class _Pads:
def __init__(self):
self.clk = Signal()
self.mosi = Signal()
self.miso = Signal()
self.cs_n = Signal()
self.dc = Signal()
self.rst_n = Signal()
self.backlight = Signal()
class _DUT(LiteXModule):
def __init__(self, with_pixel_stream=False):
self.spilcd = SPILCD(_Pads(), sys_clk_freq=50e6, with_pixel_stream=with_pixel_stream)
class TestSPILCD(unittest.TestCase):
def test_control_signals_present(self):
dut = _DUT()
dut.get_fragment()
self.assertTrue(hasattr(dut.spilcd, "spi"))
self.assertTrue(hasattr(dut.spilcd, "control"))
def test_common_init_sequence(self):
sequence = get_st7789_init_sequence()
self.assertTrue(sequence)
self.assertTrue(all(len(entry) == 2 for entry in sequence))
def test_pixel_stream_endpoint(self):
dut = _DUT(with_pixel_stream=True)
dut.get_fragment()
self.assertTrue(hasattr(dut.spilcd, "sink"))
self.assertTrue(hasattr(dut.spilcd, "pixel_enable"))
if __name__ == "__main__":
unittest.main()
2e0eaead3This file is pinned to the selected release. Download the original to open it in your design tool.