aboutsummaryrefslogtreecommitdiffstats
path: root/src/endstop.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-06-08 20:51:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-06-13 23:18:59 -0400
commit9dd101c26fff95e596039d6168d4ad25e080071c (patch)
treede4878a531f087d29edb0a164136bacb7504474a /src/endstop.c
parent4fcf5a31f5c6d84749b3ae85be9482161fd33815 (diff)
downloadkutter-9dd101c26fff95e596039d6168d4ad25e080071c.tar.gz
kutter-9dd101c26fff95e596039d6168d4ad25e080071c.tar.xz
kutter-9dd101c26fff95e596039d6168d4ad25e080071c.zip
irq: Prefer irq_disable/enable instead of irq_save/restore in cmds/tasks
Task and command handlers always run with irqs enabled, so it is not necessary to save/restore the irq state when disabling irqs in these handlers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/endstop.c')
-rw-r--r--src/endstop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/endstop.c b/src/endstop.c
index bc177605..6f155cda 100644
--- a/src/endstop.c
+++ b/src/endstop.c
@@ -7,7 +7,7 @@
#include <stddef.h> // offsetof
#include "basecmd.h" // alloc_oid
#include "board/gpio.h" // struct gpio
-#include "board/irq.h" // irq_save
+#include "board/irq.h" // irq_disable
#include "command.h" // DECL_COMMAND
#include "sched.h" // struct timer
#include "stepper.h" // stepper_stop
@@ -73,11 +73,11 @@ DECL_COMMAND(command_end_stop_home,
static void
end_stop_report(uint8_t oid, struct end_stop *e)
{
- uint8_t flag = irq_save();
+ irq_disable();
uint32_t position = stepper_get_position(e->stepper);
uint8_t eflags = e->flags;
e->flags &= ~ESF_REPORT;
- irq_restore(flag);
+ irq_enable();
sendf("end_stop_state oid=%c homing=%c pin=%c pos=%i"
, oid, !!(eflags & ESF_HOMING), gpio_in_read(e->pin)