From 7adb8a31fb051bf6bdb6b32b99f1eb288ae8e200 Mon Sep 17 00:00:00 2001 From: crinq Date: Fri, 6 Apr 2018 10:40:20 +0200 Subject: [PATCH] not comp --- Makefile | 1 + shared/comps/not.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 shared/comps/not.c diff --git a/Makefile b/Makefile index c42cabed..bd3965f1 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,7 @@ COMPS += shared/comps/scale.c COMPS += shared/comps/idx_home.c COMPS += shared/comps/move.c COMPS += shared/comps/ac.c +COMPS += shared/comps/not.c COMPS += shared/comps/jog.c SOURCES += $(COMPS) diff --git a/shared/comps/not.c b/shared/comps/not.c new file mode 100644 index 00000000..7c49a2b0 --- /dev/null +++ b/shared/comps/not.c @@ -0,0 +1,27 @@ +#include "hal.h" + +HAL_COMP(not); + +HAL_PIN(in); +HAL_PIN(out); + +static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) { + struct not_pin_ctx_t *pins = (struct not_pin_ctx_t *)pin_ptr; + + PIN(out) = PIN(in) <= 0.0; +} + +const hal_comp_t not_comp_struct = { + .name = "not", + .nrt = 0, + .rt = rt_func, + .frt = 0, + .nrt_init = 0, + .hw_init = 0, + .rt_start = 0, + .frt_start = 0, + .rt_stop = 0, + .frt_stop = 0, + .ctx_size = 0, + .pin_count = sizeof(struct not_pin_ctx_t) / sizeof(struct hal_pin_inst_t), +};