In this guid you can read how can you help in developing the Littlev Graphic Library. These are not strick rules reather just suggestions. If you have a constructive idea just create pull request on this document!
### Table Of Content
* [Who can contribute?](#who-can-contribute)
* [How to report an issue?](#how-to-report-an-issue)
* [Simple issue](#simple-issue)
* [Complex issue](#complex-issue)
* [How to suggest a feature?](#how-to-suggest-a-feature)
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
### File format
Use [misc/templ/templ.c](https://github.com/littlevgl/misc/blob/master/templ/templ.c) and [misc/templ/templ.h](https://github.com/littlevgl/misc/blob/master/templ/templ.h)
### Function
* try to write function shorter then is 40 lines
* always shorter then 100 lines (except very straightforwards)
* in function names:
* words sperated by '_'
* only lower case letters
* only clear abbreviation (OK: *lv_xy_get_title_txt*, BAD: *lv_xy_get_ttxt*)
#### Global functions names (API)
An example: *lv_btn_set_state()*
* starts with *lv*
* followed by module name: *btn*, *label*, *style* etc.
* followed by the action: *set*, *get*, *refr* etc.
* closed with subject: *name*, *size*, *state* etc.
* optional like in *lv_obj_del()* it is missing
* could contain more words: *long_mode*, *point_all*
#### Static functions names
Names can be used freely.
### Variables
* words sperated by '_'
* always lower case
* one line one declaration (BAD: char x, y;)
* use `<stdint.h>` (*uint8_t*, *int32_t* etc)
* declare variables when needed (not all at function start)
* use the smallest required scope
* variables in a file (outside functions) are always *static*
* do not use global variables (use functions to set/get static variables)
### Defines
* always upper case
* starts with *LV_*
* followed by the modul: *OBJ*, *BTN* etc.
* closed by the subject: *ANIM_TIME*, *VALUE_MIN*, *WIDTH_DEF*
### Comments
Before every function have a comment like this:
```
/**
* Return with the screen of an object
*@param obj pointer to an object
*@return pointer to a screen
*/
lv_obj_t * lv_obj_get_scr(lv_obj_t * obj);
```
Always use `/* Something */` format and NOT `//Something`
Write readable code to avoid descriptive comments like:
`x++; /* Add 1 to x */`.
The code should show clearly what you are doing.
You should write **why** have you done this:
`x++; /*Because of closeing '\0' of the string */`
### Formatting
Here is example to show bracket placing and using of white spaces:
```
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
*@param label pointer to a label object
*@param text '\0' terminated character string. NULL to refresh with the current text.