summaryrefslogtreecommitdiffhomepage
path: root/analog/motor-power-avr
diff options
context:
space:
mode:
authorGuillaume Chevillot2008-02-11 11:14:02 +0100
committerGuillaume Chevillot2008-02-11 11:14:02 +0100
commitead4346d89da1fbff254557b3e63a183a0e33881 (patch)
treecd157492dbc83b04bac31fefdc5bc3393103ae6d /analog/motor-power-avr
parent18c90e0455d7be7fe298c4e85f7996ec3691c74f (diff)
Add ADC module
Diffstat (limited to 'analog/motor-power-avr')
-rw-r--r--analog/motor-power-avr/src/Makefile2
-rw-r--r--analog/motor-power-avr/src/TODO.txt2
-rw-r--r--analog/motor-power-avr/src/utils.h45
3 files changed, 47 insertions, 2 deletions
diff --git a/analog/motor-power-avr/src/Makefile b/analog/motor-power-avr/src/Makefile
index f11fc6e9..5d44550d 100644
--- a/analog/motor-power-avr/src/Makefile
+++ b/analog/motor-power-avr/src/Makefile
@@ -3,7 +3,7 @@ PROGS = mp
HOST_PROGS = test_mp
mp_SOURCES = main.c mp_pwm_L_.c mp_pwm_LR_.c adc.c
test_mp_SOURCES = test_mp.c
-MODULES = proto uart utils math/fixed
+MODULES = adc proto uart utils math/fixed
test_mp_MODULES =
CONFIGFILE = avrconfig.h
# atmega8, atmega8535, atmega128...
diff --git a/analog/motor-power-avr/src/TODO.txt b/analog/motor-power-avr/src/TODO.txt
index 17ffa5aa..2cd80ebe 100644
--- a/analog/motor-power-avr/src/TODO.txt
+++ b/analog/motor-power-avr/src/TODO.txt
@@ -1,6 +1,6 @@
TOTOlist pour le programe avr de motor-power
-- régler le problème de compilation du regv (inclure le bon utils.h ?)
+- Mettre a jour le module ADC
- attribuer les fonctions rise et fall aux interruptions TOV et OCR du timer
- peuafiner la boucle de mesure automatique de la température et de la batterie
diff --git a/analog/motor-power-avr/src/utils.h b/analog/motor-power-avr/src/utils.h
new file mode 100644
index 00000000..54cb978e
--- /dev/null
+++ b/analog/motor-power-avr/src/utils.h
@@ -0,0 +1,45 @@
+#ifndef utils_h
+#define utils_h
+/* utils.h */
+/* {{{
+ *
+ * Copyright (C) 2008 Pierre Prot
+ *
+ * APBTeam:
+ * Web: http://apbteam.org/
+ * Email: team AT apbteam DOT org
+ *
+ * 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.
+ *
+ * }}} */
+
+
+/* Concatenate 8 bits values.
+ * vx: bit value
+ * bx: bit shift
+ */
+#define regv(b0, b1, b2, b3, b4, b5, b6, b7, v0, v1, v2, v3, v4, v5, v6, v7) \
+ ( \
+ ((v0 && 1) << b0) | \
+ ((v1 && 1) << b1) | \
+ ((v2 && 1) << b2) | \
+ ((v3 && 1) << b3) | \
+ ((v4 && 1) << b4) | \
+ ((v5 && 1) << b5) | \
+ ((v6 && 1) << b6) | \
+ ((v7 && 1) << b7) \
+ )
+
+#endif