initial import

This commit is contained in:
Bart Van Der Meerssche 2009-06-05 19:59:55 +00:00
commit 261fc325f8
11 changed files with 1722 additions and 0 deletions

289
uc/Makefile Executable file
View File

@ -0,0 +1,289 @@
# 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: WEE!
#
TARGET = main
ARDUINO_VERSION = 0011
INSTALL_DIR = /home/icarus75/arduino/arduino-$(ARDUINO_VERSION)
###############################################################################
###############################################################################
#
# serial uploader settings
#
PORT = /dev/ttyUSB*
UPLOAD_RATE = 19200
AVRDUDE_PROGRAMMER = usbtiny
# BVDM; changed from stk500v1. Will probably give us a permissions error
# 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
# F_CPU sets the clock speed in Hz. For LilyPad Arduino, change F_CPU to 8000000.
#####################################################################################
#####################################################################################
#
# Below here nothing should be changed...
#
#####################################################################################
ARDUINO = $(INSTALL_DIR)/hardware/cores/arduino
AVR_TOOLS_PATH = /usr/bin
#SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
$(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
#CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp
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)
# Place -I options here
#CINCS = -I$(ARDUINO)
#CXXINCS = -I$(ARDUINO)
# 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_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 = $(INSTALL_DIR)/hardware/tools/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).pde
# Here is the "preprocessing".
# It creates a .cpp file based with the same name as the .pde file.
# On top of the new .cpp file comes the WProgram.h header.
# At the end there is a generic main() function attached.
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .pde file you actually edit...
test -d bin || mkdir bin
#echo '#include "WProgram.h"' > bin/$(TARGET).cpp
cat $(TARGET).pde > bin/$(TARGET).c
#cat main.cxx >> bin/$(TARGET).cpp
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
sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# sudo $(AVRDUDE) -c usbtiny -p atmega168 -b $(UPLOAD_RATE) -U lock:w:0x0F:m
# 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).pde bin/core.a
$(CC) $(ALL_CFLAGS) -o $@ bin/$(TARGET).c -L. bin/core.a $(LDFLAGS)
bin/core.a: $(OBJ)
@for i in $(OBJ); do echo $(AR) rcs bin/core.a $$i; $(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

182
uc/calibration.pde Normal file
View File

@ -0,0 +1,182 @@
// Copyright (c) 2008 jokamajo.org
// $Id: main.pde 1 2008-08-19 00:40:00Z icarus75 $
// 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 <avr/interrupt.h>
// eeprom library
#include <avr/eeprom.h>
// watchdog timer library
#include <avr/wdt.h>
// 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<<RXEN0) | (1<<TXEN0)); //disable UART Tx and Rx
ADCSRA &= ~(1<<ADEN); //disable ADC
ACSR |= (1<<ACD); //disable AC
// PRR |= (1<<PRUSART0) | (1<<PRADC);
eeprom_write_block((const void*)&measurements, (void*)&EEPROM_measurements, sizeof(measurements));
}
// interrupt service routine for watchdog timeout
ISR(WDT_vect) {
}
// disable WDT
void WDT_off(void) {
cli();
wdt_reset();
// clear the WDT reset flag in the status register
MCUSR &= ~(1<<WDRF);
// timed sequence to be able to change the WDT settings afterwards
WDTCSR |= (1<<WDCE) | (1<<WDE);
// disable WDT
WDTCSR = 0x00;
}
// enable WDT
void WDT_on(void) {
// enable the watchdog timer (1s)
wdt_enable(WDTO_1S);
// set watchdog interrupt enable flag
WDTCSR |= (1<<WDIE);
}
void setup()
{
// WDT_off(); -> 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<<CLKPCE);
CLKPR = (1<<CLKPS1) | (1<<CLKPS0);
// load meterid's and metervalues from EEPROM
// eeprom_read_block((void*)&measurements, (const void*)&EEPROM_measurements, sizeof(measurements));
// init serial port
Serial.begin(4800);
delay(100);
pinMode(LEDPIN, OUTPUT);
// DP2=INT0 configuration
pinMode(METER0PIN, INPUT);
// turn on the internal 20k pull-up resistor
digitalWrite(METER0PIN, HIGH);
// set INT0 (=METER0PIN) active LOW interrupt
// DP3=INT1 configuration
pinMode(METER1PIN, INPUT);
// turn on the internal 20k pull-up resistor
digitalWrite(METER1PIN, HIGH);
// set INT1 (=METER1PIN) active LOW interrupt
// PD4=PCINT20 configuration
pinMode(METER2PIN, INPUT);
// turn on the internal 20k pull-up resistor
digitalWrite(METER2PIN, HIGH);
//enable pin change interrupt on PCINT20
PCMSK2 |= (1<<PCINT20);
//pin change interrupt enable 2
PCICR |= (1<<PCIE2);
// PB1=PCINT1 configuration
pinMode(METER3PIN, INPUT);
// turn on the internal 20k pull-up resistor
digitalWrite(METER3PIN, HIGH);
//enable pin change interrupt on PCINT1
PCMSK0 |= (1<<PCINT1);
//pin change interrupt enable 0
PCICR |= (1<<PCIE0);
// analog comparator setup for brown-out detection
// DP6=Vcc+R20k configuration
pinMode(POTPIN0, INPUT);
// turn on the internal 20k pull-up resistor
digitalWrite(POTPIN0, HIGH);
// DP7=AIN1 just configure as input to obtain high impedance
pinMode(POTPIN1, INPUT);
// DP8=GND configuration + connect the DP8 pin to GND
pinMode(POTPIN2, INPUT);
// comparing AIN1 (Vcc/4.4) to bandgap reference (1.1V)
// bandgap select | AC interrupt enable | AC interrupt on rising edge (DS p.243)
ACSR |= (1<<ACBG) | (1<<ACIE) | (1<<ACIS1) | (1<<ACIS0);
WDT_on();
//set global interrupt enable in SREG to 1 (DS p.12)
sei();
for(i=0; i<sizeof(measurements.meter); i++)
measurements.meter[i] = 0x12;
}
void loop()
{
// reset the watchdog timer
wdt_reset();
Serial.println("msg testing the integrity of the UART interface");
delay(500);
}

