Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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>
  • Loading branch information...
commit 954f9e5065b39fe4c683f4d216b54326d876f51b 1 parent 053ddb9
@mbolivar mbolivar authored
Showing with 542 additions and 507 deletions.
  1. +7 −0 Makefile
  2. +1 −1  examples/blinky.cpp
  3. +4 −5 examples/debug-dtrrts.cpp
  4. +1 −1  examples/freertos-blinky.cpp
  5. +3 −3 examples/fsmc-stress-test.cpp
  6. +1 −1  examples/mini-exti-test.cpp
  7. +1 −1  examples/qa-slave-shield.cpp
  8. +1 −1  examples/spi_master.cpp
  9. +3 −3 examples/test-bkp.cpp
  10. +2 −2 examples/test-dac.cpp
  11. +2 −2 examples/test-fsmc.cpp
  12. +1 −1  examples/test-print.cpp
  13. +2 −2 examples/test-ring-buffer-insertion.cpp
  14. +1 −1  examples/test-serial-flush.cpp
  15. +3 −3 examples/test-serialusb.cpp
  16. +1 −1  examples/test-servo.cpp
  17. +1 −1  examples/test-session.cpp
  18. +1 −1  examples/test-spi-roundtrip.cpp
  19. +2 −2 examples/test-systick.cpp
  20. +2 −2 examples/test-timers.cpp
  21. +4 −4 examples/test-usart-dma.cpp
  22. +1 −1  examples/vga-leaf.cpp
  23. +2 −2 examples/vga-scope.cpp
  24. +3 −3 libmaple/adc.c
  25. +4 −4 libmaple/bkp.c
  26. +3 −3 libmaple/dac.c
  27. +0 −30 libmaple/delay.h
  28. +3 −3 libmaple/dma.c
  29. +4 −4 libmaple/exti.c
  30. +3 −3 libmaple/flash.c
  31. +2 −2 libmaple/fsmc.c
  32. +2 −2 libmaple/gpio.c
  33. +8 −7 libmaple/i2c.c
  34. +6 −6 libmaple/{ → include/libmaple}/adc.h
  35. +12 −4 libmaple/{ → include/libmaple}/bitband.h
  36. +4 −4 libmaple/{ → include/libmaple}/bkp.h
  37. +4 −4 libmaple/{ → include/libmaple}/dac.h
  38. +65 −0 libmaple/include/libmaple/delay.h
  39. +6 −6 libmaple/{ → include/libmaple}/dma.h
  40. +5 −5 libmaple/{ → include/libmaple}/exti.h
  41. +4 −6 libmaple/{ → include/libmaple}/flash.h
  42. +4 −8 libmaple/{ → include/libmaple}/fsmc.h
  43. +5 −6 libmaple/{ → include/libmaple}/gpio.h
  44. +10 −10 libmaple/{ → include/libmaple}/i2c.h
  45. +5 −5 libmaple/{ → include/libmaple}/iwdg.h
  46. +13 −6 libmaple/{ → include/libmaple}/libmaple.h
  47. +9 −2 libmaple/{ → include/libmaple}/libmaple_types.h
  48. +5 −5 libmaple/{ → include/libmaple}/nvic.h
  49. +6 −1 libmaple/{ → include/libmaple}/pwr.h
  50. +4 −4 libmaple/{ → include/libmaple}/rcc.h
  51. +4 −5 libmaple/{ → include/libmaple}/ring_buffer.h
  52. +11 −3 libmaple/{ → include/libmaple}/scb.h
  53. +8 −8 libmaple/{ → include/libmaple}/spi.h
  54. +11 −3 libmaple/{ → include/libmaple}/stm32.h
  55. +6 −7 libmaple/{ → include/libmaple}/systick.h
  56. +8 −10 libmaple/{ → include/libmaple}/timer.h
  57. +9 −9 libmaple/{ → include/libmaple}/usart.h
  58. +5 −5 libmaple/{ → include/libmaple}/usb.h
  59. +4 −4 libmaple/{ → include/libmaple}/util.h
  60. +1 −1  libmaple/iwdg.c
  61. +3 −3 libmaple/nvic.c
  62. +2 −2 libmaple/pwr.c
  63. +4 −4 libmaple/rcc.c
  64. +5 −2 libmaple/rules.mk
  65. +2 −2 libmaple/spi.c
  66. +1 −1  libmaple/syscalls.c
  67. +1 −1  libmaple/systick.c
  68. +1 −1  libmaple/timer.c
  69. +1 −1  libmaple/usart.c
  70. +2 −2 libmaple/usb/usb_cdcacm.h
  71. +6 −6 libmaple/util.c
  72. +1 −1  libraries/FreeRTOS/MapleFreeRTOS.h
  73. +1 −1  libraries/LiquidCrystal/LiquidCrystal.cpp
  74. +2 −2 libraries/LiquidCrystal/LiquidCrystal.h
  75. +4 −4 libraries/Servo/Servo.cpp
  76. +3 −7 libraries/Servo/Servo.h
  77. +0 −1  libraries/Wire/Wire.cpp
  78. +2 −2 libraries/Wire/Wire.h
  79. +1 −1  main.cpp.example
  80. +3 −3 wirish/HardwareTimer.cpp
  81. +2 −3 wirish/Print.cpp
  82. +9 −9 wirish/boards.cpp
  83. +6 −10 wirish/boards/{maple.cpp → maple/board.cpp}
  84. +2 −2 wirish/boards/{maple.h → maple/include/board/board.h}
  85. +5 −8 wirish/boards/{maple_RET6.cpp → maple_RET6/board.cpp}
  86. +4 −3 wirish/boards/{maple_RET6.h → maple_RET6/include/board/board.h}
  87. +6 −9 wirish/boards/{maple_mini.cpp → maple_mini/board.cpp}
  88. +4 −3 wirish/boards/{maple_mini.h → maple_mini/include/board/board.h}
  89. +7 −11 wirish/boards/{maple_native.cpp → maple_native/board.cpp}
  90. +4 −3 wirish/boards/{maple_native.h → maple_native/include/board/board.h}
  91. +6 −9 wirish/boards/{olimex_stm32_h103.cpp → olimex_stm32_h103/board.cpp}
  92. +2 −2 wirish/boards/{olimex_stm32_h103.h → olimex_stm32_h103/include/board/board.h}
  93. +6 −6 wirish/comm/HardwareSPI.cpp
  94. +6 −5 wirish/comm/HardwareSerial.cpp
  95. +4 −4 wirish/ext_interrupts.cpp
  96. +5 −6 wirish/{comm → include/wirish}/HardwareSPI.h
  97. +5 −5 wirish/{comm → include/wirish}/HardwareSerial.h
  98. +3 −3 wirish/{ → include/wirish}/HardwareTimer.h
  99. +3 −3 wirish/{ → include/wirish}/Print.h
  100. +6 −1 wirish/{ → include/wirish}/WProgram.h
  101. +2 −2 wirish/{ → include/wirish}/bit_constants.h
  102. +6 −1 wirish/{ → include/wirish}/bits.h
  103. +5 −38 wirish/{ → include/wirish}/boards.h
  104. +5 −5 wirish/{ → include/wirish}/ext_interrupts.h
  105. +4 −5 wirish/{ → include/wirish}/io.h
  106. +3 −3 wirish/{ → include/wirish}/pwm.h
  107. +3 −3 wirish/{ → include/wirish}/usb_serial.h
  108. +17 −17 wirish/{ → include/wirish}/wirish.h
  109. +3 −3 wirish/{ → include/wirish}/wirish_debug.h
  110. +2 −2 wirish/{ → include/wirish}/wirish_math.h
  111. +5 −5 wirish/{ → include/wirish}/wirish_time.h
  112. +6 −6 wirish/{ → include/wirish}/wirish_types.h
  113. +4 −4 wirish/pwm.cpp
  114. +6 −7 wirish/rules.mk
  115. +5 −2 wirish/usb_serial.cpp
  116. +3 −3 wirish/wirish_analog.cpp
  117. +5 −5 wirish/wirish_digital.cpp
  118. +1 −1  wirish/wirish_math.cpp
  119. +1 −1  wirish/wirish_shift.cpp
  120. +3 −3 wirish/wirish_time.cpp
