From 75558e4cde9ba253339287c23d718e46b98f0ce2 Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Tue, 12 Sep 2017 23:17:53 +0200 Subject: [PATCH] uvw led --- conf/template/uvw_fb1.txt | 1 + shared/comps/uvw.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/conf/template/uvw_fb1.txt b/conf/template/uvw_fb1.txt index 12609d61..5dd6b451 100644 --- a/conf/template/uvw_fb1.txt +++ b/conf/template/uvw_fb1.txt @@ -8,4 +8,5 @@ fb_switch0.com_abs_pos = rev2.out fb_switch0.com_state = 3 fb_switch0.com_polecount = conf0.com_fb_polecount io0.fb1g = 1 +io0.fb1y = uvw0.led conf0.com_fb_polecount = conf0.polecount diff --git a/shared/comps/uvw.c b/shared/comps/uvw.c index 26ac122c..12875934 100644 --- a/shared/comps/uvw.c +++ b/shared/comps/uvw.c @@ -11,6 +11,8 @@ HAL_PIN(u); HAL_PIN(v); HAL_PIN(w); +HAL_PIN(led); + HAL_PIN(p0); HAL_PIN(p1); HAL_PIN(p2); @@ -43,6 +45,7 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_ struct uvw_pin_ctx_t *pins = (struct uvw_pin_ctx_t *)pin_ptr; uint32_t rpos = (PIN(u) > 0.0) * 1.0 + (PIN(v) > 0.0) * 2.0 + (PIN(w) > 0.0) * 4.0; + PIN(led) = (PIN(u) > 0.0) ^ (PIN(v) > 0.0) ^ (PIN(w) > 0.0); //TODO: make this const, fault output uint32_t t[8]; t[0] = PIN(p0);