27 #include <libopencm3/stm32/rcc.h> 28 #include <libopencm3/stm32/gpio.h> 29 #include <libopencm3/stm32/usart.h> 30 #include <libopencm3/cm3/nvic.h> 31 #include <libopencmsis/core_cm3.h> 47 #define RS232_EN_PORT B 48 #define RS232_EN_PIN 5 49 #define RS232_SHDN_PORT C 50 #define RS232_SHDN_PIN 15 51 #define RS232_RTS_PORT A 52 #define RS232_RTS_PIN 1 53 #define RS232_CTS_PORT A 54 #define RS232_CTS_PIN 0 58 #define RS232_BAUDRATE 1200 84 rcc_periph_clock_enable(RCC_AFIO);
126 rcc_periph_clock_enable(
RCC_GPIO(RS232_CTS_PORT));
127 gpio_set_mode(
GPIO(RS232_CTS_PORT), GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT,
GPIO(RS232_CTS_PIN));
130 if (gpio_get(
GPIO(RS232_CTS_PORT),
GPIO(RS232_CTS_PIN))) {
library for RS-232 communication (API)
#define RS232_SHDN_PORT
RS-232 pin to enable transmitter (active high, pulled low)
#define RCC_GPIO(x)
get RCC for GPIO based on GPIO identifier
global definitions and methods (API)
#define GPIO(x)
get GPIO based on GPIO identifier
#define RS232_EN_PIN
RS-232 pin to enable receiver (active low, pulled up)
#define RS232_USART
USART peripheral.
#define USART(x)
get USART based on USART identifier
#define USART_PORT(x)
get port for USART based on USART identifier
#define USART_PORT_RCC(x)
get RCC for USART port based on USART identifier
void rs232_setup(void)
transmit and receive buffer sizes
size_t printf(const char *format,...)
print format string on user output
printing utilities to replace the large printf from the standard library (API)
#define RS232_EN_PORT
RS-232 pin to enable receiver (active low, pulled up)
#define USART_RCC(x)
get RCC for USART based on USART identifier
#define RS232_SHDN_PIN
RS-232 pin to enable transmitter (active high, pulled low)
#define USART_PIN_RX(x)
get receive pin for USART based on USART identifier
#define USART_PIN_TX(x)
get transmit pin for USART based on USART identifier
#define RS232_BAUDRATE
serial baudrate, in bits per second (with 8N1 8 bits, no parity bit, 1 stop bit settings) ...