diff --git a/mote/v1/uc/Makefile b/mote/v1/uc/Makefile deleted file mode 100755 index 38a527a..0000000 --- a/mote/v1/uc/Makefile +++ /dev/null @@ -1,278 +0,0 @@ -# Arduino 0011 Makefile -# Arduino adaptation by mellis, eighthave, oli.keller -# -# This makefile allows you to build sketches from the command line -# without the Arduino environment (or Java). -# -# Detailed instructions for using the makefile: -# -# 1. Copy this file into the folder with your sketch. There should be a -# file with the extension .pde (e.g. foo.pde) -# -# 2. Below, modify the line containing "TARGET" to refer to the name of -# of your program's file without an extension (e.g. TARGET = foo). -# -# 3. Modify the line containg "INSTALL_DIR" to point to the directory that -# contains the Arduino installation (for example, under Mac OS X, this -# might be /Applications/arduino-0011). -# -# 4. Modify the line containing "PORT" to refer to the filename -# representing the USB or serial connection to your Arduino board -# (e.g. PORT = /dev/tty.USB0). If the exact name of this file -# changes, you can use * as a wildcard (e.g. PORT = /dev/tty.USB*). -# -# 5. Set the line containing "MCU" to match your board's processor. -# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth -# or Diecimila have the atmega168. If you're using a LilyPad Arduino, -# change F_CPU to 8000000. -# -# 6. At the command line, change to the directory containing your -# program's file and the makefile. -# -# 7. Type "make" and press enter to compile/verify your program. -# -# 8. Type "make upload", reset your Arduino board, and press enter to -# upload your program to the Arduino board. -# -# $Id$ - -############################################################################### -# -# project specific settings: -# -TARGET = main -# -# Predefine the TYPE and SENSORx C macros in main.h via this Makefile. -# Override the defaults on the command line by typing: -# make PHASE=x METERCONST=y SENSOR0=z ... -# -DBG = 0 -# -TYPE = 2300501 -PHASE = 1 -METERCONST= 5508 -# -SENSOR0 = 0123456789abcdef0123456789abcde0 -SENSOR1 = 0123456789abcdef0123456789abcde1 -SENSOR2 = 0123456789abcdef0123456789abcde2 -SENSOR3 = 0123456789abcdef0123456789abcde3 -# -CEXTRA = -D DBG=$(DBG) -D PHASE=$(PHASE) -D METERCONST=$(METERCONST) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"' -############################################################################### - - -############################################################################### -# -# serial uploader settings -# -PORT = /dev/ttyUSB* -UPLOAD_RATE = 19200 -AVRDUDE_PROGRAMMER = usbtiny -# -# HINT: If you want to use the automatic reset feature which comes with Arduino -# Diecimila, put the follwoing in your avrdude.conf: -# (Use the systemwide $(INSTALL_DIR)/tools/avr/etc/avrdude.conf or create a -# local $HOME/.avrduderc file) -# -# programmer -# id = "arduino"; -# desc = "Arduino Serial Bootloader"; -# type = stk500; -# reset = 7; -# # since Arduino Diecimila the serial DTR line can be used to trigger a reset! -# ; -# -# After this you can specify AVRDUDE_PROGRAMMER = arduino, above. -# On older boards you can manually ad this reset feature. Wire a cable from the -# FTDI 232 Chip's DTR pin (the number differs from package to package, see datasheet) -# to the RESET line of the ATmega. Inbetween this connection must be a 100nF capacitor. -##################################################################################### - - -##################################################################################### -# -# hardware dependent settings -# -MCU = atmega48 -F_CPU = 1000000 -##################################################################################### - -##################################################################################### -# -# Below here nothing should be changed... -# -##################################################################################### - -AVR_TOOLS_PATH = /usr/bin -SRC = wiring/serial.c -FORMAT = ihex - -# Name of this Makefile (used for "make depend"). -MAKEFILE = Makefile - -# Debugging format. -# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. -# AVR (extended) COFF requires stabs, plus an avr-objcopy run. -DEBUG = stabs - -OPT = s - -# Place -D or -U options here -CDEFS = -DF_CPU=$(F_CPU) -CXXDEFS = -DF_CPU=$(F_CPU) - -# Compiler flag to set the C Standard level. -# c89 - "ANSI" C -# gnu89 - c89 plus GCC extensions -# c99 - ISO C99 standard (not yet fully implemented) -# gnu99 - c99 plus GCC extensions -CSTANDARD = -std=gnu99 -CDEBUG = -g$(DEBUG) -CWARN = -Wall -Wstrict-prototypes -CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -#CEXTRA = -Wa,-adhlns=$(<:.c=.lst) - -CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) -CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT) -#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs -LDFLAGS = -lm - - -# Programming support using avrdude. Settings and variables. -AVRDUDE_PORT = $(PORT) -AVRDUDE_WRITE_FUSES= -U lfuse:w:0x6E:m -U hfuse:w:0xD6:m -U efuse:w:0x1:m -AVRDUDE_WRITE_FLASH = -U flash:w:bin/$(TARGET).hex -AVRDUDE_WRITE_EEPROM = -U eeprom:w:bin/$(TARGET).eep -AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) -b $(UPLOAD_RATE) - -# Program settings -CC = $(AVR_TOOLS_PATH)/avr-gcc -CXX = $(AVR_TOOLS_PATH)/avr-g++ -OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy -OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump -AR = $(AVR_TOOLS_PATH)/avr-ar -SIZE = $(AVR_TOOLS_PATH)/avr-size -NM = $(AVR_TOOLS_PATH)/avr-nm -AVRDUDE = avrdude -REMOVE = rm -f -MV = mv -f - -# Define all object files. -OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o) - -# Define all listing files. -LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst) - -# Combine all necessary flags and optional flags. -# Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) -ALL_CXXFLAGS = -mmcu=$(MCU) -I. $(CXXFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) - - -# Default target. -all: bin_files build sizeafter - -build: elf hex eep - -bin_files: $(TARGET).c - @test -d bin || mkdir bin - @cp $(TARGET).c bin/$(TARGET).c - -elf: bin/$(TARGET).elf -hex: bin/$(TARGET).hex -eep: bin/$(TARGET).eep -lss: bin/$(TARGET).lss -sym: bin/$(TARGET).sym - -# Program the device. -upload: bin/$(TARGET).hex - @$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FUSES) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) - -# Display size of file. -HEXSIZE = $(SIZE) --target=$(FORMAT) bin/$(TARGET).hex -ELFSIZE = $(SIZE) bin/$(TARGET).elf -sizebefore: - @if [ -f bin/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi - -sizeafter: - @if [ -f bin/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi - - -# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. -COFFCONVERT=$(OBJCOPY) --debugging \ ---change-section-address .data-0x800000 \ ---change-section-address .bss-0x800000 \ ---change-section-address .noinit-0x800000 \ ---change-section-address .eeprom-0x810000 - - -coff: bin/$(TARGET).elf - $(COFFCONVERT) -O coff-avr bin/$(TARGET).elf $(TARGET).cof - - -extcoff: $(TARGET).elf - $(COFFCONVERT) -O coff-ext-avr bin/$(TARGET).elf $(TARGET).cof - -.SUFFIXES: .elf .hex .eep .lss .sym - -.elf.hex: - @$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ - -.elf.eep: - @$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ - -# Create extended listing file from ELF output file. -.elf.lss: - $(OBJDUMP) -h -S $< > $@ - -# Create a symbol table from ELF output file. -.elf.sym: - $(NM) -n $< > $@ - - # Link: create ELF output file from library. -bin/$(TARGET).elf: $(TARGET).c bin/core.a - @$(CC) $(ALL_CFLAGS) -o $@ bin/$(TARGET).c -L. bin/core.a $(LDFLAGS) - -bin/core.a: $(OBJ) - @for i in $(OBJ); do $(AR) rcs bin/core.a $$i; done - -# Compile: create object files from C++ source files. -.cpp.o: - @$(CXX) -c $(ALL_CXXFLAGS) $< -o $@ - -# Compile: create object files from C source files. -.c.o: - @$(CC) -c $(ALL_CFLAGS) $< -o $@ - - -# Compile: create assembler files from C source files. -.c.s: - $(CC) -S $(ALL_CFLAGS) $< -o $@ - - -# Assemble: create object files from assembler source files. -.S.o: - $(CC) -c $(ALL_ASFLAGS) $< -o $@ - - - -# Target: clean project. -clean: - @$(REMOVE) bin/$(TARGET).hex bin/$(TARGET).eep bin/$(TARGET).cof bin/$(TARGET).elf \ - bin/$(TARGET).map bin/$(TARGET).sym bin/$(TARGET).lss bin/$(TARGET).c bin/core.a \ - $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d) - -depend: - if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \ - then \ - sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \ - $(MAKEFILE).$$$$ && \ - $(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \ - fi - echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \ - >> $(MAKEFILE); \ - $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE) - -.PHONY: all build elf hex eep lss sym program coff extcoff clean depend bin_files sizebefore sizeafter diff --git a/mote/v1/uc/calibration.c b/mote/v1/uc/calibration.c deleted file mode 100644 index 47f504d..0000000 --- a/mote/v1/uc/calibration.c +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) 2008 jokamajo.org -// $Id$ - -// define section, move to main.h later on - -// macro's -#ifndef __AVR_ATmega168__ - #define __AVR_ATmega168__ -#endif - -#define METER0 "cccccccccccccccccccccccccccccccc" -#define METER1 "dddddddddddddddddddddddddddddddd" -#define METER2 "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" -#define METER3 "ffffffffffffffffffffffffffffffff" - -#define START 0 -#define END3 0xffffffff -#define END2 0xeeeeeeee -#define END1 0xdddddddd -#define END0 0xcccccccc - -// pin definitions -#define METER0PIN 2 -#define METER1PIN 3 -#define METER2PIN 4 -#define METER3PIN 9 - -#define POTPIN0 6 -#define POTPIN1 7 -#define POTPIN2 8 - -#define LEDPIN 13 - -// end of define - - -// pin/register/ISR definitions -#include - -// eeprom library -#include - -// watchdog timer library -#include - -// variable declarations -uint16_t i; - -typedef struct { - boolean pulse0; - boolean toggle0; - boolean pulse1; - boolean toggle1; - boolean pulse2; - boolean toggle2; - boolean pulse3; - boolean toggle3; -} struct_aux; - -volatile struct_aux aux = {false, false, false, false, false, false, false, false}; - - -typedef struct { - char meter[513]; //don't forget to reserve a byte for a terminating NULL -} struct_meas; - -volatile struct_meas EEMEM EEPROM_measurements; -volatile struct_meas measurements; - - -// interrupt service routine for analog comparator -ISR(ANALOG_COMP_vect) { - digitalWrite(LEDPIN, HIGH); // sets the LED on - UCSR0B &= ~((1< moved the call to this function to start of the main loop, before init - - // clock settings: divide by 8 to get a 1Mhz clock, allows us to set the BOD level to 1.8V (DS p.37) - CLKPR = (1<EAGLE Design Rules\n

