-- | The main board, set up to be wired to either the Inkplate's top-level or -- the simulator's. This insulates us from Bluesim's lack of Inout support. package Numini where import Clocks import Connectable import HyperBus import I2C import Uart -- | The output pins. interface NuminiOut = ch559_uart_tx :: Bit 1 inkplate_uart_tx :: Bit 1 usb_uart_tx :: Bit 1 led_r_n :: Bit 1 led_g_n :: Bit 1 rgb_r_n :: Bit 1 rgb_g_n :: Bit 1 rgb_b_n :: Bit 1 hyperbus_ck :: Bit 1 hyperbus_ck_n :: Bit 1 hyperbus_cs0_n :: Bit 1 hyperbus_cs1_n :: Bit 1 hyperbus_cs2_n :: Bit 1 hyperbus_cs3_n :: Bit 1 hyperbus_reset_n :: Bit 1 hyperbus_rwds_out :: Maybe (Bit 1) hyperbus_dq_out :: Maybe (Bit 8) i2c_scl_out :: Bit 1 i2c_sda_out :: Bit 1 clockFreqHz :: Integer clockFreqHz = 12_000_000 mkNumini :: Wire (Bit 1) -> Wire (Bit 1) -> Wire (Bit 1) -> Wire (Bit 1) -> Wire (Bit 8) -> Wire (Bit 1) -> Wire (Bit 1) -> Module NuminiOut mkNumini ch559_uart_rx inkplate_uart_rx usb_uart_rx hyperbus_rwds_in hyperbus_dq_in i2c_scl_in i2c_sda_in = module -- Make the peripherals. ch559_uart <- mkDividedUart (clockFreqHz / 9_600) ch559_uart_rx inkplate_uart <- mkDividedUart (clockFreqHz / 2_000_000) inkplate_uart_rx usb_uart <- mkDividedUart (clockFreqHz / 9_600) usb_uart_rx hyperbus <- mkDividedHyperBus (clockFreqHz / 3_000_000) hyperbus_rwds_in hyperbus_dq_in i2c <- mkDividedI2C (clockFreqHz / 200_000) i2c_scl_in i2c_sda_in mkConnection usb_uart.send usb_uart.recv interface NuminiOut ch559_uart_tx = ch559_uart.tx inkplate_uart_tx = inkplate_uart.tx usb_uart_tx = usb_uart.tx led_r_n = 1 led_g_n = 1 rgb_r_n = 1 rgb_g_n = 1 rgb_b_n = 1 hyperbus_ck = hyperbus.ck hyperbus_ck_n = hyperbus.ck_n hyperbus_cs0_n = hyperbus.cs0_n hyperbus_cs1_n = hyperbus.cs1_n hyperbus_cs2_n = hyperbus.cs2_n hyperbus_cs3_n = hyperbus.cs3_n hyperbus_reset_n = hyperbus.reset_n hyperbus_rwds_out = hyperbus.rwds_out hyperbus_dq_out = hyperbus.dq_out i2c_scl_out = i2c.txSCL i2c_sda_out = i2c.txSDA -- vim: set ft=haskell :