Tactility/CODING_STYLE.md
Ken Van Hoeylandt 14eb43211d
Support for Waveshare S3 Touch LCD 4.3 (#18)
* initial changes for waveshare s3 touch support

* fix lvgl locking

* fix for lvgl locking

* cleaned up dependencies

* boards now depend on tactility instead of tactility-esp

* revert deletion

* remove component

* working touch&display driver

* added waveshare to github actions

* cleanup

* fix for driver

* fix for sim build

* build fixes

* updated docs

* updated docs

* attempt new sdl2 github action

* revert

* fixes for clion/cmdline build

environment wasn't parsed properly

* temporarily disable pc sim build
2024-01-26 21:36:21 +01:00

1.4 KiB

C coding Style

The basic formatting rules are set in .clang-format. Use auto-formatting in your editor.

All code should target C language revision C11/C17.

Naming

Files

Files are snake-case.

  • Files: ^[0-9a-z_]+$
  • Directories: ^[0-9a-z_]+$

Example:

some_feature.c
some_feature.h

Private/internal headers are postfixed with _i before the file extension. Like some_feature_i.h

Function names

Names are snake-case.

Public functions are prefixed with tt_ for tactility-core and tactility projects. Internal/static functions don't have prefix requirements, but prefixes are allowed.

Public functions have the feature name after tt_.

If a feature has setters or getters, it's added after the feature name part.

Example:

void tt_feature_get_name() {
    // ...
}

Function names that allocate or free memory should end in _alloc and _free.

Type names

Consts are snake-case with capital letters.

Typedefs for structs and datatype aliases are PascalCase. Examples:

typedef uint32_t SomeAlias;

typedef struct {
    // ...
} SomeStruct;

Internal struct with public handle

When you have a struct data type that is private and you want to expose a handle (pointer), append the internal name with Data like this:

feature.c

typedef struct {
    // ...
} MutexData;

feature.h

typedef void* Mutex;