File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -139,10 +139,17 @@ void UART::begin(unsigned long baudrate, uint16_t config) {
139
139
/* -------------------------------------------------------------------------- */
140
140
#if SERIAL_HOWMANY > 0
141
141
if (channel == UART1_CHANNEL) {
142
- /* TX pin */
143
- R_IOPORT_PinCfg (&g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, (uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_SCI1_3_5_7_9);
144
- /* RX pin */
145
- R_IOPORT_PinCfg (&g_ioport_ctrl, BSP_IO_PORT_03_PIN_01, (uint32_t ) IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_SCI0_2_4_6_8);
142
+ /* configuring PIN */
143
+ int pin_count = 0 ;
144
+ bsp_io_port_pin_t serial_pins[4 ];
145
+ for (int i=0 ; i<PINCOUNT_fn (); i++) {
146
+ if (g_APinDescription[i].PeripheralConfig == SERIAL_BUS) {
147
+ serial_pins[pin_count] = g_APinDescription[i].name ;
148
+ pin_count++;
149
+ }
150
+ if (pin_count == 2 ) break ;
151
+ }
152
+ setPins (serial_pins[0 ], serial_pins[1 ]);
146
153
147
154
uart_cfg.channel = UART1_CHANNEL;
148
155
uart_cfg.p_context = NULL ;
You can’t perform that action at this time.
0 commit comments