From: Michel Pollet Date: Fri, 6 Apr 2012 15:06:05 +0000 (+0100) Subject: i2ctest: Moved files to shared X-Git-Tag: v1.0b1~7 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=5774a48991a022511c2acf129d3c30769dd4cbf2;p=sx%2Fsimavr.git i2ctest: Moved files to shared Put the atmel i2c example to a shared directory Signed-off-by: Michel Pollet --- diff --git a/examples/board_i2ctest/Makefile b/examples/board_i2ctest/Makefile index 431de89..689d113 100644 --- a/examples/board_i2ctest/Makefile +++ b/examples/board_i2ctest/Makefile @@ -1,5 +1,5 @@ # -# Copyright 2008-2011 Michel Pollet +# Copyright 2008-2012 Michel Pollet # # This file is part of simavr. # @@ -30,6 +30,7 @@ IPATH += ${simavr}/simavr/sim VPATH = . VPATH += ../parts +VPATH += ../shared all: obj atmega48_${target}.axf ${target} diff --git a/examples/board_i2ctest/avr_twi_master.c b/examples/board_i2ctest/avr_twi_master.c deleted file mode 100644 index 1a8a4e3..0000000 --- a/examples/board_i2ctest/avr_twi_master.c +++ /dev/null @@ -1,220 +0,0 @@ -/***************************************************************************** -* -* Atmel Corporation -* -* File : TWI_Master.c -* Compiler : IAR EWAAVR 2.28a/3.10c -* Revision : $Revision: 1.13 $ -* Date : $Date: 24. mai 2004 11:31:20 $ -* Updated by : $Author: ltwa $ -* -* Support mail : avr@atmel.com -* -* Supported devices : All devices with a TWI module can be used. -* The example is written for the ATmega16 -* -* AppNote : AVR315 - TWI Master Implementation -* -* Description : This is a sample driver for the TWI hardware modules. -* It is interrupt driveren. All functionality is controlled through -* passing information to and from functions. Se main.c for samples -* of how to use the driver. -* -* -****************************************************************************/ - -#include -#include -#include "avr_twi_master.h" - -//static unsigned char TWI_buf[ TWI_BUFFER_SIZE ]; // Transceiver buffer -static unsigned char *TWI_buf; -static unsigned char TWI_msgSize; // Number of bytes to be transmitted. -static unsigned char TWI_sendStop; -static unsigned char TWI_state = TWI_NO_STATE; // State byte. Default set to TWI_NO_STATE. - -union TWI_statusReg TWI_statusReg = {0}; // TWI_statusReg is defined in TWI_Master.h - -/**************************************************************************** -Call this function to set up the TWI master to its initial standby state. -Remember to enable interrupts from the main application after initializing the TWI. -****************************************************************************/ -void TWI_Master_Initialise(void) -{ - TWBR = TWI_TWBR; // Set bit rate register (Baudrate). Defined in header file. -// TWSR = TWI_TWPS; // Not used. Driver presumes prescaler to be 00. - TWDR = 0xFF; // Default content = SDA released. - TWCR = (1< +#include +#include "avr_twi_master.h" + +//static unsigned char TWI_buf[ TWI_BUFFER_SIZE ]; // Transceiver buffer +static unsigned char *TWI_buf; +static unsigned char TWI_msgSize; // Number of bytes to be transmitted. +static unsigned char TWI_sendStop; +static unsigned char TWI_state = TWI_NO_STATE; // State byte. Default set to TWI_NO_STATE. + +union TWI_statusReg TWI_statusReg = {0}; // TWI_statusReg is defined in TWI_Master.h + +/**************************************************************************** +Call this function to set up the TWI master to its initial standby state. +Remember to enable interrupts from the main application after initializing the TWI. +****************************************************************************/ +void TWI_Master_Initialise(void) +{ + TWBR = TWI_TWBR; // Set bit rate register (Baudrate). Defined in header file. +// TWSR = TWI_TWPS; // Not used. Driver presumes prescaler to be 00. + TWDR = 0xFF; // Default content = SDA released. + TWCR = (1<