- All files:
Modify almost all files to adjust functions and classes to
work with pointers to objects passed at task creation
instead of global variables from config.hpp
- Remove/clear config.hpp to get rid of all global variables
- main.cpp
- Create pointer to all shared (used in multiple tasks) objects in main
- remove evaluatedSwitch button object,
since joystick library is used to get switch events
- changes HTTP-mode
- always init http-server (do not enable/disable at mode change)
- pass url-handle function to init-htpp function
- add lambda function to pass method of instance for thatMajor Rework all files - Remove global variables, pass pointers to tasks
- All files:
Modify almost all files to adjust functions and classes to
work with pointers to objects passed at task creation
instead of global variables from config.hpp
- Remove/clear config.hpp to get rid of all global variables
- main.cpp
- Create pointer to all shared (used in multiple tasks) objects in main
- remove evaluatedSwitch button object,
since joystick library is used to get switch events
- changes HTTP-mode
- always init http-server (do not enable/disable at mode change)
- pass url-handle function to init-htpp function
- add lambda function to pass method of instance for that
NOTES: - tested on breakoutboard only
- known issue that slow encoder events are not recognized
(especially in menu) - slowing down motorctl helps
20 lines
587 B
C++
20 lines
587 B
C++
extern "C" {
|
|
#include "freertos/FreeRTOS.h" // FreeRTOS related headers
|
|
#include "freertos/task.h"
|
|
#include "encoder.h"
|
|
}
|
|
|
|
//config
|
|
#define QUEUE_SIZE 10
|
|
#define PIN_A GPIO_NUM_25
|
|
#define PIN_B GPIO_NUM_26
|
|
#define PIN_BUTTON GPIO_NUM_27
|
|
|
|
//init encoder with config in encoder.cpp
|
|
QueueHandle_t encoder_init(); //TODO pass config to function
|
|
|
|
|
|
//task that handles encoder events
|
|
//note: queue obtained from encoder_init() has to be passed to that task
|
|
void task_encoderExample(void *encoderQueue);
|
|
//example: xTaskCreate(&task_encoderExample, "task_buzzer", 2048, encoderQueue, 2, NULL);
|