Skip to content

Commit cfbf3b2

Browse files
committed
cdc_uart: add RTS and DTR pins
1 parent 156a33f commit cfbf3b2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/cdc_uart.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ void cdc_uart_init(void) {
4343
gpio_set_pulls(PICOPROBE_UART_TX, 1, 0);
4444
gpio_set_pulls(PICOPROBE_UART_RX, 1, 0);
4545
uart_init(PICOPROBE_UART_INTERFACE, PICOPROBE_UART_BAUDRATE);
46+
47+
gpio_init(PICOPROBE_UART_DTR);
48+
gpio_init(PICOPROBE_UART_RTS);
49+
gpio_set_dir(PICOPROBE_UART_DTR, GPIO_OUT);
50+
gpio_set_dir(PICOPROBE_UART_RTS, GPIO_OUT);
51+
gpio_put(PICOPROBE_UART_DTR, 1);
52+
gpio_put(PICOPROBE_UART_RTS, 1);
4653
}
4754

4855
void cdc_task(void)
@@ -117,6 +124,9 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
117124

118125
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
119126
{
127+
gpio_put(PICOPROBE_UART_DTR, !dtr);
128+
gpio_put(PICOPROBE_UART_RTS, !rts);
129+
120130
/* CDC drivers use linestate as a bodge to activate/deactivate the interface.
121131
* Resume our UART polling on activate, stop on deactivate */
122132
if (!dtr && !rts)

src/picoprobe_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
// UART config
5959
#define PICOPROBE_UART_TX 4
6060
#define PICOPROBE_UART_RX 5
61+
#define PICOPROBE_UART_RTS 7
62+
#define PICOPROBE_UART_DTR 8
6163
#define PICOPROBE_UART_INTERFACE uart1
6264
#define PICOPROBE_UART_BAUDRATE 115200
6365

0 commit comments

Comments
 (0)