|
2 | 2 |
|
3 | 3 | package machine
|
4 | 4 |
|
| 5 | +import ( |
| 6 | + "device/nxp" |
| 7 | + "runtime/interrupt" |
| 8 | +) |
| 9 | + |
5 | 10 | // Digital pins
|
6 | 11 | const (
|
7 | 12 | // = Pin // [Pad]: Alt Func 0 Alt Func 1 Alt Func 2 Alt Func 3 Alt Func 4 Alt Func 5 Alt Func 6 Alt Func 7 Alt Func 8 Alt Func 9
|
@@ -83,6 +88,17 @@ const (
|
83 | 88 | I2C_SCL_PIN = I2C1_SCL_PIN // D19/A5
|
84 | 89 | )
|
85 | 90 |
|
| 91 | +func init() { |
| 92 | + // register any interrupt handlers for this board's peripherals |
| 93 | + UART1.Interrupt = interrupt.New(nxp.IRQ_LPUART6, UART1.handleInterrupt) |
| 94 | + UART2.Interrupt = interrupt.New(nxp.IRQ_LPUART4, UART2.handleInterrupt) |
| 95 | + UART3.Interrupt = interrupt.New(nxp.IRQ_LPUART2, UART3.handleInterrupt) |
| 96 | + UART4.Interrupt = interrupt.New(nxp.IRQ_LPUART3, UART4.handleInterrupt) |
| 97 | + UART5.Interrupt = interrupt.New(nxp.IRQ_LPUART8, UART5.handleInterrupt) |
| 98 | + UART6.Interrupt = interrupt.New(nxp.IRQ_LPUART1, UART6.handleInterrupt) |
| 99 | + UART7.Interrupt = interrupt.New(nxp.IRQ_LPUART7, UART7.handleInterrupt) |
| 100 | +} |
| 101 | + |
86 | 102 | // #=====================================================#
|
87 | 103 | // | UART |
|
88 | 104 | // #===========#===========#=============#===============#
|
@@ -119,8 +135,88 @@ const (
|
119 | 135 | UART7_TX_PIN = D29
|
120 | 136 | )
|
121 | 137 |
|
122 |
| -// #==================================================================# |
123 |
| -// | SPI | |
| 138 | +var ( |
| 139 | + UART1 = UART{ |
| 140 | + Buffer: NewRingBuffer(), |
| 141 | + Bus: nxp.LPUART6, |
| 142 | + muxRX: muxSelect{ // D0 (PA3 [AD_B0_03]) |
| 143 | + mux: nxp.IOMUXC_LPUART6_RX_SELECT_INPUT_DAISY_GPIO_AD_B0_03_ALT2, |
| 144 | + sel: &nxp.IOMUXC.LPUART6_RX_SELECT_INPUT, |
| 145 | + }, |
| 146 | + muxTX: muxSelect{ // D1 (PA2 [AD_B0_02]) |
| 147 | + mux: nxp.IOMUXC_LPUART6_TX_SELECT_INPUT_DAISY_GPIO_AD_B0_02_ALT2, |
| 148 | + sel: &nxp.IOMUXC.LPUART6_TX_SELECT_INPUT, |
| 149 | + }, |
| 150 | + } |
| 151 | + UART2 = UART{ |
| 152 | + Buffer: NewRingBuffer(), |
| 153 | + Bus: nxp.LPUART4, |
| 154 | + muxRX: muxSelect{ // D7 (PB17 [B1_01]) |
| 155 | + mux: nxp.IOMUXC_LPUART4_RX_SELECT_INPUT_DAISY_GPIO_B1_01_ALT2, |
| 156 | + sel: &nxp.IOMUXC.LPUART4_RX_SELECT_INPUT, |
| 157 | + }, |
| 158 | + muxTX: muxSelect{ // D8 (PB16 [B1_00]) |
| 159 | + mux: nxp.IOMUXC_LPUART4_TX_SELECT_INPUT_DAISY_GPIO_B1_00_ALT2, |
| 160 | + sel: &nxp.IOMUXC.LPUART4_TX_SELECT_INPUT, |
| 161 | + }, |
| 162 | + } |
| 163 | + UART3 = UART{ |
| 164 | + Buffer: NewRingBuffer(), |
| 165 | + Bus: nxp.LPUART2, |
| 166 | + muxRX: muxSelect{ // D15 (PA19 [AD_B1_03]) |
| 167 | + mux: nxp.IOMUXC_LPUART2_RX_SELECT_INPUT_DAISY_GPIO_AD_B1_03_ALT2, |
| 168 | + sel: &nxp.IOMUXC.LPUART2_RX_SELECT_INPUT, |
| 169 | + }, |
| 170 | + muxTX: muxSelect{ // D14 (PA18 [AD_B1_02]) |
| 171 | + mux: nxp.IOMUXC_LPUART2_TX_SELECT_INPUT_DAISY_GPIO_AD_B1_02_ALT2, |
| 172 | + sel: &nxp.IOMUXC.LPUART2_TX_SELECT_INPUT, |
| 173 | + }, |
| 174 | + } |
| 175 | + UART4 = UART{ |
| 176 | + Buffer: NewRingBuffer(), |
| 177 | + Bus: nxp.LPUART3, |
| 178 | + muxRX: muxSelect{ // D16 (PA23 [AD_B1_07]) |
| 179 | + mux: nxp.IOMUXC_LPUART3_RX_SELECT_INPUT_DAISY_GPIO_AD_B1_07_ALT2, |
| 180 | + sel: &nxp.IOMUXC.LPUART3_RX_SELECT_INPUT, |
| 181 | + }, |
| 182 | + muxTX: muxSelect{ // D17 (PA22 [AD_B1_06]) |
| 183 | + mux: nxp.IOMUXC_LPUART3_TX_SELECT_INPUT_DAISY_GPIO_AD_B1_06_ALT2, |
| 184 | + sel: &nxp.IOMUXC.LPUART3_TX_SELECT_INPUT, |
| 185 | + }, |
| 186 | + } |
| 187 | + UART5 = UART{ |
| 188 | + Buffer: NewRingBuffer(), |
| 189 | + Bus: nxp.LPUART8, |
| 190 | + muxRX: muxSelect{ // D21 (PA27 [AD_B1_11]) |
| 191 | + mux: nxp.IOMUXC_LPUART8_RX_SELECT_INPUT_DAISY_GPIO_AD_B1_11_ALT2, |
| 192 | + sel: &nxp.IOMUXC.LPUART8_RX_SELECT_INPUT, |
| 193 | + }, |
| 194 | + muxTX: muxSelect{ // D20 (PA26 [AD_B1_10]) |
| 195 | + mux: nxp.IOMUXC_LPUART8_TX_SELECT_INPUT_DAISY_GPIO_AD_B1_10_ALT2, |
| 196 | + sel: &nxp.IOMUXC.LPUART8_TX_SELECT_INPUT, |
| 197 | + }, |
| 198 | + } |
| 199 | + UART6 = UART{ |
| 200 | + Buffer: NewRingBuffer(), |
| 201 | + Bus: nxp.LPUART1, |
| 202 | + // LPUART1 not connected via IOMUXC |
| 203 | + // RX: D24 (PA12 [AD_B0_12]) |
| 204 | + // TX: D25 (PA13 [AD_B0_13]) |
| 205 | + } |
| 206 | + UART7 = UART{ |
| 207 | + Buffer: NewRingBuffer(), |
| 208 | + Bus: nxp.LPUART7, |
| 209 | + muxRX: muxSelect{ // D28 (PC18 [EMC_32]) |
| 210 | + mux: nxp.IOMUXC_LPUART7_RX_SELECT_INPUT_DAISY_GPIO_EMC_32_ALT2, |
| 211 | + sel: &nxp.IOMUXC.LPUART7_RX_SELECT_INPUT, |
| 212 | + }, |
| 213 | + muxTX: muxSelect{ // D29 (PD31 [EMC_31]) |
| 214 | + mux: nxp.IOMUXC_LPUART7_TX_SELECT_INPUT_DAISY_GPIO_EMC_31_ALT2, |
| 215 | + sel: &nxp.IOMUXC.LPUART7_TX_SELECT_INPUT, |
| 216 | + }, |
| 217 | + } |
| 218 | +) |
| 219 | + |
124 | 220 | // #===========#==========#===============#===========================#
|
125 | 221 | // | Interface | Hardware | Clock(Freq) | SDI/SDO/SCK/CS : Alt |
|
126 | 222 | // #===========#==========#===============#=================-=========#
|
|
0 commit comments