ClosedLoop as singleton

This commit is contained in:
Scott Lahteine
2020-06-28 13:48:48 -05:00
parent 30ee0d3800
commit 48151d1778
6 changed files with 29 additions and 13 deletions

View File

@ -29,12 +29,14 @@
#include "closedloop.h"
void init_closedloop() {
ClosedLoop closedloop;
void ClosedLoop::init() {
OUT_WRITE(CLOSED_LOOP_ENABLE_PIN, LOW);
SET_INPUT_PULLUP(CLOSED_LOOP_MOVE_COMPLETE_PIN);
}
void set_closedloop(const byte val) {
void ClosedLoop::set(const byte val) {
OUT_WRITE(CLOSED_LOOP_ENABLE_PIN, val);
}

View File

@ -21,5 +21,12 @@
*/
#pragma once
void init_closedloop();
void set_closedloop(const byte val);
class ClosedLoop {
public:
static void init();
static void set(const byte val);
};
extern ClosedLoop closedloop;
#define CLOSED_LOOP_WAITING() (READ(CLOSED_LOOP_ENABLE_PIN) && !READ(CLOSED_LOOP_MOVE_COMPLETE_PIN))