\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name. -layerSetup = (1*16) -mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm -mtIsolate = 1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm -mdWireWire = 10mil -mdWirePad = 10mil -mdWireVia = 10mil -mdPadPad = 10mil -mdPadVia = 10mil -mdViaVia = 10mil -mdSmdPad = 10mil -mdSmdVia = 10mil -mdSmdSmd = 10mil -mdViaViaSameLayer = 8mil -mnLayersViaInSmd = 2 -mdCopperDimension = 40mil -mdDrill = 10mil -mdSmdStop = 0mil -msWidth = 10mil -msDrill = 24mil -msMicroVia = 9.99mm -msBlindViaRatio = 0.500000 -rvPadTop = 0.250000 -rvPadInner = 0.250000 -rvPadBottom = 0.250000 -rvViaOuter = 0.250000 -rvViaInner = 0.250000 -rvMicroViaOuter = 0.250000 -rvMicroViaInner = 0.250000 -rlMinPadTop = 10mil -rlMaxPadTop = 20mil -rlMinPadInner = 10mil -rlMaxPadInner = 20mil -rlMinPadBottom = 10mil -rlMaxPadBottom = 20mil -rlMinViaOuter = 8mil -rlMaxViaOuter = 20mil -rlMinViaInner = 8mil -rlMaxViaInner = 20mil -rlMinMicroViaOuter = 4mil -rlMaxMicroViaOuter = 20mil -rlMinMicroViaInner = 4mil -rlMaxMicroViaInner = 20mil -psTop = -1 -psBottom = -1 -psFirst = -1 -psElongationLong = 100 -psElongationOffset = 100 -mvStopFrame = 0.100000 -mvCreamFrame = 0.000000 -mlMinStopFrame = 0mil -mlMaxStopFrame = 20mil -mlMinCreamFrame = 0mil -mlMaxCreamFrame = 0mil -mlViaStopLimit = 0mil -srRoundness = 0.000000 -srMinRoundness = 0mil -srMaxRoundness = 0mil -slThermalGap = 0.500000 -slMinThermalGap = 20mil -slMaxThermalGap = 100mil -slAnnulusIsolate = 20mil -slThermalIsolate = 10mil -slAnnulusRestring = 0 -slThermalRestring = 1 -slThermalsForVias = 0 -checkGrid = 0 -checkAngle = 0 -checkFont = 1 -checkRestrict = 1 -useDiameter = 13 -maxErrors = 50 diff --git a/mote/v1/uc/eagle/dru/flukso.8mil.dru b/mote/v1/uc/eagle/dru/flukso.8mil.dru deleted file mode 100644 index 562a117..0000000 --- a/mote/v1/uc/eagle/dru/flukso.8mil.dru +++ /dev/null @@ -1,72 +0,0 @@ -description = EAGLE Design Rules\n

