summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-10-20 02:23:32 +0200
committerChristian Pointner <equinox@spreadspace.org>2016-10-20 02:23:32 +0200
commitf34f40971b9cfea80e28ccf3c5e02f1991f87784 (patch)
treea4a12049aef7d0337b305e6689e200ac78c5b28f
parentwhitespace cleanup (diff)
importing pjon-5.2 (still compile errors=pjon5
-rw-r--r--contrib/Makefile2
-rw-r--r--serial-pjon/Makefile2
-rw-r--r--serial-pjon/serial-pjon.cpp31
-rw-r--r--usb-pjon/Makefile2
4 files changed, 20 insertions, 17 deletions
diff --git a/contrib/Makefile b/contrib/Makefile
index 3308183..bf9c008 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -24,7 +24,7 @@
LUFA_VERSION := 151115
FASTLED_VERSION := 3.1.0
-PJON_VERSION := 3.0
+PJON_VERSION := 5.2
all: download-lufa download-fastled download-pjon update-teensy-loader
diff --git a/serial-pjon/Makefile b/serial-pjon/Makefile
index be3dd35..3cc35b1 100644
--- a/serial-pjon/Makefile
+++ b/serial-pjon/Makefile
@@ -28,7 +28,7 @@ CXX_LIBS := arduino-stub
EXTERNAL_LIBS := pjon
SPREADAVR_PATH := ..
-PJON_PATH := $(SPREADAVR_PATH)/contrib/PJON-3.0
+PJON_PATH := $(SPREADAVR_PATH)/../pjon/
PJON_OPTS :=
include $(SPREADAVR_PATH)/include.mk
diff --git a/serial-pjon/serial-pjon.cpp b/serial-pjon/serial-pjon.cpp
index 7c3a116..bb1320d 100644
--- a/serial-pjon/serial-pjon.cpp
+++ b/serial-pjon/serial-pjon.cpp
@@ -44,28 +44,31 @@ void error_handler(uint8_t code, uint8_t data) {
printf("Possible wrong bus configuration!\r\n");
printf("higher MAX_PACKETS in PJON.h if necessary.\r\n");
}
- if(code == MEMORY_FULL) {
- printf("Packet memory allocation failed. Memory is full.\r\n");
- }
if(code == CONTENT_TOO_LONG) {
printf("Content is too long, length: %d\r\n", data);
}
if(code == ID_ACQUISITION_FAIL) {
printf("Can't acquire a free id %d\r\n", data);
}
+ if(code == DEVICES_BUFFER_FULL) {
+ printf("Packet memory allocation failed. Memory is full.\r\n");
+ }
}
-void recv_handler(uint8_t id, uint8_t *payload, uint8_t length) {
- if(length == 0) {
- printf("got 0 byte message from %d...\r\n", id);
- return;
- }
+void recv_handler(uint8_t *payload, uint8_t length, const PacketInfo &packet_info) {
+
+
+
+ // if(length == 0) {
+ // printf("got 0 byte message from %d.%d.%d.%d...\r\n");
+ // return;
+ // }
led_on();
- printf("got message(%d bytes) from %d: '", length, id);
- for(uint16_t i = 0; i < length; ++i)
- putchar(payload[i]);
- printf("'\r\n");
- delay(30);
+ // printf("got message(%d bytes) from %d: '", length, id);
+ // for(uint16_t i = 0; i < length; ++i)
+ // putchar(payload[i]);
+ // printf("'\r\n");
+ // delay(30);
led_off();
}
@@ -97,7 +100,7 @@ int main(void)
arduino_init();
bus.set_error(error_handler);
bus.set_receiver(recv_handler);
- bus.set_pin(8);
+ bus.strategy.set_pins(8, NOT_ASSIGNED);
bus.begin();
for(;;) {
diff --git a/usb-pjon/Makefile b/usb-pjon/Makefile
index 76e4831..6ea7414 100644
--- a/usb-pjon/Makefile
+++ b/usb-pjon/Makefile
@@ -28,7 +28,7 @@ CXX_LIBS := arduino-stub
EXTERNAL_LIBS := lufa pjon
SPREADAVR_PATH := ..
-PJON_PATH := $(SPREADAVR_PATH)/contrib/PJON-3.0
+PJON_PATH := $(SPREADAVR_PATH)/contrib/PJON-5.2
PJON_OPTS :=
LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-151115