diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/Makefile b/bacnet-stack/ports/bdk-atxx4-mstp/Makefile index db7d1a0c..74b8cb83 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/Makefile +++ b/bacnet-stack/ports/bdk-atxx4-mstp/Makefile @@ -52,7 +52,7 @@ ifeq (${JTAG},jtag2fast) AVRDUDE_PROGRAMMERID = jtag2fast endif ifndef JTAG -AVRDUDE_PROGRAMMERID = jtag2fast +AVRDUDE_PROGRAMMERID = dragon_jtag endif # # port--serial or parallel port to which your @@ -171,6 +171,12 @@ ifeq (${SEEPROM},128) DEFINES += -DSEEPROM_PAGE_SIZE=64 DEFINES += -DSEEPROM_WORD_ADDRESS_16BIT=1 endif +ifeq (${BDK_VERSION},3) +DEFINES += -DBDK_VERSION=3 +endif + +#ifdef + OPTIMIZE_FLAGS = -mcall-prologues OPTIMIZE_FLAGS += -finline-functions-called-once diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/led.c b/bacnet-stack/ports/bdk-atxx4-mstp/led.c index a906ace2..29e6b55e 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/led.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/led.c @@ -26,6 +26,10 @@ #include "timer.h" #include "led.h" +#ifndef BDK_VERSION +#define BDK_VERSION 4 +#endif + static struct itimer Off_Delay_Timer[MAX_LEDS]; /************************************************************************* @@ -44,10 +48,18 @@ void led_on( BIT_SET(PORTD, PD6); break; case 2: +#if (BDK_VERSION==4) + BIT_SET(PORTB, PB0); +#else BIT_SET(PORTC, PC7); +#endif break; case 3: +#if (BDK_VERSION==4) + BIT_SET(PORTB, PB4); +#else BIT_SET(PORTC, PC6); +#endif break; default: break; @@ -73,10 +85,18 @@ void led_off( BIT_CLEAR(PORTD, PD6); break; case 2: +#if (BDK_VERSION==4) + BIT_CLEAR(PORTB, PB0); +#else BIT_CLEAR(PORTC, PC7); +#endif break; case 3: +#if (BDK_VERSION==4) + BIT_CLEAR(PORTB, PB4); +#else BIT_CLEAR(PORTC, PC6); +#endif break; default: break; @@ -100,9 +120,17 @@ bool led_state( case 1: return (BIT_CHECK(PIND, PIND6)); case 2: +#if (BDK_VERSION==4) + return (BIT_CHECK(PINB, PINC0)); +#else return (BIT_CHECK(PINC, PINC7)); +#endif case 3: +#if (BDK_VERSION==4) + return (BIT_CHECK(PINB, PINC4)); +#else return (BIT_CHECK(PINC, PINC6)); +#endif default: break; } @@ -183,10 +211,15 @@ void led_init( uint8_t i; /* loop counter */ /* configure the port pins as outputs */ - BIT_SET(DDRC, DDC7); - BIT_SET(DDRC, DDC6); BIT_SET(DDRD, DDD7); BIT_SET(DDRD, DDD6); +#if (BDK_VERSION==4) + BIT_SET(DDRB, DDB0); + BIT_SET(DDRB, DDB4); +#else + BIT_SET(DDRC, DDC7); + BIT_SET(DDRC, DDC6); +#endif for (i = 0; i < MAX_LEDS; i++) { led_on_interval(i, 500); } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/test.c b/bacnet-stack/ports/bdk-atxx4-mstp/test.c index 6689e4c7..d9d147be 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/test.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/test.c @@ -37,6 +37,10 @@ /* me */ #include "test.h" +#ifndef BDK_VERSION +#define BDK_VERSION 4 +#endif + /* timer for test task */ static struct itimer Test_Timer; /* MAC Address of MS/TP */ @@ -52,7 +56,11 @@ void test_init( #endif timer_interval_start_seconds(&Test_Timer, 1); /* configure a port pin as output */ +#if (BDK_VERSION==4) + BIT_SET(DDRD, DDB5); +#else BIT_SET(DDRB, DDB0); +#endif } /************************************************************************* @@ -63,7 +71,11 @@ void test_init( static inline void test_pin_on( void) { +#if (BDK_VERSION==4) + BIT_SET(PORTD, PD5); +#else BIT_SET(PORTB, PB0); +#endif } /************************************************************************* @@ -74,7 +86,11 @@ static inline void test_pin_on( static inline void test_pin_off( void) { +#if (BDK_VERSION==4) + BIT_CLEAR(PORTD, PD5); +#else BIT_CLEAR(PORTB, PB0); +#endif } /************************************************************************* @@ -85,7 +101,11 @@ static inline void test_pin_off( static inline bool test_pin_state( void) { +#if (BDK_VERSION==4) + return (BIT_CHECK(PIND, PD5)); +#else return (BIT_CHECK(PINB, PB0)); +#endif } /*************************************************************************