From 6263ed441f45d636d9a66f94e0bc30eaca13459f Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 6 Mar 2008 23:32:31 +0100 Subject: * digital/avr/modules/twi: - avrconfig cleanup. --- digital/avr/modules/twi/test/Makefile | 13 +++++++++---- digital/avr/modules/twi/test/avrconfig_master.h | 21 +++++++++++++-------- digital/avr/modules/twi/test/avrconfig_slave.h | 21 +++++++++++++-------- digital/avr/modules/twi/test/test_twi_master.c | 3 ++- digital/avr/modules/twi/test/test_twi_sl.c | 6 +++--- 5 files changed, 40 insertions(+), 24 deletions(-) (limited to 'digital/avr/modules/twi/test') diff --git a/digital/avr/modules/twi/test/Makefile b/digital/avr/modules/twi/test/Makefile index a5ba612e..1af68de3 100644 --- a/digital/avr/modules/twi/test/Makefile +++ b/digital/avr/modules/twi/test/Makefile @@ -2,10 +2,7 @@ # It is required to clean before building each program because they share the # same object with different defines. # Files are copied in *.keep.hex. -all: - # General cleaning - $(MAKE) -f Makefile.slave clean - $(MAKE) -f Makefile.master clean +all: subclean # Slave $(MAKE) -f Makefile.slave cp test_twi_sl.hex test_twi_sl.keep.hex @@ -14,3 +11,11 @@ all: $(MAKE) -f Makefile.master cp test_twi_master.hex test_twi_master.keep.hex $(MAKE) -f Makefile.master clean + +subclean: + # General cleaning + $(MAKE) -f Makefile.slave clean + $(MAKE) -f Makefile.master clean + +clean: subclean + rm -f test_twi_master.keep.hex test_twi_sl.keep.hex diff --git a/digital/avr/modules/twi/test/avrconfig_master.h b/digital/avr/modules/twi/test/avrconfig_master.h index bc070738..16becdcf 100644 --- a/digital/avr/modules/twi/test/avrconfig_master.h +++ b/digital/avr/modules/twi/test/avrconfig_master.h @@ -25,10 +25,20 @@ * * }}} */ -#define TWI_SL_RCPT_SIZE 1 -#define TWI_SL_SEND_SIZE 1 +/* global */ +/** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800, + * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */ +#define AC_FREQ 14745600 -#define TWI_MASTER_ENABLE 1 +/* twi - TWI module. */ +/** Activate master part. */ +#define AC_TWI_MASTER_ENABLE 1 +/** Activate slave part. */ +#define AC_TWI_SLAVE_ENABLE 0 +/** Slave recv buffer size. */ +#define AC_TWI_SL_RECV_BUFFER_SIZE 1 +/** Slave send buffer size. */ +#define AC_TWI_SL_SEND_BUFFER_SIZE 1 /* proto - Protocol module. */ /** Maximum argument size. */ @@ -40,11 +50,6 @@ /** Support for quote parameter. */ #define AC_PROTO_QUOTE 1 -/* global */ -/** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800, - * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */ -#define AC_FREQ 14745600 - /* uart - UART module. */ /** Select hardware uart for primary uart: 0, 1 or -1 to disable. */ #define AC_UART0_PORT 1 diff --git a/digital/avr/modules/twi/test/avrconfig_slave.h b/digital/avr/modules/twi/test/avrconfig_slave.h index 9cbfd33b..394c5937 100644 --- a/digital/avr/modules/twi/test/avrconfig_slave.h +++ b/digital/avr/modules/twi/test/avrconfig_slave.h @@ -25,10 +25,20 @@ * * }}} */ -#define TWI_SL_RCPT_SIZE 1 -#define TWI_SL_SEND_SIZE 1 +/* global */ +/** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800, + * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */ +#define AC_FREQ 14745600 -#define TWI_SLAVE_ENABLE 1 +/* twi - TWI module. */ +/** Activate master part. */ +#define AC_TWI_MASTER_ENABLE 0 +/** Activate slave part. */ +#define AC_TWI_SLAVE_ENABLE 1 +/** Slave recv buffer size. */ +#define AC_TWI_SL_RECV_BUFFER_SIZE 1 +/** Slave send buffer size. */ +#define AC_TWI_SL_SEND_BUFFER_SIZE 1 /* proto - Protocol module. */ /** Maximum argument size. */ @@ -40,11 +50,6 @@ /** Support for quote parameter. */ #define AC_PROTO_QUOTE 1 -/* global */ -/** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800, - * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */ -#define AC_FREQ 14745600 - /* uart - UART module. */ /** Select hardware uart for primary uart: 0, 1 or -1 to disable. */ #define AC_UART0_PORT 1 diff --git a/digital/avr/modules/twi/test/test_twi_master.c b/digital/avr/modules/twi/test/test_twi_master.c index a3301e9a..85b48686 100644 --- a/digital/avr/modules/twi/test/test_twi_master.c +++ b/digital/avr/modules/twi/test/test_twi_master.c @@ -80,7 +80,8 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) while (compt-- != 0) { /* Maximum number of bytes of the message */ - static const uint8_t max_byte_number = TWI_SL_SEND_SIZE; + static const uint8_t max_byte_number = + AC_TWI_SL_RECV_BUFFER_SIZE; /* Get a random number */ uint32_t random = random_u32 (); /* Extract a number under max_byte_number */ diff --git a/digital/avr/modules/twi/test/test_twi_sl.c b/digital/avr/modules/twi/test/test_twi_sl.c index b6cbc050..020c9e6b 100644 --- a/digital/avr/modules/twi/test/test_twi_sl.c +++ b/digital/avr/modules/twi/test/test_twi_sl.c @@ -65,13 +65,13 @@ main (void) proto_send0 ('S'); while (42) { - uint8_t data[TWI_SL_RCPT_SIZE]; + uint8_t data[AC_TWI_SL_RECV_BUFFER_SIZE]; data[0] = 0; /* Check for data */ - if (twi_sl_poll (data, TWI_SL_RCPT_SIZE)) + if (twi_sl_poll (data, AC_TWI_SL_RECV_BUFFER_SIZE)) { /* Receive and store them */ - twi_sl_update (data, TWI_SL_RCPT_SIZE); + twi_sl_update (data, AC_TWI_SL_RECV_BUFFER_SIZE); } if (uart0_poll ()) proto_accept (uart0_getc ()); -- cgit v1.2.3