1
uc/calibration.pde.c Symbolic link
View File

@ -0,0 +1 @@
calibration.pde

276
uc/main.1mhz.c Normal file
View File

@ -0,0 +1,276 @@
//
// main.1mhz.c : AVR uC code for flukso sensor board
// Copyright (c) 2008-2009 jokamajo.org
//
// 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: main.1mhz.c 3 2009-05-26 20:27:00Z icarus75 $
#include <string.h>
#include <stdlib.h>
#include "wiring/wiring_private.h"
#include "main.1mhz.h"
#include <avr/io.h>
// pin/register/ISR definitions
#include <avr/interrupt.h>
// eeprom library
#include <avr/eeprom.h>
// watchdog timer library
#include <avr/wdt.h>
// variable declarations
volatile struct state aux[4] = {{false, false, START}, {false, false, START}, {false, false, START}, {false, false, START}};
volatile struct sensor EEMEM EEPROM_measurements[4] = {{SENSOR0, START}, {SENSOR1, START}, {SENSOR2, START}, {SENSOR3, START}};
volatile struct sensor measurements[4];
// interrupt service routine for INT0
ISR(INT0_vect) {
measurements[0].value++;
aux[0].pulse = true;
}
// interrupt service routine for INT1
ISR(INT1_vect) {
measurements[1].value++;
aux[1].pulse = true;
}
// interrupt service routine for PCI2 (PCINT20 = pin4)
ISR(PCINT2_vect) {
if (aux[2].toggle == false) {
aux[2].toggle = true;
}
else {
measurements[2].value++;
aux[2].pulse = true;
aux[2].toggle = false;
}
}
// interrupt service routine for PCI0 (PCINT1 = pin9)
ISR(PCINT0_vect) {
if (aux[3].toggle == false) {
aux[3].toggle = true;
}
else {
measurements[3].value++;
aux[3].pulse = true;
aux[3].toggle = false;
}
}
ISR(TIMER2_OVF_vect) {
// read ADC result
// add to nano(Wh) counter
aux[0].nano += (uint32_t)METERCONST * ADC;
if (aux[0].nano > 1000000000) {
printString("msg ADC0 sample value: ");
printIntegerInBase((unsigned long)ADC, 10);
printString("\n");
//debugging
measurements[0].value++;
aux[0].pulse = true;
aux[0].nano -= 1000000000;
}
// start a new ADC conversion
ADCSRA |= (1<<ADSC);
}
// interrupt service routine for analog comparator
ISR(ANALOG_COMP_vect) {
//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<<RXEN0) | (1<<TXEN0));
//disable ADC:
ADCSRA &= ~(1<<ADEN);
// disable AC:
ACSR |= (1<<ACD);
for (i=0; i<4; i++)
eeprom_write_block((const void*)&measurements[i].value, (void*)&EEPROM_measurements[i].value, 4);
//indicate writing to EEPROM has finished by lighting up the green LED
PORTB |= (1<<PB5);
//enable UART Tx and Rx:
UCSR0B |= (1<<RXEN0) | (1<<TXEN0);
// enable ADC and start a first ADC conversion
ADCSRA |= (1<<ADEN) | (1<<ADSC);
// enable AC
ACSR &= ~(1<<ACD);
printString("msg metervalues written to EEPROM (BROWN-OUT)\n");
}
// interrupt service routine for watchdog timeout
ISR(WDT_vect) {
for (i=0; i<4; i++)
eeprom_write_block((const void*)&measurements[i].value, (void*)&EEPROM_measurements[i].value, 4);
printString("msg metervalues written to EEPROM (WDT)\n");
}
// disable WDT
void WDT_off(void) {
cli();
wdt_reset();
// clear the WDT reset flag in the status register
MCUSR &= ~(1<<WDRF);
// timed sequence to be able to change the WDT settings afterwards
WDTCSR |= (1<<WDCE) | (1<<WDE);
// disable WDT
WDTCSR = 0x00;
}
// enable WDT
void WDT_on(void) {
// enable the watchdog timer (1s)
wdt_enable(WDTO_1S);
// set watchdog interrupt enable flag
WDTCSR |= (1<<WDIE);
}
void setup()
{
// WDT_off(); -> 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<<CLKPCE);
CLKPR = (1<<CLKPS1) | (1<<CLKPS0);
// load meterid's and metervalues from EEPROM
eeprom_read_block((void*)&measurements, (const void*)&EEPROM_measurements, sizeof(measurements));
// init serial port
beginSerial(4800);
_delay_ms(100);
//LEDPIN=PB5/SCK configured as output pin
DDRB |= (1<<PB5);
// PD2=INT0 and PD3=INT1 configuration
// set as input pin with 20k pull-up enabled
PORTD |= (1<<PD2) | (1<<PD3);
// INT0 and INT1 to trigger an interrupt on a falling edge
EICRA = (1<<ISC01) | (1<<ISC11);
// enable INT0 and INT1 interrupts
EIMSK = (1<<INT0) | (1<<INT1);
// PD4=PCINT20 configuration
// set as input pin with 20k pull-up enabled
PORTD |= (1<<PD4);
//enable pin change interrupt on PCINT20
PCMSK2 |= (1<<PCINT20);
//pin change interrupt enable 2
PCICR |= (1<<PCIE2);
// PB1=PCINT1 configuration
// set as input pin with 20k pull-up enabled
PORTB |= (1<<PB1);
//enable pin change interrupt on PCINT1
PCMSK0 |= (1<<PCINT1);
//pin change interrupt enable 0
PCICR |= (1<<PCIE0);
// analog comparator setup for brown-out detection
// PD7=AIN1 configured by default as input to obtain high impedance
// comparing AIN1 (Vcc/4.4) to bandgap reference (1.1V)
// bandgap select | AC interrupt enable | AC interrupt on rising edge (DS p.243)
ACSR |= (1<<ACBG) | (1<<ACIE) | (1<<ACIS1) | (1<<ACIS0);
// Timer2 normal operation
// Timer2 clock prescaler set to 32 => fTOV2 = 1000kHz / 256 / 32 = 122.07Hz
TCCR2B |= (1<<CS21) | (1<<CS20);
TIMSK2 |= (1<<TOIE2);
// select VBG as reference for ADC
ADMUX |= (1<<REFS1) | (1<<REFS0);
// ADC0 selected by default
// ADC prescaler set to 16 => 1000kHz / 8 = 125kHz
ADCSRA |= (1<<ADPS1) | (1<<ADPS0);
// enable ADC and start a first ADC conversion
ADCSRA |= (1<<ADEN) | (1<<ADSC);
WDT_on();
//set global interrupt enable in SREG to 1 (DS p.12)
sei();
}
void send(const struct sensor *measurement)
{
uint8_t i, length;
char buffer[49];
// determine the length of value
ltoa(measurement->value, buffer, 10);
length = strlen(buffer);
strcpy(buffer, "pls ");
strcpy(&buffer[4], measurement->id);
strcpy(&buffer[36], ":");
// insert leading 0's
for (i=0; i<10-length; i++) strcpy(&buffer[37+i], "0");
ltoa(measurement->value, &buffer[47-length], 10);
strcpy(&buffer[47], "\n");
printString(buffer);
// blink the green LED
PORTB |= (1<<PB5);
_delay_ms(100);
PORTB &= ~(1<<PB5);
}
void loop()
{
// check whether we have to send out a pls to the deamon
for (i=0; i<4; i++) {
if (aux[i].pulse == true) {
send((const struct sensor *)&measurements[i]);
aux[i].pulse = false;
}
}
// reset the watchdog timer
wdt_reset();
}
int main(void)
{
WDT_off();
// init();
setup();
for (;;) loop();
return 0;
}

