9. Abbreviations
Global variables and instance variables are always spelled out as to what they are, even if this makes their names very long. They are never abbreviated. Copy/pasting their names is a very effective way to simultaneously speed up typing them and prevent bugs caused by typos. Another way to speed things up is to use “Autocomplete” in the IDE Editor. (Type first few letters, then hit [Ctrl-SPACE] in most IDEs.)
Note that brevity can, at times, increase readability (and therefore understandability), and names that are too long can reduce readability (and therefore understandability), so if a shorter name will be just as clear as a longer name, the shorter name is preferred.
Local variables and arguments are frequently abbreviated, but do not have to be.
An abbreviation is condoned only where it is a well-understood abbreviation, or
where it can be easily looked up. (Example: AABB
[axis-aligned bounding box]
can be looked up on Wikipedia or any good text on Spatial (3D)
Mathematics.)
9.1. Common Abbreviations:
- adc:
analog-to-digital conversion or converter
- avg:
average
- bep:
being processed (e.g.
item_bep
orsat_bep
[satellite being processed])- buf:
buffer
- cfg:
configuration
- cnt:
- curr:
current
- dac:
digital-to-analog conversion or converter
- delta:
math delta (difference or displacement between 2 samples)
- diff:
difference
- ee:
EEPROM
- err:
error
- gpio:
general purpose IO pins
- init:
initialize
- io:
I/O (input/output)
- isr:
interrupt service routine (we try to use this instead of “handler” to be consistent and to provide for ease of text searches)
- lcd:
liquid crystal display
- led:
light-emitting diode
- max:
maximum
- mgr:
manager
- min:
minimum
- ms:
millisecond
- next:
next item (in a list)
- ns:
nanosecond
- prev:
previous item (in a list)
- pwm:
pulse-width modulation
- reg:
register
- rx:
receive
- sat:
satellite
- sem:
semaphore
- str:
string
- sync:
synchronize/synchronization
- temp:
temporary (not “temperature”, we spell that out)
- tmp:
temporary (not “temperature”, we spell that out)
- tx:
transmit
- us/uS:
microsecond
9.2. Common Abbreviations Found in LVGL User Interface Code:
- bar:
pointer to Bar Widget (e.g. progress bar)
- btn:
pointer to Button
- cli_area:
pointer to client area of a Window Widget
- clr:
color (not a pointer)
- disp:
pointer to Display object
- itm:
pointer to Menu Item object
- lbl:
pointer to Label Widget
- nvc:
pointer to name/value container (custom widget for menu items)
- obj:
pointer to a generic LVGL Widget
- scr:
pointer to Screen Widget
- slider:
pointer to Slider Widget
- tgt:
pointer target Widget (in LVGL events, which Widget is sending the event, e.g. a button)
- tmr:
pointer to Timer object
- widget:
pointer to a generic LVGL Widget
- win:
pointer to Window Widget
As covered above, these are ONLY used when it increases readability. In the UI-building environment, this is common.