Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Basoglu <cem.basoglu@web.de>2016-03-08 04:39:21 +0300
committerKarl Palsson <karlp@tweak.net.au>2016-04-02 01:49:18 +0300
commit6b5150a4dc54c4f5b2f8a98317ec963ea7fbc864 (patch)
tree9028aa4ecfeb07dc7426c5a1e0acffb11d2d455a /include/libopencm3/stm32/common/usart_common_v2.h
parent2c1757d269b46c214b501e1b68776d632793b852 (diff)
stm32: usart-v2: Extended USART functions (data/pin inversion, half duplex)
Includes receive timeout, all inversions and duplex and convenience functions. Applies for F0 and F3 so far.
Diffstat (limited to 'include/libopencm3/stm32/common/usart_common_v2.h')
-rw-r--r--include/libopencm3/stm32/common/usart_common_v2.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/libopencm3/stm32/common/usart_common_v2.h b/include/libopencm3/stm32/common/usart_common_v2.h
new file mode 100644
index 00000000..0df94be9
--- /dev/null
+++ b/include/libopencm3/stm32/common/usart_common_v2.h
@@ -0,0 +1,73 @@
+/** @addtogroup usart_defines
+
+ @author @htmlonly &copy; @endhtmlonly 2016 Cem Basoglu <cem.basoglu@web.de>
+
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2016 Cem Basoglu <cem.basoglu@web.de>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+/** @cond */
+#if defined(LIBOPENCM3_USART_H)
+/** @endcond */
+#ifndef LIBOPENCM3_USART_COMMON_V2_H
+#define LIBOPENCM3_USART_COMMON_V2_H
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* --- USART_RTOR values --------------------------------------------------- */
+
+/* BLEN[7:0]: Block Length */
+#define USART_RTOR_BLEN_SHIFT 24
+#define USART_RTOR_BLEN_MASK (0xFF << USART_RTOR_BLEN_SHIFT)
+#define USART_RTOR_BLEN_VAL(x) ((x) << USART_RTOR_BLEN_SHIFT)
+
+/* RTO[23:0]: Receiver timeout value */
+#define USART_RTOR_RTO_SHIFT 0
+#define USART_RTOR_RTO_MASK (0xFFFFF << USART_RTOR_RTO_SHIFT)
+#define USART_RTOR_RTO_VAL(x) ((x) << USART_RTOR_RTO_SHIFT)
+
+/* --- Function prototypes ------------------------------------------------- */
+
+BEGIN_DECLS
+
+void usart_enable_data_inversion(uint32_t usart);
+void usart_disable_data_inversion(uint32_t usart);
+void usart_enable_tx_inversion(uint32_t usart);
+void usart_disable_tx_inversion(uint32_t usart);
+void usart_enable_rx_inversion(uint32_t usart);
+void usart_disable_rx_inversion(uint32_t usart);
+void usart_enable_halfduplex(uint32_t usart);
+void usart_disable_halfduplex(uint32_t usart);
+
+void usart_set_rx_timeout_value(uint32_t usart, uint32_t value);
+void usart_enable_rx_timeout(uint32_t usart);
+void usart_disable_rx_timeout(uint32_t usart);
+void usart_enable_rx_timeout_interrupt(uint32_t usart);
+void usart_disable_rx_timeout_interrupt(uint32_t usart);
+
+END_DECLS
+
+#endif
+/** @cond */
+#else
+#warning "usart_common_v2.h should not be included directly, only via usart.h"
+#endif
+/** @endcond */