53
uc/main.1mhz.h Normal file
View File

@ -0,0 +1,53 @@
//
// main.1mhz.h : AVR uC header file for flukso sensor board
// Copyright (c) 2008-2009 jokamajo.org
//
// 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: main.1mhz.h 1 2009-05-27 20:27:00Z icarus75 $
//
#define SENSOR0 "197676b88851e28c489524b4526a3745"
#define SENSOR1 "0123456789abcdef0123456789abcdef"
#define SENSOR2 "0123456789abcdef0123456789abcdef"
#define SENSOR3 "0123456789abcdef0123456789abcdef"
#define METERCONST 29165
#define START 0
#define END3 0xffffffff
#define END2 0xeeeeeeee
#define END1 0xdddddddd
#define END0 0xcccccccc
// datastructures
uint8_t i;
struct state {
boolean pulse;
boolean toggle;
uint32_t nano;
};
struct sensor {
char id[33];
uint32_t value;
};
// prototypes
void WDT_off(void);
void WDT_on(void);
void send(const struct sensor *measurement);

14
uc/main.cxx Executable file
View File

@ -0,0 +1,14 @@
int main(void)
{
WDT_off();
// init();
setup();
for (;;)
loop();
return 0;
}

1
uc/main.pde Symbolic link
View File

@ -0,0 +1 @@
main.1mhz.c

