Skip to main content

Function and Variable naming standards

Writing styles

Non-FreeRTOS functions are named as snake_case ( void emodule_init(void) )

FreeRTOS functions are names as camelCase

FreeRTOS

Tasks

void vTaskUpdateMetrics(void *pvParameters);

Events

EventGroupHandle_t xGPIO_event_group;
int BTN_PUSH_BIT = BIT1; // bit is upper case
int BTN2_PUSH_BIT = BIT2; // bit is upper case
Queues

QueueHandle_t xGPIO_Q_handle; // Queue with item "GPIO"

Semaphore

SemaphoreHandle_t xSemaphoreSPIbus;


Variables

type type example
#define  upper case CONFIG_THIS_THAT
standard variables snake_case

int motor_state

bool my_bool_data

float voltage_1

structures

camelCase

struct Metric

struct SuperAnything

...



 

Declaration

 

int a;    // declaring a variable