View
7 Makefile
@@ -46,6 +46,13 @@ GLOBAL_FLAGS := -D$(VECT_BASE_ADDR) \
-DERROR_LED_PORT=$(ERROR_LED_PORT) \
-DERROR_LED_PIN=$(ERROR_LED_PIN) \
-D$(DENSITY)
+# FIXME: the following allows for deprecated include style, e.g.:
+# #include "libmaple.h"
+# or
+# #include "wirish.h"
+# It slows compilation noticeably; remove after 1 release.
+GLOBAL_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \
+ -I$(WIRISH_PATH)/include/wirish
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb -march=armv7-m \
-nostdlib -ffunction-sections -fdata-sections \
-Wl,--gc-sections $(GLOBAL_FLAGS)
View
2  examples/blinky.cpp
@@ -1,6 +1,6 @@
// Blinks the built-in LED
-#include "wirish.h"
+#include <wirish/wirish.h>
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT);
View
9 examples/debug-dtrrts.cpp
@@ -1,7 +1,7 @@
// Test sketch for figuring out DTR/RTS behavior on different platforms.
-#include "wirish.h"
-#include "usb.h"
+#include <wirish/wirish.h>
+#include "usb_cdcacm.h"
void setup() {
/* Set up the LED to blink */
@@ -10,7 +10,6 @@ void setup() {
/* Send a message out USART2 */
Serial2.begin(9600);
Serial2.println("Debugging DTR/RTS...");
-
}
void loop() {
@@ -18,9 +17,9 @@ void loop() {
delay(100);
Serial2.print("DTR: ");
- Serial2.print(usbGetDTR(), DEC);
+ Serial2.print(usb_cdcacm_get_dtr(), DEC);
Serial2.print("\tRTS: ");
- Serial2.println(usbGetRTS(), DEC);
+ Serial2.println(usb_cdcacm_get_rts(), DEC);
}
// Force init to be called *first*, i.e. before static object allocation.
View
2  examples/freertos-blinky.cpp
@@ -1,4 +1,4 @@
-#include "wirish.h"
+#include <wirish/wirish.h>
#include "libraries/FreeRTOS/MapleFreeRTOS.h"
static void vLEDFlashTask(void *pvParameters) {
View
6 examples/fsmc-stress-test.cpp
@@ -12,9 +12,9 @@
#include <stdio.h>
#include <stddef.h>
-#include "wirish.h"
-#include "rcc.h"
-#include "fsmc.h"
+#include <wirish/wirish.h>
+#include <libmaple/rcc.h>
+#include <libmaple/fsmc.h>
// -- SRAM config -------------------------------------------------------------
View
2  examples/mini-exti-test.cpp
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
-#include "wirish.h"
+#include <wirish/wirish.h>
// test routines
void run_exti_test(void);
View
2  examples/qa-slave-shield.cpp
@@ -1,6 +1,6 @@
// Slave mode for Quality Assurance test
-#include "wirish.h"
+#include <wirish/wirish.h>
#define INTER_TOGGLE_DELAY_NORMAL 5
#define INTER_TOGGLE_DELAY_SLOW 80
View
2  examples/spi_master.cpp
@@ -33,7 +33,7 @@
* Pin 10 is used as slave select.
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
#define NSS 10
View
6 examples/test-bkp.cpp
@@ -1,8 +1,8 @@
#include <stdio.h> // for snprintf()
-#include "wirish.h"
-#include "bkp.h"
-#include "iwdg.h"
+#include <wirish/wirish.h>
+#include <libmaple/bkp.h>
+#include <libmaple/iwdg.h>
void print_bkp_contents();
void write_to_bkp(uint16 val);
View
4 examples/test-dac.cpp
@@ -6,8 +6,8 @@
* This file is released into the public domain.
*/
-#include "wirish.h"
-#include "dac.h"
+#include <wirish/wirish.h>
+#include <libmaple/dac.h>
uint16 count = 0;
View
4 examples/test-fsmc.cpp
@@ -1,7 +1,7 @@
#include <stddef.h> // for ptrdiff_t
-#include "wirish.h"
-#include "fsmc.h"
+#include <wirish/wirish.h>
+#include <libmaple/fsmc.h>
#ifndef BOARD_maple_native
#error "Sorry, this example only works on Maple Native."
View
2  examples/test-print.cpp
@@ -8,7 +8,7 @@
* This file is released into the public domain.
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
#undef min
#undef max
View
4 examples/test-ring-buffer-insertion.cpp
@@ -12,9 +12,9 @@
* This file is released into the public domain.
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
-#include "ring_buffer.h"
+#include <libmaple/ring_buffer.h>
#define BUF_SIZE 64
ring_buffer ring_buf;
View
2  examples/test-serial-flush.cpp
@@ -2,7 +2,7 @@
* Tests the "flush" Serial function.
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
void setup() {
Serial1.begin(9600);
View
6 examples/test-serialusb.cpp
@@ -1,7 +1,7 @@
// Tests SerialUSB functionality.
-#include "wirish.h"
-#include "usb.h"
+#include <wirish/wirish.h>
+#include "usb_cdcacm.h"
#define QUICKPRINT 0
#define BIGSTUFF 1
@@ -37,7 +37,7 @@ void loop() {
switch (state) {
case QUICKPRINT:
for (int i = 0; i < 30; i++) {
- usbSendBytes(&c1, 1);
+ usb_cdcacm_putc((char)c1, 1);
SerialUSB.print('.');
SerialUSB.print('|');
}
View
2  examples/test-servo.cpp
@@ -29,7 +29,7 @@
#include <stdio.h>
-#include "wirish.h"
+#include <wirish/wirish.h>
#include "libraries/Servo/Servo.h"
View
2  examples/test-session.cpp
@@ -4,7 +4,7 @@
// Useful for testing Maple features and troubleshooting.
// Communicates over SerialUSB.
-#include "wirish.h"
+#include <wirish/wirish.h>
// ASCII escape character
#define ESC ((uint8)27)
View
2  examples/test-spi-roundtrip.cpp
@@ -17,7 +17,7 @@
* Author: Marti Bolivar <mbolivar@leaflabs.com>
*/
-#include "wirish.h"
+#include <wirish/wirish.h>
HardwareSPI alice(2);
View
4 examples/test-systick.cpp
@@ -1,7 +1,7 @@
// Tests the SysTick enable/disable functions
-#include "wirish.h"
-#include "systick.h"
+#include <wirish/wirish.h>
+#include <libmaple/systick.h>
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT);
View
4 examples/test-timers.cpp
@@ -1,7 +1,7 @@
// Program to test the timer.h implementation's essential functionality.
-#include "wirish.h"
-#include "timer.h"
+#include <wirish/wirish.h>
+#include <libmaple/timer.h>
void handler1(void);
void handler2(void);
View
8 examples/test-usart-dma.cpp
@@ -19,11 +19,11 @@
* This code is released into the public domain.
*/
-#include "dma.h"
-#include "usart.h"
-#include "gpio.h"
+#include <libmaple/dma.h>
+#include <libmaple/usart.h>
+#include <libmaple/gpio.h>
-#include "wirish.h"
+#include <wirish/wirish.h>
#define BAUD 9600
View
2  examples/vga-leaf.cpp
@@ -32,7 +32,7 @@
// FIXME: generalize for Native and Mini
-#include "wirish.h"
+#include <wirish/wirish.h>
// Pinouts -- you also must change the GPIO macros below if you change
// these
View
4 examples/vga-scope.cpp
@@ -35,8 +35,8 @@
Marti Bolivar <mbolivar@leaflabs.com>
*/
-#include "wirish.h"
-#include "systick.h"
+#include <wirish/wirish.h>
+#include <libmaple/systick.h>
// FIXME: generalize for Native and Mini
View
6 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,
View
8 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);
View
6 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
View
30 libmaple/delay.h
@@ -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
-
View
6 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
View
8 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);
View
6 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.
View
4 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
View
4 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
View
15 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,
View
12 libmaple/adc.h → 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
View
16 libmaple/bitband.h → 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
View
8 libmaple/bkp.h → 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)
View
8 libmaple/dac.h → 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
*/
View
65 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
View
12 libmaple/dma.h → 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
*/
View
10 libmaple/exti.h → 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 */
View
10 libmaple/flash.h → 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
-
-
View
12 libmaple/fsmc.h → 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
/*
View
11 libmaple/gpio.h → 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
-
View
20 libmaple/i2c.h → 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 */
View
10 libmaple/iwdg.h → 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
*/
View
19 libmaple/libmaple.h → 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
View
11 libmaple/libmaple_types.h → 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
View
10 libmaple/nvic.h → 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 */
View
7 libmaple/pwr.h → 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
View
8 libmaple/rcc.h → 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 */
View
9 libmaple/ring_buffer.h → 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
-
View
14 libmaple/scb.h → 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
View
16 libmaple/spi.h → 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
*/
View
14 libmaple/stm32.h → 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
View
13 libmaple/systick.h → 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
-
View
18 libmaple/timer.h → 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
*/
View
18 libmaple/usart.h → 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
View
10 libmaple/usb.h → 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
View
8 libmaple/util.h → 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
*/
View
2  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
View
6 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
View
4 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.
View
8 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
View
7 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 \
View
4 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);
View
2  libmaple/syscalls.c
@@ -30,7 +30,7 @@
* memory allocation.
*/
-#include "libmaple.h"
+#include <libmaple/libmaple.h>
#include <sys/stat.h>
#include <errno.h>
View
2  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);
View
2  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;
View
2  libmaple/usart.c
@@ -31,7 +31,7 @@
* @brief USART control routines
*/
-#include "usart.h"
+#include <libmaple/usart.h>
/*
* Devices
View
4 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" {
View
12 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
View
2  libraries/FreeRTOS/MapleFreeRTOS.h
@@ -27,7 +27,7 @@
#ifndef __MAPLE_FREERTOS_H__
#define __MAPLE_FREERTOS_H__
-#include "wirish.h"
+#include <wirish/wirish.h>
extern "C" {
#define GCC_ARMCM3
View
2  libraries/LiquidCrystal/LiquidCrystal.cpp
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-#include "WProgram.h"
+#include <wirish/WProgram.h>
// When the display powers up, it is configured as follows:
//
View
4 libraries/LiquidCrystal/LiquidCrystal.h
@@ -2,8 +2,8 @@
#define LiquidCrystal_h
//#include <inttypes.h>
-#include "wirish.h"
-#include "Print.h"
+#include <wirish/wirish.h>
+#include <wirish/Print.h>
// commands
#define LCD_CLEARDISPLAY 0x01
View
8 libraries/Servo/Servo.cpp
@@ -26,10 +26,10 @@
#include "Servo.h"
-#include "boards.h"
-#include "io.h"
-#include "pwm.h"
-#include "wirish_math.h"
+#include <wirish/boards.h>
+#include <wirish/io.h>
+#include <wirish/pwm.h>
+#include <wirish/wirish_math.h>
// 20 millisecond period config. For a 1-based prescaler,
//
View
10 libraries/Servo/Servo.h
@@ -27,14 +27,10 @@
#ifndef _SERVO_H_
#define _SERVO_H_
-#include "libmaple_types.h"
-#include "timer.h"
+#include <libmaple/libmaple_types.h>
+#include <libmaple/timer.h>
-#include "wirish_types.h"
-
-#ifdef MAPLE_IDE
-#include "wirish.h" /* hack for IDE compile */
-#endif
+#include <wirish/wirish_types.h>
/*
* Note on Arduino compatibility:
View
1  libraries/Wire/Wire.cpp
@@ -30,7 +30,6 @@
*/
#include "Wire.h"
-#include "wirish.h"
/* low level conventions:
* - SDA/SCL idle high (expected high)
View
4 libraries/Wire/Wire.h
@@ -29,11 +29,11 @@
* interface to I2C (two-wire) communication.
*/
-#include "wirish.h"
-
#ifndef _WIRE_H_
#define _WIRE_H_
+#include <wirish/wirish.h>
+
typedef struct {
uint8 scl;
uint8 sda;
View
2  main.cpp.example
@@ -1,7 +1,7 @@
// Sample main.cpp file. Blinks the built-in LED, sends a message out
// USART2, and turns on PWM on pin 2.
-#include "wirish.h"
+#include <wirish/wirish.h>
#define PWM_PIN 2
View
6 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
View
5 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
*/
View
18 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);
View
16 wirish/boards/maple.cpp → 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
View
4 wirish/boards/maple.h → 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_
View
13 wirish/boards/maple_RET6.cpp → 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
View
7 wirish/boards/maple_RET6.h → ...h/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_
View
15 wirish/boards/maple_mini.cpp → 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
View
7 wirish/boards/maple_mini.h → ...h/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_
View
18 wirish/boards/maple_native.cpp → 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