uc: configure TYPE and SENSORx via Makefile

This commit is contained in:
Bart Van Der Meerssche 2010-01-05 20:05:10 +00:00
parent bc2bebfdcd
commit 6222cddcb2
2 changed files with 33 additions and 9 deletions

View File

@ -53,8 +53,7 @@ INSTALL_DIR = /home/icarus75/arduino/arduino-$(ARDUINO_VERSION)
PORT = /dev/ttyUSB* PORT = /dev/ttyUSB*
UPLOAD_RATE = 19200 UPLOAD_RATE = 19200
AVRDUDE_PROGRAMMER = usbtiny 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 # HINT: If you want to use the automatic reset feature which comes with Arduino
# Diecimila, put the follwoing in your avrdude.conf: # Diecimila, put the follwoing in your avrdude.conf:
# (Use the systemwide $(INSTALL_DIR)/tools/avr/etc/avrdude.conf or create a # (Use the systemwide $(INSTALL_DIR)/tools/avr/etc/avrdude.conf or create a
@ -81,10 +80,21 @@ AVRDUDE_PROGRAMMER = usbtiny
# #
MCU = atmega48 MCU = atmega48
F_CPU = 1000000 F_CPU = 1000000
# F_CPU sets the clock speed in Hz. For LilyPad Arduino, change F_CPU to 8000000. #
# Predefine the TYPE and SENSORx C macros in main.h via this Makefile. Override the
# defaults on the command line by typing:
# make TYPE= xxxx SENSOR0=yyyy ...
#
TYPE = 2301
#
SENSOR0 = 0123456789abcdef0123456789abcde0
SENSOR1 = 0123456789abcdef0123456789abcde1
SENSOR2 = 0123456789abcdef0123456789abcde2
SENSOR3 = 0123456789abcdef0123456789abcde3
#
CEXTRA = -D TYPE=$(TYPE) -D 'SENSOR0="$(SENSOR0)"' -D 'SENSOR1="$(SENSOR1)"' -D 'SENSOR2="$(SENSOR2)"' -D 'SENSOR3="$(SENSOR3)"'
##################################################################################### #####################################################################################
##################################################################################### #####################################################################################
# #
# Below here nothing should be changed... # Below here nothing should be changed...

View File

@ -20,12 +20,26 @@
// $Id$ // $Id$
// //
#define SENSOR0 "0123456789abcdef0123456789abcde0" #ifndef SENSOR0
#define SENSOR1 "0123456789abcdef0123456789abcde1" #define SENSOR0 "0123456789abcdef0123456789abcde0"
#define SENSOR2 "0123456789abcdef0123456789abcde2" #endif
#define SENSOR3 "0123456789abcdef0123456789abcde3"
#ifndef SENSOR1
#define SENSOR1 "0123456789abcdef0123456789abcde1"
#endif
#ifndef SENSOR2
#define SENSOR2 "0123456789abcdef0123456789abcde2"
#endif
#ifndef SENSOR3
#define SENSOR3 "0123456789abcdef0123456789abcde3"
#endif
#ifndef TYPE
#define TYPE 2301
#endif
#define TYPE 2301
#if TYPE == 2201 // 220V - 1-phase @ 488.28Hz sampling rate #if TYPE == 2201 // 220V - 1-phase @ 488.28Hz sampling rate
#define METERCONST 6783 #define METERCONST 6783