yop tof,

Pour les macros extr_xxx, elles ne ressemblent plus à ça dans la head : ça fait raler gcc-4.2 sinon, du coup je les avais refait d'une manière plus correcte.

http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive/include/ aversive.h?revision=1.4&view=markup

Sinon bien vu pour le reset().


Le 15 juin 08 à 06:52, root a écrit :

Commit from tof on branch b_tof (2008-06-14 10:02 CEST)
===============================

reset SW macro changed
kbd updated

aversive include/ aversive.h 1.3.2.3 aversive modules/devices/ihm/kbd/kbd_matrix_4x4/doc/ SCHEMA.DDB 1.1.2.2 aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/ kbd_matrix_4x4_4port.c 1.1.2.5


===========================
aversive/include/aversive.h  (1.3.2.2 -> 1.3.2.3)
===========================

@@ -15,7 +15,7 @@
  *  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: aversive.h,v 1.3.2.2 2008-02-11 10:40:52 tof Exp $ + * Revision : $Id: aversive.h,v 1.3.2.3 2008-06-14 08:02:46 tof Exp $
  *
  */

@@ -114,17 +114,41 @@
  *  use only if you need speed optimization !
  *  use ">>" instead for current operations
  */
-#define extr16_08_0(i) (*(char *)(&i))         // LSB of a 16bit
-#define extr16_08_1(i) (*((char *)(&i)+1))     // MSB of a 16bit
+#define extr16_08_0(i) (*(uint8_t *)(&i))         // LSB of a 16bit
+#define extr16_08_1(i) (*((uint8_t *)(&i)+1))     // MSB of a 16bit
+
+#define extr32_16_0(i) (*(uint16_t *)(&i)) // LSB of a 32 bit +#define extr32_16_1(i) (* (((uint16_t *)(&i)) +1)) // MSB of a 32 bit +//#define extr32_16_23(i) (*((uint16_t *)((uint8_t *)(&i)+1))) // middle of a 32 bit // deprecated
+
+#define extr32_08_0(i) (*(uint8_t *)(&i))         // same stuff
+#define extr32_08_1(i) (*((uint8_t *)(&i)+1))
+#define extr32_08_2(i) (*((uint8_t *)(&i)+2))
+#define extr32_08_3(i) (*((uint8_t *)(&i)+3))
+
+
+
+#define extr64_33_0(i) (*(uint32_t *)(&i))
+#define extr64_32_1(i) (*((uint32_t *)(&i)+1))
+
+#define extr64_16_0(i) (*(uint16_t *)(&i))
+#define extr64_16_1(i) (*((uint16_t *)(&i)+1))
+#define extr64_16_2(i) (*((uint16_t *)(&i)+2))
+#define extr64_16_3(i) (*((uint16_t *)(&i)+3))
+
+#define extr64_08_0(i) (*(uint8_t *)(&i))         // same stuff
+#define extr64_08_1(i) (*((uint8_t *)(&i)+1))
+#define extr64_08_2(i) (*((uint8_t *)(&i)+2))
+#define extr64_08_3(i) (*((uint8_t *)(&i)+3))
+#define extr64_08_4(i) (*((uint8_t *)(&i)+4))
+#define extr64_08_5(i) (*((uint8_t *)(&i)+5))
+#define extr64_08_6(i) (*((uint8_t *)(&i)+6))
+#define extr64_08_7(i) (*((uint8_t *)(&i)+7))
+
+
+
+

-#define extr32_16_0(i) (*(int *)(&i))          // LSB of a 32 bit
-#define extr32_16_1(i) (* (((int *)(&i)) +1))  // MSB of a 32 bit
-#define extr32_16_23(i) (*((int *)((char *)(&i)+1))) // middle of a 32 bit
-
-#define extr32_08_0(i) (*(char *)(&i))         // same stuff
-#define extr32_08_1(i) (*((char *)(&i)+1))
-#define extr32_08_2(i) (*((char *)(&i)+2))
-#define extr32_08_3(i) (*((char *)(&i)+3))


 /* a few asm utilities */
@@ -141,13 +165,18 @@
 #ifndef sei
 #define sei() __asm__ __volatile__ ("SEI\n") /** enable interrupts */
 #endif
-/** simple software reset, but doesn't initialize the registers */
+/** software reset through WDT
+       this procedure is recommended by atmel
+ http://support.atmel.no/bin/customer? custSessionKey=&customerLang=en&noCookies=true&action=viewKbEntry&id=2 1
+ */
 #ifndef reset
+#include <avr/io.h>
+#include <avr/wdt.h>
 #define reset()                      \
 do {                                \
-  __asm__ __volatile__ ("ldi r30,0\n");  \
-  __asm__ __volatile__ ("ldi r31,0\n");  \
-  __asm__ __volatile__ ("ijmp\n");  \
+       cli();                       \
+       wdt_enable(WDTO_30MS);       \
+       while(1) {};                 \
 } while(0)
 #endif



==============================================================
aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/doc/SCHEMA.DDB (1.1.2.1 -> 1.1.2.2)
==============================================================



====================================================================== ====== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/ kbd_matrix_4x4_4port.c (1.1.2.4 -> 1.1.2.5) ====================================================================== ======

@@ -15,7 +15,7 @@
  *  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: kbd_matrix_4x4_4port.c,v 1.1.2.4 2008-03-16 15:12:49 tof Exp $ + * Revision : $Id: kbd_matrix_4x4_4port.c,v 1.1.2.5 2008-06-14 08:03:09 tof Exp $
  *
  */

@@ -224,10 +224,10 @@
// ! a l ordre, car si on mettait d abord le port a 1, on aurait une impulsion sur le port
     // meme chose + haut

-    if ((value & KBD_BIT2)!=0)
+    if ((value & (1<<KBD_BIT2))!=0)
       return 0;  // no key pressed

- value |= KBD_ROWS; // mise a 1 des bits de ligne, (inverse ensuite a 0, pour signifier ligne4) + value |= KBD_ROWS; // mise a 1 des bits de ligne, (inverse ensuite a 0, pour signifier ligne1)
   }



_______________________________________________
Avr-list mailing list
Avr-list@droids-corp.org
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog



_______________________________________________
Avr-list mailing list
Avr-list@droids-corp.org
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog

Répondre à