\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name. -layerSetup = (1*16) -mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm -mtIsolate = 1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm -mdWireWire = 8mil -mdWirePad = 8mil -mdWireVia = 8mil -mdPadPad = 8mil -mdPadVia = 8mil -mdViaVia = 8mil -mdSmdPad = 8mil -mdSmdVia = 8mil -mdSmdSmd = 8mil -mdViaViaSameLayer = 8mil -mnLayersViaInSmd = 2 -mdCopperDimension = 40mil -mdDrill = 10mil -mdSmdStop = 0mil -msWidth = 8mil -msDrill = 0.6mm -msMicroVia = 0mil -msBlindViaRatio = 0.000000 -rvPadTop = 0.250000 -rvPadInner = 0.250000 -rvPadBottom = 0.250000 -rvViaOuter = 0.250000 -rvViaInner = 0.250000 -rvMicroViaOuter = 0.250000 -rvMicroViaInner = 0.250000 -rlMinPadTop = 10mil -rlMaxPadTop = 20mil -rlMinPadInner = 10mil -rlMaxPadInner = 20mil -rlMinPadBottom = 10mil -rlMaxPadBottom = 20mil -rlMinViaOuter = 8mil -rlMaxViaOuter = 20mil -rlMinViaInner = 8mil -rlMaxViaInner = 20mil -rlMinMicroViaOuter = 8mil -rlMaxMicroViaOuter = 20mil -rlMinMicroViaInner = 8mil -rlMaxMicroViaInner = 20mil -psTop = -1 -psBottom = -1 -psFirst = -1 -psElongationLong = 100 -psElongationOffset = 100 -mvStopFrame = 0.100000 -mvCreamFrame = 0.000000 -mlMinStopFrame = 0mil -mlMaxStopFrame = 20mil -mlMinCreamFrame = 0mil -mlMaxCreamFrame = 0mil -mlViaStopLimit = 0mil -srRoundness = 0.000000 -srMinRoundness = 0mil -srMaxRoundness = 0mil -slThermalGap = 0.500000 -slMinThermalGap = 20mil -slMaxThermalGap = 100mil -slAnnulusIsolate = 20mil -slThermalIsolate = 10mil -slAnnulusRestring = 0 -slThermalRestring = 1 -slThermalsForVias = 0 -checkGrid = 0 -checkAngle = 0 -checkFont = 1 -checkRestrict = 1 -useDiameter = 13 -maxErrors = 50 diff --git a/mote/v1/uc/eagle/lbr/flukso.lbr b/mote/v1/uc/eagle/lbr/flukso.lbr deleted file mode 100644 index e664d9a..0000000 Binary files a/mote/v1/uc/eagle/lbr/flukso.lbr and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.brd b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.brd deleted file mode 100644 index 63cac72..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.brd and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.sch b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.sch deleted file mode 100644 index 980642b..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.1/flukso.sensor.board.v1.1.sch and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.bom.xls b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.bom.xls deleted file mode 100644 index 80b11e8..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.bom.xls and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.brd b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.brd deleted file mode 100644 index 66973b0..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.brd and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.sch b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.sch deleted file mode 100644 index f179be6..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1.2/flukso.sensor.board.v1.2.sch and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.brd b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.brd deleted file mode 100644 index 23e0e26..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.brd and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.sch b/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.sch deleted file mode 100644 index e59f5a4..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v1/flukso.sensor.board.v1.sch and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.bom.v2.0.xls b/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.bom.v2.0.xls deleted file mode 100644 index 31008b3..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.bom.v2.0.xls and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.brd b/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.brd deleted file mode 100644 index b5db493..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.brd and /dev/null differ diff --git a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.sch b/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.sch deleted file mode 100644 index 77421e5..0000000 Binary files a/mote/v1/uc/eagle/prj/flukso.sensor.board.v2.0/flukso.sensor.board.v2.0.sch and /dev/null differ diff --git a/mote/v1/uc/main.c b/mote/v1/uc/main.c deleted file mode 100644 index 8114edb..0000000 --- a/mote/v1/uc/main.c +++ /dev/null @@ -1,350 +0,0 @@ -// -// main.c : AVR uC code for flukso sensor board -// -// Copyright (c) 2008-2009 jokamajo.org -// 2010 flukso.net -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// $Id$ - -#include -#include - -#include "wiring/wiring_private.h" - -#include "main.h" - -#include -// pin/register/ISR definitions -#include - -// eeprom library -#include - -// watchdog timer library -#include - -// variable declarations -volatile struct state aux[4] = {{false, false, START, 0}, {false, false, START, 0}, {false, false, START, 0}, {false, false, START, 0}}; - -volatile struct sensor EEMEM EEPROM_measurements[4] = {{SENSOR0, START}, {SENSOR1, START}, {SENSOR2, START}, {SENSOR3, START}}; -volatile struct sensor measurements[4]; - -volatile uint8_t muxn = 0; -volatile uint16_t timer = 0; - -// interrupt service routine for INT0 -ISR(INT0_vect) { - measurements[2].value++; - aux[2].pulse = true; -} - -// interrupt service routine for INT1 -ISR(INT1_vect) { - measurements[3].value++; - aux[3].pulse = true; -} - -// interrupt service routine for PCI2 (PCINT20) -/** -ISR(PCINT2_vect) { - if (aux[4].toggle == false) { - aux[4].toggle = true; - } - else { - measurements[4].value++; - aux[4].pulse = true; - aux[4].toggle = false; - } -} -**/ - -// interrupt service routine for ADC -ISR(TIMER2_COMPA_vect) { -#if DBG > 0 - PORTD |= (1< WATT) { - measurements[muxn].value++; - aux[muxn].pulse = true; - aux[muxn].nano -= WATT; - aux[muxn].pulse_count++; - } - - if (timer == SECOND) { - aux[muxn].nano_start = aux[muxn].nano_end; - aux[muxn].nano_end = aux[muxn].nano; - aux[muxn].pulse_count_final = aux[muxn].pulse_count; - aux[muxn].pulse_count = 0; - aux[muxn].power = true; - } - - // cycle through the available ADC input channels (0 and 1) - muxn++; - if (!(muxn &= 0x1)) timer++; - if (timer > SECOND) timer = 0; - - ADMUX &= 0xF8; - ADMUX |= muxn; - // start a new ADC conversion - ADCSRA |= (1< 0 - PORTD &= ~(1< 1 - aux[muxn].nano = WATT+1; - timer = SECOND; -#endif -} - -// interrupt service routine for analog comparator -ISR(ANALOG_COMP_vect) { - uint8_t i; - - //debugging: - //measurements[3].value = END3; - //measurements[2].value = END2; - //measurements[1].value = END1; - //measurements[0].value = END0; - - //disable uC sections to consume less power while writing to EEPROM - - //disable UART Tx and Rx: - UCSR0B &= ~((1< moved the call to this function to start of the main loop, before init - - // clock settings: divide by 8 to get a 1Mhz clock, allows us to set the BOD level to 1.8V (DS p.37) - CLKPR = (1< 0 - // re-use PD4 pin for tracing interrupt times - DDRD |= (1< 0 - // Toggle pin OC2A=PB3 on compare match - TCCR2A |= 1< fTOV2 = 1000kHz / 256 / 8 = 488.28Hz (DS p.158) - TCCR2B |= (1< 1000kHz / 8 = 125kHz (DS p.258) - ADCSRA |= (1<value; - sei(); - - strcpy(message, "pls "); - break; - - case POWER: - cli(); - rest = aux->nano_end - aux->nano_start; - pulse_count = aux->pulse_count_final; - sei(); - - MacU16X16to32(value, (uint16_t)(labs(rest)/65536), 242); - value /= 1024; - - if (rest >= 0) - value += pulse_count*3600; - else - value = pulse_count*3600 - value; - - strcpy(message, "pwr "); - break; - } - - strcpy(&message[4], measurement->id); - strcpy(&message[36], ":0000000000\n"); - - do { // generate digits in reverse order - message[i--] = '0' + value % 10; // get next digit - } while ((value /= 10) > 0); // delete it - - printString(message); -} - -void loop() -{ - uint8_t i; - - // check whether we have to send out a pls or pwr to the deamon - for (i=0; i<4; i++) { - if (aux[i].pulse == true) { - send(PULSE, (const struct sensor *)&measurements[i], (const struct state *)&aux[i]); - aux[i].pulse = false; - } - - if (aux[i].power == true) { - send(POWER, (const struct sensor *)&measurements[i], (const struct state *)&aux[i]); - aux[i].power = false; - } - } - wdt_reset(); -} - -int main(void) -{ - uint8_t i; - - WDT_off(); - setup(); - - // insert a startup delay of 20s to prevent interference with redboot - // interrupts are already enabled at this stage - // so the pulses are counted but not sent to the deamon - for (i=0; i<4; i++) _delay_ms(5000); - - serialFlush(); - printString("\n"); - - WDT_on(); - - for (;;) loop(); - return 0; -} diff --git a/mote/v1/uc/main.h b/mote/v1/uc/main.h deleted file mode 100644 index 1596d88..0000000 --- a/mote/v1/uc/main.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// main.h : AVR uC header file for flukso sensor board -// Copyright (c) 2008-2009 jokamajo.org -// Copyright (c) 2010 flukso.net -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// $Id$ -// - -# define PULSE 0 -# define POWER 1 - -# define WATT 1000000000 -# define SECOND 624 // 625Hz - 1 - -#ifndef SENSOR0 - #error "SENSOR0 not defined" -#endif - -#ifndef SENSOR1 - #error "SENSOR1 not defined" -#endif - -#ifndef SENSOR2 - #error "SENSOR2 not defined" -#endif - -#ifndef SENSOR3 - #error "SENSOR3 not defined" -#endif - -#ifndef PHASE - #error "PHASE not defined" -#endif - -#ifndef METERCONST - #error "METERCONST not defined" -#endif - -#define START 0 -#define END3 0xffffffff -#define END2 0xeeeeeeee -#define END1 0xdddddddd -#define END0 0xcccccccc - - -// This macro performs a 16x16 -> 32 unsigned MAC in 37 cycles with operands and results in memory -// based on http://www2.ife.ee.ethz.ch/~roggend/publications/wear/DSPMic_v1.1.pdf par 3.4 and table 31. -#define MacU16X16to32(uint_32Acc, uint_16In1, uint_16In2) \ -asm volatile ( \ - "clr r2 \n\t" \ - "mul %B2, %B1 \n\t" \ - "movw r4, r0 \n\t" \ - "mul %A2, %A1 \n\t" \ - "add %A0, r0 \n\t" \ - "adc %B0, r1 \n\t" \ - "adc %C0, r4 \n\t" \ - "adc %D0, r5 \n\t" \ - "mul %B2, %A1 \n\t" \ - "add %B0, r0 \n\t" \ - "adc %C0, r1 \n\t" \ - "adc %D0, r2 \n\t" \ - "mul %A2, %B1 \n\t" \ - "add %B0, r0 \n\t" \ - "adc %C0, r1 \n\t" \ - "adc %D0, r2 \n\t" \ - "clr r1 \n\t" \ - : \ - "+r" (uint_32Acc) \ - : \ - "a" (uint_16In1), \ - "a" (uint_16In2) \ - : \ - "r2", "r4", "r5" \ -) - -// datastructures -struct state { - boolean pulse; - boolean toggle; - uint32_t nano; - uint16_t adc; - - boolean power; - uint32_t nano_start; - uint32_t nano_end; - uint8_t pulse_count; - uint8_t pulse_count_final; -}; - -struct sensor { - char id[33]; - uint32_t value; -}; - -// prototypes -void WDT_off(void); -void WDT_on(void); -void send(uint8_t msg_type, const struct sensor *measurement, const struct state *aux); diff --git a/mote/v1/uc/wiring/binary.h b/mote/v1/uc/wiring/binary.h deleted file mode 100644 index af14980..0000000 --- a/mote/v1/uc/wiring/binary.h +++ /dev/null @@ -1,515 +0,0 @@ -#ifndef Binary_h -#define Binary_h - -#define B0 0 -#define B00 0 -#define B000 0 -#define B0000 0 -#define B00000 0 -#define B000000 0 -#define B0000000 0 -#define B00000000 0 -#define B1 1 -#define B01 1 -#define B001 1 -#define B0001 1 -#define B00001 1 -#define B000001 1 -#define B0000001 1 -#define B00000001 1 -#define B10 2 -#define B010 2 -#define B0010 2 -#define B00010 2 -#define B000010 2 -#define B0000010 2 -#define B00000010 2 -#define B11 3 -#define B011 3 -#define B0011 3 -#define B00011 3 -#define B000011 3 -#define B0000011 3 -#define B00000011 3 -#define B100 4 -#define B0100 4 -#define B00100 4 -#define B000100 4 -#define B0000100 4 -#define B00000100 4 -#define B101 5 -#define B0101 5 -#define B00101 5 -#define B000101 5 -#define B0000101 5 -#define B00000101 5 -#define B110 6 -#define B0110 6 -#define B00110 6 -#define B000110 6 -#define B0000110 6 -#define B00000110 6 -#define B111 7 -#define B0111 7 -#define B00111 7 -#define B000111 7 -#define B0000111 7 -#define B00000111 7 -#define B1000 8 -#define B01000 8 -#define B001000 8 -#define B0001000 8 -#define B00001000 8 -#define B1001 9 -#define B01001 9 -#define B001001 9 -#define B0001001 9 -#define B00001001 9 -#define B1010 10 -#define B01010 10 -#define B001010 10 -#define B0001010 10 -#define B00001010 10 -#define B1011 11 -#define B01011 11 -#define B001011 11 -#define B0001011 11 -#define B00001011 11 -#define B1100 12 -#define B01100 12 -#define B001100 12 -#define B0001100 12 -#define B00001100 12 -#define B1101 13 -#define B01101 13 -#define B001101 13 -#define B0001101 13 -#define B00001101 13 -#define B1110 14 -#define B01110 14 -#define B001110 14 -#define B0001110 14 -#define B00001110 14 -#define B1111 15 -#define B01111 15 -#define B001111 15 -#define B0001111 15 -#define B00001111 15 -#define B10000 16 -#define B010000 16 -#define B0010000 16 -#define B00010000 16 -#define B10001 17 -#define B010001 17 -#define B0010001 17 -#define B00010001 17 -#define B10010 18 -#define B010010 18 -#define B0010010 18 -#define B00010010 18 -#define B10011 19 -#define B010011 19 -#define B0010011 19 -#define B00010011 19 -#define B10100 20 -#define B010100 20 -#define B0010100 20 -#define B00010100 20 -#define B10101 21 -#define B010101 21 -#define B0010101 21 -#define B00010101 21 -#define B10110 22 -#define B010110 22 -#define B0010110 22 -#define B00010110 22 -#define B10111 23 -#define B010111 23 -#define B0010111 23 -#define B00010111 23 -#define B11000 24 -#define B011000 24 -#define B0011000 24 -#define B00011000 24 -#define B11001 25 -#define B011001 25 -#define B0011001 25 -#define B00011001 25 -#define B11010 26 -#define B011010 26 -#define B0011010 26 -#define B00011010 26 -#define B11011 27 -#define B011011 27 -#define B0011011 27 -#define B00011011 27 -#define B11100 28 -#define B011100 28 -#define B0011100 28 -#define B00011100 28 -#define B11101 29 -#define B011101 29 -#define B0011101 29 -#define B00011101 29 -#define B11110 30 -#define B011110 30 -#define B0011110 30 -#define B00011110 30 -#define B11111 31 -#define B011111 31 -#define B0011111 31 -#define B00011111 31 -#define B100000 32 -#define B0100000 32 -#define B00100000 32 -#define B100001 33 -#define B0100001 33 -#define B00100001 33 -#define B100010 34 -#define B0100010 34 -#define B00100010 34 -#define B100011 35 -#define B0100011 35 -#define B00100011 35 -#define B100100 36 -#define B0100100 36 -#define B00100100 36 -#define B100101 37 -#define B0100101 37 -#define B00100101 37 -#define B100110 38 -#define B0100110 38 -#define B00100110 38 -#define B100111 39 -#define B0100111 39 -#define B00100111 39 -#define B101000 40 -#define B0101000 40 -#define B00101000 40 -#define B101001 41 -#define B0101001 41 -#define B00101001 41 -#define B101010 42 -#define B0101010 42 -#define B00101010 42 -#define B101011 43 -#define B0101011 43 -#define B00101011 43 -#define B101100 44 -#define B0101100 44 -#define B00101100 44 -#define B101101 45 -#define B0101101 45 -#define B00101101 45 -#define B101110 46 -#define B0101110 46 -#define B00101110 46 -#define B101111 47 -#define B0101111 47 -#define B00101111 47 -#define B110000 48 -#define B0110000 48 -#define B00110000 48 -#define B110001 49 -#define B0110001 49 -#define B00110001 49 -#define B110010 50 -#define B0110010 50 -#define B00110010 50 -#define B110011 51 -#define B0110011 51 -#define B00110011 51 -#define B110100 52 -#define B0110100 52 -#define B00110100 52 -#define B110101 53 -#define B0110101 53 -#define B00110101 53 -#define B110110 54 -#define B0110110 54 -#define B00110110 54 -#define B110111 55 -#define B0110111 55 -#define B00110111 55 -#define B111000 56 -#define B0111000 56 -#define B00111000 56 -#define B111001 57 -#define B0111001 57 -#define B00111001 57 -#define B111010 58 -#define B0111010 58 -#define B00111010 58 -#define B111011 59 -#define B0111011 59 -#define B00111011 59 -#define B111100 60 -#define B0111100 60 -#define B00111100 60 -#define B111101 61 -#define B0111101 61 -#define B00111101 61 -#define B111110 62 -#define B0111110 62 -#define B00111110 62 -#define B111111 63 -#define B0111111 63 -#define B00111111 63 -#define B1000000 64 -#define B01000000 64 -#define B1000001 65 -#define B01000001 65 -#define B1000010 66 -#define B01000010 66 -#define B1000011 67 -#define B01000011 67 -#define B1000100 68 -#define B01000100 68 -#define B1000101 69 -#define B01000101 69 -#define B1000110 70 -#define B01000110 70 -#define B1000111 71 -#define B01000111 71 -#define B1001000 72 -#define B01001000 72 -#define B1001001 73 -#define B01001001 73 -#define B1001010 74 -#define B01001010 74 -#define B1001011 75 -#define B01001011 75 -#define B1001100 76 -#define B01001100 76 -#define B1001101 77 -#define B01001101 77 -#define B1001110 78 -#define B01001110 78 -#define B1001111 79 -#define B01001111 79 -#define B1010000 80 -#define B01010000 80 -#define B1010001 81 -#define B01010001 81 -#define B1010010 82 -#define B01010010 82 -#define B1010011 83 -#define B01010011 83 -#define B1010100 84 -#define B01010100 84 -#define B1010101 85 -#define B01010101 85 -#define B1010110 86 -#define B01010110 86 -#define B1010111 87 -#define B01010111 87 -#define B1011000 88 -#define B01011000 88 -#define B1011001 89 -#define B01011001 89 -#define B1011010 90 -#define B01011010 90 -#define B1011011 91 -#define B01011011 91 -#define B1011100 92 -#define B01011100 92 -#define B1011101 93 -#define B01011101 93 -#define B1011110 94 -#define B01011110 94 -#define B1011111 95 -#define B01011111 95 -#define B1100000 96 -#define B01100000 96 -#define B1100001 97 -#define B01100001 97 -#define B1100010 98 -#define B01100010 98 -#define B1100011 99 -#define B01100011 99 -#define B1100100 100 -#define B01100100 100 -#define B1100101 101 -#define B01100101 101 -#define B1100110 102 -#define B01100110 102 -#define B1100111 103 -#define B01100111 103 -#define B1101000 104 -#define B01101000 104 -#define B1101001 105 -#define B01101001 105 -#define B1101010 106 -#define B01101010 106 -#define B1101011 107 -#define B01101011 107 -#define B1101100 108 -#define B01101100 108 -#define B1101101 109 -#define B01101101 109 -#define B1101110 110 -#define B01101110 110 -#define B1101111 111 -#define B01101111 111 -#define B1110000 112 -#define B01110000 112 -#define B1110001 113 -#define B01110001 113 -#define B1110010 114 -#define B01110010 114 -#define B1110011 115 -#define B01110011 115 -#define B1110100 116 -#define B01110100 116 -#define B1110101 117 -#define B01110101 117 -#define B1110110 118 -#define B01110110 118 -#define B1110111 119 -#define B01110111 119 -#define B1111000 120 -#define B01111000 120 -#define B1111001 121 -#define B01111001 121 -#define B1111010 122 -#define B01111010 122 -#define B1111011 123 -#define B01111011 123 -#define B1111100 124 -#define B01111100 124 -#define B1111101 125 -#define B01111101 125 -#define B1111110 126 -#define B01111110 126 -#define B1111111 127 -#define B01111111 127 -#define B10000000 128 -#define B10000001 129 -#define B10000010 130 -#define B10000011 131 -#define B10000100 132 -#define B10000101 133 -#define B10000110 134 -#define B10000111 135 -#define B10001000 136 -#define B10001001 137 -#define B10001010 138 -#define B10001011 139 -#define B10001100 140 -#define B10001101 141 -#define B10001110 142 -#define B10001111 143 -#define B10010000 144 -#define B10010001 145 -#define B10010010 146 -#define B10010011 147 -#define B10010100 148 -#define B10010101 149 -#define B10010110 150 -#define B10010111 151 -#define B10011000 152 -#define B10011001 153 -#define B10011010 154 -#define B10011011 155 -#define B10011100 156 -#define B10011101 157 -#define B10011110 158 -#define B10011111 159 -#define B10100000 160 -#define B10100001 161 -#define B10100010 162 -#define B10100011 163 -#define B10100100 164 -#define B10100101 165 -#define B10100110 166 -#define B10100111 167 -#define B10101000 168 -#define B10101001 169 -#define B10101010 170 -#define B10101011 171 -#define B10101100 172 -#define B10101101 173 -#define B10101110 174 -#define B10101111 175 -#define B10110000 176 -#define B10110001 177 -#define B10110010 178 -#define B10110011 179 -#define B10110100 180 -#define B10110101 181 -#define B10110110 182 -#define B10110111 183 -#define B10111000 184 -#define B10111001 185 -#define B10111010 186 -#define B10111011 187 -#define B10111100 188 -#define B10111101 189 -#define B10111110 190 -#define B10111111 191 -#define B11000000 192 -#define B11000001 193 -#define B11000010 194 -#define B11000011 195 -#define B11000100 196 -#define B11000101 197 -#define B11000110 198 -#define B11000111 199 -#define B11001000 200 -#define B11001001 201 -#define B11001010 202 -#define B11001011 203 -#define B11001100 204 -#define B11001101 205 -#define B11001110 206 -#define B11001111 207 -#define B11010000 208 -#define B11010001 209 -#define B11010010 210 -#define B11010011 211 -#define B11010100 212 -#define B11010101 213 -#define B11010110 214 -#define B11010111 215 -#define B11011000 216 -#define B11011001 217 -#define B11011010 218 -#define B11011011 219 -#define B11011100 220 -#define B11011101 221 -#define B11011110 222 -#define B11011111 223 -#define B11100000 224 -#define B11100001 225 -#define B11100010 226 -#define B11100011 227 -#define B11100100 228 -#define B11100101 229 -#define B11100110 230 -#define B11100111 231 -#define B11101000 232 -#define B11101001 233 -#define B11101010 234 -#define B11101011 235 -#define B11101100 236 -#define B11101101 237 -#define B11101110 238 -#define B11101111 239 -#define B11110000 240 -#define B11110001 241 -#define B11110010 242 -#define B11110011 243 -#define B11110100 244 -#define B11110101 245 -#define B11110110 246 -#define B11110111 247 -#define B11111000 248 -#define B11111001 249 -#define B11111010 250 -#define B11111011 251 -#define B11111100 252 -#define B11111101 253 -#define B11111110 254 -#define B11111111 255 - -#endif diff --git a/mote/v1/uc/wiring/serial.c b/mote/v1/uc/wiring/serial.c deleted file mode 100755 index 57f9503..0000000 --- a/mote/v1/uc/wiring/serial.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - wiring_serial.c - serial functions. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ -*/ - -#include "wiring_private.h" - -// Define constants and variables for buffering incoming serial data. We're -// using a ring buffer (I think), in which rx_buffer_head is the index of the -// location to which to write the next incoming character and rx_buffer_tail -// is the index of the location from which to read. -#define RX_BUFFER_SIZE 1 - -unsigned char rx_buffer[RX_BUFFER_SIZE]; - -int rx_buffer_head = 0; -int rx_buffer_tail = 0; - -void beginSerial(long baud) -{ - UBRR0H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8; - UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1); - - // enable rx and tx - sbi(UCSR0B, RXEN0); - sbi(UCSR0B, TXEN0); - - // enable interrupt on complete reception of a byte - sbi(UCSR0B, RXCIE0); - - // defaults to 8-bit, no parity, 1 stop bit -} - -void serialWrite(unsigned char c) -{ - while (!(UCSR0A & (1 << UDRE0))) - ; - - UDR0 = c; -} - -int serialAvailable() -{ - return (RX_BUFFER_SIZE + rx_buffer_head - rx_buffer_tail) % RX_BUFFER_SIZE; -} - -int serialRead() -{ - // if the head isn't ahead of the tail, we don't have any characters - if (rx_buffer_head == rx_buffer_tail) { - return -1; - } else { - unsigned char c = rx_buffer[rx_buffer_tail]; - rx_buffer_tail = (rx_buffer_tail + 1) % RX_BUFFER_SIZE; - return c; - } -} - -void serialFlush() -{ - // don't reverse this or there may be problems if the RX interrupt - // occurs after reading the value of rx_buffer_head but before writing - // the value to rx_buffer_tail; the previous value of rx_buffer_head - // may be written to rx_buffer_tail, making it appear as if the buffer - // were full, not empty. - rx_buffer_head = rx_buffer_tail; -} - -SIGNAL(SIG_USART_RECV) -{ - unsigned char c = UDR0; - - int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE; - - // if we should be storing the received character into the location - // just before the tail (meaning that the head would advance to the - // current location of the tail), we're about to overflow the buffer - // and so we don't write the character or advance the head. - if (i != rx_buffer_tail) { - rx_buffer[rx_buffer_head] = c; - rx_buffer_head = i; - } -} - -void printByte(unsigned char c) -{ - serialWrite(c); -} - -void printString(const char *s) -{ - while (*s) - printByte(*s++); -} - -void printIntegerInBase(unsigned long n, unsigned long base) -{ - unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. - unsigned long i = 0; - - if (n == 0) { - printByte('0'); - return; - } - - while (n > 0) { - buf[i++] = n % base; - n /= base; - } - - for (; i > 0; i--) - printByte(buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10); -} - -void printInteger(long n) -{ - if (n < 0) { - printByte('-'); - n = -n; - } - - printIntegerInBase(n, 10); -} - -void printHex(unsigned long n) -{ - printIntegerInBase(n, 16); -} - -void printOctal(unsigned long n) -{ - printIntegerInBase(n, 8); -} - -void printBinary(unsigned long n) -{ - printIntegerInBase(n, 2); -} diff --git a/mote/v1/uc/wiring/wiring.h b/mote/v1/uc/wiring/wiring.h deleted file mode 100755 index c4d4daa..0000000 --- a/mote/v1/uc/wiring/wiring.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - wiring.h - Partial implementation of the Wiring API for the ATmega8. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 387 2008-03-08 21:30:00Z mellis $ -*/ - -#ifndef Wiring_h -#define Wiring_h - -#include -#include "binary.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#define HIGH 0x1 -#define LOW 0x0 - -#define INPUT 0x0 -#define OUTPUT 0x1 - -#define true 0x1 -#define false 0x0 - -#define PI 3.14159265 -#define HALF_PI 1.57079 -#define TWO_PI 6.283185 -#define DEG_TO_RAD 0.01745329 -#define RAD_TO_DEG 57.2957786 - -#define SERIAL 0x0 -#define DISPLAY 0x1 - -#define LSBFIRST 0 -#define MSBFIRST 1 - -#define CHANGE 1 -#define FALLING 2 -#define RISING 3 - -#define INTERNAL 3 -#define DEFAULT 1 -#define EXTERNAL 0 - -// undefine stdlib's abs if encountered -#ifdef abs -#undef abs -#endif - -#define int(x) ((int)(x)) -#define char(x) ((char)(x)) -#define long(x) ((long)(x)) -#define byte(x) ((uint8_t)(x)) -#define float(x) ((float)(x)) -#define boolean(x) ((uint8_t)((x)==0?0:1)) - -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) -#define abs(x) ((x)>0?(x):-(x)) -#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) -#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) -#define radians(deg) ((deg)*DEG_TO_RAD) -#define degrees(rad) ((rad)*RAD_TO_DEG) -#define sq(x) ((x)*(x)) - -#define interrupts() sei() -#define noInterrupts() cli() - -#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) -#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) -#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) - -typedef uint8_t boolean; -typedef uint8_t byte; - -void init(void); - -void beginSerial(long); -void serialWrite(unsigned char); -int serialAvailable(void); -int serialRead(void); -void serialFlush(void); -void printByte(unsigned char c); -void printString(const char *s); -void printInteger(long n); -void printHex(unsigned long n); -void printOctal(unsigned long n); -void printBinary(unsigned long n); -void printIntegerInBase(unsigned long n, unsigned long base); - -void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val); - -void setup(void); -void loop(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/mote/v1/uc/wiring/wiring_private.h b/mote/v1/uc/wiring/wiring_private.h deleted file mode 100755 index f2dc83f..0000000 --- a/mote/v1/uc/wiring/wiring_private.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - wiring_private.h - Internal header file. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ -*/ - -#ifndef WiringPrivate_h -#define WiringPrivate_h - -#include -#include -#include -#include -#include - -#include "wiring.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#ifndef cbi -#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) -#endif -#ifndef sbi -#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) -#endif - -#define EXTERNAL_INT_0 0 -#define EXTERNAL_INT_1 1 - -#define EXTERNAL_NUM_INTERRUPTS 2 - -typedef void (*voidFuncPtr)(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif