aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-11-15 12:45:43 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2012-04-11 16:56:50 -0400
commitf36fae273ec84ee2c53a33caa2dddea2d79db0da (patch)
treefcdaf01cc72a69ca8252213eec35fa0c4aba9ce0 /wirish
parent526d51aa2b83c7a73a2ecdba8525d2a0847e5587 (diff)
downloadlibrambutan-f36fae273ec84ee2c53a33caa2dddea2d79db0da.tar.gz
librambutan-f36fae273ec84ee2c53a33caa2dddea2d79db0da.zip
Move public headers to include directories; related cleanups.
Move libmaple/*.h to (new) libmaple/include/libmaple/. The new accepted way to include a libmaple header foo.h is with: #include <libmaple/foo.h> This is more polite in terms of the include namespace. It also allows us to e.g. implement the Arduino SPI library at all (which has header SPI.h; providing it was previously impossible on case-insensitive filesystems due to libmaple's spi.h). Similarly for Wirish. The old include style (#include "header.h") is now deprecated. libmaple/*.h: - Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_. - Add license headers where they're missing - Add conditional extern "C" { ... } blocks where they're missing (they aren't always necessary, but we might was well do it against the future, while we're at it.). - Change includes from #include "foo.h" to #include <libmaple/foo.h>. - Move includes after extern "C". - Remove extra trailing newlines Note that this doesn't include the headers under libmaple/usb/ or libmaple/usb/usb_lib. These will get fixed later. libmaple/*.c: - Change includes from #include "foo.h" to #include <libmaple/foo.h>. Makefile: - Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows for users (including Wirish) to migrate their code, but should go away ASAP, since it slows down compilation. Wirish: - Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores the USB headers, which, as usual, are getting handled after everything else. - Similarly generify wirish/boards/ structure. For each supported board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to wirish/boards/foo/include/board/board.h and wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef hacks around the .cpp files. - wirish/rules.mk: put wirish/boards/foo/include in the include path (and add wirish/boards/foo/board.cpp to the list of sources to be compiled). This allows saying: #include <board/board.h> instead of the hack currently in place. We can allow the user to override this setting later to make adding custom board definitions easier. - Disable -Werror in libmaple/rules.mk, as the current USB warnings don't let the olimex_stm32_h103 board compile. We can re-enable -Werror once we've moved the board-specific bits out of libmaple proper. libraries, examples: - Update includes accordingly. - Miscellaneous cosmetic fixups. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'wirish')
-rw-r--r--wirish/HardwareTimer.cpp6
-rw-r--r--wirish/Print.cpp5
-rw-r--r--wirish/boards.cpp18
-rw-r--r--wirish/boards/maple/board.cpp (renamed from wirish/boards/maple.cpp)16
-rw-r--r--wirish/boards/maple/include/board/board.h (renamed from wirish/boards/maple.h)4
-rw-r--r--wirish/boards/maple_RET6/board.cpp (renamed from wirish/boards/maple_RET6.cpp)13
-rw-r--r--wirish/boards/maple_RET6/include/board/board.h (renamed from wirish/boards/maple_RET6.h)7
-rw-r--r--wirish/boards/maple_mini/board.cpp (renamed from wirish/boards/maple_mini.cpp)15
-rw-r--r--wirish/boards/maple_mini/include/board/board.h (renamed from wirish/boards/maple_mini.h)7
-rw-r--r--wirish/boards/maple_native/board.cpp (renamed from wirish/boards/maple_native.cpp)18
-rw-r--r--wirish/boards/maple_native/include/board/board.h (renamed from wirish/boards/maple_native.h)7
-rw-r--r--wirish/boards/olimex_stm32_h103/board.cpp (renamed from wirish/boards/olimex_stm32_h103.cpp)15
-rw-r--r--wirish/boards/olimex_stm32_h103/include/board/board.h (renamed from wirish/boards/olimex_stm32_h103.h)4
-rw-r--r--wirish/comm/HardwareSPI.cpp12
-rw-r--r--wirish/comm/HardwareSerial.cpp11
-rw-r--r--wirish/ext_interrupts.cpp8
-rw-r--r--wirish/include/wirish/HardwareSPI.h (renamed from wirish/comm/HardwareSPI.h)11
-rw-r--r--wirish/include/wirish/HardwareSerial.h (renamed from wirish/comm/HardwareSerial.h)10
-rw-r--r--wirish/include/wirish/HardwareTimer.h (renamed from wirish/HardwareTimer.h)6
-rw-r--r--wirish/include/wirish/Print.h (renamed from wirish/Print.h)6
-rw-r--r--wirish/include/wirish/WProgram.h (renamed from wirish/WProgram.h)7
-rw-r--r--wirish/include/wirish/bit_constants.h (renamed from wirish/bit_constants.h)4
-rw-r--r--wirish/include/wirish/bits.h (renamed from wirish/bits.h)7
-rw-r--r--wirish/include/wirish/boards.h (renamed from wirish/boards.h)43
-rw-r--r--wirish/include/wirish/ext_interrupts.h (renamed from wirish/ext_interrupts.h)10
-rw-r--r--wirish/include/wirish/io.h (renamed from wirish/io.h)9
-rw-r--r--wirish/include/wirish/pwm.h (renamed from wirish/pwm.h)6
-rw-r--r--wirish/include/wirish/usb_serial.h (renamed from wirish/usb_serial.h)6
-rw-r--r--wirish/include/wirish/wirish.h (renamed from wirish/wirish.h)34
-rw-r--r--wirish/include/wirish/wirish_debug.h (renamed from wirish/wirish_debug.h)6
-rw-r--r--wirish/include/wirish/wirish_math.h (renamed from wirish/wirish_math.h)4
-rw-r--r--wirish/include/wirish/wirish_time.h (renamed from wirish/wirish_time.h)10
-rw-r--r--wirish/include/wirish/wirish_types.h (renamed from wirish/wirish_types.h)12
-rw-r--r--wirish/pwm.cpp8
-rw-r--r--wirish/rules.mk13
-rw-r--r--wirish/usb_serial.cpp7
-rw-r--r--wirish/wirish_analog.cpp6
-rw-r--r--wirish/wirish_digital.cpp10
-rw-r--r--wirish/wirish_math.cpp2
-rw-r--r--wirish/wirish_shift.cpp2
-rw-r--r--wirish/wirish_time.cpp6
41 files changed, 187 insertions, 224 deletions
diff --git a/wirish/HardwareTimer.cpp b/wirish/HardwareTimer.cpp
index bd61a89..52257bf 100644
--- a/wirish/HardwareTimer.cpp
+++ b/wirish/HardwareTimer.cpp
@@ -24,9 +24,9 @@
* SOFTWARE.
*****************************************************************************/
-#include "HardwareTimer.h"
-#include "boards.h" // for CYCLES_PER_MICROSECOND
-#include "wirish_math.h"
+#include <wirish/HardwareTimer.h>
+#include <wirish/boards.h> // for CYCLES_PER_MICROSECOND
+#include <wirish/wirish_math.h>
// TODO [0.1.0] Remove deprecated pieces
diff --git a/wirish/Print.cpp b/wirish/Print.cpp
index 58c7cc7..1a2bddb 100644
--- a/wirish/Print.cpp
+++ b/wirish/Print.cpp
@@ -21,8 +21,9 @@
* Modified 12 April 2011 by Marti Bolivar <mbolivar@leaflabs.com>
*/
-#include "Print.h"
+#include <wirish/Print.h>
+#include <wirish/wirish_math.h>
#include <limits.h>
#ifndef LLONG_MAX
@@ -40,8 +41,6 @@
#define LLONG_MAX 9223372036854775807LL
#endif
-#include "wirish_math.h"
-
/*
* Public methods
*/
diff --git a/wirish/boards.cpp b/wirish/boards.cpp
index 569ca6d..dbdcf1c 100644
--- a/wirish/boards.cpp
+++ b/wirish/boards.cpp
@@ -32,15 +32,15 @@
* at 72MHz. APB1 is clocked at 36MHz.
*/
-#include "boards.h"
-
-#include "flash.h"
-#include "rcc.h"
-#include "nvic.h"
-#include "systick.h"
-#include "gpio.h"
-#include "adc.h"
-#include "timer.h"
+#include <wirish/boards.h>
+
+#include <libmaple/flash.h>
+#include <libmaple/rcc.h>
+#include <libmaple/nvic.h>
+#include <libmaple/systick.h>
+#include <libmaple/gpio.h>
+#include <libmaple/adc.h>
+#include <libmaple/timer.h>
#include "usb_cdcacm.h"
static void setupFlash(void);
diff --git a/wirish/boards/maple.cpp b/wirish/boards/maple/board.cpp
index 43d4386..256bb90 100644
--- a/wirish/boards/maple.cpp
+++ b/wirish/boards/maple/board.cpp
@@ -25,18 +25,16 @@
*****************************************************************************/
/**
- * @file maple.cpp
+ * @file wirish/boards/maple/board.cpp
* @author Marti Bolivar <mbolivar@leaflabs.com>
- * @brief Maple PIN_MAP and boardInit().
+ * @brief Maple board file.
*/
-#ifdef BOARD_maple
+#include <board/board.h>
-#include "maple.h"
-
-#include "gpio.h"
-#include "timer.h"
-#include "wirish_types.h"
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
+#include <wirish/wirish_types.h>
void boardInit(void) {
}
@@ -112,5 +110,3 @@ extern const uint8 boardUsedPins[] __FLASH__ = {
BOARD_LED_PIN, BOARD_BUTTON_PIN, BOARD_JTMS_SWDIO_PIN,
BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
};
-
-#endif
diff --git a/wirish/boards/maple.h b/wirish/boards/maple/include/board/board.h
index a986884..49f5b9a 100644
--- a/wirish/boards/maple.h
+++ b/wirish/boards/maple/include/board/board.h
@@ -25,9 +25,9 @@
*****************************************************************************/
/**
- * @file maple.h
+ * @file wirish/boards/maple/include/board/board.h
* @author Marti Bolivar <mbolivar@leaflabs.com>
- * @brief Private include file for Maple in boards.h
+ * @brief Maple board header.
*/
#ifndef _BOARD_MAPLE_H_
diff --git a/wirish/boards/maple_RET6.cpp b/wirish/boards/maple_RET6/board.cpp
index cbd7e25..2ef7de7 100644
--- a/wirish/boards/maple_RET6.cpp
+++ b/wirish/boards/maple_RET6/board.cpp
@@ -25,18 +25,17 @@
*****************************************************************************/
/**
- * @file maple_RET6.cpp
+ * @file wirish/boards/maple_RET6/board.cpp
* @author Marti Bolivar <mbolivar@leaflabs.com>
* @brief Maple RET6 Edition board file
*/
-#ifdef BOARD_maple_RET6
+#include <board/board.h>
-#include "maple_RET6.h"
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
-#include "gpio.h"
-#include "timer.h"
-#include "wirish_types.h"
+#include <wirish/wirish_types.h>
void boardInit(void) {
}
@@ -114,5 +113,3 @@ extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
BOARD_LED_PIN, BOARD_BUTTON_PIN, BOARD_JTMS_SWDIO_PIN,
BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
};
-
-#endif
diff --git a/wirish/boards/maple_RET6.h b/wirish/boards/maple_RET6/include/board/board.h
index 9e7ce9d..1a0365a 100644
--- a/wirish/boards/maple_RET6.h
+++ b/wirish/boards/maple_RET6/include/board/board.h
@@ -25,11 +25,12 @@
*****************************************************************************/
/**
- * @file maple_RET6.h
+ * @file wirish/boards/maple_RET6/include/board/board.h
* @author Marti Bolivar <mbolivar@leaflabs.com>
- * @brief Private include file for Maple RET6 Edition in boards.h
+ * @brief Maple RET6 Edition board header.
*
- * See maple.h for more information on these definitions.
+ * See wirish/boards/maple/include/board/board.h for more information
+ * on these definitions.
*/
#ifndef _BOARDS_MAPLE_RET6_H_
diff --git a/wirish/boards/maple_mini.cpp b/wirish/boards/maple_mini/board.cpp
index f111a14..599cb66 100644
--- a/wirish/boards/maple_mini.cpp
+++ b/wirish/boards/maple_mini/board.cpp
@@ -25,19 +25,18 @@
*****************************************************************************/
/**
- * @file maple_mini.cpp
+ * @file wirish/boards/maple_mini/board.cpp
* @author Marti Bolivar <mbolivar@leaflabs.com>
* @brief Maple Mini board file.
*/
-#ifdef BOARD_maple_mini
+#include <board/board.h>
-#include "maple_mini.h"
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
-#include "gpio.h"
-#include "timer.h"
-#include "wirish_debug.h"
-#include "wirish_types.h"
+#include <wirish/wirish_debug.h>
+#include <wirish/wirish_types.h>
/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW
* and JTAG debug support */
@@ -102,5 +101,3 @@ extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
BOARD_LED_PIN, BOARD_BUTTON_PIN, USB_DP, USB_DM
};
-
-#endif
diff --git a/wirish/boards/maple_mini.h b/wirish/boards/maple_mini/include/board/board.h
index 40f507b..bfba46d 100644
--- a/wirish/boards/maple_mini.h
+++ b/wirish/boards/maple_mini/include/board/board.h
@@ -25,11 +25,12 @@
*****************************************************************************/
/**
- * @file maple_mini.h
+ * @file wirish/boards/maple_mini/include/board/board.h
* @author Marti Bolivar <mbolivar@leaflabs.com>
- * @brief Private include file for Maple Mini in boards.h
+ * @brief Maple Mini board header.
*
- * See maple.h for more information on these definitions.
+ * See wirish/boards/maple/include/board/board.h for more information
+ * on these definitions.
*/
#ifndef _BOARD_MAPLE_MINI_H_
diff --git a/wirish/boards/maple_native.cpp b/wirish/boards/maple_native/board.cpp
index 821be77..515cf5b 100644
--- a/wirish/boards/maple_native.cpp
+++ b/wirish/boards/maple_native/board.cpp
@@ -25,21 +25,19 @@
*****************************************************************************/
/**
- * @file maple_native.cpp
+ * @file wirish/boards/maple_native/board.cpp
* @author Marti Bolivar <mbolivar@leaflabs.com>
* @brief Maple Native board file.
*/
-#ifdef BOARD_maple_native
+#include <board/board.h>
-#include "maple_native.h"
+#include <libmaple/fsmc.h>
+#include <libmaple/gpio.h>
+#include <libmaple/rcc.h>
+#include <libmaple/timer.h>
-#include "fsmc.h"
-#include "gpio.h"
-#include "rcc.h"
-#include "timer.h"
-
-#include "wirish_types.h"
+#include <wirish/wirish_types.h>
static void initSRAMChip(void);
@@ -197,5 +195,3 @@ static void initSRAMChip(void) {
fsmc_nor_psram_set_addset(regs, 0);
fsmc_nor_psram_set_datast(regs, 3);
}
-
-#endif
diff --git a/wirish/boards/maple_native.h b/wirish/boards/maple_native/include/board/board.h
index 7c09014..397afaf 100644
--- a/wirish/boards/maple_native.h
+++ b/wirish/boards/maple_native/include/board/board.h
@@ -25,11 +25,12 @@
*****************************************************************************/
/**
- * @file maple_native.h
+ * @file wirish/boards/maple_native/include/board/board.h.
* @author Marti Bolivar <mbolivar@leaflabs.com>
- * @brief Private include file for Maple Native in boards.h
+ * @brief Maple Native board header file.
*
- * See maple.h for more information on these definitions.
+ * See wirish/boards/maple/include/board/board.h for more information
+ * on these definitions.
*/
#ifndef _BOARD_MAPLE_NATIVE_H_
diff --git a/wirish/boards/olimex_stm32_h103.cpp b/wirish/boards/olimex_stm32_h103/board.cpp
index a9f0936..d9b8033 100644
--- a/wirish/boards/olimex_stm32_h103.cpp
+++ b/wirish/boards/olimex_stm32_h103/board.cpp
@@ -26,18 +26,17 @@
*****************************************************************************/
/**
- * @file olimex_stm32_h103.cpp
+ * @file wirish/boards/olimex_stm32_h103/board.cpp
* @author David Kiliani <mail@davidkiliani.de>
- * @brief Olimex STM32_H103 PIN_MAP and boardInit().
+ * @brief Olimex STM32_H103 board file.
*/
-#ifdef BOARD_olimex_stm32_h103
+#include <board/board.h>
-#include "olimex_stm32_h103.h"
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
-#include "gpio.h"
-#include "timer.h"
-#include "wirish_types.h"
+#include <wirish/wirish_types.h>
void boardInit(void) {
}
@@ -118,5 +117,3 @@ extern const uint8 boardUsedPins[] __FLASH__ = {
BOARD_LED_PIN, BOARD_BUTTON_PIN, BOARD_JTMS_SWDIO_PIN,
BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
};
-
-#endif
diff --git a/wirish/boards/olimex_stm32_h103.h b/wirish/boards/olimex_stm32_h103/include/board/board.h
index d2b5fcc..b312e26 100644
--- a/wirish/boards/olimex_stm32_h103.h
+++ b/wirish/boards/olimex_stm32_h103/include/board/board.h
@@ -26,9 +26,9 @@
*****************************************************************************/
/**
- * @file olimex_stm32_h103.h
+ * @file wirish/boards/olimex_stm32_h103/include/board/board.h
* @author David Kiliani <mail@davidkiliani.de>
- * @brief Private include file for Olimex STM32_H103 in boards.h
+ * @brief Olimex STM32_H103 board header.
*/
#ifndef _BOARD_OLIMEX_STM32_H103_H_
diff --git a/wirish/comm/HardwareSPI.cpp b/wirish/comm/HardwareSPI.cpp
index 21ae180..e1f186e 100644
--- a/wirish/comm/HardwareSPI.cpp
+++ b/wirish/comm/HardwareSPI.cpp
@@ -29,14 +29,14 @@
* @brief Wirish SPI implementation.
*/
-#include "HardwareSPI.h"
+#include <wirish/HardwareSPI.h>
-#include "timer.h"
-#include "util.h"
-#include "rcc.h"
+#include <libmaple/timer.h>
+#include <libmaple/util.h>
+#include <libmaple/rcc.h>
-#include "wirish.h"
-#include "boards.h"
+#include <wirish/wirish.h>
+#include <wirish/boards.h>
struct spi_pins {
uint8 nss;
diff --git a/wirish/comm/HardwareSerial.cpp b/wirish/comm/HardwareSerial.cpp
index 6ef9222..a9eb763 100644
--- a/wirish/comm/HardwareSerial.cpp
+++ b/wirish/comm/HardwareSerial.cpp
@@ -29,12 +29,13 @@
* @brief Wirish serial port implementation.
*/
-#include "libmaple.h"
-#include "gpio.h"
-#include "timer.h"
+#include <wirish/HardwareSerial.h>
-#include "HardwareSerial.h"
-#include "boards.h"
+#include <libmaple/libmaple.h>
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
+
+#include <wirish/boards.h>
#define TX1 BOARD_USART1_TX_PIN
#define RX1 BOARD_USART1_RX_PIN
diff --git a/wirish/ext_interrupts.cpp b/wirish/ext_interrupts.cpp
index b7f96f9..8f8c768 100644
--- a/wirish/ext_interrupts.cpp
+++ b/wirish/ext_interrupts.cpp
@@ -30,12 +30,12 @@
* @brief Wiring-like interface for external interrupts
*/
-#include "ext_interrupts.h"
+#include <wirish/ext_interrupts.h>
-#include "gpio.h"
-#include "exti.h"
+#include <libmaple/gpio.h>
+#include <libmaple/exti.h>
-#include "boards.h"
+#include <wirish/boards.h>
static inline exti_trigger_mode exti_out_mode(ExtIntTriggerMode mode);
diff --git a/wirish/comm/HardwareSPI.h b/wirish/include/wirish/HardwareSPI.h
index d138910..ad95191 100644
--- a/wirish/comm/HardwareSPI.h
+++ b/wirish/include/wirish/HardwareSPI.h
@@ -33,13 +33,13 @@
/* TODO [0.1.0] Remove deprecated methods. */
-#include "libmaple_types.h"
-#include "spi.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/spi.h>
-#include "boards.h"
+#include <wirish/boards.h>
-#ifndef _HARDWARESPI_H_
-#define _HARDWARESPI_H_
+#ifndef _WIRISH_HARDWARESPI_H_
+#define _WIRISH_HARDWARESPI_H_
/**
* @brief Defines the possible SPI communication speeds.
@@ -220,4 +220,3 @@ private:
};
#endif
-
diff --git a/wirish/comm/HardwareSerial.h b/wirish/include/wirish/HardwareSerial.h
index f69b67a..c25fd6e 100644
--- a/wirish/comm/HardwareSerial.h
+++ b/wirish/include/wirish/HardwareSerial.h
@@ -29,13 +29,13 @@
* @brief Wirish serial port interface.
*/
-#ifndef _HARDWARESERIAL_H_
-#define _HARDWARESERIAL_H_
+#ifndef _WIRISH_HARDWARESERIAL_H_
+#define _WIRISH_HARDWARESERIAL_H_
-#include "libmaple_types.h"
-#include "usart.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/usart.h>
-#include "Print.h"
+#include <wirish/Print.h>
/*
* IMPORTANT:
diff --git a/wirish/HardwareTimer.h b/wirish/include/wirish/HardwareTimer.h
index 1c34b9d..bdcca5d 100644
--- a/wirish/HardwareTimer.h
+++ b/wirish/include/wirish/HardwareTimer.h
@@ -28,12 +28,12 @@
* @brief Wirish timer class.
*/
-#ifndef _HARDWARETIMER_H_
-#define _HARDWARETIMER_H_
+#ifndef _WIRISH_HARDWARETIMER_H_
+#define _WIRISH_HARDWARETIMER_H_
// TODO [0.1.0] Remove deprecated pieces, pick a better API
-#include "timer.h"
+#include <libmaple/timer.h>
/** Timer mode. */
typedef timer_mode TimerMode;
diff --git a/wirish/Print.h b/wirish/include/wirish/Print.h
index c0c63cb..5fd0b7a 100644
--- a/wirish/Print.h
+++ b/wirish/include/wirish/Print.h
@@ -20,10 +20,10 @@
* Modified 12 April 2011 by Marti Bolivar <mbolivar@leaflabs.com>
*/
-#ifndef _PRINT_H_
-#define _PRINT_H_
+#ifndef _WIRISH_PRINT_H_
+#define _WIRISH_PRINT_H_
-#include "libmaple_types.h"
+#include <libmaple/libmaple_types.h>
enum {
BYTE = 0,
diff --git a/wirish/WProgram.h b/wirish/include/wirish/WProgram.h
index 2949a0a..b24ec2a 100644
--- a/wirish/WProgram.h
+++ b/wirish/include/wirish/WProgram.h
@@ -24,7 +24,12 @@
* SOFTWARE.
*****************************************************************************/
-#include "wirish.h"
+#ifndef _WIRISH_WPROGRAM_H_
+#define _WIRISH_WPROGRAM_H_
+
+#include <wirish/wirish.h>
void setup();
void loop();
+
+#endif
diff --git a/wirish/bit_constants.h b/wirish/include/wirish/bit_constants.h
index 8accc6b..4638f76 100644
--- a/wirish/bit_constants.h
+++ b/wirish/include/wirish/bit_constants.h
@@ -29,8 +29,8 @@
* compatibility.
*/
-#ifndef _BIT_CONSTANTS_H_
-#define _BIT_CONSTANTS_H_
+#ifndef _WIRISH_BIT_CONSTANTS_H_
+#define _WIRISH_BIT_CONSTANTS_H_
#define BIT0 (1 << 0)
#define BIT1 (1 << 1)
diff --git a/wirish/bits.h b/wirish/include/wirish/bits.h
index 3e755b7..0a63c58 100644
--- a/wirish/bits.h
+++ b/wirish/include/wirish/bits.h
@@ -27,4 +27,9 @@
/* Note: Use of this header file is deprecated. Use bit_constants.h
instead. */
-#include "bit_constants.h"
+#ifndef _WIRISH_BITS_H_
+#define _WIRISH_BITS_H_
+
+#include <wirish/bit_constants.h>
+
+#endif
diff --git a/wirish/boards.h b/wirish/include/wirish/boards.h
index 9ca4a66..e708f79 100644
--- a/wirish/boards.h
+++ b/wirish/include/wirish/boards.h
@@ -36,12 +36,12 @@
* file in the top-level Makefile build.
*/
-#ifndef _BOARDS_H_
-#define _BOARDS_H_
+#ifndef _WIRISH_BOARDS_H_
+#define _WIRISH_BOARDS_H_
-#include "libmaple_types.h"
-
-#include "wirish_types.h"
+#include <libmaple/libmaple_types.h>
+#include <wirish/wirish_types.h>
+#include <board/board.h>
/* Set of all possible pin names; not all boards have all these (note
* that we use the Dx convention since all of the Maple's pins are
@@ -115,40 +115,7 @@ extern void boardInit(void);
*/
bool boardUsesPin(uint8 pin);
-/* Include the appropriate private header from boards/: */
-
-/* FIXME HACK put boards/ before these paths once IDE uses make. */
-
-#ifdef BOARD_maple
-#include "maple.h"
-#elif defined(BOARD_maple_native)
-#include "maple_native.h"
-#elif defined(BOARD_maple_mini)
-#include "maple_mini.h"
-#elif defined(BOARD_maple_RET6)
-/*
- * **NOT** MAPLE REV6. This the **Maple RET6 EDITION**, which is a
- * Maple with an STM32F103RET6 (...RET6) instead of an STM32F103RBT6
- * (...RBT6) on it. Maple Rev6 (as of March 2011) DOES NOT EXIST.
- */
-#include "maple_RET6.h"
-#elif defined(BOARD_olimex_stm32_h103)
-#include "olimex_stm32_h103.h"
-#else
-/*
- * TODO turn this into a warning so people can:
- *
- * #include "my_board_config.h"
- * #include "wirish.h"
- *
- * This will enable third-party board support without requiring that
- * anybody hack around in libmaple itself.
- */
-#error "Board type has not been selected correctly."
-#endif
-
/* Set derived definitions */
-
#define CLOCK_SPEED_MHZ CYCLES_PER_MICROSECOND
#define CLOCK_SPEED_HZ (CLOCK_SPEED_MHZ * 1000000UL)
diff --git a/wirish/ext_interrupts.h b/wirish/include/wirish/ext_interrupts.h
index b5c6f98..617e43d 100644
--- a/wirish/ext_interrupts.h
+++ b/wirish/include/wirish/ext_interrupts.h
@@ -24,17 +24,17 @@
* SOFTWARE.
*****************************************************************************/
-#include "libmaple_types.h"
-#include "nvic.h"
-
/**
* @file ext_interrupts.h
*
* @brief Wiring-like external interrupt prototypes and types.
*/
-#ifndef _EXT_INTERRUPTS_H_
-#define _EXT_INTERRUPTS_H_
+#ifndef _WIRISH_EXT_INTERRUPTS_H_
+#define _WIRISH_EXT_INTERRUPTS_H_
+
+#include <libmaple/libmaple_types.h>
+#include <libmaple/nvic.h>
/**
* The kind of transition on an external pin which should trigger an
diff --git a/wirish/io.h b/wirish/include/wirish/io.h
index 0cb9c04..de56a49 100644
--- a/wirish/io.h
+++ b/wirish/include/wirish/io.h
@@ -30,12 +30,11 @@
* @brief Arduino-compatible digital pin I/O interface.
*/
-#ifndef _IO_H_
-#define _IO_H_
+#ifndef _WIRISH_IO_H_
+#define _WIRISH_IO_H_
-#include "libmaple_types.h"
-
-#include "boards.h"
+#include <libmaple/libmaple_types.h>
+#include <wirish/boards.h>
/**
* Specifies a GPIO pin behavior.
diff --git a/wirish/pwm.h b/wirish/include/wirish/pwm.h
index a7705ab..e7130fb 100644
--- a/wirish/pwm.h
+++ b/wirish/include/wirish/pwm.h
@@ -30,10 +30,10 @@
* @brief Arduino-compatible PWM interface.
*/
-#ifndef _PWM_H_
-#define _PWM_H_
+#ifndef _WIRISH_PWM_H_
+#define _WIRISH_PWM_H_
-#include "libmaple_types.h"
+#include <libmaple/libmaple_types.h>
/**
* As a convenience, analogWrite is an alias of pwmWrite to ease
diff --git a/wirish/usb_serial.h b/wirish/include/wirish/usb_serial.h
index d43b288..81e9e97 100644
--- a/wirish/usb_serial.h
+++ b/wirish/include/wirish/usb_serial.h
@@ -28,10 +28,10 @@
* @brief Wirish virtual serial port
*/
-#ifndef _USB_SERIAL_H_
-#define _USB_SERIAL_H_
+#ifndef _WIRISH_USB_SERIAL_H_
+#define _WIRISH_USB_SERIAL_H_
-#include "Print.h"
+#include <wirish/Print.h>
/**
* @brief Virtual serial terminal.
diff --git a/wirish/wirish.h b/wirish/include/wirish/wirish.h
index d024f3b..4097ce1 100644
--- a/wirish/wirish.h
+++ b/wirish/include/wirish/wirish.h
@@ -31,26 +31,26 @@
* substantial pieces of libmaple proper.
*/
-#ifndef _WIRISH_H_
-#define _WIRISH_H_
+#ifndef _WIRISH_WIRISH_H_
+#define _WIRISH_WIRISH_H_
-#include "boards.h"
-#include "io.h"
-#include "bit_constants.h"
-#include "pwm.h"
-#include "ext_interrupts.h"
-#include "wirish_debug.h"
-#include "wirish_math.h"
-#include "wirish_time.h"
-#include "HardwareSPI.h"
-#include "HardwareSerial.h"
-#include "HardwareTimer.h"
-#include "usb_serial.h"
+#include <wirish/boards.h>
+#include <wirish/io.h>
+#include <wirish/bit_constants.h>
+#include <wirish/pwm.h>
+#include <wirish/ext_interrupts.h>
+#include <wirish/wirish_debug.h>
+#include <wirish/wirish_math.h>
+#include <wirish/wirish_time.h>
+#include <wirish/HardwareSPI.h>
+#include <wirish/HardwareSerial.h>
+#include <wirish/HardwareTimer.h>
+#include <wirish/usb_serial.h>
+#include <wirish/wirish_types.h>
-#include "libmaple.h"
-#include "wirish_types.h"
+#include <libmaple/libmaple.h>
-/* Arduino wiring macros and bit defines */
+/* Wiring macros and bit defines */
#define true 0x1
#define false 0x0
diff --git a/wirish/wirish_debug.h b/wirish/include/wirish/wirish_debug.h
index 3f92b02..c8bc077 100644
--- a/wirish/wirish_debug.h
+++ b/wirish/include/wirish/wirish_debug.h
@@ -29,10 +29,10 @@
* @brief High level debug port configuration
*/
-#ifndef _WIRISH_DEBUG_H_
-#define _WIRISH_DEBUG_H_
+#ifndef _WIRISH_WIRISH_DEBUG_H_
+#define _WIRISH_WIRISH_DEBUG_H_
-#include "gpio.h"
+#include <libmaple/gpio.h>
/**
* @brief Disable the JTAG and Serial Wire (SW) debug ports.
diff --git a/wirish/wirish_math.h b/wirish/include/wirish/wirish_math.h
index a85b30a..3820cab 100644
--- a/wirish/wirish_math.h
+++ b/wirish/include/wirish/wirish_math.h
@@ -29,8 +29,8 @@
* @brief Includes <math.h>; provides Arduino-compatible math routines.
*/
-#ifndef _WIRING_MATH_H_
-#define _WIRING_MATH_H_
+#ifndef _WIRISH_WIRISH_MATH_H_
+#define _WIRISH_WIRISH_MATH_H_
#include <math.h>
diff --git a/wirish/wirish_time.h b/wirish/include/wirish/wirish_time.h
index 719a775..a81075c 100644
--- a/wirish/wirish_time.h
+++ b/wirish/include/wirish/wirish_time.h
@@ -29,13 +29,13 @@
* @brief Timing and delay functions.
*/
-#ifndef _TIME_H_
-#define _TIME_H_
+#ifndef _WIRISH_WIRISH_TIME_H_
+#define _WIRISH_WIRISH_TIME_H_
-#include "libmaple_types.h"
-#include "systick.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/systick.h>
-#include "boards.h"
+#include <wirish/boards.h>
#define US_PER_MS 1000
diff --git a/wirish/wirish_types.h b/wirish/include/wirish/wirish_types.h
index 43a6525..d70b26f 100644
--- a/wirish/wirish_types.h
+++ b/wirish/include/wirish/wirish_types.h
@@ -30,13 +30,13 @@
* @brief Wirish library type definitions.
*/
-#include "libmaple_types.h"
-#include "gpio.h"
-#include "timer.h"
-#include "adc.h"
+#ifndef _WIRISH_WIRISH_TYPES_H_
+#define _WIRISH_WIRISH_TYPES_H_
-#ifndef _WIRISH_TYPES_H_
-#define _WIRISH_TYPES_H_
+#include <libmaple/libmaple_types.h>
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
+#include <libmaple/adc.h>
/**
* Invalid stm32_pin_info adc_channel value.
diff --git a/wirish/pwm.cpp b/wirish/pwm.cpp
index 7e8a535..a55f245 100644
--- a/wirish/pwm.cpp
+++ b/wirish/pwm.cpp
@@ -28,12 +28,12 @@
* @brief Arduino-style PWM implementation.
*/
-#include "pwm.h"
+#include <wirish/pwm.h>
-#include "libmaple_types.h"
-#include "timer.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/timer.h>
-#include "boards.h"
+#include <wirish/boards.h>
void pwmWrite(uint8 pin, uint16 duty_cycle) {
timer_dev *dev = PIN_MAP[pin].timer_device;
diff --git a/wirish/rules.mk b/wirish/rules.mk
index 1bf6245..923c17b 100644
--- a/wirish/rules.mk
+++ b/wirish/rules.mk
@@ -4,9 +4,12 @@ dirstack_$(sp) := $(d)
d := $(dir)
BUILDDIRS += $(BUILD_PATH)/$(d)
BUILDDIRS += $(BUILD_PATH)/$(d)/comm
-BUILDDIRS += $(BUILD_PATH)/$(d)/boards
-WIRISH_INCLUDES := -I$(d) -I$(d)/comm -I$(d)/boards
+# Board config -- TODO allow user override
+WIRISH_BOARD_PATH := boards/$(BOARD)
+BUILDDIRS += $(BUILD_PATH)/$(d)/$(WIRISH_BOARD_PATH)
+
+WIRISH_INCLUDES := -I$(d)/include -I$(d)/$(WIRISH_BOARD_PATH)/include
# Local flags
CFLAGS_$(d) := $(WIRISH_INCLUDES) $(LIBMAPLE_INCLUDES)
@@ -18,11 +21,6 @@ cSRCS_$(d) := start_c.c
cppSRCS_$(d) := wirish_math.cpp \
Print.cpp \
boards.cpp \
- boards/maple.cpp \
- boards/maple_mini.cpp \
- boards/maple_native.cpp \
- boards/maple_RET6.cpp \
- boards/olimex_stm32_h103.cpp \
comm/HardwareSerial.cpp \
comm/HardwareSPI.cpp \
HardwareTimer.cpp \
@@ -34,6 +32,7 @@ cppSRCS_$(d) := wirish_math.cpp \
pwm.cpp \
ext_interrupts.cpp \
wirish_digital.cpp
+cppSRCS_$(d) += $(WIRISH_BOARD_PATH)/board.cpp
sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%)
cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%)
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp
index b66b992..1fd6e65 100644
--- a/wirish/usb_serial.cpp
+++ b/wirish/usb_serial.cpp
@@ -28,11 +28,14 @@
* @brief USB virtual serial terminal
*/
+#include <wirish/usb_serial.h>
+
#include <string.h>
-#include "wirish.h"
#include "usb_cdcacm.h"
-#include "usb.h"
+#include <libmaple/usb.h>
+
+#include <wirish/wirish.h>
#define USB_TIMEOUT 50
diff --git a/wirish/wirish_analog.cpp b/wirish/wirish_analog.cpp
index e5b9ffc..7a12156 100644
--- a/wirish/wirish_analog.cpp
+++ b/wirish/wirish_analog.cpp
@@ -28,11 +28,11 @@
* @brief Arduino-compatible ADC implementation.
*/
-#include "io.h"
+#include <wirish/io.h>
-#include "adc.h"
+#include <libmaple/adc.h>
-#include "boards.h"
+#include <wirish/boards.h>
/* Assumes that the ADC has been initialized and that the pin is set
* to INPUT_ANALOG */
diff --git a/wirish/wirish_digital.cpp b/wirish/wirish_digital.cpp
index 6a0577c..6be1a29 100644
--- a/wirish/wirish_digital.cpp
+++ b/wirish/wirish_digital.cpp
@@ -28,13 +28,13 @@
* Arduino-compatible digital I/O implementation.
*/
-#include "io.h"
+#include <wirish/io.h>
-#include "gpio.h"
-#include "timer.h"
+#include <libmaple/gpio.h>
+#include <libmaple/timer.h>
-#include "wirish_time.h"
-#include "boards.h"
+#include <wirish/wirish_time.h>
+#include <wirish/boards.h>
void pinMode(uint8 pin, WiringPinMode mode) {
gpio_pin_mode outputMode;
diff --git a/wirish/wirish_math.cpp b/wirish/wirish_math.cpp
index 5aa6510..1443b3c 100644
--- a/wirish/wirish_math.cpp
+++ b/wirish/wirish_math.cpp
@@ -22,7 +22,7 @@
*/
#include <stdlib.h>
-#include "math.h"
+#include <wirish/wirish_math.h>
void randomSeed(unsigned int seed) {
if (seed != 0) {
diff --git a/wirish/wirish_shift.cpp b/wirish/wirish_shift.cpp
index f67364d..0f24f59 100644
--- a/wirish/wirish_shift.cpp
+++ b/wirish/wirish_shift.cpp
@@ -22,7 +22,7 @@
* $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, uint8 val) {
int i;
diff --git a/wirish/wirish_time.cpp b/wirish/wirish_time.cpp
index c9f10a8..9ce934b 100644
--- a/wirish/wirish_time.cpp
+++ b/wirish/wirish_time.cpp
@@ -28,10 +28,10 @@
* @brief Delay implementation.
*/
-#include "wirish_time.h"
+#include <wirish/wirish_time.h>
-#include "libmaple_types.h"
-#include "delay.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/delay.h>
void delay(unsigned long ms) {
uint32 i;