Commit from tof on branch b_tof (2008-02-10 15:55 CET) ===============================
first version of the new kbd ! compilation is ok, needs to be tested : who has HW ?oliv ? eirbot ? microb ? + aversive modules/devices/ihm/kbd/kbd.h 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/Makefile 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/kbd.h 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/kbd_matrix_4x4.c 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/config/kbd_matrix_4x4_config.h 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/doc/SCHEMA.DDB 1.1.2.1 ====================================== aversive/modules/devices/ihm/kbd/kbd.h (1.1.2.1) ====================================== @@ -0,0 +1,74 @@ +/* + * 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: kbd.h,v 1.1.2.1 2008-02-10 14:55:00 tof Exp $ + * + */ + + +/** \file kbd.h + \brief Standard interface for all keyboards + + this is the interface for all keyboard modules + Every keyboard type has to use this interface. + Only one type of keyboard can be used at a time. +*/ + + +#ifndef _KBD_ +#define _KBD_ + +#include <utils.h> + + + +/** Initialisation function */ +extern void kbd_init(void); + +/** + * For each key event, call the function key_event(c, event_type) + * has to be called periodically + * typical recommendation is every 20 ms typically. + */ +extern void kbd_manage(void); + + +/** the event type definition */ +enum kbd_event {KBD_RELEASED, KBD_PRESSED , KBD_REPEAT}; +typedef enum kbd_event kbd_event; + +/** + * Add a function f(u08) which will be called on key event + * + * the registered function is for example: + * void kbd_callback(char c, kbd_event event_type) + * event_type is KBD_RELEASED, KBD_PRESSED or KBD_REPEAT + */ +extern void kbd_register_event(void (*f)(char, kbd_event)); + + + +/** + * Return 0 if the key is NOT currently pressed, or 1 if + * the key is pressed + * key is the ascii value of the key without any shifts + * this function can be called in a loop to test one key + */ +extern uint8_t kbd_key_state(char key); + + +#endif // _KBD_ ======================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/Makefile (1.1.2.1) ======================================================== @@ -0,0 +1,7 @@ +TARGET = kbd_matrix_4x4 + +# List C source files here. (C dependencies are automatically generated.) +SRC = kbd_matrix_4x4.c + +include $(AVERSIVE_DIR)/mk/aversive_module.mk + ===================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/kbd.h (1.1.2.1) ===================================================== @@ -0,0 +1,74 @@ +/* + * 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: kbd.h,v 1.1.2.1 2008-02-10 14:55:00 tof Exp $ + * + */ + + +/** \file kbd.h + \brief Standard interface for all keyboards + + this is the interface for all keyboard modules + Every keyboard type has to use this interface. + Only one type of keyboard can be used at a time. +*/ + + +#ifndef _KBD_ +#define _KBD_ + +#include <utils.h> + + + +/** Initialisation function */ +extern void kbd_init(void); + +/** + * For each key event, call the function key_event(c, event_type) + * has to be called periodically + * typical recommendation is every 20 ms typically. + */ +extern void kbd_manage(void); + + +/** the event type definition */ +enum kbd_event {KBD_RELEASED, KBD_PRESSED , KBD_REPEAT}; +typedef enum kbd_event kbd_event; + +/** + * Add a function f(u08) which will be called on key event + * + * the registered function is for example: + * void kbd_callback(char c, kbd_event event_type) + * event_type is KBD_RELEASED, KBD_PRESSED or KBD_REPEAT + */ +extern void kbd_register_event(void (*f)(char, kbd_event)); + + + +/** + * Return 0 if the key is NOT currently pressed, or 1 if + * the key is pressed + * key is the ascii value of the key without any shifts + * this function can be called in a loop to test one key + */ +extern uint8_t kbd_key_state(char key); + + +#endif // _KBD_ ================================================================ aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/kbd_matrix_4x4.c (1.1.2.1) ================================================================ @@ -0,0 +1,330 @@ +/* + * 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: kbd_matrix_4x4.c,v 1.1.2.1 2008-02-10 14:55:00 tof Exp $ + * + */ + + + + +/**********************************************************/ + +#include <avr/io.h> +#include <stdio.h> +#include <avr/pgmspace.h> + +#include <utils.h> +#include <kbd_matrix_4x4_config.h> +#include <kbd.h> + + +// mask bits definition + +#ifdef KBD_ROW1_BIT + #define KBD_ROW1_MASK (1<<KBD_ROW1_BIT) +#else + #define KBD_ROW1_MASK 0 +#endif +#ifdef KBD_ROW2_BIT + #define KBD_ROW2_MASK (1<<KBD_ROW2_BIT) +#else + #define KBD_ROW2_MASK 0 +#endif +#ifdef KBD_ROW3_BIT + #define KBD_ROW3_MASK (1<<KBD_ROW3_BIT) +#else + #define KBD_ROW3_MASK 0 +#endif +#ifdef KBD_ROW4_BIT + #define KBD_ROW4_MASK (1<<KBD_ROW4_BIT) +#else + #define KBD_ROW4_MASK 0 +#endif + +#define KBD_ALL_ROWS_MASK ( KBD_ROW1_MASK | KBD_ROW2_MASK | KBD_ROW3_MASK | KBD_ROW4_MASK ) + +#ifdef KBD_COL1_BIT + #define KBD_COL1_MASK (1<<KBD_COL1_BIT) +#else + #define KBD_COL1_MASK 0 +#endif +#ifdef KBD_COL2_BIT + #define KBD_COL2_MASK (1<<KBD_COL2_BIT) +#else + #define KBD_COL2_MASK 0 +#endif +#ifdef KBD_COL3_BIT + #define KBD_COL3_MASK (1<<KBD_COL3_BIT) +#else + #define KBD_COL3_MASK 0 +#endif +#ifdef KBD_COL4_BIT + #define KBD_COL4_MASK (1<<KBD_COL4_BIT) +#else + #define KBD_COL4_MASK 0 +#endif + +#define KBD_ALL_COLS_MASK ( KBD_COL1_MASK | KBD_COL2_MASK | KBD_COL3_MASK | KBD_COL4_MASK ) + + + +u16 kbd_scan(void); + + +void (*g_event)(char, kbd_event) = NULL; + +/** keybitmap is a variable with one bit > one key */ +u16 g_debounced_keybitmap =0; + + +const u08 PROGMEM pg_key_definition [16] = KBD_KEY_DEFINITION ; + + +/**********************************************************/ +/** Initialisation function */ +void kbd_init(void) +{ + + /* enabling pull-ups */ + /* Desactivate all COLs */ + KBD_PORT |= KBD_ALL_COLS_MASK | KBD_ALL_ROWS_MASK; + +} + + +/**********************************************************/ +/** + * Add a function f(char, event) which will be called on key event + */ +void kbd_register_event(void (*f)(char,kbd_event)) +{ + uint8_t flags; + + IRQ_LOCK(flags); + g_event = f ; + IRQ_UNLOCK(flags); +} + +/**********************************************************/ +/** + * Return 0 if the key is NOT currently pressed, or 1 if + * the key is pressed + */ +uint8_t kbd_key_state(char key) +{ + s08 keynumber =-1; + + // search for the key number + for(u08 i=0; i<sizeof(pg_key_definition); i++) + { + if(pgm_read_byte(pg_key_definition+i) == key) + keynumber = i; + } + + // check state + if(g_debounced_keybitmap & (1 << keynumber)) + return 1; + else + return 0; + +} + + +/**********************************************************/ +void kbd_manage(void) +{ + static u16 previous_keybitmap =0; + u16 actual_keybitmap; + + u16 pressed, released; + + actual_keybitmap = kbd_scan(); + + /** detection of changes. + efficient debouncing is done here + detection of changed keys is valid only if the 2 last scans agree on the change towards the debounced value */ + + pressed = actual_keybitmap & previous_keybitmap & ~g_debounced_keybitmap; + released = ~actual_keybitmap & ~previous_keybitmap & g_debounced_keybitmap; + + previous_keybitmap= actual_keybitmap; // update memory state + + + + /** application of the modification to the global variable */ + g_debounced_keybitmap &= pressed; + g_debounced_keybitmap |= ~released; + + + + /** autorepeat function + it is global to all keys (it is reset on each change) + So it covers the shift, or other various functions + that the user can implement */ +#ifdef KBD_AUTOREPEAT_ENABLED + u08 autorepeat = 0; + static u08 autorepeat_timer; + + if((pressed | released) !=0) + autorepeat_timer = KBD_AUTOREPEAT_LATENCY; // reset autorepeat on change + else + { + if (autorepeat_timer-- ==0) // no change : we decrement and test the timer + { + autorepeat_timer = KBD_AUTOREPEAT_DELAY; + autorepeat = 1; + } + } +#endif //KBD_AUTOREPEAT_ENABLED + + + /** calling the related event function */ + + // security copy : avoid corruption of the pointer in an interrupt + if(g_event) + { + void (*event_copy)(char, kbd_event); + + uint8_t flags; + + IRQ_LOCK(flags); + event_copy = g_event; + IRQ_UNLOCK(flags); + + + // calling events + u16 mask = 0x01; + for(u08 key=0; key<16; key++) + { + if( mask & pressed) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_PRESSED ) ; + + if( mask & released) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_RELEASED ) ; +#ifdef KBD_AUTOREPEAT_ENABLED + if( (autorepeat) && (mask & g_debounced_keybitmap) ) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_REPEAT ) ; +#endif //KBD_AUTOREPEAT_ENABLED + } + } +} + + + +/**********************************************************/ + +/* Private functions */ + +/**********************************************************/ + + +/** + * Returns a keybitmap in an integer containing the state of each key : 1 + * if the key is pressed, 0 if it is released. + */ +u16 kbd_scan(void) +{ + u08 state[4] = {0,0,0,0}; + u16 keybitmap = 0; + + + /* switching cols is done with atomic operations (sbi) in order to enshure + not to interfere with other users of the port (case of a smaller keyboard than 8*8) + + the scanning is done by enabling only one output, so that 2 keys are always detected, even if in the same row */ + + // read col 1 + #ifdef KBD_COL1_BIT + cbi(KBD_PORT, KBD_COL1_BIT); + sbi(DDR(KBD_PORT), KBD_COL1_BIT); + nop(); + nop(); + nop(); + state[0] = ~ PIN(KBD_PORT); + sbi(KBD_PORT, KBD_COL1_BIT); // order is for precharging activated row again to H level + cbi(DDR(KBD_PORT), KBD_COL1_BIT); + #endif + + // read col 2 + #ifdef KBD_COL2_BIT + cbi(KBD_PORT, KBD_COL2_BIT); + sbi(DDR(KBD_PORT), KBD_COL2_BIT); + nop(); + nop(); + nop(); + state[1] = ~ PIN(KBD_PORT); + sbi(KBD_PORT, KBD_COL2_BIT); // order is for precharging activated row again to H level + cbi(DDR(KBD_PORT), KBD_COL2_BIT); + #endif + + // read col 3 + #ifdef KBD_COL3_BIT + cbi(KBD_PORT, KBD_COL3_BIT); + sbi(DDR(KBD_PORT), KBD_COL3_BIT); + nop(); + nop(); + nop(); + state[2] = ~ PIN(KBD_PORT); + sbi(KBD_PORT, KBD_COL3_BIT); // order is for precharging activated row again to H level + cbi(DDR(KBD_PORT), KBD_COL3_BIT); + #endif + + // read col 4 + #ifdef KBD_COL4_BIT + cbi(KBD_PORT, KBD_COL4_BIT); + sbi(DDR(KBD_PORT), KBD_COL4_BIT); + nop(); + nop(); + nop(); + state[3] = ~ PIN(KBD_PORT); + sbi(KBD_PORT, KBD_COL4_BIT); // order is for precharging activated row again to H level + cbi(DDR(KBD_PORT), KBD_COL4_BIT); + #endif + + + // convert to keybitmap + // optimize it with a loop ? not shure + #ifdef KBD_COL1_BIT + if(state[0] & KBD_ROW1_MASK) keybitmap |= (1<<0); + if(state[0] & KBD_ROW2_MASK) keybitmap |= (1<<1); + if(state[0] & KBD_ROW3_MASK) keybitmap |= (1<<2); + if(state[0] & KBD_ROW4_MASK) keybitmap |= (1<<3); + #endif + #ifdef KBD_COL2_BIT + if(state[1] & KBD_ROW1_MASK) keybitmap |= (1<<4); + if(state[1] & KBD_ROW2_MASK) keybitmap |= (1<<5); + if(state[1] & KBD_ROW3_MASK) keybitmap |= (1<<6); + if(state[1] & KBD_ROW4_MASK) keybitmap |= (1<<7); + #endif + #ifdef KBD_COL3_BIT + if(state[2] & KBD_ROW1_MASK) keybitmap |= (1<<8); + if(state[2] & KBD_ROW2_MASK) keybitmap |= (1<<9); + if(state[2] & KBD_ROW3_MASK) keybitmap |= (1<<10); + if(state[2] & KBD_ROW4_MASK) keybitmap |= (1<<11); + #endif + #ifdef KBD_COL4_BIT + if(state[3] & KBD_ROW1_MASK) keybitmap |= (1<<12); + if(state[3] & KBD_ROW2_MASK) keybitmap |= (1<<13); + if(state[3] & KBD_ROW3_MASK) keybitmap |= (1<<14); + if(state[3] & KBD_ROW4_MASK) keybitmap |= (1<<15); + #endif + + + return keybitmap; +} + ============================================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/config/kbd_matrix_4x4_config.h (1.1.2.1) ============================================================================== @@ -0,0 +1,64 @@ +/* + * 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: kbd_matrix_4x4_config.h,v 1.1.2.1 2008-02-10 14:55:00 tof Exp $ + * + */ + + + + + + +#ifndef _KBD_CONFIG_H_ +#define _KBD_CONFIG_H_ + + +/** Keymap */ + +#define KBD_KEY_DEFINITION { '1', '2', '3', 'A', \ + '4', '5', '6', 'B', \ + '7', '8', '9', 'C', \ + '*', '0', '#', 'D' } + + +/** Port definitions + if one row or col does not exist, just undefine the corresponding bit */ + +#define KBD_PORT PORTA + +#define KBD_ROW1_BIT 0 +#define KBD_ROW2_BIT 1 +#define KBD_ROW3_BIT 2 +#define KBD_ROW4_BIT 3 +#define KBD_COL1_BIT 4 +#define KBD_COL2_BIT 5 +#define KBD_COL3_BIT 6 +#define KBD_COL4_BIT 7 + + +/** Autorepeat parameters + value is in number of cycles of kbd_manage + latency is the delay before the first activation + delay is the value between repetitions */ + +#define KBD_AUTOREPEAT_ENABLED +#define KBD_AUTOREPEAT_LATENCY 50 +#define KBD_AUTOREPEAT_DELAY 10 + + +#endif ============================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/doc/SCHEMA.DDB (1.1.2.1) ============================================================== Commit from tof (2008-02-10 15:55 CET) =============== + schematic.pdf connection 1.1.2.1 ======================== schematic.pdf/connection (1.1.2.1) ======================== Commit from tof on branch b_tof (2008-02-10 15:55 CET) =============================== first version of the new kbd ! compilation is ok, needs to be tested : who has HW ?oliv ? eirbot ? microb ? + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/test/.config 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/test/Makefile 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4/test/main.c 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/Makefile 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/kbd.h 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/kbd_matrix_4x4_4port.c 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/config/kbd_matrix_4x4_4port_config.h 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/doc/SCHEMA.DDB 1.1.2.1 ============================================================ aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/test/.config (1.1.2.1) ============================================================ @@ -0,0 +1,205 @@ +# +# Automatically generated by make menuconfig: don't edit +# + +# +# Hardware +# +# CONFIG_MCU_AT90S2313 is not set +# CONFIG_MCU_AT90S2323 is not set +# CONFIG_MCU_AT90S3333 is not set +# CONFIG_MCU_AT90S2343 is not set +# CONFIG_MCU_ATTINY22 is not set +# CONFIG_MCU_ATTINY26 is not set +# CONFIG_MCU_AT90S4414 is not set +# CONFIG_MCU_AT90S4433 is not set +# CONFIG_MCU_AT90S4434 is not set +# CONFIG_MCU_AT90S8515 is not set +# CONFIG_MCU_AT90S8534 is not set +# CONFIG_MCU_AT90S8535 is not set +# CONFIG_MCU_AT86RF401 is not set +# CONFIG_MCU_ATMEGA103 is not set +# CONFIG_MCU_ATMEGA603 is not set +# CONFIG_MCU_AT43USB320 is not set +# CONFIG_MCU_AT43USB355 is not set +# CONFIG_MCU_AT76C711 is not set +# CONFIG_MCU_ATMEGA8 is not set +# CONFIG_MCU_ATMEGA48 is not set +# CONFIG_MCU_ATMEGA88 is not set +# CONFIG_MCU_ATMEGA8515 is not set +# CONFIG_MCU_ATMEGA8535 is not set +# CONFIG_MCU_ATTINY13 is not set +# CONFIG_MCU_ATTINY2313 is not set +# CONFIG_MCU_ATMEGA16 is not set +# CONFIG_MCU_ATMEGA161 is not set +# CONFIG_MCU_ATMEGA162 is not set +# CONFIG_MCU_ATMEGA163 is not set +# CONFIG_MCU_ATMEGA165 is not set +# CONFIG_MCU_ATMEGA168 is not set +# CONFIG_MCU_ATMEGA169 is not set +# CONFIG_MCU_ATMEGA32 is not set +# CONFIG_MCU_ATMEGA323 is not set +# CONFIG_MCU_ATMEGA325 is not set +# CONFIG_MCU_ATMEGA3250 is not set +# CONFIG_MCU_ATMEGA64 is not set +# CONFIG_MCU_ATMEGA645 is not set +# CONFIG_MCU_ATMEGA6450 is not set +CONFIG_MCU_ATMEGA128=y +# CONFIG_MCU_AT90CAN128 is not set +# CONFIG_MCU_AT94K is not set +# CONFIG_MCU_AT90S1200 is not set +CONFIG_QUARTZ=8000000 + +# +# Generation options +# +# CONFIG_OPTM_0 is not set +# CONFIG_OPTM_1 is not set +# CONFIG_OPTM_2 is not set +# CONFIG_OPTM_3 is not set +CONFIG_OPTM_S=y +# CONFIG_MATH_LIB is not set +# CONFIG_FDEVOPEN_COMPAT is not set +# CONFIG_MINIMAL_PRINTF is not set +CONFIG_STANDARD_PRINTF=y +CONFIG_FORMAT_IHEX=y +# CONFIG_FORMAT_SREC is not set +# CONFIG_FORMAT_BINARY is not set + +# +# Base modules +# +CONFIG_MODULE_UTILS=y +# CONFIG_MODULE_FIXED_POINT is not set +# CONFIG_MODULE_VECT2 is not set +CONFIG_MODULE_WAIT=y +CONFIG_MODULE_LIST=y +# CONFIG_MODULE_SCHEDULER is not set +# CONFIG_MODULE_SCHEDULER_CREATE_CONFIG is not set +# CONFIG_MODULE_TIME is not set +# CONFIG_MODULE_TIME_CREATE_CONFIG is not set + +# +# Communication modules +# +CONFIG_MODULE_UART=y +CONFIG_MODULE_UART_CREATE_CONFIG=y + +# +# Hardware modules +# +# CONFIG_MODULE_PWM is not set +# CONFIG_MODULE_PWM_CREATE_CONFIG is not set +# CONFIG_MODULE_ADC is not set +# CONFIG_MODULE_ADC_CREATE_CONFIG is not set + +# +# IHM modules +# +# CONFIG_MODULE_MENU is not set + +# +# External devices modules +# +# CONFIG_MODULE_LCD is not set +# CONFIG_MODULE_LCD_CREATE_CONFIG is not set + +# +# Keyboards +# +CONFIG_MODULE_KBD_MATRIX_4X4=y +CONFIG_MODULE_KBD_MATRIX_4X4_CREATE_CONFIG=y +# CONFIG_MODULE_MULTISERVO is not set +# CONFIG_MODULE_MULTISERVO_CREATE_CONFIG is not set + +# +# Brushless motor drivers (you should enable utils and pwm modules to see all) +# +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_CREATE_CONFIG is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG is not set + +# +# Encoders (you should enable utils and fixed_point modules to see all available encoders) +# +# CONFIG_MODULE_ENCODERS_MICROB is not set +# CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG is not set +# CONFIG_MODULE_ENCODERS_EIRBOT is not set +# CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG is not set + +# +# Robot specific modules +# +# CONFIG_MODULE_ROBOT_SYSTEM is not set +# CONFIG_MODULE_POSITION_MANAGER is not set +# CONFIG_MODULE_TRAJECTORY_MANAGER is not set + +# +# Control system modules +# +# CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set +# CONFIG_MODULE_PID is not set +# CONFIG_MODULE_RAMP is not set +# CONFIG_MODULE_QUADRAMP is not set +# CONFIG_MODULE_QUADRAMP_DERIVATE is not set +# CONFIG_MODULE_BIQUAD is not set + +# +# Crypto modules +# +# CONFIG_MODULE_AES is not set +# CONFIG_MODULE_AES_CTR is not set +# CONFIG_MODULE_MD5 is not set +# CONFIG_MODULE_MD5_HMAC is not set +# CONFIG_MODULE_RC4 is not set + +# +# Encodings modules +# +# CONFIG_MODULE_BASE64 is not set +# CONFIG_MODULE_HAMMING is not set + +# +# Debug modules +# +# CONFIG_MODULE_DIAGNOSTIC is not set +# CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set +CONFIG_MODULE_ERROR=y +CONFIG_MODULE_ERROR_CREATE_CONFIG=y + +# +# Programmer options +# +CONFIG_AVRDUDE=y +# CONFIG_AVARICE is not set + +# +# Avrdude +# +# CONFIG_AVRDUDE_PROG_FUTURELEC is not set +# CONFIG_AVRDUDE_PROG_ABCMINI is not set +# CONFIG_AVRDUDE_PROG_PICOWEB is not set +# CONFIG_AVRDUDE_PROG_SP12 is not set +# CONFIG_AVRDUDE_PROG_ALF is not set +# CONFIG_AVRDUDE_PROG_BASCOM is not set +# CONFIG_AVRDUDE_PROG_DT006 is not set +# CONFIG_AVRDUDE_PROG_PONY_STK200 is not set +CONFIG_AVRDUDE_PROG_STK200=y +# CONFIG_AVRDUDE_PROG_PAVR is not set +# CONFIG_AVRDUDE_PROG_BUTTERFLY is not set +# CONFIG_AVRDUDE_PROG_AVR910 is not set +# CONFIG_AVRDUDE_PROG_STK500 is not set +# CONFIG_AVRDUDE_PROG_AVRISP is not set +# CONFIG_AVRDUDE_PROG_BSD is not set +# CONFIG_AVRDUDE_PROG_DAPA is not set +# CONFIG_AVRDUDE_PROG_JTAG1 is not set +CONFIG_AVRDUDE_PORT="/dev/parport0" + +# +# Avarice +# +CONFIG_AVARICE_PORT="/dev/ttyS0" +CONFIG_AVARICE_DEBUG_PORT=1234 +CONFIG_AVARICE_PROG_MKI=y +# CONFIG_AVARICE_PROG_MKII is not set ============================================================= aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/test/Makefile (1.1.2.1) ============================================================= @@ -0,0 +1,19 @@ +TARGET = main + +# Aversive root directory +AVERSIVE_DIR = ../../../../../.. + +# 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 =========================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4/test/main.c (1.1.2.1) =========================================================== @@ -0,0 +1,61 @@ +/* + * 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.1.2.1 2008-02-10 14:55:01 tof Exp $ + * + */ + +#include <utils.h> +#include <uart.h> +#include <wait.h> +#include <kbd.h> + +void kbd_callback(char c, kbd_event event_type) +{ + switch(event_type) + { + case KBD_PRESSED: + case KBD_REPEAT: + uart0_send(c); + break; + case KBD_RELEASED: + uart0_send('\n'); + break; + } +} + +int main(void) +{ + + + kbd_init(); + uart_init(); + + kbd_register_event(kbd_callback); + + sei(); + + while(1) + { + + kbd_manage(); + wait_ms(10); // no scheduler precision needed + + } + + return 0; +} ============================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/Makefile (1.1.2.1) ============================================================== @@ -0,0 +1,7 @@ +TARGET = kbd_matrix_4x4_4port + +# List C source files here. (C dependencies are automatically generated.) +SRC = kbd_matrix_4x4_4port.c + +include $(AVERSIVE_DIR)/mk/aversive_module.mk + =========================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/kbd.h (1.1.2.1) =========================================================== @@ -0,0 +1,74 @@ +/* + * 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: kbd.h,v 1.1.2.1 2008-02-10 14:55:01 tof Exp $ + * + */ + + +/** \file kbd.h + \brief Standard interface for all keyboards + + this is the interface for all keyboard modules + Every keyboard type has to use this interface. + Only one type of keyboard can be used at a time. +*/ + + +#ifndef _KBD_ +#define _KBD_ + +#include <utils.h> + + + +/** Initialisation function */ +extern void kbd_init(void); + +/** + * For each key event, call the function key_event(c, event_type) + * has to be called periodically + * typical recommendation is every 20 ms typically. + */ +extern void kbd_manage(void); + + +/** the event type definition */ +enum kbd_event {KBD_RELEASED, KBD_PRESSED , KBD_REPEAT}; +typedef enum kbd_event kbd_event; + +/** + * Add a function f(u08) which will be called on key event + * + * the registered function is for example: + * void kbd_callback(char c, kbd_event event_type) + * event_type is KBD_RELEASED, KBD_PRESSED or KBD_REPEAT + */ +extern void kbd_register_event(void (*f)(char, kbd_event)); + + + +/** + * Return 0 if the key is NOT currently pressed, or 1 if + * the key is pressed + * key is the ascii value of the key without any shifts + * this function can be called in a loop to test one key + */ +extern uint8_t kbd_key_state(char key); + + +#endif // _KBD_ ============================================================================ aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/kbd_matrix_4x4_4port.c (1.1.2.1) ============================================================================ @@ -0,0 +1,236 @@ +/* + * 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: kbd_matrix_4x4_4port.c,v 1.1.2.1 2008-02-10 14:55:01 tof Exp $ + * + */ + + + + +/**********************************************************/ + +#include <avr/io.h> +#include <stdio.h> +#include <avr/pgmspace.h> + +#include <utils.h> +#include <kbd_matrix_4x4_4port_config.h> +#include <kbd.h> + + +// mask bits definition +// simplifing macros +#define KBD_PORT_MASK (0x0F << KBD_BIT) +#define KBD_COLS (0x03 << KBD_BIT) +#define KBD_LINES (0x0C << KBD_BIT) +#define KBD_BIT2 (0x04 << KBD_BIT) + + + +u16 kbd_scan(void); + + +void (*g_event)(char, kbd_event) = NULL; + +/** keybitmap is a variable with one bit > one key */ +u16 g_debounced_keybitmap =0; + + +const u08 PROGMEM pg_key_definition [16] = KBD_KEY_DEFINITION ; + + +/**********************************************************/ +/** Initialisation function */ +void kbd_init(void) +{ + + KBD_PORT |= KBD_PORT_MASK; + DDR(KBD_PORT) &= (~KBD_PORT_MASK); + +} + + +/**********************************************************/ +/** + * Add a function f(char, event) which will be called on key event + */ +void kbd_register_event(void (*f)(char,kbd_event)) +{ + uint8_t flags; + + IRQ_LOCK(flags); + g_event = f ; + IRQ_UNLOCK(flags); +} + +/**********************************************************/ +/** + * Return 0 if the key is NOT currently pressed, or 1 if + * the key is pressed + */ +uint8_t kbd_key_state(char key) +{ + s08 keynumber =-1; + + // search for the key number + for(u08 i=0; i<sizeof(pg_key_definition); i++) + { + if(pgm_read_byte(pg_key_definition+i) == key) + keynumber = i; + } + + // check state + if(g_debounced_keybitmap & (1 << keynumber)) + return 1; + else + return 0; + +} + + +/**********************************************************/ +void kbd_manage(void) +{ + static u16 previous_keybitmap =0; + u16 actual_keybitmap; + + u16 pressed, released; + + actual_keybitmap = kbd_scan(); + + /** detection of changes. + efficient debouncing is done here + detection of changed keys is valid only if the 2 last scans agree on the change towards the debounced value */ + + pressed = actual_keybitmap & previous_keybitmap & ~g_debounced_keybitmap; + released = ~actual_keybitmap & ~previous_keybitmap & g_debounced_keybitmap; + + previous_keybitmap= actual_keybitmap; // update memory state + + + + /** application of the modification to the global variable */ + g_debounced_keybitmap &= pressed; + g_debounced_keybitmap |= ~released; + + + + /** autorepeat function + it is global to all keys (it is reset on each change) + So it covers the shift, or other various functions + that the user can implement */ +#ifdef KBD_AUTOREPEAT_ENABLED + u08 autorepeat = 0; + static u08 autorepeat_timer; + + if((pressed | released) !=0) + autorepeat_timer = KBD_AUTOREPEAT_LATENCY; // reset autorepeat on change + else + { + if (autorepeat_timer-- ==0) // no change : we decrement and test the timer + { + autorepeat_timer = KBD_AUTOREPEAT_DELAY; + autorepeat = 1; + } + } +#endif //KBD_AUTOREPEAT_ENABLED + + + /** calling the related event function */ + + // security copy : avoid corruption of the pointer in an interrupt + if(g_event) + { + void (*event_copy)(char, kbd_event); + + uint8_t flags; + + IRQ_LOCK(flags); + event_copy = g_event; + IRQ_UNLOCK(flags); + + + // calling events + u16 mask = 0x01; + for(u08 key=0; key<16; key++) + { + if( mask & pressed) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_PRESSED ) ; + + if( mask & released) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_RELEASED ) ; +#ifdef KBD_AUTOREPEAT_ENABLED + if( (autorepeat) && (mask & g_debounced_keybitmap) ) + event_copy( pgm_read_byte(pg_key_definition+key), KBD_REPEAT ) ; +#endif //KBD_AUTOREPEAT_ENABLED + } + } +} + + + +/**********************************************************/ + +/* Private functions */ + +/**********************************************************/ + + +/** + * Returns a keybitmap in an integer containing the state of each key : 1 + * if the key is pressed, 0 if it is released. + */ +u16 kbd_scan(void) +{ + + u08 no_key_pressed = 0; + + u08 value; + + // temps 1: on teste les 3 premieres lignes + value = PIN(KBD_PORT); + + // si aucune ligne active detectee, on a soit la 4eme ligne active, soit aucune touche appuyee + if ((~(value) & KBD_LINES) ==0) { + //temps2: on teste la 4eme ligne + cbi(KBD_PORT,KBD_BIT + 3); //on met le bit 3 en sortie a 0 + sbi(DDR(KBD_PORT) ,KBD_BIT + 3); //ce qui permet a T3 de conduire si la 4eme ligne est utilisee + + nop(); + nop(); + nop(); + value = PIN(KBD_PORT);; // lecture + + cbi(DDR(KBD_PORT),KBD_BIT +3); //on remet DDR3 a 0 + sbi(KBD_PORT,KBD_BIT +3); //et le port a 1 + // ! 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) + no_key_pressed = 1; // aucune touche + else + value |= KBD_LINES; // mise a 1 des bits de ligne, (plus tard a 0, pour signifier ligne4) + } + + + value = ((~value) & KBD_PORT_MASK) >> KBD_BIT ; // inversion et extraction des valeurs: colonne + 4*ligne, avec 0 represente la ligne/colonne 4 + + + return (1<<value); +} + ========================================================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/config/kbd_matrix_4x4_4port_config.h (1.1.2.1) ========================================================================================== @@ -0,0 +1,56 @@ +/* + * 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: kbd_matrix_4x4_4port_config.h,v 1.1.2.1 2008-02-10 14:55:01 tof Exp $ + * + */ + + + + + + +#ifndef _KBD_CONFIG_H_ +#define _KBD_CONFIG_H_ + + +/** Keymap */ + +#define KBD_KEY_DEFINITION { '1', '2', '3', 'A', \ + '4', '5', '6', 'B', \ + '7', '8', '9', 'C', \ + '*', '0', '#', 'D' } + + +/** Port definitions + the order must be the same than in the schematic. + the lowest bit is KBD_BIT */ + +#define KBD_PORT PORTA +#define KBD_BIT 0 + +/** Autorepeat parameters + value is in number of cycles of kbd_manage + latency is the delay before the first activation + delay is the value between repetitions */ + +#define KBD_AUTOREPEAT_ENABLED +#define KBD_AUTOREPEAT_LATENCY 50 +#define KBD_AUTOREPEAT_DELAY 10 + + +#endif ==================================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/doc/SCHEMA.DDB (1.1.2.1) ==================================================================== Commit from tof (2008-02-10 15:55 CET) =============== + schematics.pdf connection 1.1.2.1 ========================= schematics.pdf/connection (1.1.2.1) ========================= Commit from tof on branch b_tof (2008-02-10 15:55 CET) =============================== first version of the new kbd ! compilation is ok, needs to be tested : who has HW ?oliv ? eirbot ? microb ? + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/.config 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/Makefile 1.1.2.1 + aversive modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/main.c 1.1.2.1 ================================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/.config (1.1.2.1) ================================================================== @@ -0,0 +1,207 @@ +# +# Automatically generated by make menuconfig: don't edit +# + +# +# Hardware +# +# CONFIG_MCU_AT90S2313 is not set +# CONFIG_MCU_AT90S2323 is not set +# CONFIG_MCU_AT90S3333 is not set +# CONFIG_MCU_AT90S2343 is not set +# CONFIG_MCU_ATTINY22 is not set +# CONFIG_MCU_ATTINY26 is not set +# CONFIG_MCU_AT90S4414 is not set +# CONFIG_MCU_AT90S4433 is not set +# CONFIG_MCU_AT90S4434 is not set +# CONFIG_MCU_AT90S8515 is not set +# CONFIG_MCU_AT90S8534 is not set +# CONFIG_MCU_AT90S8535 is not set +# CONFIG_MCU_AT86RF401 is not set +# CONFIG_MCU_ATMEGA103 is not set +# CONFIG_MCU_ATMEGA603 is not set +# CONFIG_MCU_AT43USB320 is not set +# CONFIG_MCU_AT43USB355 is not set +# CONFIG_MCU_AT76C711 is not set +# CONFIG_MCU_ATMEGA8 is not set +# CONFIG_MCU_ATMEGA48 is not set +# CONFIG_MCU_ATMEGA88 is not set +# CONFIG_MCU_ATMEGA8515 is not set +# CONFIG_MCU_ATMEGA8535 is not set +# CONFIG_MCU_ATTINY13 is not set +# CONFIG_MCU_ATTINY2313 is not set +# CONFIG_MCU_ATMEGA16 is not set +# CONFIG_MCU_ATMEGA161 is not set +# CONFIG_MCU_ATMEGA162 is not set +# CONFIG_MCU_ATMEGA163 is not set +# CONFIG_MCU_ATMEGA165 is not set +# CONFIG_MCU_ATMEGA168 is not set +# CONFIG_MCU_ATMEGA169 is not set +# CONFIG_MCU_ATMEGA32 is not set +# CONFIG_MCU_ATMEGA323 is not set +# CONFIG_MCU_ATMEGA325 is not set +# CONFIG_MCU_ATMEGA3250 is not set +# CONFIG_MCU_ATMEGA64 is not set +# CONFIG_MCU_ATMEGA645 is not set +# CONFIG_MCU_ATMEGA6450 is not set +CONFIG_MCU_ATMEGA128=y +# CONFIG_MCU_AT90CAN128 is not set +# CONFIG_MCU_AT94K is not set +# CONFIG_MCU_AT90S1200 is not set +CONFIG_QUARTZ=8000000 + +# +# Generation options +# +# CONFIG_OPTM_0 is not set +# CONFIG_OPTM_1 is not set +# CONFIG_OPTM_2 is not set +# CONFIG_OPTM_3 is not set +CONFIG_OPTM_S=y +# CONFIG_MATH_LIB is not set +# CONFIG_FDEVOPEN_COMPAT is not set +# CONFIG_MINIMAL_PRINTF is not set +CONFIG_STANDARD_PRINTF=y +CONFIG_FORMAT_IHEX=y +# CONFIG_FORMAT_SREC is not set +# CONFIG_FORMAT_BINARY is not set + +# +# Base modules +# +CONFIG_MODULE_UTILS=y +# CONFIG_MODULE_FIXED_POINT is not set +# CONFIG_MODULE_VECT2 is not set +CONFIG_MODULE_WAIT=y +CONFIG_MODULE_LIST=y +# CONFIG_MODULE_SCHEDULER is not set +# CONFIG_MODULE_SCHEDULER_CREATE_CONFIG is not set +# CONFIG_MODULE_TIME is not set +# CONFIG_MODULE_TIME_CREATE_CONFIG is not set + +# +# Communication modules +# +CONFIG_MODULE_UART=y +CONFIG_MODULE_UART_CREATE_CONFIG=y + +# +# Hardware modules +# +# CONFIG_MODULE_PWM is not set +# CONFIG_MODULE_PWM_CREATE_CONFIG is not set +# CONFIG_MODULE_ADC is not set +# CONFIG_MODULE_ADC_CREATE_CONFIG is not set + +# +# IHM modules +# +# CONFIG_MODULE_MENU is not set + +# +# External devices modules +# +# CONFIG_MODULE_LCD is not set +# CONFIG_MODULE_LCD_CREATE_CONFIG is not set + +# +# Keyboards +# +# CONFIG_MODULE_KBD_MATRIX_4X4 is not set +# CONFIG_MODULE_KBD_MATRIX_4X4_CREATE_CONFIG is not set +CONFIG_MODULE_KBD_MATRIX_4X4_4PORT=y +CONFIG_MODULE_KBD_MATRIX_4X4_4PORT_CREATE_CONFIG=y +# CONFIG_MODULE_MULTISERVO is not set +# CONFIG_MODULE_MULTISERVO_CREATE_CONFIG is not set + +# +# Brushless motor drivers (you should enable utils and pwm modules to see all) +# +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_CREATE_CONFIG is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE is not set +# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG is not set + +# +# Encoders (you should enable utils and fixed_point modules to see all available encoders) +# +# CONFIG_MODULE_ENCODERS_MICROB is not set +# CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG is not set +# CONFIG_MODULE_ENCODERS_EIRBOT is not set +# CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG is not set + +# +# Robot specific modules +# +# CONFIG_MODULE_ROBOT_SYSTEM is not set +# CONFIG_MODULE_POSITION_MANAGER is not set +# CONFIG_MODULE_TRAJECTORY_MANAGER is not set + +# +# Control system modules +# +# CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set +# CONFIG_MODULE_PID is not set +# CONFIG_MODULE_RAMP is not set +# CONFIG_MODULE_QUADRAMP is not set +# CONFIG_MODULE_QUADRAMP_DERIVATE is not set +# CONFIG_MODULE_BIQUAD is not set + +# +# Crypto modules +# +# CONFIG_MODULE_AES is not set +# CONFIG_MODULE_AES_CTR is not set +# CONFIG_MODULE_MD5 is not set +# CONFIG_MODULE_MD5_HMAC is not set +# CONFIG_MODULE_RC4 is not set + +# +# Encodings modules +# +# CONFIG_MODULE_BASE64 is not set +# CONFIG_MODULE_HAMMING is not set + +# +# Debug modules +# +# CONFIG_MODULE_DIAGNOSTIC is not set +# CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set +CONFIG_MODULE_ERROR=y +CONFIG_MODULE_ERROR_CREATE_CONFIG=y + +# +# Programmer options +# +CONFIG_AVRDUDE=y +# CONFIG_AVARICE is not set + +# +# Avrdude +# +# CONFIG_AVRDUDE_PROG_FUTURELEC is not set +# CONFIG_AVRDUDE_PROG_ABCMINI is not set +# CONFIG_AVRDUDE_PROG_PICOWEB is not set +# CONFIG_AVRDUDE_PROG_SP12 is not set +# CONFIG_AVRDUDE_PROG_ALF is not set +# CONFIG_AVRDUDE_PROG_BASCOM is not set +# CONFIG_AVRDUDE_PROG_DT006 is not set +# CONFIG_AVRDUDE_PROG_PONY_STK200 is not set +CONFIG_AVRDUDE_PROG_STK200=y +# CONFIG_AVRDUDE_PROG_PAVR is not set +# CONFIG_AVRDUDE_PROG_BUTTERFLY is not set +# CONFIG_AVRDUDE_PROG_AVR910 is not set +# CONFIG_AVRDUDE_PROG_STK500 is not set +# CONFIG_AVRDUDE_PROG_AVRISP is not set +# CONFIG_AVRDUDE_PROG_BSD is not set +# CONFIG_AVRDUDE_PROG_DAPA is not set +# CONFIG_AVRDUDE_PROG_JTAG1 is not set +CONFIG_AVRDUDE_PORT="/dev/parport0" + +# +# Avarice +# +CONFIG_AVARICE_PORT="/dev/ttyS0" +CONFIG_AVARICE_DEBUG_PORT=1234 +CONFIG_AVARICE_PROG_MKI=y +# CONFIG_AVARICE_PROG_MKII is not set =================================================================== aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/Makefile (1.1.2.1) =================================================================== @@ -0,0 +1,19 @@ +TARGET = main + +# Aversive root directory +AVERSIVE_DIR = ../../../../../.. + +# 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 ================================================================= aversive/modules/devices/ihm/kbd/kbd_matrix_4x4_4port/test/main.c (1.1.2.1) ================================================================= @@ -0,0 +1,61 @@ +/* + * 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.1.2.1 2008-02-10 14:55:01 tof Exp $ + * + */ + +#include <utils.h> +#include <uart.h> +#include <wait.h> +#include <kbd.h> + +void kbd_callback(char c, kbd_event event_type) +{ + switch(event_type) + { + case KBD_PRESSED: + case KBD_REPEAT: + uart0_send(c); + break; + case KBD_RELEASED: + uart0_send('\n'); + break; + } +} + +int main(void) +{ + + + kbd_init(); + uart_init(); + + kbd_register_event(kbd_callback); + + sei(); + + while(1) + { + + kbd_manage(); + wait_ms(10); // no scheduler precision needed + + } + + return 0; +} _______________________________________________ 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