MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / uart_for_pin

Function uart_for_pin

modules/io/serial/pico/serial.c:87–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85static Serial uart_in_use[2] = {0, 0};
86
87int uart_for_pin(int transmit, int receive)
88{
89 int i;
90 if (UART_PIN_NO_CHANGE != transmit) {
91 for (i=0; uart_chan_0_tx[i] != 0xff; i++)
92 if (uart_chan_0_tx[i] == transmit)
93 return 0;
94 for (i=0; uart_chan_1_tx[i] != 0xff; i++)
95 if (uart_chan_1_tx[i] == transmit)
96 return 1;
97 }
98 else if (UART_PIN_NO_CHANGE != receive) {
99 for (i=0; uart_chan_0_tx[i] != 0xff; i++)
100 if (uart_chan_0_rx[i] == receive)
101 return 0;
102 for (i=0; uart_chan_1_tx[i] != 0xff; i++)
103 if (uart_chan_1_rx[i] == receive)
104 return 1;
105 }
106 return -1;
107}
108
109void xs_serial_constructor(xsMachine *the)
110{

Callers 1

xs_serial_constructorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected