aboutsummaryrefslogtreecommitdiffstats
path: root/notes/coding_standard.txt
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-03-25 20:09:30 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-03-25 20:09:30 -0400
commitf8081eeb04c9cb511adaf58e201c7cfbe1ddfbd4 (patch)
treea4de9665dd2d2340820b888c47e252c233ff9421 /notes/coding_standard.txt
parent63ea7464925b8cbeb8623d08a2bde0b1d2044047 (diff)
downloadlibrambutan-f8081eeb04c9cb511adaf58e201c7cfbe1ddfbd4.tar.gz
librambutan-f8081eeb04c9cb511adaf58e201c7cfbe1ddfbd4.zip
Final stm32_pin_info design candidate; ADC3 support on Native.
Added an adc_dev to struct stm32_pin_info. This was necessary to add support for the channels on the Native which are only connected to ADC3, but it does add a bunch of NULLs to the PIN_MAPs. I don't think any other peripherals need representation on a per-pin basis. Each peripheral library will be responsible for keeping track of related GPIO ports and bits, and we can throw #defines in to boards/*.h for other things (e.g. BOARD_SPI1_MISO_PIN). Fleshed out the ADC refactor and brought it more in keeping with the new design as it evolves. A couple of other tweaks. Notably: waitForButtonPress() now takes a default argument meaning "wait forever". Removed Maple-specific documentation from core functions in io.h; this information will need to go into the individual board docs files.
Diffstat (limited to 'notes/coding_standard.txt')
-rw-r--r--notes/coding_standard.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/notes/coding_standard.txt b/notes/coding_standard.txt
index 372ebf4..b81847d 100644
--- a/notes/coding_standard.txt
+++ b/notes/coding_standard.txt
@@ -220,3 +220,47 @@ General Formatting
(require 'lineker)
(dolist (hook '(c-mode-hook c++-mode-hook))
(add-hook hook (lambda () (lineker-mode 1))))
+
+Language Features and Compiler Extensions
+-----------------------------------------
+
+- In libmaple proper, aim for C99 compatibility. Some GCC extensions
+ are OK, but let's not go crazy.
+
+- If you'd like to get code into libmaple which uses a GCC extension
+ not already in use elsewhere, ask a LeafLabs developer (or another
+ one, if you are one) what they think about it first.
+
+- Explicitly approved GCC extensions:
+
+ * asm volatile:
+ http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
+
+ * Nested functions:
+ http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
+
+- In wirish, generally be very conservative when using C++ features
+ that aren't part of C. We are forced to use C++ for Arduino
+ compatibility (and the general Arduino style of pretending that an
+ object is a library), but it's an angry beast, and we don't want to
+ provoke it. The mantra is "C with classes".
+
+- Explicitly approved C++ features:
+
+ * Initializers that aren't constant; e.g. the gpio_dev* values in
+ PIN_MAPs.
+
+ * Default arguments: e.g., the timeout argument defaulting to 0
+ (meaning to wait forever) in waitForButtonPress().
+
+- Explicitly forbidden C++ features:
+
+ * Templates
+
+- C++ features that are conditionally allowed, but require explicit
+ approval from at least two libmaple developers (one of which may be
+ yourself):
+
+ * Operator overloading: Never allowed when it's just for style.
+ Potentially allowed when you're implementing a class that models a
+ mathematical structure, and you'd like to implement e.g. operator+().