libopencm3/HACKING

54 lines
2.0 KiB
Plaintext
Raw Normal View History

------------------------------------------------------------------------------
HACKING
------------------------------------------------------------------------------
Coding style
------------
The whole library is programmed using the Linux kernel coding style, see
http://lxr.linux.no/linux/Documentation/CodingStyle for details.
Please use the same style for any code contributions, thanks!
Development guidelines
----------------------
- Every new file added must have the usual license header, see the
existing files for examples.
- In general, please try to keep the register and bit naming as close
2010-12-30 02:09:35 +00:00
as possible to the official vendor datasheets. Among other reasons, this
makes it easier for users to find what they're looking for in the
datasheets, programming manuals, and application notes.
- All register definitions should follow the following naming conventions:
- The #define names should be all-caps, parts are separated by
an underscore.
- The name should be of the form SUBSYSTEM_REGISTER_BIT, e.g.
ADC_CR2_DMA, where ADC is the subsystem name, CR2 is the register NAME,
and DMA is the name of the bit in the register that is defined.
2010-12-29 14:52:37 +00:00
- All subsystem-specific function names should be prefixed with the
subsystem name. For example, gpio_set_mode() or rcc_osc_on().
- Please consistently use the short form types from <cm3/common.h>,
e.g. u8, u16, u32, and so on.
- Variables that are used to store register values read from registers or
to be stored in a register should be named reg8, reg16, reg32 etc.
- In the examples directory, the following structure should be used:
- One (or more) subdirectories for the type of microcontroller, e.g.
lm3s, lpc13xx, stm32/f1, stm32/f2, stm32/f4.
- One subdirectory in there for each eval board or piece of hardware, e.g.
stm32-h103, lisa-m, stm32vl-discovery, stm32f4-discovery, etc.
- One subdirectory in there for each example, e.g.
miniblink, button, usart, usb_dfu, etc.