From: Joseph Coffland Date: Tue, 16 Jan 2018 01:42:47 +0000 (-0800) Subject: Added output control via variable X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=a0b141b11142cb353eeab40509611587d3ea0822;p=bbctrl-firmware Added output control via variable --- diff --git a/package.json b/package.json index 44571c2..87f60a4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "0.2.3", "homepage": "https://github.com/buildbotics/bbctrl-firmware", "license": "GPL 3+", - "dependencies": { "autoprefixer": ">=3.0.0", "jade": ">=1.3.0", diff --git a/src/avr/src/outputs.c b/src/avr/src/outputs.c index c600720..0a8805d 100644 --- a/src/avr/src/outputs.c +++ b/src/avr/src/outputs.c @@ -113,11 +113,24 @@ output_state_t outputs_get_state(uint8_t pin) { } +// Var callbacks uint8_t get_output_state(uint8_t id) { return OUTS <= id ? OUT_TRI : outputs[id].state; } +bool get_output_active(uint8_t id) { + return OUTS <= id ? false : outputs[id].active; +} + + +void set_output_active(uint8_t id, bool active) { + if (OUTS <= id) return; + outputs[id].active = active; + _update_state(&outputs[id]); +} + + uint8_t get_output_mode(uint8_t id) { return OUTS <= id ? OUT_DISABLED : outputs[id].mode; } diff --git a/src/avr/src/vars.def b/src/avr/src/vars.def index 897c070..020ec20 100644 --- a/src/avr/src/vars.def +++ b/src/avr/src/vars.def @@ -81,6 +81,7 @@ VAR(axis_position, p, f32, AXES, 1, 1, "Axis position") VAR(axis_can_home, ch, bool, AXES, 0, 1, "Axis can home") // Outputs +VAR(output_active, oa, bool, OUTS, 1, 1, "Output pin active") VAR(output_state, os, u8, OUTS, 0, 1, "Output pin state") VAR(output_mode, om, u8, OUTS, 1, 1, "Output pin mode")