diff options
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/adc.c | 6 | ||||
-rw-r--r-- | libmaple/bkp.c | 8 | ||||
-rw-r--r-- | libmaple/dac.c | 6 | ||||
-rw-r--r-- | libmaple/delay.h | 30 | ||||
-rw-r--r-- | libmaple/dma.c | 6 | ||||
-rw-r--r-- | libmaple/exti.c | 8 | ||||
-rw-r--r-- | libmaple/flash.c | 6 | ||||
-rw-r--r-- | libmaple/fsmc.c | 4 | ||||
-rw-r--r-- | libmaple/gpio.c | 4 | ||||
-rw-r--r-- | libmaple/i2c.c | 15 | ||||
-rw-r--r-- | libmaple/include/libmaple/adc.h (renamed from libmaple/adc.h) | 12 | ||||
-rw-r--r-- | libmaple/include/libmaple/bitband.h (renamed from libmaple/bitband.h) | 16 | ||||
-rw-r--r-- | libmaple/include/libmaple/bkp.h (renamed from libmaple/bkp.h) | 8 | ||||
-rw-r--r-- | libmaple/include/libmaple/dac.h (renamed from libmaple/dac.h) | 8 | ||||
-rw-r--r-- | libmaple/include/libmaple/delay.h | 65 | ||||
-rw-r--r-- | libmaple/include/libmaple/dma.h (renamed from libmaple/dma.h) | 12 | ||||
-rw-r--r-- | libmaple/include/libmaple/exti.h (renamed from libmaple/exti.h) | 10 | ||||
-rw-r--r-- | libmaple/include/libmaple/flash.h (renamed from libmaple/flash.h) | 10 | ||||
-rw-r--r-- | libmaple/include/libmaple/fsmc.h (renamed from libmaple/fsmc.h) | 12 | ||||
-rw-r--r-- | libmaple/include/libmaple/gpio.h (renamed from libmaple/gpio.h) | 11 | ||||
-rw-r--r-- | libmaple/include/libmaple/i2c.h (renamed from libmaple/i2c.h) | 20 | ||||
-rw-r--r-- | libmaple/include/libmaple/iwdg.h (renamed from libmaple/iwdg.h) | 10 | ||||
-rw-r--r-- | libmaple/include/libmaple/libmaple.h (renamed from libmaple/libmaple.h) | 19 | ||||
-rw-r--r-- | libmaple/include/libmaple/libmaple_types.h (renamed from libmaple/libmaple_types.h) | 11 | ||||
-rw-r--r-- | libmaple/include/libmaple/nvic.h (renamed from libmaple/nvic.h) | 10 | ||||
-rw-r--r-- | libmaple/include/libmaple/pwr.h (renamed from libmaple/pwr.h) | 7 | ||||
-rw-r--r-- | libmaple/include/libmaple/rcc.h (renamed from libmaple/rcc.h) | 8 | ||||
-rw-r--r-- | libmaple/include/libmaple/ring_buffer.h (renamed from libmaple/ring_buffer.h) | 9 | ||||
-rw-r--r-- | libmaple/include/libmaple/scb.h (renamed from libmaple/scb.h) | 14 | ||||
-rw-r--r-- | libmaple/include/libmaple/spi.h (renamed from libmaple/spi.h) | 16 | ||||
-rw-r--r-- | libmaple/include/libmaple/stm32.h (renamed from libmaple/stm32.h) | 14 | ||||
-rw-r--r-- | libmaple/include/libmaple/systick.h (renamed from libmaple/systick.h) | 13 | ||||
-rw-r--r-- | libmaple/include/libmaple/timer.h (renamed from libmaple/timer.h) | 18 | ||||
-rw-r--r-- | libmaple/include/libmaple/usart.h (renamed from libmaple/usart.h) | 18 | ||||
-rw-r--r-- | libmaple/include/libmaple/usb.h (renamed from libmaple/usb.h) | 10 | ||||
-rw-r--r-- | libmaple/include/libmaple/util.h (renamed from libmaple/util.h) | 8 | ||||
-rw-r--r-- | libmaple/iwdg.c | 2 | ||||
-rw-r--r-- | libmaple/nvic.c | 6 | ||||
-rw-r--r-- | libmaple/pwr.c | 4 | ||||
-rw-r--r-- | libmaple/rcc.c | 8 | ||||
-rw-r--r-- | libmaple/rules.mk | 7 | ||||
-rw-r--r-- | libmaple/spi.c | 4 | ||||
-rw-r--r-- | libmaple/syscalls.c | 2 | ||||
-rw-r--r-- | libmaple/systick.c | 2 | ||||
-rw-r--r-- | libmaple/timer.c | 2 | ||||
-rw-r--r-- | libmaple/usart.c | 2 | ||||
-rw-r--r-- | libmaple/usb/usb_cdcacm.h | 4 | ||||
-rw-r--r-- | libmaple/util.c | 12 |
48 files changed, 294 insertions, 223 deletions
diff --git a/libmaple/adc.c b/libmaple/adc.c index 2bd2ad1..40369e9 100644 --- a/libmaple/adc.c +++ b/libmaple/adc.c @@ -37,9 +37,9 @@ * See STM32 manual RM0008 for how to calculate this. */ -#include "libmaple.h" -#include "rcc.h" -#include "adc.h" +#include <libmaple/libmaple.h> +#include <libmaple/rcc.h> +#include <libmaple/adc.h> static adc_dev adc1 = { .regs = ADC1_BASE, diff --git a/libmaple/bkp.c b/libmaple/bkp.c index 7d1ad7f..62783e7 100644 --- a/libmaple/bkp.c +++ b/libmaple/bkp.c @@ -29,10 +29,10 @@ * @brief Backup register support. */ -#include "bkp.h" -#include "pwr.h" -#include "rcc.h" -#include "bitband.h" +#include <libmaple/bkp.h> +#include <libmaple/pwr.h> +#include <libmaple/rcc.h> +#include <libmaple/bitband.h> static inline __io uint32* data_register(uint8 reg); diff --git a/libmaple/dac.c b/libmaple/dac.c index 15e944f..efcba15 100644 --- a/libmaple/dac.c +++ b/libmaple/dac.c @@ -29,9 +29,9 @@ * @brief Digital to analog converter support. */ -#include "libmaple.h" -#include "gpio.h" -#include "dac.h" +#include <libmaple/libmaple.h> +#include <libmaple/gpio.h> +#include <libmaple/dac.h> #ifdef STM32_HIGH_DENSITY diff --git a/libmaple/delay.h b/libmaple/delay.h deleted file mode 100644 index 6f8b8ba..0000000 --- a/libmaple/delay.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file delay.h - * @brief Delay implementation - */ - -#include "libmaple_types.h" -#include "stm32.h" - -#ifndef _DELAY_H_ -#define _DELAY_H_ - -/** - * @brief Delay the given number of microseconds. - * - * @param us Number of microseconds to delay. - */ -static inline void delay_us(uint32 us) { - us *= STM32_DELAY_US_MULT; - - /* fudge for function call overhead */ - us--; - asm volatile(" mov r0, %[us] \n\t" - "1: subs r0, #1 \n\t" - " bhi 1b \n\t" - : - : [us] "r" (us) - : "r0"); -} -#endif - diff --git a/libmaple/dma.c b/libmaple/dma.c index 60f4d47..f20613b 100644 --- a/libmaple/dma.c +++ b/libmaple/dma.c @@ -31,9 +31,9 @@ * @brief Direct Memory Access peripheral support */ -#include "dma.h" -#include "bitband.h" -#include "util.h" +#include <libmaple/dma.h> +#include <libmaple/bitband.h> +#include <libmaple/util.h> /* * Devices diff --git a/libmaple/exti.c b/libmaple/exti.c index 1fcc35b..00e0df2 100644 --- a/libmaple/exti.c +++ b/libmaple/exti.c @@ -29,10 +29,10 @@ * @brief External interrupt control routines */ -#include "exti.h" -#include "libmaple.h" -#include "nvic.h" -#include "bitband.h" +#include <libmaple/exti.h> +#include <libmaple/libmaple.h> +#include <libmaple/nvic.h> +#include <libmaple/bitband.h> static inline void dispatch_single_exti(uint32 exti_num); static inline void dispatch_extis(uint32 start, uint32 stop); diff --git a/libmaple/flash.c b/libmaple/flash.c index a22fbd3..d0e23d0 100644 --- a/libmaple/flash.c +++ b/libmaple/flash.c @@ -29,9 +29,9 @@ * @brief Flash management functions */ -#include "libmaple.h" -#include "flash.h" -#include "bitband.h" +#include <libmaple/libmaple.h> +#include <libmaple/flash.h> +#include <libmaple/bitband.h> /** * @brief Turn on the hardware prefetcher. diff --git a/libmaple/fsmc.c b/libmaple/fsmc.c index 06ca7df..bf4611d 100644 --- a/libmaple/fsmc.c +++ b/libmaple/fsmc.c @@ -29,8 +29,8 @@ * @brief Flexible static memory controller support. */ -#include "fsmc.h" -#include "gpio.h" +#include <libmaple/fsmc.h> +#include <libmaple/gpio.h> #ifdef STM32_HIGH_DENSITY diff --git a/libmaple/gpio.c b/libmaple/gpio.c index e643873..e607595 100644 --- a/libmaple/gpio.c +++ b/libmaple/gpio.c @@ -29,8 +29,8 @@ * @brief GPIO initialization routine */ -#include "gpio.h" -#include "rcc.h" +#include <libmaple/gpio.h> +#include <libmaple/rcc.h> /* * GPIO devices diff --git a/libmaple/i2c.c b/libmaple/i2c.c index e3f3199..ae44532 100644 --- a/libmaple/i2c.c +++ b/libmaple/i2c.c @@ -31,13 +31,14 @@ * Currently, only master mode is supported. */ -#include "libmaple.h" -#include "rcc.h" -#include "gpio.h" -#include "nvic.h" -#include "i2c.h" -#include "string.h" -#include "systick.h" +#include <libmaple/libmaple.h> +#include <libmaple/rcc.h> +#include <libmaple/gpio.h> +#include <libmaple/nvic.h> +#include <libmaple/i2c.h> +#include <libmaple/systick.h> + +#include <string.h> static i2c_dev i2c_dev1 = { .regs = I2C1_BASE, diff --git a/libmaple/adc.h b/libmaple/include/libmaple/adc.h index d0b85fa..d531d00 100644 --- a/libmaple/adc.h +++ b/libmaple/include/libmaple/adc.h @@ -30,17 +30,17 @@ * @brief Analog-to-Digital Conversion (ADC) header. */ -#ifndef _ADC_H_ -#define _ADC_H_ - -#include "libmaple.h" -#include "bitband.h" -#include "rcc.h" +#ifndef _LIBMAPLE_ADC_H_ +#define _LIBMAPLE_ADC_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple.h> +#include <libmaple/bitband.h> +#include <libmaple/rcc.h> + /** ADC register map type. */ typedef struct adc_reg_map { __io uint32 SR; ///< Status register diff --git a/libmaple/bitband.h b/libmaple/include/libmaple/bitband.h index 73941b0..607e4eb 100644 --- a/libmaple/bitband.h +++ b/libmaple/include/libmaple/bitband.h @@ -30,10 +30,14 @@ * @brief Bit-banding utility functions */ -#include "libmaple_types.h" +#ifndef _LIBMAPLE_BITBAND_H_ +#define _LIBMAPLE_BITBAND_H_ -#ifndef _BITBAND_H_ -#define _BITBAND_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#include <libmaple/libmaple_types.h> #define BB_SRAM_REF 0x20000000 #define BB_SRAM_BASE 0x22000000 @@ -117,4 +121,8 @@ static inline volatile uint32* __bb_addr(volatile void *address, bit * 4); } -#endif /* _BITBAND_H_ */ +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libmaple/bkp.h b/libmaple/include/libmaple/bkp.h index a81267d..92359b6 100644 --- a/libmaple/bkp.h +++ b/libmaple/include/libmaple/bkp.h @@ -29,15 +29,15 @@ * @brief Backup register support. */ -#ifndef _BKP_H_ -#define _BKP_H_ - -#include "libmaple.h" +#ifndef _LIBMAPLE_BKP_H_ +#define _LIBMAPLE_BKP_H_ #ifdef __cplusplus extern "C" { #endif +#include <libmaple/libmaple.h> + #if defined(STM32_MEDIUM_DENSITY) #define BKP_NR_DATA_REGS 10 #elif defined(STM32_HIGH_DENSITY) diff --git a/libmaple/dac.h b/libmaple/include/libmaple/dac.h index aa04981..738bede 100644 --- a/libmaple/dac.h +++ b/libmaple/include/libmaple/dac.h @@ -31,15 +31,15 @@ /* See notes/dac.txt for more info */ -#ifndef _DAC_H_ -#define _DAC_H_ - -#include "rcc.h" +#ifndef _LIBMAPLE_DAC_H_ +#define _LIBMAPLE_DAC_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/rcc.h> + /* * Register maps */ diff --git a/libmaple/include/libmaple/delay.h b/libmaple/include/libmaple/delay.h new file mode 100644 index 0000000..f79655d --- /dev/null +++ b/libmaple/include/libmaple/delay.h @@ -0,0 +1,65 @@ +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2010 Perry Hung. + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/** + * @file delay.h + * @brief Delay implementation + */ + +#ifndef _LIBMAPLE_DELAY_H_ +#define _LIBMAPLE_DELAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <libmaple/libmaple_types.h> +#include <libmaple/stm32.h> + +/** + * @brief Delay the given number of microseconds. + * + * @param us Number of microseconds to delay. + */ +static inline void delay_us(uint32 us) { + us *= STM32_DELAY_US_MULT; + + /* fudge for function call overhead */ + us--; + asm volatile(" mov r0, %[us] \n\t" + "1: subs r0, #1 \n\t" + " bhi 1b \n\t" + : + : [us] "r" (us) + : "r0"); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libmaple/dma.h b/libmaple/include/libmaple/dma.h index 6e8087f..da2bd4f 100644 --- a/libmaple/dma.h +++ b/libmaple/include/libmaple/dma.h @@ -37,17 +37,17 @@ * See /notes/dma.txt for more information. */ -#ifndef _DMA_H_ -#define _DMA_H_ - -#include "libmaple_types.h" -#include "rcc.h" -#include "nvic.h" +#ifndef _LIBMAPLE_DMA_H_ +#define _LIBMAPLE_DMA_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/rcc.h> +#include <libmaple/nvic.h> + /* * Register maps */ diff --git a/libmaple/exti.h b/libmaple/include/libmaple/exti.h index f225844..0a763d7 100644 --- a/libmaple/exti.h +++ b/libmaple/include/libmaple/exti.h @@ -31,16 +31,16 @@ /* See notes/exti.txt for more info */ -#include "libmaple.h" -#include "gpio.h" - -#ifndef _EXTI_H_ -#define _EXTI_H_ +#ifndef _LIBMAPLE_EXTI_H_ +#define _LIBMAPLE_EXTI_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple.h> +#include <libmaple/gpio.h> + /** EXTI register map type */ typedef struct exti_reg_map { __io uint32 IMR; /**< Interrupt mask register */ diff --git a/libmaple/flash.h b/libmaple/include/libmaple/flash.h index 0b4e49b..e28ea28 100644 --- a/libmaple/flash.h +++ b/libmaple/include/libmaple/flash.h @@ -30,15 +30,15 @@ * routines */ -#include "libmaple_types.h" - -#ifndef _FLASH_H_ -#define _FLASH_H_ +#ifndef _LIBMAPLE_FLASH_H_ +#define _LIBMAPLE_FLASH_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> + /** Flash register map type */ typedef struct flash_reg_map { __io uint32 ACR; /**< Access control register */ @@ -138,5 +138,3 @@ void flash_set_latency(uint32 wait_states); #endif #endif - - diff --git a/libmaple/fsmc.h b/libmaple/include/libmaple/fsmc.h index ef82b08..95b0d3a 100644 --- a/libmaple/fsmc.h +++ b/libmaple/include/libmaple/fsmc.h @@ -33,19 +33,15 @@ * See ../notes/fsmc.txt for more info */ -#include "libmaple_types.h" - -/** - * @file fsmc.h - */ - -#ifndef _FSMC_H_ -#define _FSMC_H_ +#ifndef _LIBMAPLE_FSMC_H_ +#define _LIBMAPLE_FSMC_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> + #ifdef STM32_HIGH_DENSITY /* diff --git a/libmaple/gpio.h b/libmaple/include/libmaple/gpio.h index a7859a7..685e1b1 100644 --- a/libmaple/gpio.h +++ b/libmaple/include/libmaple/gpio.h @@ -31,16 +31,16 @@ * (AFIO) prototypes, defines, and inlined access functions. */ -#ifndef _GPIO_H_ -#define _GPIO_H_ - -#include "libmaple.h" -#include "rcc.h" +#ifndef _LIBMAPLE_GPIO_H_ +#define _LIBMAPLE_GPIO_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple.h> +#include <libmaple/rcc.h> + /* * GPIO register maps and devices */ @@ -524,4 +524,3 @@ static inline void afio_cfg_debug_ports(afio_debug_cfg config) { #endif #endif - diff --git a/libmaple/i2c.h b/libmaple/include/libmaple/i2c.h index 4c60ad7..35c4628 100644 --- a/libmaple/i2c.h +++ b/libmaple/include/libmaple/i2c.h @@ -29,13 +29,17 @@ * @brief Inter-Integrated Circuit (I2C) peripheral support */ -#include "libmaple_types.h" -#include "rcc.h" -#include "nvic.h" -#include "gpio.h" +#ifndef _LIBMAPLE_I2C_H_ +#define _LIBMAPLE_I2C_H_ -#ifndef _I2C_H_ -#define _I2C_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#include <libmaple/libmaple_types.h> +#include <libmaple/rcc.h> +#include <libmaple/nvic.h> +#include <libmaple/gpio.h> /** I2C register map type */ typedef struct i2c_reg_map { @@ -169,10 +173,6 @@ extern i2c_dev* const I2C2; * Convenience routines */ -#ifdef __cplusplus -extern "C" { -#endif - void i2c_init(i2c_dev *dev); /* I2C enable options */ diff --git a/libmaple/iwdg.h b/libmaple/include/libmaple/iwdg.h index 59e8e18..baddf4f 100644 --- a/libmaple/iwdg.h +++ b/libmaple/include/libmaple/iwdg.h @@ -38,16 +38,16 @@ * Once started, the independent watchdog cannot be turned off. */ -#ifndef _IWDG_H_ -#define _IWDG_H_ - -#include "libmaple_types.h" -#include "util.h" +#ifndef _LIBMAPLE_IWDG_H_ +#define _LIBMAPLE_IWDG_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/util.h> + /* * Register map */ diff --git a/libmaple/libmaple.h b/libmaple/include/libmaple/libmaple.h index c509f5d..60b23ed 100644 --- a/libmaple/libmaple.h +++ b/libmaple/include/libmaple/libmaple.h @@ -29,13 +29,17 @@ * @brief General include file for libmaple */ -#ifndef _LIBMAPLE_H_ -#define _LIBMAPLE_H_ +#ifndef _LIBMAPLE_LIBMAPLE_H_ +#define _LIBMAPLE_LIBMAPLE_H_ -#include "libmaple_types.h" -#include "stm32.h" -#include "util.h" -#include "delay.h" +#ifdef __cplusplus +extern "C" { +#endif + +#include <libmaple/libmaple_types.h> +#include <libmaple/stm32.h> +#include <libmaple/util.h> +#include <libmaple/delay.h> /* * Where to put usercode, based on space reserved for bootloader. @@ -46,5 +50,8 @@ #define USER_ADDR_RAM 0x20000C00 #define STACK_TOP 0x20000800 +#ifdef __cplusplus +} #endif +#endif diff --git a/libmaple/libmaple_types.h b/libmaple/include/libmaple/libmaple_types.h index 08adaff..ae01691 100644 --- a/libmaple/libmaple_types.h +++ b/libmaple/include/libmaple/libmaple_types.h @@ -30,8 +30,12 @@ * @brief libmaple types */ -#ifndef _LIBMAPLE_TYPES_H_ -#define _LIBMAPLE_TYPES_H_ +#ifndef _LIBMAPLE_LIBMAPLE_TYPES_H_ +#define _LIBMAPLE_LIBMAPLE_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif typedef unsigned char uint8; typedef unsigned short uint16; @@ -53,5 +57,8 @@ typedef void (*voidFuncPtr)(void); #define NULL 0 #endif +#ifdef __cplusplus +} #endif +#endif diff --git a/libmaple/nvic.h b/libmaple/include/libmaple/nvic.h index feb7335..d631eeb 100644 --- a/libmaple/nvic.h +++ b/libmaple/include/libmaple/nvic.h @@ -43,16 +43,16 @@ * @endcode */ -#ifndef _NVIC_H_ -#define _NVIC_H_ - -#include "libmaple_types.h" -#include "util.h" +#ifndef _LIBMAPLE_NVIC_H_ +#define _LIBMAPLE_NVIC_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/util.h> + /** NVIC register map type. */ typedef struct nvic_reg_map { __io uint32 ISER[8]; /**< Interrupt Set Enable Registers */ diff --git a/libmaple/pwr.h b/libmaple/include/libmaple/pwr.h index 88b49c0..6836e7f 100644 --- a/libmaple/pwr.h +++ b/libmaple/include/libmaple/pwr.h @@ -29,12 +29,15 @@ * @brief Power control (PWR) defines. */ -#include "libmaple.h" +#ifndef _LIBMAPLE_PWR_H_ +#define _LIBMAPLE_PWR_H_ #ifdef __cplusplus extern "C" { #endif +#include <libmaple/libmaple.h> + /** Power interface register map. */ typedef struct pwr_reg_map { __io uint32 CR; /**< Control register */ @@ -83,3 +86,5 @@ void pwr_init(void); #ifdef __cplusplus } #endif + +#endif diff --git a/libmaple/rcc.h b/libmaple/include/libmaple/rcc.h index c50686c..ef44b68 100644 --- a/libmaple/rcc.h +++ b/libmaple/include/libmaple/rcc.h @@ -29,15 +29,15 @@ * @brief reset and clock control definitions and prototypes */ -#include "libmaple_types.h" - -#ifndef _RCC_H_ -#define _RCC_H_ +#ifndef _LIBMAPLE_RCC_H_ +#define _LIBMAPLE_RCC_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> + /** RCC register map type */ typedef struct rcc_reg_map { __io uint32 CR; /**< Clock control register */ diff --git a/libmaple/ring_buffer.h b/libmaple/include/libmaple/ring_buffer.h index c443bc3..7169e7e 100644 --- a/libmaple/ring_buffer.h +++ b/libmaple/include/libmaple/ring_buffer.h @@ -32,15 +32,15 @@ * these functions is guaranteed re-entrant. */ -#ifndef _RING_BUFFER_H_ -#define _RING_BUFFER_H_ - -#include "libmaple_types.h" +#ifndef _LIBMAPLE_RING_BUFFER_H_ +#define _LIBMAPLE_RING_BUFFER_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> + /** * Ring buffer type. * @@ -186,4 +186,3 @@ static inline void rb_reset(ring_buffer *rb) { #endif #endif - diff --git a/libmaple/scb.h b/libmaple/include/libmaple/scb.h index feacaa5..9c4ee15 100644 --- a/libmaple/scb.h +++ b/libmaple/include/libmaple/scb.h @@ -29,10 +29,14 @@ * @brief System control block header */ -#include "libmaple_types.h" +#ifndef _LIBMAPLE_SCB_H_ +#define _LIBMAPLE_SCB_H_ -#ifndef _SCB_H_ -#define _SCB_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#include <libmaple/libmaple_types.h> /* * Register map and base pointer @@ -198,4 +202,8 @@ typedef struct scb_reg_map { #define SCB_DFSR_BKPT BIT(1) #define SCB_DFSR_HALTED BIT(0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/libmaple/spi.h b/libmaple/include/libmaple/spi.h index f4fa4b7..6f509c2 100644 --- a/libmaple/spi.h +++ b/libmaple/include/libmaple/spi.h @@ -33,19 +33,19 @@ * I2S support is currently limited to register maps and bit definitions. */ -#ifndef _SPI_H_ -#define _SPI_H_ - -#include "libmaple_types.h" -#include "rcc.h" -#include "nvic.h" -#include "gpio.h" -#include "util.h" +#ifndef _LIBMAPLE_SPI_H_ +#define _LIBMAPLE_SPI_H_ #ifdef __cplusplus extern "C" { #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/rcc.h> +#include <libmaple/nvic.h> +#include <libmaple/gpio.h> +#include <libmaple/util.h> + /* * Register maps */ diff --git a/libmaple/stm32.h b/libmaple/include/libmaple/stm32.h index 3b54dbc..53a5d7a 100644 --- a/libmaple/stm32.h +++ b/libmaple/include/libmaple/stm32.h @@ -29,8 +29,12 @@ * @brief STM32 chip-specific definitions */ -#ifndef _STM32_H_ -#define _STM32_H_ +#ifndef _LIBMAPLE_STM32_H_ +#define _LIBMAPLE_STM32_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* * User-specific configuration. @@ -188,4 +192,8 @@ #endif -#endif /* _STM32_H_ */ +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libmaple/systick.h b/libmaple/include/libmaple/systick.h index 6ec3364..1731c85 100644 --- a/libmaple/systick.h +++ b/libmaple/include/libmaple/systick.h @@ -27,19 +27,19 @@ /** * @file systick.h * - * @brief Various system timer definitions + * @brief System timer definitions */ -#ifndef _SYSTICK_H_ -#define _SYSTICK_H_ - -#include "libmaple_types.h" -#include "util.h" +#ifndef _LIBMAPLE_SYSTICK_H_ +#define _LIBMAPLE_SYSTICK_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/util.h> + /** SysTick register map type */ typedef struct systick_reg_map { __io uint32 CSR; /**< Control and status register */ @@ -114,4 +114,3 @@ static inline uint32 systick_check_underflow(void) { #endif #endif - diff --git a/libmaple/timer.h b/libmaple/include/libmaple/timer.h index 53e2547..9e4e20c 100644 --- a/libmaple/timer.h +++ b/libmaple/include/libmaple/timer.h @@ -27,23 +27,21 @@ /** * @file timer.h * @author Marti Bolivar <mbolivar@leaflabs.com> - * @brief New-style timer interface. - * - * Replaces old timers.h implementation. + * @brief Timer interface. */ -#ifndef _TIMERS_H_ -#define _TIMERS_H_ - -#include "libmaple.h" -#include "rcc.h" -#include "nvic.h" -#include "bitband.h" +#ifndef _LIBMAPLE_TIMERS_H_ +#define _LIBMAPLE_TIMERS_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple.h> +#include <libmaple/rcc.h> +#include <libmaple/nvic.h> +#include <libmaple/bitband.h> + /* * Register maps and devices */ diff --git a/libmaple/usart.h b/libmaple/include/libmaple/usart.h index ed00e16..f9bdb8b 100644 --- a/libmaple/usart.h +++ b/libmaple/include/libmaple/usart.h @@ -31,19 +31,19 @@ * @brief USART definitions and prototypes */ -#ifndef _USART_H_ -#define _USART_H_ - -#include "libmaple_types.h" -#include "util.h" -#include "rcc.h" -#include "nvic.h" -#include "ring_buffer.h" +#ifndef _LIBMAPLE_USART_H_ +#define _LIBMAPLE_USART_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/util.h> +#include <libmaple/rcc.h> +#include <libmaple/nvic.h> +#include <libmaple/ring_buffer.h> + /* * Register maps and devices */ @@ -333,4 +333,4 @@ static inline void usart_reset_rx(usart_dev *dev) { } // extern "C" #endif -#endif // _USART_H_ +#endif diff --git a/libmaple/usb.h b/libmaple/include/libmaple/usb.h index 94579ea..82bace9 100644 --- a/libmaple/usb.h +++ b/libmaple/include/libmaple/usb.h @@ -28,16 +28,16 @@ * NOTE: This API is _unstable_ and will change drastically over time. */ -#ifndef _USB_H_ -#define _USB_H_ - -#include "libmaple_types.h" -#include "rcc.h" +#ifndef _LIBMAPLE_USB_H_ +#define _LIBMAPLE_USB_H_ #ifdef __cplusplus extern "C" { #endif +#include <libmaple/libmaple_types.h> +#include <libmaple/rcc.h> + #ifndef USB_ISR_MSK /* Handle CTRM, WKUPM, SUSPM, ERRM, SOFM, ESOFM, RESETM */ #define USB_ISR_MSK 0xBF00 diff --git a/libmaple/util.h b/libmaple/include/libmaple/util.h index 7b41769..d0b7b0b 100644 --- a/libmaple/util.h +++ b/libmaple/include/libmaple/util.h @@ -29,15 +29,15 @@ * @brief Miscellaneous utility macros and procedures. */ -#include "libmaple_types.h" - -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef _LIBMAPLE_UTIL_H_ +#define _LIBMAPLE_UTIL_H_ #ifdef __cplusplus extern "C"{ #endif +#include <libmaple/libmaple_types.h> + /* * Bit manipulation */ diff --git a/libmaple/iwdg.c b/libmaple/iwdg.c index 63c1b2b..6dd77fc 100644 --- a/libmaple/iwdg.c +++ b/libmaple/iwdg.c @@ -29,7 +29,7 @@ * @brief Independent watchdog (IWDG) support */ -#include "iwdg.h" +#include <libmaple/iwdg.h> /** * @brief Initialise and start the watchdog diff --git a/libmaple/nvic.c b/libmaple/nvic.c index 345c850..b80751f 100644 --- a/libmaple/nvic.c +++ b/libmaple/nvic.c @@ -29,9 +29,9 @@ * @brief Nested vector interrupt controller support. */ -#include "nvic.h" -#include "scb.h" -#include "stm32.h" +#include <libmaple/nvic.h> +#include <libmaple/scb.h> +#include <libmaple/stm32.h> /** * @brief Set interrupt priority for an interrupt line diff --git a/libmaple/pwr.c b/libmaple/pwr.c index ead8b64..f934269 100644 --- a/libmaple/pwr.c +++ b/libmaple/pwr.c @@ -29,8 +29,8 @@ * @brief Power control (PWR) support. */ -#include "pwr.h" -#include "rcc.h" +#include <libmaple/pwr.h> +#include <libmaple/rcc.h> /** * Enables the power interface clock, and resets the power device. diff --git a/libmaple/rcc.c b/libmaple/rcc.c index 65abfb6..ed3f11e 100644 --- a/libmaple/rcc.c +++ b/libmaple/rcc.c @@ -30,10 +30,10 @@ * stm32, clock enable/disable and peripheral reset commands. */ -#include "libmaple.h" -#include "flash.h" -#include "rcc.h" -#include "bitband.h" +#include <libmaple/libmaple.h> +#include <libmaple/flash.h> +#include <libmaple/rcc.h> +#include <libmaple/bitband.h> #define APB1 RCC_APB1 #define APB2 RCC_APB2 diff --git a/libmaple/rules.mk b/libmaple/rules.mk index 1ee611d..a6b330a 100644 --- a/libmaple/rules.mk +++ b/libmaple/rules.mk @@ -6,10 +6,13 @@ BUILDDIRS += $(BUILD_PATH)/$(d) BUILDDIRS += $(BUILD_PATH)/$(d)/usb BUILDDIRS += $(BUILD_PATH)/$(d)/usb/usb_lib -LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH) -I$(LIBMAPLE_PATH)/usb -I$(LIBMAPLE_PATH)/usb/usb_lib +LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH)/include +# FIXME: move public USB headers to include/libmaple/usb/ or something. +LIBMAPLE_INCLUDES += -I$(LIBMAPLE_PATH)/usb \ + -I$(LIBMAPLE_PATH)/usb/usb_lib # Local flags -CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) -Wall -Werror +CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) -Wall # -Werror # Local rules and targets cSRCS_$(d) := adc.c \ diff --git a/libmaple/spi.c b/libmaple/spi.c index 1c68529..d0aaaf0 100644 --- a/libmaple/spi.c +++ b/libmaple/spi.c @@ -31,8 +31,8 @@ * Currently, there is no Integrated Interchip Sound (I2S) support. */ -#include "spi.h" -#include "bitband.h" +#include <libmaple/spi.h> +#include <libmaple/bitband.h> static void spi_reconfigure(spi_dev *dev, uint32 cr1_config); diff --git a/libmaple/syscalls.c b/libmaple/syscalls.c index 8a57945..86fd8e6 100644 --- a/libmaple/syscalls.c +++ b/libmaple/syscalls.c @@ -30,7 +30,7 @@ * memory allocation. */ -#include "libmaple.h" +#include <libmaple/libmaple.h> #include <sys/stat.h> #include <errno.h> diff --git a/libmaple/systick.c b/libmaple/systick.c index 9bb5d50..c6e3cbd 100644 --- a/libmaple/systick.c +++ b/libmaple/systick.c @@ -29,7 +29,7 @@ * @brief System timer interrupt handler and initialization routines */ -#include "systick.h" +#include <libmaple/systick.h> volatile uint32 systick_uptime_millis; static void (*systick_user_callback)(void); diff --git a/libmaple/timer.c b/libmaple/timer.c index 83e9ace..90995e2 100644 --- a/libmaple/timer.c +++ b/libmaple/timer.c @@ -30,7 +30,7 @@ * @brief New-style timer interface */ -#include "timer.h" +#include <libmaple/timer.h> /* Just like the corresponding DIER bits: * [0] = Update handler; diff --git a/libmaple/usart.c b/libmaple/usart.c index 0bdc37a..ba63b79 100644 --- a/libmaple/usart.c +++ b/libmaple/usart.c @@ -31,7 +31,7 @@ * @brief USART control routines */ -#include "usart.h" +#include <libmaple/usart.h> /* * Devices diff --git a/libmaple/usb/usb_cdcacm.h b/libmaple/usb/usb_cdcacm.h index 8ca1c68..ec672a3 100644 --- a/libmaple/usb/usb_cdcacm.h +++ b/libmaple/usb/usb_cdcacm.h @@ -32,8 +32,8 @@ #ifndef _USB_CDCACM_H_ #define _USB_CDCACM_H_ -#include "libmaple_types.h" -#include "gpio.h" +#include <libmaple/libmaple_types.h> +#include <libmaple/gpio.h> #ifdef __cplusplus extern "C" { diff --git a/libmaple/util.c b/libmaple/util.c index b15d658..07e9572 100644 --- a/libmaple/util.c +++ b/libmaple/util.c @@ -30,12 +30,12 @@ * and messages dumped over a UART for failed asserts. */ -#include "libmaple.h" -#include "usart.h" -#include "gpio.h" -#include "nvic.h" -#include "adc.h" -#include "timer.h" +#include <libmaple/libmaple.h> +#include <libmaple/usart.h> +#include <libmaple/gpio.h> +#include <libmaple/nvic.h> +#include <libmaple/adc.h> +#include <libmaple/timer.h> /* Failed ASSERT()s send out a message using this USART config. */ #ifndef ERROR_USART |