diff options
Diffstat (limited to 'notes')
-rw-r--r-- | notes/coding_standard.txt | 44 | ||||
-rw-r--r-- | notes/pin-definitions.txt (renamed from notes/native-pin-definitions.txt) | 20 |
2 files changed, 54 insertions, 10 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+(). diff --git a/notes/native-pin-definitions.txt b/notes/pin-definitions.txt index b871f89..71572ac 100644 --- a/notes/native-pin-definitions.txt +++ b/notes/pin-definitions.txt @@ -1,4 +1,4 @@ -Maple Native (STM32F103ZE) pin definitions, by GPIO bank. +Pin definitions by GPIO bank. Source: ST DOC ID 14611, Datasheet for STM32F103xC, STM32F103xD, STM32F103xE, Table 5, pp. 30--35. @@ -9,13 +9,13 @@ bank's main table. Non-default alternate functions are not listed. If wirish will/does remap the pin's main function after reset, the main function is listed under "Other". -This document was prepared carefully and is believed to be complete -and correct, but the final arbiter of truth is the ST datasheet. +This document was prepared carefully and is believed to be correct, +but the final arbiter of truth is the ST datasheet. *** NB: UART 4 and 5 are NOT USART (columns are labeled appropriately). --------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C USART SPI DAC 5v? +GPIO ADC Timer FSMC I2S I2C USART SPI DAC 5v? --------------------------------------------------------------------------- PA0 123in0 2ch1etr - - - 2cts - - - 5ch1 @@ -52,7 +52,7 @@ PA14: JTCK-SWCLK (default) PA15: JTDI (default) ------------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C USART SPI DAC 5v? SDIO +GPIO ADC Timer FSMC I2S I2C USART SPI DAC 5v? SDIO ------------------------------------------------------------------------------- PB0 12in8 3ch3 - - - - - - - - 8ch2n @@ -80,7 +80,7 @@ PB3: JTDO (default) PB4: NJTRST (default) ------------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C UART SPI DAC 5v? SDIO +GPIO ADC Timer FSMC I2S I2C UART SPI DAC 5v? SDIO ------------------------------------------------------------------------------- PC0 123in10 - - - - - - - - - PC1 123in11 - - - - - - - - - @@ -106,7 +106,7 @@ PC14: OSC32_IN PC15: OSC32_OUT ------------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C UART SPI DAC 5v? SDIO +GPIO ADC Timer FSMC I2S I2C UART SPI DAC 5v? SDIO ------------------------------------------------------------------------------- PD0 - - D2 - - - - - Y - PD1 - - D3 - - - - - Y - @@ -132,7 +132,7 @@ PD0: OSC_IN (default) PD1: OSC_OUT (default) --------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C USART SPI DAC 5v? +GPIO ADC Timer FSMC I2S I2C USART SPI DAC 5v? --------------------------------------------------------------------------- PE0 - 4etr NBL0 - - - - - Y PE1 - - NBL1 - - - - - Y @@ -159,7 +159,7 @@ PE5: TRACED2 PE6: TRACED3 --------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C USART SPI DAC 5v? +GPIO ADC Timer FSMC I2S I2C USART SPI DAC 5v? --------------------------------------------------------------------------- PF0 - - A0 - - - - - Y PF1 - - A1 - - - - - Y @@ -179,7 +179,7 @@ PF14 - - A8 - - - - - Y PF15 - - A9 - - - - - Y --------------------------------------------------------------------------- -STM32 ADC Timer FSMC I2S I2C USART SPI DAC 5v? +GPIO ADC Timer FSMC I2S I2C USART SPI DAC 5v? --------------------------------------------------------------------------- PG0 - - A10 - - - - - Y PG1 - - A11 - - - - - Y |