summaryrefslogtreecommitdiff
path: root/tests/usb-serial-rs485
diff options
context:
space:
mode:
Diffstat (limited to 'tests/usb-serial-rs485')
-rw-r--r--tests/usb-serial-rs485/main-stm32f103-generic.c3
-rw-r--r--tests/usb-serial-rs485/main-stm32f4-disco.c6
2 files changed, 4 insertions, 5 deletions
diff --git a/tests/usb-serial-rs485/main-stm32f103-generic.c b/tests/usb-serial-rs485/main-stm32f103-generic.c
index 6374d24..415a18b 100644
--- a/tests/usb-serial-rs485/main-stm32f103-generic.c
+++ b/tests/usb-serial-rs485/main-stm32f103-generic.c
@@ -121,14 +121,13 @@ void usart2_isr(void)
void usb_cdcacm_setup_pre_arch(void)
{
+ // Hack to reenumerate
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
gpio_clear(GPIOA, GPIO12);
for (unsigned int i = 0; i < 800000; i++) {
__asm__("nop");
}
-
- rcc_periph_clock_enable(RCC_OTGFS);
}
void usb_cdcacm_setup_post_arch(usbd_device *dev)
diff --git a/tests/usb-serial-rs485/main-stm32f4-disco.c b/tests/usb-serial-rs485/main-stm32f4-disco.c
index 8678c43..ac3cdff 100644
--- a/tests/usb-serial-rs485/main-stm32f4-disco.c
+++ b/tests/usb-serial-rs485/main-stm32f4-disco.c
@@ -77,7 +77,7 @@ void usart2_isr(void)
gpio_really(GPIOA, GPIO5, 1);
// usbser-rxne()
/* Check if we were called because of RXNE. */
- if (usart_get_interrupt_source(USART2, USART_SR_RXNE)) {
+ if (usart_get_flag(USART2, USART_SR_RXNE)) {
gpio_set(LED_RX_PORT, LED_RX_PIN);
uint8_t c = usart_recv(USART2);
if (ringb_put(&rx_ring, c)) {
@@ -92,7 +92,7 @@ void usart2_isr(void)
gpio_clear(LED_RX_PORT, LED_RX_PIN);
}
// usbser-irq-txe()
- if (usart_get_interrupt_source(USART2, USART_SR_TXE)) {
+ if (usart_get_flag(USART2, USART_SR_TXE)) {
if (ringb_depth(&tx_ring) == 0) {
// turn off tx empty interrupts, nothing left to send
usart_disable_tx_interrupt(USART2);
@@ -105,7 +105,7 @@ void usart2_isr(void)
}
}
// usbser-irq-txc? rs485 is auto on some devices, but can be emulated anyway
-// if (usart_get_interrupt_source(USART2, USART_SR_TC)) {
+// if (usart_get_flag(USART2, USART_SR_TC)) {
// ER_DPRINTF("TC");
// // turn off the complete irqs, we're done now.
// USART_SR(USART2) &= ~USART_SR_TC;