Skip to content

[wip] Multiple implementations #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@

# Linux / KDE specific
*.directory

# scons
.sconsign.dblite
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "xpcc/xpcc"]
path = xpcc/xpcc
url = https://github.com/roboterclubaachen/xpcc.git
1 change: 1 addition & 0 deletions build/makefile → bare-metal/build/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ BAUD = -b 57600
VPATH = ..

RAWSOURCES = $(wildcard ../*.c)
RAWSOURCES += ../../light_ws2812/light_ws2812.c
SOURCES = $(RAWSOURCES:../%=%)
OBJECTS = $(SOURCES:.c=.o)

Expand Down
2 changes: 1 addition & 1 deletion main.c → bare-metal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdlib.h>

#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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions light_ws2812.h → light_ws2812/light_ws2812.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

#include <avr/io.h>
#include <avr/interrupt.h>

#ifndef WS2812_CONFIG_H_
#include "ws2812_config.h"
#endif

/*
* Structure of the LED array
Expand Down
21 changes: 21 additions & 0 deletions light_ws2812/ws2812_config.h
Original file line number Diff line number Diff line change
@@ -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_ */
4 changes: 4 additions & 0 deletions xpcc/arduino-nano/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# path to the xpcc root directory
xpccpath = '../xpcc'
# execute the common SConstruct file
execfile(xpccpath + '/scons/SConstruct')
32 changes: 32 additions & 0 deletions xpcc/arduino-nano/main.cpp
Original file line number Diff line number Diff line change
@@ -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 <xpcc/architecture/platform.hpp>

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<clock, 115200, xpcc::Tolerance::FivePercent>();

// Enable interrupts, this is needed for every buffered UART
sei();

// todo

while (1)
{
}
}
8 changes: 8 additions & 0 deletions xpcc/arduino-nano/project.cfg
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions xpcc/xpcc
Submodule xpcc added at 48d60e