Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ponty
committed
Feb 10, 2015
1 parent
0ebf616
commit 08dd5b5
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ Nanpy/libraries | |
# ignore all hidden files... | ||
.* | ||
# ...except: | ||
!.gitignore | ||
!.git* | ||
!.travis* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: c | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -y binutils-avr gcc-avr scons arduino | ||
- sudo rm /usr/share/arduino/libraries/Robot_Control/Wire.h | ||
- sudo pip install confduino | ||
- sudo pip install pyavrutils | ||
- sudo pip install path.py | ||
|
||
install: | ||
|
||
script: nosetests -v tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from nose.tools import eq_, ok_ | ||
from path import path | ||
# from pyavrutils import support, arduino | ||
from pyavrutils.arduino import Arduino, ArduinoCompileError | ||
from pyavrutils.support import simple_targets | ||
import logging | ||
|
||
root = path(__file__).parent.parent | ||
sample_cfg = root / 'sample_cfg.h' | ||
ino = root / 'Nanpy' / 'Nanpy.ino' | ||
cfg = root / 'Nanpy' / 'cfg.h' | ||
|
||
''' | ||
sudo rm /usr/share/arduino/libraries/Robot_Control/Wire.h | ||
''' | ||
|
||
EXTERNAL_LIBS = [ | ||
'USE_LiquidCrystal_I2C', | ||
'USE_OneWire', | ||
'USE_DallasTemperature', | ||
'USE_CapacitiveSensor', | ||
'USE_DHT', | ||
] | ||
|
||
MCUs=[ | ||
# 'atmega8', | ||
# 'atmega48', | ||
'atmega168', | ||
'atmega328p', | ||
# 'atmega640', | ||
'atmega1280', | ||
'atmega2560' | ||
] | ||
|
||
def get_features(): | ||
ls = [] | ||
print 'reading', sample_cfg | ||
for l in sample_cfg.lines(): | ||
parts = l.split() | ||
if len(parts) >= 3: | ||
if parts[0] == '#define': | ||
s = parts[1] | ||
if s.startswith('USE'): | ||
ls.append(s) | ||
assert len(ls) > 3 | ||
print 'get_features:', ls | ||
return ls | ||
|
||
def check_build(ino, mcu): | ||
cc = Arduino(mcu=mcu) | ||
print cc.mcu, ino | ||
cc.build(ino) | ||
ok_( cc.size().ok ) | ||
|
||
|
||
|
||
def test_config(): | ||
known_mcus=[t.mcu for t in simple_targets()] | ||
for mcu in MCUs: | ||
assert mcu in known_mcus, 'MCU %s was not found in config %s'% (mcu, known_mcus) | ||
|
||
def test_build(): | ||
print 'available MCUs:', [t.mcu for t in simple_targets()] | ||
for mcu in MCUs: | ||
print '++++++++++++++++++++++ MCU:', mcu | ||
for f in get_features(): | ||
if f not in EXTERNAL_LIBS: | ||
scfg = sample_cfg.text() | ||
# scfg=sample_cfg.text().replace(f, '%s 1 \n//' % f) | ||
scfg+='\n#define %s 1 \n' % f | ||
# scfg='#define %s 1' % f | ||
print '*********** feature:', f | ||
# print 'cfg.h:', scfg | ||
|
||
cfg.write_text(scfg) | ||
check_build(ino, mcu) | ||
# assert 0 |