From a0b55e808194b6054fd3d733e9987861ef5c61a4 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 17 May 2013 21:41:45 +0200 Subject: [PATCH] initial rev --- Makefile | 21 +++++++++++++++++ error_config.h | 31 +++++++++++++++++++++++++ main.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 Makefile create mode 100644 error_config.h create mode 100644 main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cae25c2 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +TARGET = main + +# repertoire des modules +AVERSIVE_DIR ?=../..# VALUE, absolute or relative path : example ../.. # + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + +######################################## + +-include .aversive_conf +include $(AVERSIVE_DIR)/mk/aversive_project.mk diff --git a/error_config.h b/error_config.h new file mode 100644 index 0000000..2e1288a --- /dev/null +++ b/error_config.h @@ -0,0 +1,31 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error_config.h,v 1.4.6.1 2006-11-26 21:06:03 zer0 Exp $ + * + */ + +#ifndef _ERROR_CONFIG_ +#define _ERROR_CONFIG_ + +/** enable the dump of the comment */ +#define ERROR_DUMP_TEXTLOG + +/** enable the dump of filename and line number */ +#define ERROR_DUMP_FILE_LINE + +#endif diff --git a/main.c b/main.c new file mode 100644 index 0000000..9c2a25f --- /dev/null +++ b/main.c @@ -0,0 +1,63 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.c,v 1.4.6.3 2007-05-28 12:55:48 zer0 Exp $ + * + */ + +#include +#include + +#include +#include + +#define TX_ENABLE_PORT 2 +#define DATA_PORT 1 +#define BUZZER_PORT 0 + +#define TX_ON() sbi(PORTB, TX_ENABLE_PORT) +#define TX_OFF() cbi(PORTB, TX_ENABLE_PORT) + +#define DATA_ON() sbi(PORTB, DATA_PORT) +#define DATA_OFF() cbi(PORTB, DATA_PORT) + +int main(void) +{ + int i; + + /* PORTB TX/DATA out*/ + DDRB |= (1 << TX_ENABLE_PORT) | + (1 << DATA_PORT) | + (1 << BUZZER_PORT); + + + while (1) { + PORTB &= ~(1 << TX_ENABLE_PORT); + wait_ms(500); + PORTB |= (1 << TX_ENABLE_PORT); + for (i=0;i<100; i++) { + PORTB |= (1 << DATA_PORT); + PORTB |= (1 << BUZZER_PORT); + _delay_us(1000); + PORTB &= ~(1 << DATA_PORT); + PORTB &= ~(1 << BUZZER_PORT); + _delay_us(1000); + } + } + + return 0; +} -- 2.20.1