- Move all separately declared functions in control.hpp to a new class 'controlledArmchair' - now passing other objects only one time with constructor instead of accessing them globally - Create control instance in config.hpp, and passing objects in config.cpp - Add functions to new control class - toggleIdle(): toggle between last mode and idle - toggleModes(mode1, mode2): toggle between two modes - Add commands to button.cpp - 2x button press: call toggleIdle() - 6x button press: toggleModes MASSAGE -> JOYSTICK - Define control task in main.cpp - Adjust button files and main.cpp to use the new command object instead of the previus functions
28 lines
607 B
C++
28 lines
607 B
C++
#pragma once
|
|
|
|
#include "motordrivers.hpp"
|
|
#include "motorctl.hpp"
|
|
#include "joystick.hpp"
|
|
|
|
#include "gpio_evaluateSwitch.hpp"
|
|
#include "buzzer.hpp"
|
|
#include "control.hpp"
|
|
|
|
|
|
//create global controlledMotor instances for both motors
|
|
extern controlledMotor motorLeft;
|
|
extern controlledMotor motorRight;
|
|
|
|
//create global joystic instance
|
|
extern evaluatedJoystick joystick;
|
|
|
|
//create global evaluated switch instance for button next to joystick
|
|
extern gpio_evaluatedSwitch buttonJoystick;
|
|
|
|
//create global buzzer object
|
|
extern buzzer_t buzzer;
|
|
|
|
//create global control object
|
|
extern controlledArmchair control;
|
|
|