Skip to content
Browse files

Port to work in the Arduino environment.

  • Loading branch information...
1 parent 054a7a0 commit 366b6a5a4f90ed06247acb3db55a699dc748c091 @knielsen knielsen committed Jun 26, 2014
View
2 Makefile
@@ -1,6 +1,6 @@
## Name your project
NAME = doorduino
-FILES = doorduino.c sha1.c serial.c softserial.c
+FILES = doorduino.c tools/sha1.c tools/serial.c tools/softserial.c
## Point this to the directory where you did
## git clone git://github.com/esmil/oniudra-headers.git arduino
View
16 doorduino.c
@@ -51,14 +51,14 @@ volatile uint8_t events = EV_NONE;
#define SERIAL_INBUF 64
#define SERIAL_OUTBUF 128
-#include "serial.c"
+#include "tools/serial.c"
#undef SERIAL_INBUF
#undef SERIAL_OUTBUF
-#include "softserial.c"
+#include "tools/softserial.c"
#define SHA1_SHORTCODE
-#include "sha1.c"
+#include "tools/sha1.c"
#undef SHA1_SHORTCODE
static void
@@ -234,7 +234,7 @@ handle_rfid_input(void)
}
int
-main(void)
+door_main(void)
{
serial_init(9600, 8e2);
@@ -323,3 +323,11 @@ main(void)
}
}
}
+
+#ifndef ARDUINO
+int
+main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
+{
+ door_main();
+}
+#endif
View
9 doorduino.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int door_main(void);
+
+#ifdef __cplusplus
+}
+#endif
View
7 doorduino.ino
@@ -0,0 +1,7 @@
+#include <oniudra.h>
+#include <doorduino.h>
+
+int main(int argc, char *argv[]) {
+ door_main();
+}
+
View
0 serial.c → tools/serial.c
File renamed without changes.
View
0 sha1.c → tools/sha1.c
File renamed without changes.
View
0 softserial.c → tools/softserial.c
File renamed without changes.

0 comments on commit 366b6a5

Please sign in to comment.
Something went wrong with that request. Please try again.