blob: b5e0223cd6d81effb398e5eeb654cb8175ac1abd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
-- | 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 / 400_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 :
|