summaryrefslogtreecommitdiff
path: root/usb-i2c-sl018
diff options
context:
space:
mode:
Diffstat (limited to 'usb-i2c-sl018')
-rw-r--r--usb-i2c-sl018/limits.c48
-rw-r--r--usb-i2c-sl018/limits.h32
2 files changed, 80 insertions, 0 deletions
diff --git a/usb-i2c-sl018/limits.c b/usb-i2c-sl018/limits.c
new file mode 100644
index 0000000..98144ed
--- /dev/null
+++ b/usb-i2c-sl018/limits.c
@@ -0,0 +1,48 @@
+/*
+ * spreadspace avr utils
+ *
+ *
+ * Copyright (C) 2013 Christian Pointner <equinox@spreadspace.org>
+ * Othmar Gsenger <otti@wirdorange.org>
+ *
+ * This file is part of spreadspace avr utils.
+ *
+ * spreadspace avr utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * spreadspace avr utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "limits.h"
+#include <LUFA/Drivers/Misc/RingBuffer.h>
+
+#define LIMITS_PIN PINC
+#define LIMITS_PORT PORTC
+#define LIMITS_DDR DDRC
+#define LIMITS_OPEN 6
+#define LIMITS_CLOSE 7
+
+void init_limits(void)
+{
+ LIMITS_DDR = LIMITS_PORT & ~(1<<LIMITS_OPEN | 1<<LIMITS_CLOSE);
+ LIMITS_PORT |= (1<<LIMITS_OPEN | 1<<LIMITS_CLOSE);
+}
+
+limits_t limits_get(void)
+{
+ limits_t state = none;
+
+ uint8_t tmp = LIMITS_PORT;
+
+
+ return state;
+}
+
diff --git a/usb-i2c-sl018/limits.h b/usb-i2c-sl018/limits.h
new file mode 100644
index 0000000..7624c83
--- /dev/null
+++ b/usb-i2c-sl018/limits.h
@@ -0,0 +1,32 @@
+/*
+ * spreadspace avr utils
+ *
+ *
+ * Copyright (C) 2013 Christian Pointner <equinox@spreadspace.org>
+ * Othmar Gsenger <otti@wirdorange.org>
+ *
+ * This file is part of spreadspace avr utils.
+ *
+ * spreadspace avr utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * spreadspace avr utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef R3TUER_limits_h_INCLUDED
+#define R3TUER_limits_h_INCLUDED
+
+typedef enum { none, open, close, both } limits_t;
+
+void init_limits(void);
+limits_t limits_get(void);
+
+#endif