- outsource global variables and objects - move from config.hpp to global.cpp / hpp - rename config.hpp, thus change all includes - re-arrange includes -> in source files instead of header - optimize / make function comment titles more consistent - optimize comments overall - add several temporary files to gitignore - fix unused variable compiler warnings
39 lines
895 B
C++
39 lines
895 B
C++
/* in this file all used functions from original rotary_encoder.h library are wrapped with custom functions to reduce global variables and duplicate code
|
|
*/
|
|
//TODO create a cpp class for an encoder?
|
|
#pragma once
|
|
extern "C" {
|
|
#include <freertos/task.h>
|
|
}
|
|
|
|
|
|
|
|
//----------------------------
|
|
//----- global variables -----
|
|
//----------------------------
|
|
//TODO ignore global encoder queue, since it is not used?
|
|
extern QueueHandle_t encoder_queue; //encoder event queue
|
|
|
|
|
|
//-------------------------
|
|
//------- functions -------
|
|
//-------------------------
|
|
|
|
//--- encoder_init ---
|
|
//init encoder
|
|
QueueHandle_t encoder_init();
|
|
|
|
//--- encoder_getSteps ---
|
|
//get steps counted since last reset
|
|
int encoder_getSteps();
|
|
|
|
|
|
//--- encoder_getLenMm ---
|
|
//get current length in Mm since last reset
|
|
int encoder_getLenMm();
|
|
|
|
|
|
//--- encoder_reset ---
|
|
//reset counted steps / length to 0
|
|
void encoder_reset();
|