From 3fa65ef714a839650aea557ffe089dd606bd3260 Mon Sep 17 00:00:00 2001 From: Raphael Lehmann Date: Tue, 31 Oct 2017 19:01:44 +0100 Subject: [PATCH 1/3] move bare metal implementation to bare-metal/ --- {build => bare-metal/build}/makefile | 1 + main.c => bare-metal/main.c | 2 +- uart.c => bare-metal/uart.c | 0 uart.h => bare-metal/uart.h | 0 ws2812_config.h => bare-metal/ws2812_config.h | 0 light_ws2812.c => light_ws2812/light_ws2812.c | 0 light_ws2812.h => light_ws2812/light_ws2812.h | 3 +++ light_ws2812/ws2812_config.h | 21 +++++++++++++++++++ 8 files changed, 26 insertions(+), 1 deletion(-) rename {build => bare-metal/build}/makefile (96%) rename main.c => bare-metal/main.c (99%) rename uart.c => bare-metal/uart.c (100%) rename uart.h => bare-metal/uart.h (100%) rename ws2812_config.h => bare-metal/ws2812_config.h (100%) rename light_ws2812.c => light_ws2812/light_ws2812.c (100%) rename light_ws2812.h => light_ws2812/light_ws2812.h (98%) create mode 100644 light_ws2812/ws2812_config.h diff --git a/build/makefile b/bare-metal/build/makefile similarity index 96% rename from build/makefile rename to bare-metal/build/makefile index 9b220ef..d8f17a7 100644 --- a/build/makefile +++ b/bare-metal/build/makefile @@ -9,6 +9,7 @@ BAUD = -b 57600 VPATH = .. RAWSOURCES = $(wildcard ../*.c) +RAWSOURCES += ../../light_ws2812/light_ws2812.c SOURCES = $(RAWSOURCES:../%=%) OBJECTS = $(SOURCES:.c=.o) diff --git a/main.c b/bare-metal/main.c similarity index 99% rename from main.c rename to bare-metal/main.c index 4c8924b..0bfae99 100644 --- a/main.c +++ b/bare-metal/main.c @@ -20,7 +20,7 @@ #include #include "ws2812_config.h" // override config in submodule -#include "light_ws2812.h" +#include "../light_ws2812/light_ws2812.h" #include "uart.h" // LED cRGB array ws2812 library reads periodically from diff --git a/uart.c b/bare-metal/uart.c similarity index 100% rename from uart.c rename to bare-metal/uart.c diff --git a/uart.h b/bare-metal/uart.h similarity index 100% rename from uart.h rename to bare-metal/uart.h diff --git a/ws2812_config.h b/bare-metal/ws2812_config.h similarity index 100% rename from ws2812_config.h rename to bare-metal/ws2812_config.h diff --git a/light_ws2812.c b/light_ws2812/light_ws2812.c similarity index 100% rename from light_ws2812.c rename to light_ws2812/light_ws2812.c diff --git a/light_ws2812.h b/light_ws2812/light_ws2812.h similarity index 98% rename from light_ws2812.h rename to light_ws2812/light_ws2812.h index 7d40d81..3bec3ca 100644 --- a/light_ws2812.h +++ b/light_ws2812/light_ws2812.h @@ -15,7 +15,10 @@ #include #include + +#ifndef WS2812_CONFIG_H_ #include "ws2812_config.h" +#endif /* * Structure of the LED array diff --git a/light_ws2812/ws2812_config.h b/light_ws2812/ws2812_config.h new file mode 100644 index 0000000..8e9124a --- /dev/null +++ b/light_ws2812/ws2812_config.h @@ -0,0 +1,21 @@ +/* + * light_ws2812_config.h + * + * Created: 18.01.2014 09:58:15 + * + * User Configuration file for the light_ws2812_lib + * + */ + + +#ifndef WS2812_CONFIG_H_ +#define WS2812_CONFIG_H_ + +/////////////////////////////////////////////////////////////////////// +// Define I/O pin +/////////////////////////////////////////////////////////////////////// + +#define ws2812_port D // Data port +#define ws2812_pin 7 // Data out pin + +#endif /* WS2812_CONFIG_H_ */ From 94575af0fd65f628ad855792437f86ce70f4dedb Mon Sep 17 00:00:00 2001 From: Raphael Lehmann Date: Tue, 31 Oct 2017 19:21:46 +0100 Subject: [PATCH 2/3] add xpcc submodule --- .gitignore | 3 +++ .gitmodules | 3 +++ xpcc/xpcc | 1 + 3 files changed, 7 insertions(+) create mode 100644 .gitmodules create mode 160000 xpcc/xpcc diff --git a/.gitignore b/.gitignore index becc58e..1998f34 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ # Linux / KDE specific *.directory + +# scons +.sconsign.dblite diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..48dcbba --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "xpcc/xpcc"] + path = xpcc/xpcc + url = https://github.com/roboterclubaachen/xpcc.git diff --git a/xpcc/xpcc b/xpcc/xpcc new file mode 160000 index 0000000..48d60e2 --- /dev/null +++ b/xpcc/xpcc @@ -0,0 +1 @@ +Subproject commit 48d60e2219b3b356cf99afacc0c43fbcc7644aed From 8d580ea065d33c1cedf1651ed6e1942eefd4dae0 Mon Sep 17 00:00:00 2001 From: Raphael Lehmann Date: Tue, 31 Oct 2017 19:23:28 +0100 Subject: [PATCH 3/3] [wip] add basic ardiuno nano xpcc project --- xpcc/arduino-nano/SConstruct | 4 ++++ xpcc/arduino-nano/main.cpp | 32 ++++++++++++++++++++++++++++++++ xpcc/arduino-nano/project.cfg | 8 ++++++++ 3 files changed, 44 insertions(+) create mode 100644 xpcc/arduino-nano/SConstruct create mode 100644 xpcc/arduino-nano/main.cpp create mode 100644 xpcc/arduino-nano/project.cfg diff --git a/xpcc/arduino-nano/SConstruct b/xpcc/arduino-nano/SConstruct new file mode 100644 index 0000000..dcd6002 --- /dev/null +++ b/xpcc/arduino-nano/SConstruct @@ -0,0 +1,4 @@ +# path to the xpcc root directory +xpccpath = '../xpcc' +# execute the common SConstruct file +execfile(xpccpath + '/scons/SConstruct') diff --git a/xpcc/arduino-nano/main.cpp b/xpcc/arduino-nano/main.cpp new file mode 100644 index 0000000..dd1806f --- /dev/null +++ b/xpcc/arduino-nano/main.cpp @@ -0,0 +1,32 @@ +// coding: utf-8 +/* Copyright (c) 2017, Raphael Lehmann + * All Rights Reserved. + * + * See the file `LICENSE` for the full license governing this code. + */ +// ---------------------------------------------------------------------------- + +#include + +using namespace xpcc::atmega; +using clock = xpcc::avr::SystemClock; + +// Create a new UART object and configure it to a baudrate of 115200 +using uart = Uart0; + +int +main() +{ + GpioOutputD1::connect(Uart0::Tx); + GpioInputD0::connect(Uart0::Rx); + uart::initialize(); + + // Enable interrupts, this is needed for every buffered UART + sei(); + + // todo + + while (1) + { + } +} diff --git a/xpcc/arduino-nano/project.cfg b/xpcc/arduino-nano/project.cfg new file mode 100644 index 0000000..0afe5c1 --- /dev/null +++ b/xpcc/arduino-nano/project.cfg @@ -0,0 +1,8 @@ +[build] +device = atmega328p +clock = 16000000 +buildpath = ${xpccpath}/build/ledpp/${name} + +[avrdude] +port = /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 +programmer = arduino