Add button support

This commit is contained in:
Scott Bezek
2021-10-25 21:44:37 -07:00
parent 0b5785ecf3
commit a33c46b29b
4 changed files with 80 additions and 55 deletions

View File

@@ -1,20 +1,26 @@
#pragma once
#include <AceButton.h>
#include <Arduino.h>
#include "motor_task.h"
#include "task.h"
class InterfaceTask : public Task<InterfaceTask> {
class InterfaceTask : public Task<InterfaceTask>, public ace_button::IEventHandler {
friend class Task<InterfaceTask>; // Allow base Task to invoke protected run()
public:
InterfaceTask(const uint8_t task_core, MotorTask& motor_task);
~InterfaceTask();
void handleEvent(ace_button::AceButton* button, uint8_t event_type, uint8_t button_state) override;
protected:
void run();
private:
MotorTask& motor_task_;
int current_config_ = 0;
void nextConfig();
};