summaryrefslogtreecommitdiffstats
path: root/libopencm3/include/libopencm3/stm32/f0
diff options
context:
space:
mode:
Diffstat (limited to 'libopencm3/include/libopencm3/stm32/f0')
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/adc.h352
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/cec.h125
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/comparator.h124
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/crc.h89
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/crs.h131
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/dac.h117
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/dma.h37
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/doc-stm32f0.h32
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/exti.h40
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/flash.h116
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/gpio.h75
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/i2c.h256
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/irq.json39
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/iwdg.h70
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/memorymap.h116
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/pwr.h67
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/rcc.h524
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/rtc.h36
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/spi.h36
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/syscfg.h110
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/timer.h37
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/tsc.h159
-rw-r--r--libopencm3/include/libopencm3/stm32/f0/usart.h343
23 files changed, 3031 insertions, 0 deletions
diff --git a/libopencm3/include/libopencm3/stm32/f0/adc.h b/libopencm3/include/libopencm3/stm32/f0/adc.h
new file mode 100644
index 0000000..c76fefb
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/adc.h
@@ -0,0 +1,352 @@
+/** @defgroup adc_defines ADC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Analog to Digital
+ * Converter</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_ADC_H
+#define LIBOPENCM3_ADC_H
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/** @defgroup adc_reg_base ADC register base addresses
+ * @ingroup adc_defines
+ *
+ *@{*/
+#define ADC ADC_BASE
+#define ADC1 ADC_BASE/* for API compatibility */
+/**@}*/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+/* ADC interrupt and status register */
+#define ADC_ISR(base) MMIO32(base + 0x00)
+#define ADC1_ISR ADC_ISR(ADC)
+
+/* Interrupt Enable Register */
+#define ADC_IER(base) MMIO32(base + 0x04)
+#define ADC1_IER ADC_IER(ADC)
+
+/* Control Register */
+#define ADC_CR(base) MMIO32(base + 0x08)
+#define ADC1_CR ADC_CR(ADC)
+
+
+/* Configuration Register 1 */
+#define ADC_CFGR1(base) MMIO32(base + 0x0C)
+#define ADC1_CFGR1 ADC_CFGR1(ADC)
+
+
+/* Configuration Register 2 */
+#define ADC_CFGR2(base) MMIO32(base + 0x10)
+#define ADC1_CFGR2 ADC_CFGR2(ADC)
+
+
+/* Sample Time Register 1 */
+#define ADC_SMPR(base) MMIO32(base + 0x14)
+#define ADC1_SMPR ADC_SMPR(ADC)
+
+
+/* Watchdog Threshold Register */
+#define ADC_TR(base) MMIO32(base + 0x20)
+#define ADC1_TR ADC_TR(ADC)
+
+
+/* Channel Select Register */
+#define ADC_CHSELR(base) MMIO32(base + 0x28)
+#define ADC1_CHSELR ADC_CHSELR(ADC)
+
+
+/* Regular Data Register */
+#define ADC_DR(base) MMIO32(base + 0x40)
+#define ADC1_DR ADC_DR(ADC)
+
+
+/* Regular Data Register */
+#define ADC_CCR MMIO32(ADC_BASE + 0x308)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* ADC_ISR Values -----------------------------------------------------------*/
+
+#define ADC_ISR_AWD (1 << 7)
+#define ADC_ISR_OVR (1 << 4)
+#define ADC_ISR_EOSEQ (1 << 3)
+#define ADC_ISR_EOC (1 << 2)
+#define ADC_ISR_EOSMP (1 << 1)
+#define ADC_ISR_ADRDY (1 << 0)
+
+/* ADC_IER Values -----------------------------------------------------------*/
+
+#define ADC_IER_AWDIE (1 << 7)
+#define ADC_IER_OVRIE (1 << 4)
+#define ADC_IER_EOSEQIE (1 << 3)
+#define ADC_IER_EOCIE (1 << 2)
+#define ADC_IER_EOSMPIE (1 << 1)
+#define ADC_IER_ADRDYIE (1 << 0)
+
+/* ADC_CR Values ------------------------------------------------------------*/
+
+#define ADC_CR_ADCAL (1 << 31)
+#define ADC_CR_ADSTP (1 << 4)
+#define ADC_CR_ADSTART (1 << 2)
+#define ADC_CR_ADDIS (1 << 1)
+#define ADC_CR_ADEN (1 << 0)
+
+/* ADC_CFGR1 Values ---------------------------------------------------------*/
+
+#define ADC_CFGR1_AWDCH_SHIFT 26
+#define ADC_CFGR1_AWDCH (0x1F << ADC_CFGR1_AWDCH_SHIFT)
+#define ADC_CFGR1_AWDCH_VAL(x) ((x) << ADC_CFGR1_AWDCH_SHIFT)
+
+#define ADC_CFGR1_AWDEN (1 << 23)
+#define ADC_CFGR1_AWDSGL (1 << 22)
+#define ADC_CFGR1_DISCEN (1 << 16)
+#define ADC_CFGR1_AUTOFF (1 << 15)
+#define ADC_CFGR1_WAIT (1 << 14)
+#define ADC_CFGR1_CONT (1 << 13)
+#define ADC_CFGR1_OVRMOD (1 << 12)
+
+#define ADC_CFGR1_EXTEN_SHIFT 10
+#define ADC_CFGR1_EXTEN (3 << ADC_CFGR1_EXTEN_SHIFT)
+#define ADC_CFGR1_EXTEN_DISABLE (0 << ADC_CFGR1_EXTEN_SHIFT)
+#define ADC_CFGR1_EXTEN_RISING (1 << ADC_CFGR1_EXTEN_SHIFT)
+#define ADC_CFGR1_EXTEN_FALLING (2 << ADC_CFGR1_EXTEN_SHIFT)
+#define ADC_CFGR1_EXTEN_BOTH (3 << ADC_CFGR1_EXTEN_SHIFT)
+
+#define ADC_CFGR1_EXTSEL_SHIFT 6
+#define ADC_CFGR1_EXTSEL (7 << ADC_CFGR1_EXTSEL_SHIFT)
+#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
+
+#define ADC_CFGR1_ALIGN (1 << 5)
+
+#define ADC_CFGR1_RES_SHIFT 3
+#define ADC_CFGR1_RES (3 << ADC_CFGR1_RES_SHIFT)
+#define ADC_CFGR1_RES_12_BIT (0 << ADC_CFGR1_RES_SHIFT)
+#define ADC_CFGR1_RES_10_BIT (1 << ADC_CFGR1_RES_SHIFT)
+#define ADC_CFGR1_RES_8_BIT (2 << ADC_CFGR1_RES_SHIFT)
+#define ADC_CFGR1_RES_6_BIT (3 << ADC_CFGR1_RES_SHIFT)
+
+#define ADC_CFGR1_SCANDIR (1 << 2)
+#define ADC_CFGR1_DMACFG (1 << 1)
+#define ADC_CFGR1_DMAEN (1 << 0)
+
+/* ADC_CFGR2 Values ---------------------------------------------------------*/
+
+#define ADC_CFGR2_CKMODE_SHIFT 30
+#define ADC_CFGR2_CKMODE (3 << ADC_CFGR2_CKMODE_SHIFT)
+#define ADC_CFGR2_CKMODE_CK_ADC (0 << ADC_CFGR2_CKMODE_SHIFT)
+#define ADC_CFGR2_CKMODE_PCLK_DIV2 (1 << ADC_CFGR2_CKMODE_SHIFT)
+#define ADC_CFGR2_CKMODE_PCLK_DIV4 (2 << ADC_CFGR2_CKMODE_SHIFT)
+
+/* ADC_SMPR Values ----------------------------------------------------------*/
+
+#define ADC_SMPR_SMP_SHIFT 0
+#define ADC_SMPR_SMP (7 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_001DOT5 (0 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_007DOT5 (1 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_013DOT5 (2 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_028DOT5 (3 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_041DOT5 (4 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_055DOT5 (5 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_071DOT5 (6 << ADC_SMPR_SMP_SHIFT)
+#define ADC_SMPR_SMP_239DOT5 (7 << ADC_SMPR_SMP_SHIFT)
+
+/* ADC_TR Values ------------------------------------------------------------*/
+
+#define ADC_TR_LT_SHIFT 0
+#define ADC_TR_LT (0xFFF << ADC_TR_LT_SHIFT)
+#define ADC_TR_LT_VAL(x) ((x) << ADC_TR_LT_SHIFT)
+
+#define ADC_TR_HT_SHIFT 16
+#define ADC_TR_HT (0xFFF << ADC_TR_HT_SHIFT)
+#define ADC_TR_HT_VAL(x) ((x) << ADC_TR_HT_SHIFT)
+
+/* ADC_CHSELR Values --------------------------------------------------------*/
+
+#define ADC_CHSELR_CHSEL(x) (1 << (x))
+
+/* ADC_DR Values ------------------------------------------------------------*/
+
+#define ADC_DR_DATA 0xFFFF
+
+/* ADC_CCR Values -----------------------------------------------------------*/
+
+#define ADC_CCR_VBATEN (1 << 24)
+#define ADC_CCR_TSEN (1 << 23)
+#define ADC_CCR_VREFEN (1 << 22)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/** @defgroup adc_api_res ADC resolutions
+ * @ingroup adc_defines
+ *
+ *@{*/
+#define ADC_RESOLUTION_12BIT ADC_CFGR1_RES_12_BIT
+#define ADC_RESOLUTION_10BIT ADC_CFGR1_RES_10_BIT
+#define ADC_RESOLUTION_8BIT ADC_CFGR1_RES_8_BIT
+#define ADC_RESOLUTION_6BIT ADC_CFGR1_RES_6_BIT
+/**@}*/
+
+/** @defgroup adc_api_smptime ADC sampling time
+ * @ingroup adc_defines
+ *
+ *@{*/
+#define ADC_SMPTIME_001DOT5 ADC_SMPR_SMP_001DOT5
+#define ADC_SMPTIME_007DOT5 ADC_SMPR_SMP_007DOT5
+#define ADC_SMPTIME_013DOT5 ADC_SMPR_SMP_013DOT5
+#define ADC_SMPTIME_028DOT5 ADC_SMPR_SMP_028DOT5
+#define ADC_SMPTIME_041DOT5 ADC_SMPR_SMP_041DOT5
+#define ADC_SMPTIME_055DOT5 ADC_SMPR_SMP_055DOT5
+#define ADC_SMPTIME_071DOT5 ADC_SMPR_SMP_071DOT5
+#define ADC_SMPTIME_239DOT5 ADC_SMPR_SMP_239DOT5
+/**@}*/
+
+/** @defgroup adc_api_clksource ADC clock source
+ * @ingroup adc_defines
+ *
+ *@{*/
+#define ADC_CLKSOURCE_ADC ADC_CFGR2_CKMODE_CK_ADC
+#define ADC_CLKSOURCE_PCLK_DIV2 ADC_CFGR2_CKMODE_PCLK_DIV2
+#define ADC_CLKSOURCE_PCLK_DIV4 ADC_CFGR2_CKMODE_PCLK_DIV4
+/**@}*/
+
+/** @defgroup adc_channel ADC Channel Numbers
+ * @ingroup adc_defines
+ *
+ *@{*/
+#define ADC_CHANNEL0 0x00
+#define ADC_CHANNEL1 0x01
+#define ADC_CHANNEL2 0x02
+#define ADC_CHANNEL3 0x03
+#define ADC_CHANNEL4 0x04
+#define ADC_CHANNEL5 0x05
+#define ADC_CHANNEL6 0x06
+#define ADC_CHANNEL7 0x07
+#define ADC_CHANNEL8 0x08
+#define ADC_CHANNEL9 0x09
+#define ADC_CHANNEL10 0x0A
+#define ADC_CHANNEL11 0x0B
+#define ADC_CHANNEL12 0x0C
+#define ADC_CHANNEL13 0x0D
+#define ADC_CHANNEL14 0x0E
+#define ADC_CHANNEL15 0x0F
+#define ADC_CHANNEL_TEMP 0x10
+#define ADC_CHANNEL_VREF 0x11
+#define ADC_CHANNEL_VBAT 0x12
+/**@}*/
+
+/** @defgroup adc_api_opmode ADC Operation Modes
+ * @ingroup adc_defines
+ *
+ *@{*/
+enum adc_opmode {
+ ADC_MODE_SEQUENTIAL,
+ ADC_MODE_SCAN,
+ ADC_MODE_SCAN_INFINITE,
+};
+/**@}*/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+
+BEGIN_DECLS
+
+/* Operation mode API */
+void adc_set_continuous_conversion_mode(uint32_t adc);
+void adc_set_single_conversion_mode(uint32_t adc);
+void adc_enable_discontinuous_mode(uint32_t adc);
+void adc_disable_discontinuous_mode(uint32_t adc);
+void adc_set_operation_mode(uint32_t adc, enum adc_opmode opmode);
+
+/* Trigger API */
+void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger,
+ uint32_t polarity);
+void adc_disable_external_trigger_regular(uint32_t adc);
+
+/* Conversion API */
+void adc_start_conversion_regular(uint32_t adc);
+bool adc_eoc(uint32_t adc);
+uint32_t adc_read_regular(uint32_t adc);
+
+/* Interrupt configuration */
+void adc_enable_watchdog_interrupt(uint32_t adc);
+void adc_disable_watchdog_interrupt(uint32_t adc);
+bool adc_get_watchdog_flag(uint32_t adc);
+void adc_clear_watchdog_flag(uint32_t adc);
+void adc_enable_overrun_interrupt(uint32_t adc);
+void adc_disable_overrun_interrupt(uint32_t adc);
+bool adc_get_overrun_flag(uint32_t adc);
+void adc_clear_overrun_flag(uint32_t adc);
+void adc_enable_eoc_sequence_interrupt(uint32_t adc);
+void adc_disable_eoc_sequence_interrupt(uint32_t adc);
+bool adc_get_eoc_sequence_flag(uint32_t adc);
+void adc_enable_eoc_interrupt(uint32_t adc);
+void adc_disable_eoc_interrupt(uint32_t adc);
+
+/* Basic configuration */
+void adc_power_off(uint32_t adc);
+void adc_power_on(uint32_t adc);
+void adc_set_clk_source(uint32_t adc, uint32_t source);
+void adc_set_regular_sequence(uint32_t adc, uint8_t length, uint8_t channel[]);
+void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time);
+void adc_set_resolution(uint32_t adc, uint16_t resolution);
+void adc_set_left_aligned(uint32_t adc);
+void adc_set_right_aligned(uint32_t adc);
+void adc_enable_dma(uint32_t adc);
+void adc_disable_dma(uint32_t adc);
+void adc_enable_temperature_sensor(void);
+void adc_disable_temperature_sensor(void);
+void adc_enable_vref_sensor(void);
+void adc_disable_vref_sensor(void);
+void adc_enable_vbat_sensor(void);
+void adc_disable_vbat_sensor(void);
+void adc_calibrate_start(uint32_t adc);
+void adc_calibrate_wait_finish(uint32_t adc);
+
+/* Analog Watchdog */
+void adc_enable_analog_watchdog_on_all_channels(uint32_t adc);
+void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t chan);
+void adc_disable_analog_watchdog(uint32_t adc);
+void adc_set_watchdog_high_threshold(uint32_t adc, uint8_t threshold);
+void adc_set_watchdog_low_threshold(uint32_t adc, uint8_t threshold);
+
+END_DECLS
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/cec.h b/libopencm3/include/libopencm3/stm32/f0/cec.h
new file mode 100644
index 0000000..2193a97
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/cec.h
@@ -0,0 +1,125 @@
+/** @defgroup CEC_defines CEC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx HDMI-CEC</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_CEC_H
+#define LIBOPENCM3_CEC_H
+/**@{*/
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define CEC CEC_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define CEC_CR MMIO32(CEC_BASE + 0x00)
+#define CEC_CFGR MMIO32(CEC_BASE + 0x04)
+#define CEC_TXDR MMIO32(CEC_BASE + 0x08)
+#define CEC_RXDR MMIO32(CEC_BASE + 0x0c)
+#define CEC_ISR MMIO32(CEC_BASE + 0x10)
+#define CEC_IER MMIO32(CEC_BASE + 0x14)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* CEC_CR Values ------------------------------------------------------------*/
+
+#define CEC_CR_TXEOM (1 << 2)
+#define CEC_CR_TXSOM (1 << 1)
+#define CEC_CR_CECEN (1 << 0)
+
+/* CEC_CFGR Values ----------------------------------------------------------*/
+
+#define CEC_CFGR_LSTN (1 << 31)
+
+#define CEC_CFGR_OAR_SHIFT 16
+#define CEC_CFGR_OAR (0x3FFF << CEC_CFGR_OAR_SHIFT)
+
+#define CEC_CFGR_SFTOPT (1 << 8)
+#define CEC_CFGR_BRDNOGEN (1 << 7)
+#define CEC_CFGR_LBPEGEN (1 << 6)
+#define CEC_CFGR_BREGEN (1 << 5)
+#define CEC_CFGR_BRESTP (1 << 4)
+#define CEC_CFGR_RXTOL (1 << 3)
+
+#define CEC_CFGR_SFT_SHIFT 0
+#define CEC_CFGR_SFT (7 >> CEC_CFGR_SFT_SHIFT)
+
+/* CEC_ISR Values -----------------------------------------------------------*/
+
+#define CEC_ISR_TXACKE (1 << 12)
+#define CEC_ISR_TXERR (1 << 11)
+#define CEC_ISR_TXUDR (1 << 10)
+#define CEC_ISR_TXEND (1 << 9)
+#define CEC_ISR_TXBR (1 << 8)
+#define CEC_ISR_ARBLST (1 << 7)
+#define CEC_ISR_RXACKE (1 << 6)
+#define CEC_ISR_LBPE (1 << 5)
+#define CEC_ISR_SBPE (1 << 4)
+#define CEC_ISR_BRE (1 << 3)
+#define CEC_ISR_RXOVR (1 << 2)
+#define CEC_ISR_RXEND (1 << 1)
+#define CEC_ISR_RXBR (1 << 0)
+
+/* CEC_IER Values -----------------------------------------------------------*/
+
+#define CEC_IER_TXACKIE (1 << 12)
+#define CEC_IER_TXERRIE (1 << 11)
+#define CEC_IER_TXUDRIE (1 << 10)
+#define CEC_IER_TXENDIE (1 << 9)
+#define CEC_IER_TXBRIE (1 << 8)
+#define CEC_IER_ARBLSTIE (1 << 7)
+#define CEC_IER_RXACKIE (1 << 6)
+#define CEC_IER_LBPEIE (1 << 5)
+#define CEC_IER_SBPEIE (1 << 4)
+#define CEC_IER_BREIE (1 << 3)
+#define CEC_IER_RXOVRIE (1 << 2)
+#define CEC_IER_RXENDIE (1 << 1)
+#define CEC_IER_RXBRIE (1 << 0)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/comparator.h b/libopencm3/include/libopencm3/stm32/f0/comparator.h
new file mode 100644
index 0000000..78db9cf
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/comparator.h
@@ -0,0 +1,124 @@
+/** @defgroup comp_defines COMP Defines
+ *
+ * @brief <b>libopencm3 Defined Constants and Types for the STM32F0xx
+ * Comparator module</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 29 Jun 2013
+ *
+ *LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_COMP_H
+#define LIBOPENCM3_COMP_H
+/**@{*/
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define COMP1 0
+#define COMP2 1
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define COMP_CSR(i) MMIO16(SYSCFG_COMP_BASE + 0x1c + (i)*2)
+#define COMP_CSR1 COMP_CSR(COMP1)
+#define COMP_CSR2 COMP_CSR(COMP2)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* COMP_CSR Values ----------------------------------------------------------*/
+
+#define COMP_CSR_LOCK (1 << 15)
+#define COMP_CSR_OUT (1 << 14)
+
+#define COMP_CSR_HYST_SHIFT 12
+#define COMP_CSR_HYST (3 << COMP_CSR_HYST_SHIFT)
+#define COMP_CSR_HYST_NO (0 << COMP_CSR_HYST_SHIFT)
+#define COMP_CSR_HYST_LOW (1 << COMP_CSR_HYST_SHIFT)
+#define COMP_CSR_HYST_MED (2 << COMP_CSR_HYST_SHIFT)
+#define COMP_CSR_HYST_HIGH (3 << COMP_CSR_HYST_SHIFT)
+
+#define COMP_CSR_POL (1 << 11)
+
+#define COMP_CSR_OUTSEL_SHIFT 8
+#define COMP_CSR_OUTSEL (7 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_NONE (0 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM1_BRK (1 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM1_IC1 (2 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM1_OCRCLR (3 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM2_IC4 (4 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM2_OCRCLR (5 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM3_IC1 (6 << COMP_CSR_OUTSEL_SHIFT)
+#define COMP_CSR_OUTSEL_TIM3_OCRCLR (7 << COMP_CSR_OUTSEL_SHIFT)
+
+#define COMP_CSR_WINDWEN (1 << 23)
+
+#define COMP_CSR_INSEL_SHIFT 4
+#define COMP_CSR_INSEL (7 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_1_4_VREFINT (0 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_2_4_VREFINT (1 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_3_4_VREFINT (2 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_4_4_VREFINT (3 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_VREFINT (3 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_INM4 (4 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_INM5 (5 << COMP_CSR_INSEL_SHIFT)
+#define COMP_CSR_INSEL_INM6 (6 << COMP_CSR_INSEL_SHIFT)
+
+#define COMP_CSR_SPEED_SHIFT 2
+#define COMP_CSR_SPEED (3 << COMP_CSR_SPEED_SHIFT)
+#define COMP_CSR_SPEED_HIGH (0 << COMP_CSR_SPEED_SHIFT)
+#define COMP_CSR_SPEED_MED (1 << COMP_CSR_SPEED_SHIFT)
+#define COMP_CSR_SPEED_LOW (2 << COMP_CSR_SPEED_SHIFT)
+#define COMP_CSR_SPEED_VERYLOW (3 << COMP_CSR_SPEED_SHIFT)
+
+#define COMP_CSR_SW1 (1 << 1)
+#define COMP_CSR_EN (1 << 0)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+void comp_enable(uint8_t id);
+void comp_disable(uint8_t id);
+void comp_select_input(uint8_t id, uint32_t input);
+void comp_select_output(uint8_t id, uint32_t output);
+void comp_select_hyst(uint8_t id, uint32_t hyst);
+void comp_select_speed(uint8_t id, uint32_t speed);
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/crc.h b/libopencm3/include/libopencm3/stm32/f0/crc.h
new file mode 100644
index 0000000..34d8a89
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/crc.h
@@ -0,0 +1,89 @@
+/** @defgroup crc_defines CRC Defines
+ *
+ * @brief <b>libopencm3 Defined Constants and Types for the STM32F1xx CRC
+ * Generator </b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 29 Jun 2013
+ *
+ *LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_CRC_H
+#define LIBOPENCM3_CRC_H
+/**@{*/
+
+#include <libopencm3/stm32/common/crc_common_all.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+/* Initial CRC Value */
+#define CRC_INIT MMIO32(CRC_BASE + 0x10)
+
+/* CRC Polynomial */
+#define CRC_POL MMIO32(CRC_BASE + 0x14)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+#define CRC_CR_REV_OUT (1 << 7)
+
+#define CRC_CR_REV_IN_SHIFT 5
+#define CRC_CR_REV_IN (3 << CRC_CR_REV_IN_SHIFT)
+#define CRC_CR_REV_IN_NONE (0 << CRC_CR_REV_IN_SHIFT)
+#define CRC_CR_REV_IN_BYTE (1 << CRC_CR_REV_IN_SHIFT)
+#define CRC_CR_REV_IN_HALF (2 << CRC_CR_REV_IN_SHIFT)
+#define CRC_CR_REV_IN_WORD (3 << CRC_CR_REV_IN_SHIFT)
+
+#define CRC_CR_POLYSIZE_SHIFT 3
+#define CRC_CR_POLYSIZE (3 << CRC_CR_POLYSIZE_SHIFT)
+#define CRC_CR_POLYSIZE_32BIT (0 << CRC_CR_POLYSIZE_SHIFT)
+#define CRC_CR_POLYSIZE_16BIT (1 << CRC_CR_POLYSIZE_SHIFT)
+#define CRC_CR_POLYSIZE_8BIT (2 << CRC_CR_POLYSIZE_SHIFT)
+#define CRC_CR_POLYSIZE_7BIT (3 << CRC_CR_POLYSIZE_SHIFT)
+
+/* Default polynomial */
+#define CRC_POL_DEFAULT 0x04C11DB7
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/crs.h b/libopencm3/include/libopencm3/stm32/f0/crs.h
new file mode 100644
index 0000000..b65610c
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/crs.h
@@ -0,0 +1,131 @@
+/** @defgroup CRS_defines CRS Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Clock Recovery</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 5 Feb 2014
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2014 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_CRS_H
+#define LIBOPENCM3_CRS_H
+/**@{*/
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define CRS CRS_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define CRS_CR MMIO32(CRS_BASE + 0x00)
+#define CRS_CFGR MMIO32(CRS_BASE + 0x04)
+#define CRS_ISR MMIO32(CRS_BASE + 0x08)
+#define CRS_ICR MMIO32(CRS_BASE + 0x0c)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* CEC_CR Values ------------------------------------------------------------*/
+
+#define CRS_CR_TRIM_SHIFT 8
+#define CRS_CR_TRIM (0x3F << CRS_CR_TRIM_SHIFT)
+
+#define CRS_CR_SWSYNC (1 << 7)
+#define CRS_CR_AUTOTRIMEN (1 << 6)
+#define CRS_CR_CEN (1 << 5)
+#define CRS_CR_ESYNCIE (1 << 3)
+#define CRS_CR_ERRIE (1 << 2)
+#define CRS_CR_SYNCWARNIE (1 << 1)
+#define CRS_CR_SYNCOKIE (1 << 0)
+
+/* CEC_CFGR Values ----------------------------------------------------------*/
+
+#define CRS_CFGR_SYNCPOL (1 << 31)
+
+#define CRS_CFGR_SYNCSRC_SHIFT 28
+#define CRS_CFGR_SYNCSRC (3 << CRS_CFGR_SYNCSRC_SHIFT)
+#define CRS_CFGR_SYNCSRC_GPIO (0 << CRS_CFGR_SYNCSRC_SHIFT)
+#define CRS_CFGR_SYNCSRC_LSE (1 << CRS_CFGR_SYNCSRC_SHIFT)
+#define CRS_CFGR_SYNCSRC_USB_SOF (2 << CRS_CFGR_SYNCSRC_SHIFT)
+
+#define CRS_CFGR_SYNCDIV_SHIFT 24
+#define CRS_CFGR_SYNCDIV (7 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_NODIV (0 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV2 (1 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV4 (2 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV8 (3 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV16 (4 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV32 (5 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV64 (6 << CRS_CFGR_SYNCDIV_SHIFT)
+#define CRS_CFGR_SYNCDIV_DIV128 (7 << CRS_CFGR_SYNCDIV_SHIFT)
+
+#define CRS_CFGR_FELIM_SHIFT 16
+#define CRS_CFGR_FELIM (0xFF << CRS_CFGR_FELIM_SHIFT)
+#define CRS_CFGR_FELIM_VAL(x) ((x) << CRS_CFGR_FELIM_SHIFT)
+
+#define CRS_CFGR_RELOAD_SHIFT 0
+#define CRS_CFGR_RELOAD (0xFFFF << CRS_CFGR_RELOAD_SHIFT)
+#define CRS_CFGR_RELOAD_VAL(x) ((x) << CRS_CFGR_RELOAD_SHIFT)
+
+/* CEC_ISR Values -----------------------------------------------------------*/
+
+#define CRS_ISR_FECAP_SHIFT 16
+#define CRS_ISR_FECAP (0xFFFF << CRS_ISR_FECAP_SHIFT)
+
+#define CRS_ISR_FEDIR (1 << 15)
+#define CRS_ISR_TRIMOVF (1 << 10)
+#define CRS_ISR_SYNCMISS (1 << 9)
+#define CRS_ISR_SYNCERR (1 << 8)
+#define CRS_ISR_ESYNCF (1 << 3)
+#define CRS_ISR_ERRF (1 << 2)
+#define CRS_ISR_SYNCWARNF (1 << 1)
+#define CRS_ISR_SYNCOOKF (1 << 0)
+
+/* CEC_ICR Values -----------------------------------------------------------*/
+
+#define CRS_ICR_ESYNCC (1 << 3)
+#define CRS_ICR_ERRC (1 << 2)
+#define CRS_ICR_SYNCWARNC (1 << 1)
+#define CRS_ICR_SYNCOKC (1 << 0)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/dac.h b/libopencm3/include/libopencm3/stm32/f0/dac.h
new file mode 100644
index 0000000..7f54484
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/dac.h
@@ -0,0 +1,117 @@
+/** @defgroup dac_defines DAC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Digital to Analog
+ * Converter</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_DAC_H
+#define LIBOPENCM3_DAC_H
+
+#include <libopencm3/stm32/common/dac_common_all.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define DAC DAC_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define DAC_CR MMIO32(DAC_BASE + 0x00)
+#define DAC_SWTRIGR MMIO32(DAC_BASE + 0x04)
+#define DAC_DHR12R1 MMIO32(DAC_BASE + 0x08)
+#define DAC_DHR12L1 MMIO32(DAC_BASE + 0x0C)
+#define DAC_DHR8R1 MMIO32(DAC_BASE + 0x10)
+#define DAC_DOR1 MMIO32(DAC_BASE + 0x2C)
+#define DAC_SR MMIO32(DAC_BASE + 0x34)
+
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* DAC_CR Values ------------------------------------------------------------*/
+
+#define DAC_CR_DMAUDRIE1 (1 << 13)
+#define DAC_CR_DMAEN1 (1 << 12)
+
+#define DAC_CR_TSEL1_SHIFT 3
+#define DAC_CR_TSEL1 (7 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM6_TRGO (0 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM8_TRGO (1 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM7_TRGO (2 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM5_TRGO (3 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM2_TRGO (4 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_TIM4_TRGO (5 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_EXT_9 (6 << DAC_CR_TSEL1_SHIFT)
+#define DAC_CR_TSEL1_SWTRG (7 << DAC_CR_TSEL1_SHIFT)
+
+#define DAC_CR_TEN1 (1 << 2)
+#define DAC_CR_BOFF1 (1 << 1)
+#define DAC_CR_EN1 (1 << 0)
+
+/* DAC_SWTRIGR Values -------------------------------------------------------*/
+
+#define DAC_SWTRIGR_SWTRIG1 (1 << 0)
+
+/* DAC_DHR12R1 Values -------------------------------------------------------*/
+
+#define DAC_DHR12R1_DACC1DHR 0xFFF
+
+/* DAC_DHR12L1 Values -------------------------------------------------------*/
+
+#define DAC_DHR12L1_DACC1DHR (0xFFF << 4)
+
+/* DAC_DHR8R1 Values --------------------------------------------------------*/
+
+#define DAC_DHR8R1_DACC1DHR 0xFF
+
+/* DAC_DOR1 Values ----------------------------------------------------------*/
+
+#define DAC_DOR1_DACC1DOR 0xFFF
+
+/* DAC_SR Values ------------------------------------------------------------*/
+
+#define DAC_SR_DMAUDR1 (1 << 13)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/dma.h b/libopencm3/include/libopencm3/stm32/f0/dma.h
new file mode 100644
index 0000000..42b4687
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/dma.h
@@ -0,0 +1,37 @@
+/** @defgroup dma_defines DMA Defines
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @brief Defined Constants and Types for the STM32F0xx DMA Controller
+ *
+ * @version 1.0.0
+ *
+ * @date 10 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_DMA_H
+#define LIBOPENCM3_DMA_H
+
+#include <libopencm3/stm32/common/dma_common_l1f013.h>
+
+#endif
+
diff --git a/libopencm3/include/libopencm3/stm32/f0/doc-stm32f0.h b/libopencm3/include/libopencm3/stm32/f0/doc-stm32f0.h
new file mode 100644
index 0000000..fc26c50
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/doc-stm32f0.h
@@ -0,0 +1,32 @@
+/** @mainpage libopencm3 STM32F0
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * API documentation for ST Microelectronics STM32F0 Cortex M0 series.
+ *
+ * LGPL License Terms @ref lgpl_license
+*/
+
+/** @defgroup STM32F0xx STM32F0xx
+ * Libraries for ST Microelectronics STM32F0xx series.
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/** @defgroup STM32F0xx_defines STM32F0xx Defines
+ *
+ * @brief Defined Constants and Types for the STM32F0xx series
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
diff --git a/libopencm3/include/libopencm3/stm32/f0/exti.h b/libopencm3/include/libopencm3/stm32/f0/exti.h
new file mode 100644
index 0000000..3a99f5b
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/exti.h
@@ -0,0 +1,40 @@
+/** @defgroup exti_defines EXTI Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx External Interrupts
+ * </b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_EXTI_H
+#define LIBOPENCM3_EXTI_H
+/**@{*/
+
+#include <libopencm3/stm32/common/exti_common_all.h>
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/flash.h b/libopencm3/include/libopencm3/stm32/f0/flash.h
new file mode 100644
index 0000000..58e9ea6
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/flash.h
@@ -0,0 +1,116 @@
+/** @defgroup flash_defines FLASH Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Flash memory</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @author @htmlonly &copy; @endhtmlonly 2013
+ * Frantisek Burian <BuFran@seznam.cz>
+ *
+ * @date 14 January 2014
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_FLASH_H
+#define LIBOPENCM3_FLASH_H
+/**@{*/
+
+#include <libopencm3/stm32/common/flash_common_f01.h>
+
+/* --- FLASH_OPTION values ------------------------------------------------- */
+
+/** @defgroup flash_options Option Byte Addresses
+@ingroup flash_defines
+@{*/
+#define FLASH_OPTION_BYTE_0 FLASH_OPTION_BYTE(0)
+#define FLASH_OPTION_BYTE_1 FLASH_OPTION_BYTE(1)
+#define FLASH_OPTION_BYTE_2 FLASH_OPTION_BYTE(2)
+#define FLASH_OPTION_BYTE_3 FLASH_OPTION_BYTE(3)
+#define FLASH_OPTION_BYTE_4 FLASH_OPTION_BYTE(4)
+#define FLASH_OPTION_BYTE_5 FLASH_OPTION_BYTE(5)
+/**@}*/
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* --- FLASH_ACR values ---------------------------------------------------- */
+
+/** @defgroup flash_latency FLASH Wait States
+@ingroup flash_defines
+@{*/
+#define FLASH_ACR_LATENCY_000_024MHZ 0
+#define FLASH_ACR_LATENCY_024_048MHZ 1
+#define FLASH_ACR_LATENCY_0WS 0
+#define FLASH_ACR_LATENCY_1WS 1
+/**@}*/
+
+/* --- FLASH_SR values ----------------------------------------------------- */
+
+#define FLASH_SR_EOP (1 << 5)
+#define FLASH_SR_WRPRTERR (1 << 4)
+#define FLASH_SR_PGERR (1 << 2)
+#define FLASH_SR_BSY (1 << 0)
+
+/* --- FLASH_CR values ----------------------------------------------------- */
+
+#define FLASH_CR_OBL_LAUNCH (1 << 13)
+
+/* --- FLASH_OBR values ---------------------------------------------------- */
+
+#define FLASH_OBR_DATA1_SHIFT 24
+#define FLASH_OBR_DATA1 (0xFF << FLASH_OBR_DATA1_SHIFT)
+#define FLASH_OBR_DATA0_SHIFT 16
+#define FLASH_OBR_DATA0 (0xFF << FLASH_OBR_DATA0_SHIFT)
+
+#define FLASH_OBR_RAM_PARITY_CHECK (1 << 14)
+#define FLASH_OBR_VDDA_MONITOR (1 << 13)
+#define FLASH_OBR_NBOOT1 (1 << 12)
+#define FLASH_OBR_NRST_STDBY (1 << 10)
+#define FLASH_OBR_NRST_STOP (1 << 9)
+#define FLASH_OBR_WDG_SW (1 << 8)
+#define FLASH_OBR_RDPRT (3 << FLASH_OBR_RDPRT_SHIFT)
+#define FLASH_OBR_RDPRT_L0 (0 << FLASH_OBR_RDPRT_SHIFT)
+#define FLASH_OBR_RDPRT_L1 (1 << FLASH_OBR_RDPRT_SHIFT)
+#define FLASH_OBR_RDPRT_L2 (3 << FLASH_OBR_RDPRT_SHIFT)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/* Read protection option byte protection level setting */
+#define FLASH_RDP_L0 ((uint8_t)0xaa)
+#define FLASH_RDP_L1 ((uint8_t)0xf0) /* any value */
+#define FLASH_RDP_L2 ((uint8_t)0xcc)
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/gpio.h b/libopencm3/include/libopencm3/stm32/f0/gpio.h
new file mode 100644
index 0000000..cfef358
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/gpio.h
@@ -0,0 +1,75 @@
+/** @defgroup gpio_defines GPIO Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx General Purpose I/O</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 1 July 2012
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_GPIO_H
+#define LIBOPENCM3_GPIO_H
+
+#include <libopencm3/stm32/common/gpio_common_f24.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define GPIO_BRR(port) MMIO32(port + 0x24)
+#define GPIOA_BRR GPIO_BRR(GPIOA)
+#define GPIOB_BRR GPIO_BRR(GPIOB)
+#define GPIOC_BRR GPIO_BRR(GPIOC)
+#define GPIOD_BRR GPIO_BRR(GPIOD)
+#define GPIOF_BRR GPIO_BRR(GPIOF)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/** @defgroup gpio_speed GPIO Output Pin Speed
+@ingroup gpio_defines
+@{*/
+#define GPIO_OSPEED_LOW 0x0
+#define GPIO_OSPEED_MED 0x1
+#define GPIO_OSPEED_HIGH 0x3
+/**@}*/
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/i2c.h b/libopencm3/include/libopencm3/stm32/f0/i2c.h
new file mode 100644
index 0000000..06ff2dd
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/i2c.h
@@ -0,0 +1,256 @@
+/** @defgroup i2c_defines I2C Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx I2C</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_I2C_H
+#define LIBOPENCM3_I2C_H
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define I2C1 I2C1_BASE
+#define I2C2 I2C2_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define I2C_CR1(i2c_base) MMIO32(i2c_base + 0x00)
+#define I2C1_CR1 I2C_CR1(I2C1)
+#define I2C2_CR1 I2C_CR1(I2C2)
+
+#define I2C_CR2(i2c_base) MMIO32(i2c_base + 0x04)
+#define I2C1_CR2 I2C_CR2(I2C1)
+#define I2C2_CR2 I2C_CR2(I2C2)
+
+#define I2C_OAR1(i2c_base) MMIO32(i2c_base + 0x08)
+#define I2C1_OAR1 I2C_OAR1(I2C1)
+#define I2C2_OAR1 I2C_OAR1(I2C2)
+
+#define I2C_OAR2(i2c_base) MMIO32(i2c_base + 0x0c)
+#define I2C1_OAR2 I2C_OAR2(I2C1)
+#define I2C2_OAR2 I2C_OAR2(I2C2)
+
+#define I2C_TIMINGR(i2c_base) MMIO32(i2c_base + 0x10)
+#define I2C1_TIMINGR I2C_TIMINGR(I2C1)
+#define I2C2_TIMINGR I2C_TIMINGR(I2C2)
+
+#define I2C_TIMEOUTR(i2c_base) MMIO32(i2c_base + 0x14)
+#define I2C1_TIMEOUTR I2C_TIMEOUTR(I2C1)
+#define I2C2_TIMEOUTR I2C_TIMEOUTR(I2C2)
+
+#define I2C_ISR(i2c_base) MMIO32(i2c_base + 0x18)
+#define I2C1_ISR I2C_ISR(I2C1)
+#define I2C2_ISR I2C_ISR(I2C2)
+
+#define I2C_ICR(i2c_base) MMIO32(i2c_base + 0x1C)
+#define I2C1_ICR I2C_ICR(I2C1)
+#define I2C2_ICR I2C_ICR(I2C2)
+
+#define I2C_PECR(i2c_base) MMIO8(i2c_base + 0x20)
+#define I2C1_PECR I2C_PECR(I2C1)
+#define I2C2_PECR I2C_PECR(I2C2)
+
+#define I2C_RXDR(i2c_base) MMIO8(i2c_base + 0x24)
+#define I2C1_RXDR I2C_RXDR(I2C1)
+#define I2C2_RXDR I2C_RXDR(I2C2)
+
+#define I2C_TXDR(i2c_base) MMIO8(i2c_base + 0x28)
+#define I2C1_TXDR I2C_TXDR(I2C1)
+#define I2C2_TXDR I2C_TXDR(I2C2)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* I2C_CR1 values ---------------------------------------------------------- */
+
+#define I2C_CR1_PECEN (1 << 23)
+#define I2C_CR1_ALERTEN (1 << 22)
+#define I2C_CR1_SMBDEN (1 << 21)
+#define I2C_CR1_SMBHEN (1 << 20)
+#define I2C_CR1_GCEN (1 << 19)
+#define I2C_CR1_WUPEN (1 << 18)
+#define I2C_CR1_NOSTRETCH (1 << 17)
+#define I2C_CR1_SBC (1 << 16)
+#define I2C_CR1_RXDMAEN (1 << 15)
+#define I2C_CR1_TXDMAEN (1 << 14)
+#define I2C_CR1_ANFOFF (1 << 12)
+
+#define I2C_CR1_DNF_SHIFT 8
+#define I2C_CR1_DNF (0x0F << I2C_CR1_DNF_SHIFT)
+#define I2C_CR1_DNF_VAL(x) ((x) << I2C_CR1_DNF_SHIFT)
+
+#define I2C_CR1_ERRIE (1 << 7)
+#define I2C_CR1_TCIE (1 << 6)
+#define I2C_CR1_STOPIE (1 << 5)
+#define I2C_CR1_NACKIE (1 << 4)
+#define I2C_CR1_ADDRIE (1 << 3)
+#define I2C_CR1_RXIE (1 << 2)
+#define I2C_CR1_TXIE (1 << 1)
+#define I2C_CR1_PE (1 << 0)
+
+/* I2C_CR2 values ---------------------------------------------------------- */
+
+#define I2C_CR2_PECBYTE (1 << 26)
+#define I2C_CR2_AUTOEND (1 << 25)
+#define I2C_CR2_RELOAD (1 << 24)
+
+#define I2C_CR2_NBYTES_SHIFT 16
+#define I2C_CR2_NBYTES (0xFF << I2C_CR2_NBYTES_SHIFT)
+#define I2C_CR2_NBYTES_VAL(x) ((x) << I2C_CR2_NBYTES_SHIFT)
+
+#define I2C_CR2_NACK (1 << 15)
+#define I2C_CR2_STOP (1 << 14)
+#define I2C_CR2_START (1 << 13)
+#define I2C_CR2_HEAD10R (1 << 12)
+#define I2C_CR2_ADD10 (1 << 11)
+#define I2C_CR2_RD_WRN (1 << 10)
+
+#define I2C_CR2_SADD_SHIFT 0
+#define I2C_CR2_SADD (0x3FF << I2C_CR2_SADD_SHIFT)
+#define I2C_CR2_SADD_VAL(x) ((x) << I2C_CR2_SADD_SHIFT)
+
+/* I2C_OAR1 values --------------------------------------------------------- */
+
+#define I2C_OAR1_OA1EN (1 << 15)
+#define I2C_OAR1_OA1MODE (1 << 10)
+
+#define I2C_OAR1_OA1_SHIFT 0
+#define I2C_OAR1_OA1 (0x3FF << I2C_OAR1_OA1_SHIFT)
+#define I2C_OAR1_OA1_VAL(x) ((x) << I2C_OAR1_OA1_SHIFT)
+
+/* I2C_OAR2 values --------------------------------------------------------- */
+
+#define I2C_OAR2_OA1EN (1 << 15)
+
+#define I2C_OAR2_OA2MSK_SHIFT 8
+#define I2C_OAR2_OA2MSK (7 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_NOMASK (0 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_1_BIT (1 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_2_BIT (2 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_3_BIT (3 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_4_BIT (4 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_5_BIT (5 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_6_BIT (6 << I2C_OAR2_OA2MSK_SHIFT)
+#define I2C_OAR2_OA2MSK_ALL (7 << I2C_OAR2_OA2MSK_SHIFT)
+
+#define I2C_OAR2_OA2_SHIFT 1
+#define I2C_OAR2_OA2 (0x7F << I2C_OAR2_OA2_SHIFT)
+#define I2C_OAR2_OA2_VAL(x) ((x) << I2C_OAR2_OA2_SHIFT)
+
+/* I2C_TIMINGR values ------------------------------------------------------ */
+
+#define I2C_TIMINGR_PRESC_SHIFT 28
+#define I2C_TIMINGR_PRESC (0x0F << I2C_TIMINGR_PRESC_SHIFT)
+#define I2C_TIMINGR_PRESC_VAL(x) ((x) << I2C_TIMINGR_PRESC_SHIFT)
+
+#define I2C_TIMINGR_SCLDEL_SHIFT 20
+#define I2C_TIMINGR_SCLDEL (0x0F << I2C_TIMINGR_SCLDEL_SHIFT)
+#define I2C_TIMINGR_SCLDEL_VAL(x) ((x) << I2C_TIMINGR_SCLDEL_SHIFT)
+
+#define I2C_TIMINGR_SDADEL_SHIFT 16
+#define I2C_TIMINGR_SDADEL (0x0F << I2C_TIMINGR_SDADEL_SHIFT)
+#define I2C_TIMINGR_SDADEL_VAL(x) ((x) << I2C_TIMINGR_SDADEL_SHIFT)
+
+#define I2C_TIMINGR_SCLH_SHIFT 8
+#define I2C_TIMINGR_SCLH (0xFF << I2C_TIMINGR_SCLH_SHIFT)
+#define I2C_TIMINGR_SCLH_VAL(x) ((x) << I2C_TIMINGR_SCLH_SHIFT)
+
+#define I2C_TIMINGR_SCLL_SHIFT 0
+#define I2C_TIMINGR_SCLL (0xFF << I2C_TIMINGR_SCLL_SHIFT)
+#define I2C_TIMINGR_SCLL_VAL(x) ((x) << I2C_TIMINGR_SCLL_SHIFT)
+
+/* I2C_TIMEOUTR values ----------------------------------------------------- */
+
+#define I2C_TIMEOUTR_TETXEN (1 << 31)
+
+#define I2C_TIMEOUTR_TIMEOUTB_SHIFT 16
+#define I2C_TIMEOUTR_TIMEOUTB (0xFFF << I2C_TIMEOUTR_TIMEOUTB_SHIFT)
+#define I2C_TIMEOUTR_TIMEOUTB_VAL(x) ((x) << I2C_TIMEOUTR_TIMEOUTB_SHIFT)
+
+#define I2C_TIMEOUTR_TIMOUTEN (1 << 15)
+#define I2C_TIMEOUTR_TIDLE (1 << 12)
+
+#define I2C_TIMEOUTR_TIMEOUTA_SHIFT 0
+#define I2C_TIMEOUTR_TIMEOUTA (0xFFF << I2C_TIMEOUTR_TIMEOUTA_SHIFT)
+#define I2C_TIMEOUTR_TIMEOUTA_VAL(x) ((x) << I2C_TIMEOUTR_TIMEOUTA_SHIFT)
+
+/* I2C_ISR values ---------------------------------------------------------- */
+
+#define I2C_ISR_ADDCODE_SHIFT 17
+#define I2C_ISR_ADDCODE (0x7F << I2C_ISR_ADDCODE_SHIFT)
+#define I2C_ISR_ADDCODE_VAL(x) ((x) << I2C_ISR_ADDCODE_SHIFT)
+#define I2C_ISR_ADDCODE_VALG(reg) (((reg) & I2C_ISR_ADDCODE) >> \
+ I2C_ISR_ADDCODE_SHIFT)
+
+#define I2C_ISR_DIR (1 << 16)
+#define I2C_ISR_BUSY (1 << 15)
+#define I2C_ISR_ALERT (1 << 13)
+#define I2C_ISR_TIMEOUT (1 << 12)
+#define I2C_ISR_PECERR (1 << 11)
+#define I2C_ISR_OVR (1 << 10)
+#define I2C_ISR_ARLO (1 << 9)
+#define I2C_ISR_BERR (1 << 8)
+#define I2C_ISR_TCR (1 << 7)
+#define I2C_ISR_TC (1 << 6)
+#define I2C_ISR_STOPF (1 << 5)
+#define I2C_ISR_NACKF (1 << 4)
+#define I2C_ISR_ADDR (1 << 3)
+#define I2C_ISR_RXNE (1 << 2)
+#define I2C_ISR_TXIS (1 << 1)
+#define I2C_ISR_TXE (1 << 0)
+
+/* I2C_ICR values ---------------------------------------------------------- */
+
+#define I2C_ICR_ALERTCF (1 << 13)
+#define I2C_ICR_TIMEOUTCF (1 << 12)
+#define I2C_ICR_PECCF (1 << 11)
+#define I2C_ICR_OVRCF (1 << 10)
+#define I2C_ICR_ARLOCF (1 << 9)
+#define I2C_ICR_BERRCF (1 << 8)
+#define I2C_ICR_STOPCF (1 << 5)
+#define I2C_ICR_NACKCF (1 << 4)
+#define I2C_ICR_ADDRCF (1 << 3)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/irq.json b/libopencm3/include/libopencm3/stm32/f0/irq.json
new file mode 100644
index 0000000..8a407dc
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/irq.json
@@ -0,0 +1,39 @@
+{
+ "irqs": [
+ "wwdg",
+ "pvd",
+ "rtc",
+ "flash",
+ "rcc",
+ "exti0_1",
+ "exti2_3",
+ "exti4_15",
+ "tsc",
+ "dma1_channel1",
+ "dma1_channel2_3",
+ "dma1_channel4_5",
+ "adc_comp",
+ "tim1_brk_up_trg_com",
+ "tim1_cc",
+ "tim2",
+ "tim3",
+ "tim6_dac",
+ "tim7",
+ "tim14",
+ "tim15",
+ "tim16",
+ "tim17",
+ "i2c1",
+ "i2c2",
+ "spi1",
+ "spi2",
+ "usart1",
+ "usart2",
+ "usart3_4",
+ "cec_can",
+ "usb"
+ ],
+ "partname_humanreadable": "STM32 F0 series",
+ "partname_doxygen": "STM32F0",
+ "includeguard": "LIBOPENCM3_STM32_F0_NVIC_H"
+} \ No newline at end of file
diff --git a/libopencm3/include/libopencm3/stm32/f0/iwdg.h b/libopencm3/include/libopencm3/stm32/f0/iwdg.h
new file mode 100644
index 0000000..be9dc5a
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/iwdg.h
@@ -0,0 +1,70 @@
+/** @defgroup iwdg_defines IWDG Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Independent Watchdog
+ * Timer</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 18 August 2012
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_IWDG_H
+#define LIBOPENCM3_IWDG_H
+
+#include <libopencm3/stm32/common/iwdg_common_all.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+/* Key Register (IWDG_WINR) */
+#define IWDG_WINR MMIO32(IWDG_BASE + 0x10)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* --- IWDG_SR values ------------------------------------------------------ */
+
+/* WVU: Watchdog counter window value update */
+#define IWDG_SR_WVU (1 << 2)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/memorymap.h b/libopencm3/include/libopencm3/stm32/f0/memorymap.h
new file mode 100644
index 0000000..4802b0f
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/memorymap.h
@@ -0,0 +1,116 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * .. based on file from F4.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_MEMORYMAP_H
+#define LIBOPENCM3_MEMORYMAP_H
+
+#include <libopencm3/cm3/memorymap.h>
+
+/* --- STM32 specific peripheral definitions ------------------------------- */
+
+/* Memory map for all buses */
+#define FLASH_BASE (0x08000000U)
+#define PERIPH_BASE (0x40000000U)
+#define INFO_BASE (0x1ffff000U)
+#define PERIPH_BASE_APB (PERIPH_BASE + 0x00000000)
+#define PERIPH_BASE_AHB1 (PERIPH_BASE + 0x00020000)
+#define PERIPH_BASE_AHB2 (PERIPH_BASE + 0x08000000)
+
+/* Register boundary addresses */
+
+/* APB1 */
+#define TIM2_BASE (PERIPH_BASE_APB + 0x0000)
+#define TIM3_BASE (PERIPH_BASE_APB + 0x0400)
+
+#define TIM6_BASE (PERIPH_BASE_APB + 0x1000)
+#define TIM7_BASE (PERIPH_BASE_APB + 0x1400)
+
+#define TIM14_BASE (PERIPH_BASE_APB + 0x2000)
+/* PERIPH_BASE_APB1 + 0x2400 (0x4000 2400 - 0x4000 27FF): Reserved */
+#define RTC_BASE (PERIPH_BASE_APB + 0x2800)
+#define WWDG_BASE (PERIPH_BASE_APB + 0x2c00)
+#define IWDG_BASE (PERIPH_BASE_APB + 0x3000)
+/* PERIPH_BASE_APB + 0x3400 (0x4000 3400 - 0x4000 37FF): Reserved */
+#define SPI2_BASE (PERIPH_BASE_APB + 0x3800)
+/* PERIPH_BASE_APB + 0x4000 (0x4000 4000 - 0x4000 3FFF): Reserved */
+#define USART2_BASE (PERIPH_BASE_APB + 0x4400)
+#define USART3_BASE (PERIPH_BASE_APB + 0x4800)
+#define USART4_BASE (PERIPH_BASE_APB + 0x4C00)
+
+#define I2C1_BASE (PERIPH_BASE_APB + 0x5400)
+#define I2C2_BASE (PERIPH_BASE_APB + 0x5800)
+#define USB_DEV_FS_BASE (PERIPH_BASE_APB + 0x5C00)
+/* USB_PMA_BASE already defined in usb.h */
+#define BX_CAN1_BASE (PERIPH_BASE_APB + 0x6400)
+
+#define CRS_BASE (PERIPH_BASE_APB + 0x6C00)
+#define POWER_CONTROL_BASE (PERIPH_BASE_APB + 0x7000)
+#define DAC_BASE (PERIPH_BASE_APB + 0x7400)
+#define CEC_BASE (PERIPH_BASE_APB + 0x7800)
+
+#define SYSCFG_COMP_BASE (PERIPH_BASE_APB + 0x10000)
+#define EXTI_BASE (PERIPH_BASE_APB + 0x10400)
+
+#define ADC_BASE (PERIPH_BASE_APB + 0x12400)
+#define TIM1_BASE (PERIPH_BASE_APB + 0x12C00)
+#define SPI1_I2S1_BASE (PERIPH_BASE_APB + 0x13000)
+
+#define USART1_BASE (PERIPH_BASE_APB + 0x13800)
+#define TIM15_BASE (PERIPH_BASE_APB + 0x14000)
+#define TIM16_BASE (PERIPH_BASE_APB + 0x14400)
+#define TIM17_BASE (PERIPH_BASE_APB + 0x14800)
+
+#define DBGMCU_BASE (PERIPH_BASE_APB + 0x15800)
+
+/* AHB1 */
+#define DMA_BASE (PERIPH_BASE_AHB1 + 0x0000)
+/* DMA is the name in the F0 refman, but all other stm32's use DMA1 */
+#define DMA1_BASE DMA_BASE
+
+#define RCC_BASE (PERIPH_BASE_AHB1 + 0x1000)
+
+#define FLASH_MEM_INTERFACE_BASE (PERIPH_BASE_AHB1 + 0x2000)
+
+#define CRC_BASE (PERIPH_BASE_AHB1 + 0x3000)
+
+#define TSC_BASE (PERIPH_BASE_AHB1 + 0x4000)
+
+/* AHB2 */
+#define GPIO_PORT_A_BASE (PERIPH_BASE_AHB2 + 0x0000)
+#define GPIO_PORT_B_BASE (PERIPH_BASE_AHB2 + 0x0400)
+#define GPIO_PORT_C_BASE (PERIPH_BASE_AHB2 + 0x0800)
+#define GPIO_PORT_D_BASE (PERIPH_BASE_AHB2 + 0x0C00)
+#define GPIO_PORT_E_BASE (PERIPH_BASE_AHB2 + 0x1000)
+#define GPIO_PORT_F_BASE (PERIPH_BASE_AHB2 + 0x1400)
+
+/* Device Electronic Signature */
+#define DESIG_FLASH_SIZE_BASE (0x1FFFF7CCU)
+#define DESIG_UNIQUE_ID_BASE (0x1FFFF7ACU)
+#define DESIG_UNIQUE_ID0 MMIO32(DESIG_UNIQUE_ID_BASE)
+#define DESIG_UNIQUE_ID1 MMIO32(DESIG_UNIQUE_ID_BASE + 4)
+#define DESIG_UNIQUE_ID2 MMIO32(DESIG_UNIQUE_ID_BASE + 8)
+
+/* ST provided factory calibration values @ 3.3V */
+#define ST_VREFINT_CAL MMIO16(0x1FFFF7BA)
+#define ST_TSENSE_CAL1_30C MMIO16(0x1FFFF7B8)
+#define ST_TSENSE_CAL2_110 MMIO16(0x1FFFF7C2)
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/pwr.h b/libopencm3/include/libopencm3/stm32/f0/pwr.h
new file mode 100644
index 0000000..e0706b6
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/pwr.h
@@ -0,0 +1,67 @@
+/** @defgroup pwr_defines PWR Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx PWR Control</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 5 December 2012
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_PWR_H
+#define LIBOPENCM3_PWR_H
+
+#include <libopencm3/stm32/common/pwr_common_all.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* EWUP: Enable WKUP2 pin */
+#define PWR_CSR_EWUP2 (1 << 9)
+
+/* EWUP: Enable WKUP1 pin */
+#define PWR_CSR_EWUP1 (1 << 8)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
+
diff --git a/libopencm3/include/libopencm3/stm32/f0/rcc.h b/libopencm3/include/libopencm3/stm32/f0/rcc.h
new file mode 100644
index 0000000..39de15e
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/rcc.h
@@ -0,0 +1,524 @@
+/** @defgroup rcc_defines RCC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Reset and Clock
+Control</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @author @htmlonly &copy; @endhtmlonly 2013
+ * Frantisek Burian <BuFran@seznam.cz>
+ *
+ * @version 1.0.0
+ *
+ * @date 29 Jun 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+/**@{*/
+
+#ifndef LIBOPENCM3_RCC_H
+#define LIBOPENCM3_RCC_H
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define RCC_CR MMIO32(RCC_BASE + 0x00)
+#define RCC_CFGR MMIO32(RCC_BASE + 0x04)
+#define RCC_CIR MMIO32(RCC_BASE + 0x08)
+#define RCC_APB2RSTR MMIO32(RCC_BASE + 0x0c)
+#define RCC_APB1RSTR MMIO32(RCC_BASE + 0x10)
+#define RCC_AHBENR MMIO32(RCC_BASE + 0x14)
+#define RCC_APB2ENR MMIO32(RCC_BASE + 0x18)
+#define RCC_APB1ENR MMIO32(RCC_BASE + 0x1c)
+#define RCC_BDCR MMIO32(RCC_BASE + 0x20)
+#define RCC_CSR MMIO32(RCC_BASE + 0x24)
+#define RCC_AHBRSTR MMIO32(RCC_BASE + 0x28)
+#define RCC_CFGR2 MMIO32(RCC_BASE + 0x2c)
+#define RCC_CFGR3 MMIO32(RCC_BASE + 0x30)
+#define RCC_CR2 MMIO32(RCC_BASE + 0x34)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* --- RCC_CR values ------------------------------------------------------- */
+
+#define RCC_CR_PLLRDY (1 << 25)
+#define RCC_CR_PLLON (1 << 24)
+#define RCC_CR_CSSON (1 << 19)
+#define RCC_CR_HSEBYP (1 << 18)
+#define RCC_CR_HSERDY (1 << 17)
+#define RCC_CR_HSEON (1 << 16)
+#define RCC_CR_HSICAL_SHIFT 8
+#define RCC_CR_HSICAL (0xFF << RCC_CR_HSICAL_SHIFT)
+#define RCC_CR_HSITRIM_SHIFT 3
+#define RCC_CR_HSITRIM (0x1F << RCC_CR_HSITRIM_SHIFT)
+#define RCC_CR_HSIRDY (1 << 1)
+#define RCC_CR_HSION (1 << 0)
+
+/* --- RCC_CFGR values ----------------------------------------------------- */
+
+#define RCC_CFGR_PLLNODIV (1 << 31)
+
+#define RCC_CFGR_MCOPRE_SHIFT 28
+#define RCC_CFGR_MCOPRE (7 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV1 (0 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV2 (1 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV4 (2 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV8 (3 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV16 (4 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV32 (5 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV64 (6 << RCC_CFGR_MCOPRE_SHIFT)
+#define RCC_CFGR_MCOPRE_DIV128 (7 << RCC_CFGR_MCOPRE_SHIFT)
+
+#define RCC_CFGR_MCO_SHIFT 24
+#define RCC_CFGR_MCO (15 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_NOCLK (0 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_HSI14 (1 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_LSI (2 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_LSE (3 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_SYSCLK (4 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_HSI (5 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_HSE (6 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_PLL (7 << RCC_CFGR_MCO_SHIFT)
+#define RCC_CFGR_MCO_HSI48 (8 << RCC_CFGR_MCO_SHIFT)/*f07*/
+
+#define RCC_CFGR_PLLMUL_SHIFT 18
+#define RCC_CFGR_PLLMUL (0x0F << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL2 (0x00 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL3 (0x01 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL4 (0x02 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL5 (0x03 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL6 (0x04 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL7 (0x05 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL8 (0x06 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL9 (0x07 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL10 (0x08 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL11 (0x09 << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL12 (0x0A << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL13 (0x0B << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL14 (0x0C << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL15 (0x0D << RCC_CFGR_PLLMUL_SHIFT)
+#define RCC_CFGR_PLLMUL_MUL16 (0x0E << RCC_CFGR_PLLMUL_SHIFT)
+
+#define RCC_CFGR_PLLXTPRE (1<<17)
+#define RCC_CFGR_PLLSRC (1<<16)
+#define RCC_CFGR_PLLSRC0 (1<<15)
+#define RCC_CFGR_ADCPRE (1<<14)
+
+
+#define RCC_CFGR_PPRE_SHIFT 8
+#define RCC_CFGR_PPRE (7 << RCC_CFGR_PPRE_SHIFT)
+#define RCC_CFGR_PPRE_NODIV (0 << RCC_CFGR_PPRE_SHIFT)
+#define RCC_CFGR_PPRE_DIV2 (4 << RCC_CFGR_PPRE_SHIFT)
+#define RCC_CFGR_PPRE_DIV4 (5 << RCC_CFGR_PPRE_SHIFT)
+#define RCC_CFGR_PPRE_DIV8 (6 << RCC_CFGR_PPRE_SHIFT)
+#define RCC_CFGR_PPRE_DIV16 (7 << RCC_CFGR_PPRE_SHIFT)
+
+#define RCC_CFGR_HPRE_SHIFT 4
+#define RCC_CFGR_HPRE (0xf << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_NODIV (0x0 << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV2 (0x8 << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV4 (0x9 << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV8 (0xa << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV16 (0xb << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV64 (0xc << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV128 (0xd << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV256 (0xe << RCC_CFGR_HPRE_SHIFT)
+#define RCC_CFGR_HPRE_DIV512 (0xf << RCC_CFGR_HPRE_SHIFT)
+
+#define RCC_CFGR_SWS_SHIFT 2
+#define RCC_CFGR_SWS (3 << RCC_CFGR_SWS_SHIFT)
+#define RCC_CFGR_SWS_HSI (0 << RCC_CFGR_SWS_SHIFT)
+#define RCC_CFGR_SWS_HSE (1 << RCC_CFGR_SWS_SHIFT)
+#define RCC_CFGR_SWS_PLL (2 << RCC_CFGR_SWS_SHIFT)
+#define RCC_CFGR_SWS_HSI48 (3 << RCC_CFGR_SWS_SHIFT)
+
+#define RCC_CFGR_SW_SHIFT 0
+#define RCC_CFGR_SW (3 << RCC_CFGR_SW_SHIFT)
+#define RCC_CFGR_SW_HSI (0 << RCC_CFGR_SW_SHIFT)
+#define RCC_CFGR_SW_HSE (1 << RCC_CFGR_SW_SHIFT)
+#define RCC_CFGR_SW_PLL (2 << RCC_CFGR_SW_SHIFT)
+#define RCC_CFGR_SW_HSI48 (3 << RCC_CFGR_SW_SHIFT)
+
+/* --- RCC_CIR values ------------------------------------------------------ */
+
+#define RCC_CIR_CSSC (1 << 23)
+#define RCC_CIR_HSI48RDYC (1 << 22)
+#define RCC_CIR_HSI14RDYC (1 << 21)
+#define RCC_CIR_PLLRDYC (1 << 20)
+#define RCC_CIR_HSERDYC (1 << 19)
+#define RCC_CIR_HSIRDYC (1 << 18)
+#define RCC_CIR_LSERDYC (1 << 17)
+#define RCC_CIR_LSIRDYC (1 << 16)
+#define RCC_CIR_HSI48RDYIE (1 << 14)
+#define RCC_CIR_HSI14RDYIE (1 << 13)
+#define RCC_CIR_PLLRDYIE (1 << 12)
+#define RCC_CIR_HSERDYIE (1 << 11)
+#define RCC_CIR_HSIRDYIE (1 << 10)
+#define RCC_CIR_LSERDYIE (1 << 9)
+#define RCC_CIR_LSIRDYIE (1 << 8)
+#define RCC_CIR_CSSF (1 << 7)
+#define RCC_CIR_HSI48RDYF (1 << 6)
+#define RCC_CIR_HSI14RDYF (1 << 5)
+#define RCC_CIR_PLLRDYF (1 << 4)
+#define RCC_CIR_HSERDYF (1 << 3)
+#define RCC_CIR_HSIRDYF (1 << 2)
+#define RCC_CIR_LSERDYF (1 << 1)
+#define RCC_CIR_LSIRDYF (1 << 0)
+
+/* --- RCC_APB2RSTR values ------------------------------------------------- */
+
+#define RCC_APB2RSTR_DBGMCURST (1 << 22)
+#define RCC_APB2RSTR_TIM17RST (1 << 18)
+#define RCC_APB2RSTR_TIM16RST (1 << 17)
+#define RCC_APB2RSTR_TIM15RST (1 << 16)
+#define RCC_APB2RSTR_USART1RST (1 << 14)
+#define RCC_APB2RSTR_SPI1RST (1 << 12)
+#define RCC_APB2RSTR_TIM1RST (1 << 11)
+#define RCC_APB2RSTR_ADCRST (1 << 9)
+#define RCC_APB2RSTR_SYSCFGRST (1 << 0)
+
+/* --- RCC_APB1RSTR values ------------------------------------------------- */
+
+#define RCC_APB1RSTR_CECRST (1 << 30)
+#define RCC_APB1RSTR_DACRST (1 << 29)
+#define RCC_APB1RSTR_PWRRST (1 << 28)
+#define RCC_APB1RSTR_CRSRST (1 << 27)
+#define RCC_APB1RSTR_CANRST (1 << 25)
+#define RCC_APB1RSTR_USBRST (1 << 23)
+#define RCC_APB1RSTR_I2C2RST (1 << 22)
+#define RCC_APB1RSTR_I2C1RST (1 << 21)
+#define RCC_APB1RSTR_USART4RST (1 << 19)
+#define RCC_APB1RSTR_USART3RST (1 << 18)
+#define RCC_APB1RSTR_USART2RST (1 << 17)
+#define RCC_APB1RSTR_SPI2RST (1 << 14)
+#define RCC_APB1RSTR_WWDGRST (1 << 11)
+#define RCC_APB1RSTR_TIM14RST (1 << 8)
+#define RCC_APB1RSTR_TIM7RST (1 << 5)
+#define RCC_APB1RSTR_TIM6RST (1 << 4)
+#define RCC_APB1RSTR_TIM3RST (1 << 1)
+#define RCC_APB1RSTR_TIM2RST (1 << 0)
+
+/* --- RCC_AHBENR values --------------------------------------------------- */
+
+#define RCC_AHBENR_TSCEN (1 << 24)
+#define RCC_AHBENR_GPIOFEN (1 << 22)
+#define RCC_AHBENR_GPIOEEN (1 << 21)
+#define RCC_AHBENR_GPIODEN (1 << 20)
+#define RCC_AHBENR_GPIOCEN (1 << 19)
+#define RCC_AHBENR_GPIOBEN (1 << 18)
+#define RCC_AHBENR_GPIOAEN (1 << 17)
+#define RCC_AHBENR_CRCEN (1 << 6)
+#define RCC_AHBENR_FLTFEN (1 << 4)
+#define RCC_AHBENR_SRAMEN (1 << 2)
+#define RCC_AHBENR_DMAEN (1 << 0)
+
+/* --- RCC_APB2ENR values -------------------------------------------------- */
+
+#define RCC_APB2ENR_DBGMCUEN (1 << 22)
+#define RCC_APB2ENR_TIM17EN (1 << 18)
+#define RCC_APB2ENR_TIM16EN (1 << 17)
+#define RCC_APB2ENR_TIM15EN (1 << 16)
+#define RCC_APB2ENR_USART1EN (1 << 14)
+#define RCC_APB2ENR_SPI1EN (1 << 12)
+#define RCC_APB2ENR_TIM1EN (1 << 11)
+#define RCC_APB2ENR_ADCEN (1 << 9)
+#define RCC_APB2ENR_SYSCFGCOMPEN (1 << 0)
+
+/* --- RCC_APB1ENR values -------------------------------------------------- */
+
+#define RCC_APB1ENR_CECEN (1 << 30)
+#define RCC_APB1ENR_DACEN (1 << 29)
+#define RCC_APB1ENR_PWREN (1 << 28)
+#define RCC_APB1ENR_CRSEN (1 << 27)
+#define RCC_APB1ENR_CANEN (1 << 25)
+#define RCC_APB1ENR_USBEN (1 << 23)
+#define RCC_APB1ENR_I2C2EN (1 << 22)
+#define RCC_APB1ENR_I2C1EN (1 << 21)
+#define RCC_APB1ENR_USART4EN (1 << 19)
+#define RCC_APB1ENR_USART3EN (1 << 18)
+#define RCC_APB1ENR_USART2EN (1 << 17)
+#define RCC_APB1ENR_SPI2EN (1 << 14)
+#define RCC_APB1ENR_WWDGEN (1 << 11)
+#define RCC_APB1ENR_TIM14EN (1 << 8)
+#define RCC_APB1ENR_TIM7EN (1 << 5)
+#define RCC_APB1ENR_TIM6EN (1 << 4)
+#define RCC_APB1ENR_TIM3EN (1 << 1)
+#define RCC_APB1ENR_TIM2EN (1 << 0)
+
+/* --- RCC_BDCR values ----------------------------------------------------- */
+
+#define RCC_BDCR_BDRST (1 << 16)
+#define RCC_BDCR_RTCEN (1 << 15)
+#define RCC_BDCR_RTCSEL_SHIFT 8
+#define RCC_BDCR_RTCSEL (3 << RCC_BDCR_RTCSEL_SHIFT)
+#define RCC_BDCR_RTCSEL_NOCLK (0 << RCC_BDCR_RTCSEL_SHIFT)
+#define RCC_BDCR_RTCSEL_LSE (1 << RCC_BDCR_RTCSEL_SHIFT)
+#define RCC_BDCR_RTCSEL_LSI (2 << RCC_BDCR_RTCSEL_SHIFT)
+#define RCC_BDCR_RTCSEL_HSE (3 << RCC_BDCR_RTCSEL_SHIFT)
+#define RCC_BDCR_LSEDRV_SHIFT 3
+#define RCC_BDCR_LSEDRV (3 << RCC_BDCR_LSEDRV_SHIFT)
+#define RCC_BDCR_LSEDRV_LOW (0 << RCC_BDCR_LSEDRV_SHIFT)
+#define RCC_BDCR_LSEDRV_MEDLO (1 << RCC_BDCR_LSEDRV_SHIFT)
+#define RCC_BDCR_LSEDRV_MEDHI (2 << RCC_BDCR_LSEDRV_SHIFT)
+#define RCC_BDCR_LSEDRV_HIGH (3 << RCC_BDCR_LSEDRV_SHIFT)
+#define RCC_BDCR_LSEBYP (1 << 2)
+#define RCC_BDCR_LSERDY (1 << 1)
+#define RCC_BDCR_LSEON (1 << 0)
+
+/* --- RCC_CSR values ------------------------------------------------------ */
+
+#define RCC_CSR_LPWRRSTF (1 << 31)
+#define RCC_CSR_WWDGRSTF (1 << 30)
+#define RCC_CSR_IWDGRSTF (1 << 29)
+#define RCC_CSR_SFTRSTF (1 << 28)
+#define RCC_CSR_PORRSTF (1 << 27)
+#define RCC_CSR_PINRSTF (1 << 26)
+#define RCC_CSR_OBLRSTF (1 << 25)
+#define RCC_CSR_RMVF (1 << 24)
+#define RCC_CSR_V18PWRRSTF (1 << 23)
+#define RCC_CSR_LSIRDY (1 << 1)
+#define RCC_CSR_LSION (1 << 0)
+
+/* --- RCC_AHBRSTR values -------------------------------------------------- */
+
+#define RCC_AHBRSTR_TSCRST (1 << 24)
+#define RCC_AHBRSTR_IOPFRST (1 << 22)
+#define RCC_AHBRSTR_IOPERST (1 << 21)
+#define RCC_AHBRSTR_IOPDRST (1 << 20)
+#define RCC_AHBRSTR_IOPCRST (1 << 19)
+#define RCC_AHBRSTR_IOPBRST (1 << 18)
+#define RCC_AHBRSTR_IOPARST (1 << 17)
+
+
+/* --- RCC_CFGR2 values ---------------------------------------------------- */
+
+#define RCC_CFGR2_PREDIV 0xf
+#define RCC_CFGR2_PREDIV_NODIV 0x0
+#define RCC_CFGR2_PREDIV_DIV2 0x1
+#define RCC_CFGR2_PREDIV_DIV3 0x2
+#define RCC_CFGR2_PREDIV_DIV4 0x3
+#define RCC_CFGR2_PREDIV_DIV5 0x4
+#define RCC_CFGR2_PREDIV_DIV6 0x5
+#define RCC_CFGR2_PREDIV_DIV7 0x6
+#define RCC_CFGR2_PREDIV_DIV8 0x7
+#define RCC_CFGR2_PREDIV_DIV9 0x8
+#define RCC_CFGR2_PREDIV_DIV10 0x9
+#define RCC_CFGR2_PREDIV_DIV11 0xa
+#define RCC_CFGR2_PREDIV_DIV12 0xb
+#define RCC_CFGR2_PREDIV_DIV13 0xc
+#define RCC_CFGR2_PREDIV_DIV14 0xd
+#define RCC_CFGR2_PREDIV_DIV15 0xe
+#define RCC_CFGR2_PREDIV_DIV16 0xf
+
+/* --- RCC_CFGR3 values ---------------------------------------------------- */
+
+#define RCC_CFGR3_USART2SW_SHIFT 16
+#define RCC_CFGR3_USART2SW (3 << RCC_CFGR3_USART2SW_SHIFT)
+#define RCC_CFGR3_USART2SW_PCLK (0 << RCC_CFGR3_USART2SW_SHIFT)
+#define RCC_CFGR3_USART2SW_SYSCLK (1 << RCC_CFGR3_USART2SW_SHIFT)
+#define RCC_CFGR3_USART2SW_LSE (2 << RCC_CFGR3_USART2SW_SHIFT)
+#define RCC_CFGR3_USART2SW_HSI (3 << RCC_CFGR3_USART2SW_SHIFT)
+
+#define RCC_CFGR3_ADCSW (1 << 8)
+#define RCC_CFGR3_USBSW (1 << 7)
+#define RCC_CFGR3_CECSW (1 << 6)
+#define RCC_CFGR3_I2C1SW (1 << 4)
+
+#define RCC_CFGR3_USART1SW_SHIFT 0
+#define RCC_CFGR3_USART1SW (3 << RCC_CFGR3_USART1SW_SHIFT)
+#define RCC_CFGR3_USART1SW_PCLK (0 << RCC_CFGR3_USART1SW_SHIFT)
+#define RCC_CFGR3_USART1SW_SYSCLK (1 << RCC_CFGR3_USART1SW_SHIFT)
+#define RCC_CFGR3_USART1SW_LSE (2 << RCC_CFGR3_USART1SW_SHIFT)
+#define RCC_CFGR3_USART1SW_HSI (3 << RCC_CFGR3_USART1SW_SHIFT)
+
+/* --- RCC_CFGR3 values ---------------------------------------------------- */
+
+#define RCC_CR2_HSI48CAL_SHIFT 24
+#define RCC_CR2_HSI48CAL (0xFF << RCC_CR2_HSI48CAL_SHIFT)
+#define RCC_CR2_HSI48RDY (1 << 17)
+#define RCC_CR2_HSI48ON (1 << 16)
+#define RCC_CR2_HSI14CAL_SHIFT 8
+#define RCC_CR2_HSI14CAL (0xFF << RCC_CR2_HSI14CAL_SHIFT)
+#define RCC_CR2_HSI14TRIM_SHIFT 3
+#define RCC_CR2_HSI14TRIM (31 << RCC_CR2_HSI14TRIM_SHIFT)
+#define RCC_CR2_HSI14DIS (1 << 2)
+#define RCC_CR2_HSI14RDY (1 << 1)
+#define RCC_CR2_HSI14ON (1 << 0)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/* --- Variable definitions ------------------------------------------------ */
+extern uint32_t rcc_core_frequency;
+extern uint32_t rcc_ppre_frequency;
+
+enum rcc_osc {
+ HSI14, HSI, HSE, PLL, LSI, LSE, HSI48
+};
+
+#define _REG_BIT(base, bit) (((base) << 5) + (bit))
+
+enum rcc_periph_clken {
+ /* AHB peripherals */
+ RCC_DMA = _REG_BIT(0x14, 0),
+ RCC_SRAM = _REG_BIT(0x14, 2),
+ RCC_FLTIF = _REG_BIT(0x14, 4),
+ RCC_CRC = _REG_BIT(0x14, 6),
+ RCC_GPIOA = _REG_BIT(0x14, 17),
+ RCC_GPIOB = _REG_BIT(0x14, 18),
+ RCC_GPIOC = _REG_BIT(0x14, 19),
+ RCC_GPIOD = _REG_BIT(0x14, 20),
+ RCC_GPIOE = _REG_BIT(0x14, 21),
+ RCC_GPIOF = _REG_BIT(0x14, 22),
+ RCC_TSC = _REG_BIT(0x14, 24),
+
+ /* APB2 peripherals */
+ RCC_SYSCFG_COMP = _REG_BIT(0x18, 0),
+ RCC_ADC = _REG_BIT(0x18, 9),
+ RCC_TIM1 = _REG_BIT(0x18, 11),
+ RCC_SPI1 = _REG_BIT(0x18, 12),
+ RCC_USART1 = _REG_BIT(0x18, 14),
+ RCC_TIM15 = _REG_BIT(0x18, 16),
+ RCC_TIM16 = _REG_BIT(0x18, 17),
+ RCC_TIM17 = _REG_BIT(0x18, 18),
+ RCC_DBGMCU = _REG_BIT(0x18, 22),
+
+ /* APB1 peripherals */
+ RCC_TIM2 = _REG_BIT(0x1C, 0),
+ RCC_TIM3 = _REG_BIT(0x1C, 1),
+ RCC_TIM6 = _REG_BIT(0x1C, 4),
+ RCC_TIM7 = _REG_BIT(0x1C, 5),
+ RCC_TIM14 = _REG_BIT(0x1C, 8),
+ RCC_WWDG = _REG_BIT(0x1C, 11),
+ RCC_SPI2 = _REG_BIT(0x1C, 14),
+ RCC_USART2 = _REG_BIT(0x1C, 17),
+ RCC_USART3 = _REG_BIT(0x1C, 18),
+ RCC_USART4 = _REG_BIT(0x1C, 19),
+ RCC_I2C1 = _REG_BIT(0x1C, 21),
+ RCC_I2C2 = _REG_BIT(0x1C, 22),
+ RCC_USB = _REG_BIT(0x1C, 23),
+ RCC_CAN = _REG_BIT(0x1C, 25),
+ RCC_CRS = _REG_BIT(0x1C, 27),
+ RCC_PWR = _REG_BIT(0x1C, 28),
+ RCC_DAC = _REG_BIT(0x1C, 29),
+ RCC_CEC = _REG_BIT(0x1C, 30),
+
+ /* Advanced peripherals */
+ RCC_RTC = _REG_BIT(0x20, 15),/* BDCR[15] */
+};
+
+enum rcc_periph_rst {
+ /* APB2 peripherals */
+ RST_SYSCFG = _REG_BIT(0x0C, 0),
+ RST_ADC = _REG_BIT(0x0C, 9),
+ RST_TIM1 = _REG_BIT(0x0C, 11),
+ RST_SPI1 = _REG_BIT(0x0C, 12),
+ RST_USART1 = _REG_BIT(0x0C, 14),
+ RST_TIM15 = _REG_BIT(0x0C, 16),
+ RST_TIM16 = _REG_BIT(0x0C, 17),
+ RST_TIM17 = _REG_BIT(0x0C, 18),
+ RST_DBGMCU = _REG_BIT(0x0C, 22),
+
+ /* APB1 peripherals */
+ RST_TIM2 = _REG_BIT(0x10, 0),
+ RST_TIM3 = _REG_BIT(0x10, 1),
+ RST_TIM6 = _REG_BIT(0x10, 4),
+ RST_TIM7 = _REG_BIT(0x10, 5),
+ RST_TIM14 = _REG_BIT(0x10, 8),
+ RST_WWDG = _REG_BIT(0x10, 11),
+ RST_SPI2 = _REG_BIT(0x10, 14),
+ RST_USART2 = _REG_BIT(0x10, 17),
+ RST_USART3 = _REG_BIT(0x10, 18),
+ RST_USART4 = _REG_BIT(0x10, 19),
+ RST_I2C1 = _REG_BIT(0x10, 21),
+ RST_I2C2 = _REG_BIT(0x10, 22),
+ RST_USB = _REG_BIT(0x10, 23),
+ RST_CAN = _REG_BIT(0x10, 25),
+ RST_CRS = _REG_BIT(0x10, 27),
+ RST_PWR = _REG_BIT(0x10, 28),
+ RST_DAC = _REG_BIT(0x10, 29),
+ RST_CEC = _REG_BIT(0x10, 30),
+
+ /* Advanced peripherals */
+ RST_BACKUPDOMAIN = _REG_BIT(0x20, 16),/* BDCR[16] */
+
+ /* AHB peripherals */
+ RST_GPIOA = _REG_BIT(0x28, 17),
+ RST_GPIOB = _REG_BIT(0x28, 18),
+ RST_GPIOC = _REG_BIT(0x28, 19),
+ RST_GPIOD = _REG_BIT(0x28, 20),
+ RST_GPIOE = _REG_BIT(0x28, 21),
+ RST_GPIOF = _REG_BIT(0x28, 22),
+ RST_TSC = _REG_BIT(0x28, 24),
+};
+#undef _REG_BIT
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+void rcc_osc_ready_int_clear(enum rcc_osc osc);
+void rcc_osc_ready_int_enable(enum rcc_osc osc);
+void rcc_osc_ready_int_disable(enum rcc_osc osc);
+int rcc_osc_ready_int_flag(enum rcc_osc osc);
+void rcc_wait_for_osc_ready(enum rcc_osc osc);
+void rcc_osc_on(enum rcc_osc osc);
+void rcc_osc_off(enum rcc_osc osc);
+void rcc_osc_bypass_enable(enum rcc_osc osc);
+void rcc_osc_bypass_disable(enum rcc_osc osc);
+void rcc_css_enable(void);
+void rcc_css_disable(void);
+void rcc_css_int_clear(void);
+int rcc_css_int_flag(void);
+void rcc_set_sysclk_source(enum rcc_osc clk);
+void rcc_set_pll_multiplication_factor(uint32_t mul);
+void rcc_set_ppre(uint32_t ppre);
+void rcc_set_hpre(uint32_t hpre);
+void rcc_set_prediv(uint32_t prediv);
+void rcc_set_mco(uint32_t mcosrc);
+enum rcc_osc rcc_system_clock_source(void);
+void rcc_clock_setup_in_hsi_out_8mhz(void);
+void rcc_clock_setup_in_hsi_out_16mhz(void);
+void rcc_clock_setup_in_hsi_out_24mhz(void);
+void rcc_clock_setup_in_hsi_out_32mhz(void);
+void rcc_clock_setup_in_hsi_out_40mhz(void);
+void rcc_clock_setup_in_hsi_out_48mhz(void);
+void rcc_periph_clock_enable(enum rcc_periph_clken periph);
+void rcc_periph_clock_disable(enum rcc_periph_clken periph);
+void rcc_periph_reset_pulse(enum rcc_periph_rst periph);
+void rcc_periph_reset_hold(enum rcc_periph_rst periph);
+void rcc_periph_reset_release(enum rcc_periph_rst periph);
+
+END_DECLS
+
+#endif
+/**@}*/
+
diff --git a/libopencm3/include/libopencm3/stm32/f0/rtc.h b/libopencm3/include/libopencm3/stm32/f0/rtc.h
new file mode 100644
index 0000000..8a99c24
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/rtc.h
@@ -0,0 +1,36 @@
+/** @defgroup rtc_defines RTC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx RTC</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 5 December 2012
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_RTC_H
+#define LIBOPENCM3_RTC_H
+
+#include <libopencm3/stm32/common/rtc_common_l1f024.h>
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/spi.h b/libopencm3/include/libopencm3/stm32/f0/spi.h
new file mode 100644
index 0000000..773743e
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/spi.h
@@ -0,0 +1,36 @@
+/** @defgroup spi_defines SPI Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx SPI</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_SPI_H
+#define LIBOPENCM3_SPI_H
+
+#include <libopencm3/stm32/common/spi_common_f03.h>
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/syscfg.h b/libopencm3/include/libopencm3/stm32/f0/syscfg.h
new file mode 100644
index 0000000..1084543
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/syscfg.h
@@ -0,0 +1,110 @@
+/** @defgroup syscfg_defines SYSCFG Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx System Config</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @author @htmlonly &copy; @endhtmlonly 2013
+ * Frantisek Burian <BuFran@seznam.cz>
+ *
+ * @date 13 January 2014
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_SYSCFG_H
+#define LIBOPENCM3_SYSCFG_H
+/**@{*/
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define SYSCFG_CFGR1 MMIO32(SYSCFG_COMP_BASE + 0x00)
+#define SYSCFG_EXTICR(i) MMIO32(SYSCFG_COMP_BASE + 0x08 + (i)*4)
+#define SYSCFG_EXTICR1 SYSCFG_EXTICR(0)
+#define SYSCFG_EXTICR2 SYSCFG_EXTICR(1)
+#define SYSCFG_EXTICR3 SYSCFG_EXTICR(2)
+#define SYSCFG_EXTICR4 SYSCFG_EXTICR(3)
+#define SYSCFG_CFGR2 MMIO32(SYSCFG_COMP_BASE + 0x18)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* SYSCFG_CFGR1 Values -- ---------------------------------------------------*/
+
+#define SYSCFG_CFGR1_MEM_MODE_SHIFT 0
+#define SYSCFG_CFGR1_MEM_MODE (3 << SYSCFG_CFGR1_MEM_MODE_SHIFT)
+#define SYSCFG_CFGR1_MEM_MODE_FLASH (0 << SYSCFG_CFGR1_MEM_MODE_SHIFT)
+#define SYSCFG_CFGR1_MEM_MODE_SYSTEM (1 << SYSCFG_CFGR1_MEM_MODE_SHIFT)
+#define SYSCFG_CFGR1_MEM_MODE_SRAM (3 << SYSCFG_CFGR1_MEM_MODE_SHIFT)
+
+#define SYSCFG_CFGR1_ADC_DMA_RMP (1 << 8)
+#define SYSCFG_CFGR1_USART1_TX_DMA_RMP (1 << 9)
+#define SYSCFG_CFGR1_USART1_RX_DMA_RMP (1 << 10)
+#define SYSCFG_CFGR1_TIM16_DMA_RMP (1 << 11)
+#define SYSCFG_CFGR1_TIM17_DMA_RMP (1 << 12)
+
+#define SYSCFG_CFGR1_I2C_PB6_FMPLUS (1 << 16)
+#define SYSCFG_CFGR1_I2C_PB7_FMPLUS (1 << 17)
+#define SYSCFG_CFGR1_I2C_PB8_FMPLUS (1 << 18)
+#define SYSCFG_CFGR1_I2C_PB9_FMPLUS (1 << 19)
+#define SYSCFG_CFGR1_I2C1_FMPLUS (1 << 20)
+#define SYSCFG_CFGR1_I2C_PA9_FMPLUS (1 << 22)
+#define SYSCFG_CFGR1_I2C_PA10_FMPLUS (1 << 23)
+
+/* SYSCFG_EXTICR Values -- --------------------------------------------------*/
+
+#define SYSCFG_EXTICR_SKIP 4
+#define SYSCFG_EXTICR_GPIOA 0
+#define SYSCFG_EXTICR_GPIOB 1
+#define SYSCFG_EXTICR_GPIOC 2
+#define SYSCFG_EXTICR_GPIOD 3
+#define SYSCFG_EXTICR_GPIOF 5
+
+/* SYSCFG_CFGR2 Values -- ---------------------------------------------------*/
+
+#define SYSCFG_CFGR2_LOCKUP_LOCK (1 << 0)
+#define SYSCFG_CFGR2_SRAM_PARITY_LOCK (1 << 1)
+#define SYSCFG_CFGR2_PVD_LOCK (1 << 2)
+#define SYSCFG_CFGR2_SRAM_PEF (1 << 8)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/timer.h b/libopencm3/include/libopencm3/stm32/f0/timer.h
new file mode 100644
index 0000000..eac50c2
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/timer.h
@@ -0,0 +1,37 @@
+/** @defgroup timer_defines Timers Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Timers</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_TIMER_H
+#define LIBOPENCM3_TIMER_H
+
+#include <libopencm3/stm32/common/timer_common_all.h>
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/tsc.h b/libopencm3/include/libopencm3/stm32/f0/tsc.h
new file mode 100644
index 0000000..fbd65b4
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/tsc.h
@@ -0,0 +1,159 @@
+/** @defgroup tsc_defines TSC Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx Touch Sensor</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 11 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_TSC_H
+#define LIBOPENCM3_TSC_H
+/**@{*/
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define TSC TSC_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define TSC_CR MMIO32(TSC_BASE + 0x00)
+#define TSC_IER MMIO32(TSC_BASE + 0x04)
+#define TSC_ICR MMIO32(TSC_BASE + 0x08)
+#define TSC_ISR MMIO32(TSC_BASE + 0x0c)
+#define TSC_IOHCR MMIO32(TSC_BASE + 0x10)
+#define TSC_IOASCR MMIO32(TSC_BASE + 0x18)
+#define TSC_IOSCR MMIO32(TSC_BASE + 0x20)
+#define TSC_IOCCR MMIO32(TSC_BASE + 0x28)
+#define TSC_IOGCSR MMIO32(TSC_BASE + 0x30)
+#define TSC_IOGxCR(x) MMIO8(TSC_BASE + 0x34 + (x)*4)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* TSC_CR Values ------------------------------------------------------------*/
+
+#define TSC_CR_CTPH_SHIFT 28
+#define TSC_CR_CTPH (0xF << TSC_CR_CTPH_SHIFT)
+
+#define TSC_CR_CTPL_SHIFT 24
+#define TSC_CR_CTPL (0x0F << TSC_CR_CTPL_SHIFT)
+
+#define TSC_CR_SSD_SHIFT 17
+#define TSC_CR_SSD (0x7F << TSC_CR_SSD_SHIFT)
+
+#define TSC_CR_SSE (1 << 16)
+#define TSC_CR_SSPSC (1 << 15)
+
+#define TSC_CR_PGPSC_SHIFT 12
+#define TSC_CR_PGPSC (7 << TSC_CR_PGPSC_SHIFT)
+
+#define TSC_CR_MCV_SHIFT 5
+#define TSC_CR_MCV (7 << TSC_CR_MCV_SHIFT)
+
+#define TSC_CR_IODEF (1 << 4)
+#define TSC_CR_SYNCPOL (1 << 3)
+#define TSC_CR_AM (1 << 2)
+#define TSC_CR_START (1 << 1)
+#define TSC_CR_TSCE (1 << 0)
+
+/* TSC_IER Values -----------------------------------------------------------*/
+
+#define TSC_IER_MCEIE (1 << 1)
+#define TSC_IER_EOAIE (1 << 0)
+
+/* TSC_ICR Values -----------------------------------------------------------*/
+
+#define TSC_ICR_MCEIC (1 << 1)
+#define TSC_ICR_EOAIC (1 << 0)
+
+/* TSC_ISR Values -----------------------------------------------------------*/
+
+#define TSC_ISR_MCEF (1 << 1)
+#define TSC_ISR_EOAF (1 << 0)
+
+/* TSC_IOHCR Values ---------------------------------------------------------*/
+
+/* Bit helper g = [1..6] io = [1..4] */
+#define TSC_IOBIT_VAL(g, io) ((1 << ((io)-1)) << (((g)-1)*4))
+
+#define TSC_IOHCR_G1(io) TSC_IOBIT_VAL(1, io)
+#define TSC_IOHCR_G2(io) TSC_IOBIT_VAL(2, io)
+#define TSC_IOHCR_G3(io) TSC_IOBIT_VAL(3, io)
+#define TSC_IOHCR_G4(io) TSC_IOBIT_VAL(4, io)
+#define TSC_IOHCR_G5(io) TSC_IOBIT_VAL(5, io)
+#define TSC_IOHCR_G6(io) TSC_IOBIT_VAL(6, io)
+
+/* TSC_IOASCR Values --------------------------------------------------------*/
+
+#define TSC_IOASCR_G1(io) TSC_IOBIT_VAL(1, io)
+#define TSC_IOASCR_G2(io) TSC_IOBIT_VAL(2, io)
+#define TSC_IOASCR_G3(io) TSC_IOBIT_VAL(3, io)
+#define TSC_IOASCR_G4(io) TSC_IOBIT_VAL(4, io)
+#define TSC_IOASCR_G5(io) TSC_IOBIT_VAL(5, io)
+#define TSC_IOASCR_G6(io) TSC_IOBIT_VAL(6, io)
+
+/* TSC_IOSCR Values ---------------------------------------------------------*/
+
+#define TSC_IOSCR_G1(io) TSC_IOBIT_VAL(1, io)
+#define TSC_IOSCR_G2(io) TSC_IOBIT_VAL(2, io)
+#define TSC_IOSCR_G3(io) TSC_IOBIT_VAL(3, io)
+#define TSC_IOSCR_G4(io) TSC_IOBIT_VAL(4, io)
+#define TSC_IOSCR_G5(io) TSC_IOBIT_VAL(5, io)
+#define TSC_IOSCR_G6(io) TSC_IOBIT_VAL(6, io)
+
+/* TSC_IOCCR Values ---------------------------------------------------------*/
+
+#define TSC_IOCCR_G1(io) TSC_IOBIT_VAL(1, io)
+#define TSC_IOCCR_G2(io) TSC_IOBIT_VAL(2, io)
+#define TSC_IOCCR_G3(io) TSC_IOBIT_VAL(3, io)
+#define TSC_IOCCR_G4(io) TSC_IOBIT_VAL(4, io)
+#define TSC_IOCCR_G5(io) TSC_IOBIT_VAL(5, io)
+#define TSC_IOCCR_G6(io) TSC_IOBIT_VAL(6, io)
+
+/* TSC_IOGCSR Values --------------------------------------------------------*/
+
+#define TSC_IOGCSR_GxE(x) (1 << ((x)-1))
+#define TSC_IOGCSR_GxS(x) (1 << ((x)+15))
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+/**@}*/
+
+#endif
diff --git a/libopencm3/include/libopencm3/stm32/f0/usart.h b/libopencm3/include/libopencm3/stm32/f0/usart.h
new file mode 100644
index 0000000..8dba683
--- /dev/null
+++ b/libopencm3/include/libopencm3/stm32/f0/usart.h
@@ -0,0 +1,343 @@
+/** @defgroup usart_defines USART Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32F0xx USART</b>
+ *
+ * @ingroup STM32F0xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 2 July 2013
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * 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/>.
+ */
+
+#ifndef LIBOPENCM3_USART_H
+#define LIBOPENCM3_USART_H
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+#define USART1 USART1_BASE
+#define USART2 USART2_BASE
+#define USART3 USART3_BASE
+#define USART4 USART4_BASE
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define USART_CR1(usart_base) MMIO32(usart_base + 0x00)
+#define USART1_CR1 USART_CR1(USART1_BASE)
+#define USART2_CR1 USART_CR1(USART2_BASE)
+#define USART3_CR1 USART_CR1(USART3_BASE)
+#define USART4_CR1 USART_CR1(USART4_BASE)
+
+#define USART_CR2(usart_base) MMIO32(usart_base + 0x04)
+#define USART1_CR2 USART_CR2(USART1_BASE)
+#define USART2_CR2 USART_CR2(USART2_BASE)
+#define USART3_CR2 USART_CR2(USART3_BASE)
+#define USART4_CR2 USART_CR2(USART4_BASE)
+
+#define USART_CR3(usart_base) MMIO32(usart_base + 0x08)
+#define USART1_CR3 USART_CR3(USART1_BASE)
+#define USART2_CR3 USART_CR3(USART2_BASE)
+#define USART3_CR3 USART_CR3(USART3_BASE)
+#define USART4_CR3 USART_CR3(USART4_BASE)
+
+#define USART_BRR(usart_base) MMIO32(usart_base + 0x0c)
+#define USART1_BRR USART_BRR(USART1_BASE)
+#define USART2_BRR USART_BRR(USART2_BASE)
+#define USART3_BRR USART_BRR(USART3_BASE)
+#define USART4_BRR USART_BRR(USART4_BASE)
+
+#define USART_GTPR(usart_base) MMIO32(usart_base + 0x10)
+#define USART1_GTPR USART_GTPR(USART1_BASE)
+#define USART2_GTPR USART_GTPR(USART2_BASE)
+#define USART3_GTPR USART_GTPR(USART3_BASE)
+#define USART4_GTPR USART_GTPR(USART4_BASE)
+
+#define USART_RTOR(usart_base) MMIO32(usart_base + 0x14)
+#define USART1_RTOR USART_RTOR(USART1_BASE)
+#define USART2_RTOR USART_RTOR(USART2_BASE)
+#define USART3_RTOR USART_RTOR(USART3_BASE)
+#define USART4_RTOR USART_RTOR(USART4_BASE)
+
+#define USART_RQR(usart_base) MMIO32(usart_base + 0x18)
+#define USART1_RQR USART_RQR(USART1_BASE)
+#define USART2_RQR USART_RQR(USART2_BASE)
+#define USART3_RQR USART_RQR(USART3_BASE)
+#define USART4_RQR USART_RQR(USART4_BASE)
+
+#define USART_ISR(usart_base) MMIO32(usart_base + 0x1c)
+#define USART1_ISR USART_ISR(USART1_BASE)
+#define USART2_ISR USART_ISR(USART2_BASE)
+#define USART3_ISR USART_ISR(USART3_BASE)
+#define USART4_ISR USART_ISR(USART4_BASE)
+
+#define USART_ICR(usart_base) MMIO32(usart_base + 0x20)
+#define USART1_ICR USART_ICR(USART1_BASE)
+#define USART2_ICR USART_ICR(USART2_BASE)
+#define USART3_ICR USART_ICR(USART3_BASE)
+#define USART4_ICR USART_ICR(USART4_BASE)
+
+#define USART_RDR(usart_base) MMIO8(usart_base + 0x24)
+#define USART1_RDR USART_RDR(USART1_BASE)
+#define USART2_RDR USART_RDR(USART2_BASE)
+#define USART3_RDR USART_RDR(USART3_BASE)
+#define USART4_RDR USART_RDR(USART4_BASE)
+
+#define USART_TDR(usart_base) MMIO8(usart_base + 0x28)
+#define USART1_TDR USART_TDR(USART1_BASE)
+#define USART2_TDR USART_TDR(USART2_BASE)
+#define USART3_TDR USART_TDR(USART3_BASE)
+#define USART4_TDR USART_TDR(USART4_BASE)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/* USART_CR1 Values ---------------------------------------------------------*/
+
+#define USART_CR1_M1 (1 << 28) /* F07x */
+#define USART_CR1_EOBIE (1 << 27)
+#define USART_CR1_RTOIE (1 << 26)
+
+#define USART_CR1_DEAT_SHIFT 21
+#define USART_CR1_DEAT (0x1F << USART_CR1_DEAT_SHIFT)
+#define USART_CR1_DEAT_VAL(x) ((x) << USART_CR1_DEAT_SHIFT)
+
+#define USART_CR1_DEDT_SHIFT 16
+#define USART_CR1_DEDT (0x1F << USART_CR1_DEDT_SHIFT)
+#define USART_CR1_DEDT_VAL(x) ((x) << USART_CR1_DEDT_SHIFT)
+
+#define USART_CR1_OVER8 (1 << 15)
+#define USART_CR1_CMIE (1 << 14)
+#define USART_CR1_MME (1 << 13)
+#define USART_CR1_M (1 << 12) /* Obsolete, please use M0 */
+#define USART_CR1_M0 (1 << 12)
+#define USART_CR1_WAKE (1 << 11)
+#define USART_CR1_PCE (1 << 10)
+#define USART_CR1_PS (1 << 9)
+#define USART_CR1_PEIE (1 << 8)
+#define USART_CR1_TXEIE (1 << 7)
+#define USART_CR1_TCIE (1 << 6)
+#define USART_CR1_RXNEIE (1 << 5)
+#define USART_CR1_IDLEIE (1 << 4)
+#define USART_CR1_TE (1 << 3)
+#define USART_CR1_RE (1 << 2)
+#define USART_CR1_UESM (1 << 1)
+#define USART_CR1_UE (1 << 0)
+
+/* USART_CR2 Values ---------------------------------------------------------*/
+
+#define USART_CR2_ADD_SHIFT 24
+#define USART_CR2_ADD (0xFF << USART_CR2_ADD_SHIFT)
+#define USART_CR2_ADD_VAL(x) ((x) << USART_CR2_ADD_SHIFT)
+
+#define USART_CR2_RTOEN (1 << 23)
+
+#define USART_CR2_ABRMOD_SHIFT 21
+#define USART_CR2_ABRMOD (3 << USART_CR2_ABRMOD_SHIFT)
+#define USART_CR2_ABRMOD_STARTBIT (0 << USART_CR2_ABRMOD_SHIFT)
+#define USART_CR2_ABRMOD_FALLTOFALL (1 << USART_CR2_ABRMOD_SHIFT)
+
+#define USART_CR2_ABREN (1 << 20)
+#define USART_CR2_MSBFIRST (1 << 19)
+#define USART_CR2_DATAINV (1 << 18)
+#define USART_CR2_TXINV (1 << 17)
+#define USART_CR2_RXINV (1 << 16)
+#define USART_CR2_SWAP (1 << 15)
+#define USART_CR2_LINEN (1 << 14)
+
+#define USART_CR2_STOP_SHIFT 12
+#define USART_CR2_STOP (3 << USART_CR2_STOP_SHIFT)
+#define USART_CR2_STOP_1_0BIT (0 << USART_CR2_STOP_SHIFT)
+#define USART_CR2_STOP_2_0BIT (2 << USART_CR2_STOP_SHIFT)
+#define USART_CR2_STOP_1_5BIT (3 << USART_CR2_STOP_SHIFT)
+
+#define USART_CR2_CLKEN (1 << 11)
+#define USART_CR2_CPOL (1 << 10)
+#define USART_CR2_CPHA (1 << 9)
+#define USART_CR2_LBCL (1 << 8)
+#define USART_CR2_LBIDE (1 << 6)
+#define USART_CR2_LBDL (1 << 5)
+#define USART_CR2_ADDM (1 << 4) /* Obsolete, use ADDM7 */
+#define USART_CR2_ADDM7 (1 << 4)
+
+/* USART_CR3 Values ---------------------------------------------------------*/
+
+#define USART_CR3_WUFIE (1 << 22)
+
+#define USART_CR3_WUS_SHIFT 20
+#define USART_CR3_WUS (3 << USART_CR3_WUS_SHIFT)
+#define USART_CR3_WUS_ADDRMATCH (0 << USART_CR3_WUS_SHIFT)
+#define USART_CR3_WUS_STARTBIT (2 << USART_CR3_WUS_SHIFT)
+#define USART_CR3_WUS_RXNE (3 << USART_CR3_WUS_SHIFT)
+
+#define USART_CR3_SCARCNT_SHIFT 17
+#define USART_CR3_SCARCNT (7 << USART_CR3_SCARCNT_SHIFT)
+#define USART_CR3_SCARCNT_DISABLE (0 << USART_CR3_SCARCNT_SHIFT)
+#define USART_CR3_SCARCNT_VAL(x) ((x) << USART_CR3_SCARCNT_SHIFT)
+
+#define USART_CR3_DEP (1 << 15)
+#define USART_CR3_DEM (1 << 14)
+#define USART_CR3_DDRE (1 << 13)
+#define USART_CR3_OVRDIS (1 << 12)
+#define USART_CR3_ONEBIT (1 << 11)
+#define USART_CR3_CTSIE (1 << 10)
+#define USART_CR3_CTSE (1 << 9)
+#define USART_CR3_RTSE (1 << 8)
+#define USART_CR3_DMAT (1 << 7)
+#define USART_CR3_DMAR (1 << 6)
+#define USART_CR3_SCEN (1 << 5)
+#define USART_CR3_NACK (1 << 4)
+#define USART_CR3_HDSEL (1 << 3)
+#define USART_CR3_IRLP (1 << 2)
+#define USART_CR3_IREN (1 << 1)
+#define USART_CR3_EIE (1 << 0)
+
+/* USART_GTPR Values --------------------------------------------------------*/
+
+#define USART_GTPR_GT_SHIFT 8
+#define USART_GTPR_GT (0xFF << USART_GTPR_GT_SHIFT)
+#define USART_GTPR_GT_VAL(x) ((x) << USART_GTPR_GT_SHIFT)
+
+#define USART_GTPR_PSC_SHIFT 0
+#define USART_GTPR_PSC (0xFF << USART_GTPR_PSC_SHIFT)
+#define USART_GTPR_PSC_VAL(x) ((x) << USART_GTPR_PSC_SHIFT)
+
+
+/* USART_RTOR Values --------------------------------------------------------*/
+
+#define USART_RTOR_BLEN_SHIFT 24
+#define USART_RTOR_BLEN (0xFF << USART_RTOR_BLEN_SHIFT)
+#define USART_RTOR_BLEN_VAL(x) ((x) << USART_RTOR_BLEN_SHIFT)
+
+#define USART_RTOR_RTO_SHIFT 0
+#define USART_RTOR_RTO (0xFF << USART_RTOR_RTO_SHIFT)
+#define USART_RTOR_RTO_VAL(x) ((x) << USART_RTOR_RTO_SHIFT)
+
+/* USART_RQR Values ---------------------------------------------------------*/
+
+#define USART_RQR_TXFRQ (1 << 4)
+#define USART_RQR_RXFRQ (1 << 3)
+#define USART_RQR_MMRQ (1 << 2)
+#define USART_RQR_SBKRQ (1 << 1)
+#define USART_RQR_ABRRQ (1 << 0)
+
+/* USART_ISR Values ---------------------------------------------------------*/
+
+#define USART_ISR_REACK (1 << 22)
+#define USART_ISR_TEACK (1 << 21)
+#define USART_ISR_WUF (1 << 20)
+#define USART_ISR_RWU (1 << 19)
+#define USART_ISR_SBKF (1 << 18)
+#define USART_ISR_CMF (1 << 17)
+#define USART_ISR_BUSY (1 << 16)
+#define USART_ISR_ABRF (1 << 15)
+#define USART_ISR_ABRE (1 << 14)
+#define USART_ISR_EOBF (1 << 12)
+#define USART_ISR_RTOF (1 << 11)
+#define USART_ISR_CTS (1 << 10)
+#define USART_ISR_CTSIF (1 << 9)
+#define USART_ISR_LBDF (1 << 8)
+#define USART_ISR_TXE (1 << 7)
+#define USART_ISR_TC (1 << 6)
+#define USART_ISR_RXNE (1 << 5)
+#define USART_ISR_IDLE (1 << 4)
+#define USART_ISR_ORE (1 << 3)
+#define USART_ISR_NF (1 << 2)
+#define USART_ISR_FE (1 << 1)
+#define USART_ISR_PE (1 << 0)
+
+/* USART_ICR Values ---------------------------------------------------------*/
+
+#define USART_ICR_WUCF (1 << 20)
+#define USART_ICR_CMCF (1 << 17)
+#define USART_ICR_EOBCF (1 << 12)
+#define USART_ICR_RTOCF (1 << 11)
+#define USART_ICR_CTSCF (1 << 9)
+#define USART_ICR_LBDCF (1 << 8)
+#define USART_ICR_TCCF (1 << 6)
+#define USART_ICR_IDLECF (1 << 4)
+#define USART_ICR_ORECF (1 << 3)
+#define USART_ICR_NCF (1 << 2)
+#define USART_ICR_FECF (1 << 1)
+#define USART_ICR_PECF (1 << 0)
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+#define USART_PARITY (USART_CR1_PCE | USART_CR1_PS)
+#define USART_PARITY_NONE (0)
+#define USART_PARITY_EVEN (USART_CR1_PCE)
+#define USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS)
+
+#define USART_MODE (USART_CR1_TE | USART_CR1_RE)
+#define USART_MODE_NONE (0)
+#define USART_MODE_RX (USART_CR1_RE)
+#define USART_MODE_TX (USART_CR1_TE)
+#define USART_MODE_TX_RX (USART_CR1_TE | USART_CR1_RE)
+
+#define USART_FLOWCONTROL (USART_CR3_RTSE | USART_CR3_CTSE)
+#define USART_FLOWCONTROL_NONE (0)
+#define USART_FLOWCONTROL_RTS (USART_CR3_RTSE)
+#define USART_FLOWCONTROL_CTS (USART_CR3_CTSE)
+#define USART_FLOWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE)
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+void usart_set_baudrate(uint32_t usart, uint32_t baud);
+void usart_set_databits(uint32_t usart, uint32_t bits);
+void usart_set_stopbits(uint32_t usart, uint32_t stopbits);
+void usart_set_parity(uint32_t usart, uint32_t parity);
+void usart_set_mode(uint32_t usart, uint32_t mode);
+void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol);
+void usart_enable(uint32_t usart);
+void usart_disable(uint32_t usart);
+void usart_send(uint32_t usart, uint8_t data);
+uint8_t usart_recv(uint32_t usart);
+void usart_wait_send_ready(uint32_t usart);
+void usart_wait_recv_ready(uint32_t usart);
+void usart_send_blocking(uint32_t usart, uint8_t data);
+uint8_t usart_recv_blocking(uint32_t usart);
+void usart_enable_rx_dma(uint32_t usart);
+void usart_disable_rx_dma(uint32_t usart);
+void usart_enable_tx_dma(uint32_t usart);
+void usart_disable_tx_dma(uint32_t usart);
+void usart_enable_rx_interrupt(uint32_t usart);
+void usart_disable_rx_interrupt(uint32_t usart);
+void usart_enable_tx_interrupt(uint32_t usart);
+void usart_disable_tx_interrupt(uint32_t usart);
+void usart_enable_error_interrupt(uint32_t usart);
+void usart_disable_error_interrupt(uint32_t usart);
+bool usart_get_flag(uint32_t usart, uint32_t flag);
+bool usart_get_interrupt_source(uint32_t usart, uint32_t flag);
+
+END_DECLS
+
+#endif
+