515
uc/wiring/binary.h Normal file
View File

@ -0,0 +1,515 @@
#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

212
uc/wiring/serial.c Executable file
View File

@ -0,0 +1,212 @@
/*
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 128
unsigned char rx_buffer[RX_BUFFER_SIZE];
int rx_buffer_head = 0;
int rx_buffer_tail = 0;
void beginSerial(long baud)
{
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
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);
#else
UBRRH = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
UBRRL = ((F_CPU / 16 + baud / 2) / baud - 1);
// enable rx and tx
sbi(UCSRB, RXEN);
sbi(UCSRB, TXEN);
// enable interrupt on complete reception of a byte
sbi(UCSRB, RXCIE);
#endif
// defaults to 8-bit, no parity, 1 stop bit
}
void serialWrite(unsigned char c)
{
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
while (!(UCSR0A & (1 << UDRE0)))
;
UDR0 = c;
#else
while (!(UCSRA & (1 << UDRE)))
;
UDR = c;
#endif
}
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;
}
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
SIGNAL(SIG_USART_RECV)
#else
SIGNAL(SIG_UART_RECV)
#endif
{
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
unsigned char c = UDR0;
#else
unsigned char c = UDR;
#endif
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 printMode(int mode)
{
// do nothing, we only support serial printing, not lcd.
}
void printByte(unsigned char c)
{
serialWrite(c);
}
void printNewline()
{
printByte('\n');
}
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);
}
/* Including print() adds approximately 1500 bytes to the binary size,
* so we replace it with the smaller and less-confusing printString(),
* printInteger(), etc.
void print(const char *format, ...)
{
char buf[256];
va_list ap;
va_start(ap, format);
vsnprintf(buf, 256, format, ap);
va_end(ap);
printString(buf);
}
*/

121
uc/wiring/wiring.h Executable file
View File

@ -0,0 +1,121 @@
/*
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 <avr/io.h>
#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 printMode(int);
void printByte(unsigned char c);
void printNewline(void);
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

58
uc/wiring/wiring_private.h Executable file
View File

@ -0,0 +1,58 @@
/*
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 <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdarg.h>
#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