deleted keyboard folder and rename reload keys function

This commit is contained in:
milang 2019-08-27 20:32:48 +02:00
parent 270dd184c8
commit 153c707b77
3 changed files with 7 additions and 57 deletions

View File

@ -15,8 +15,13 @@
typedef void (*callback)(void);
void FE_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function);
void event_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function);
void FE_keyboard_reload();
// reload all key events and call callbacks
void event_keyboard_reload();
//void event_keyboard_start();
//void event_keyboard_stop();
#endif

View File

@ -1,33 +0,0 @@
#include "keyboard.h"
static callback callbacks[3][6][10]={0};
static inline uint32_t get_x(const uint32_t matrix_code)
{
return (matrix_code-1) % 0x10;
}
static inline uint32_t get_y(const uint32_t matrix_code)
{
return (matrix_code-1) / 0x10;
}
void FE_keyboard_reload()
{
key_event_t event;
while (1)
{
event=pollevent();
event.type--;
if (event.type==-1)
break;
callback action = callbacks[event.type][get_x(event.key)][get_y(event.key)];
if (action)
action();
}
}
void FE_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function)
{
callbacks[ev_type-1][get_x(matrix_code)][get_y(matrix_code)]=function;
}

View File

@ -1,22 +0,0 @@
#ifndef FE_KEYBOARD
#define FE_KEYBOARD
#include <gint/keyboard.h>
#include <gint/keycodes.h>
#include <stdint.h>
/* FE_keyboard: gestion evenementielle du clavier
on peut assigner des callbacks à certains evènements définis dans gint
les arguments envoyés sont le code de la touche en question (event.key)
le type d'evenement (event.type)
void (*callback)(void)
la fonction à exécuter en cas de pression sur une touche
la fonction reload est appelée à la demande de l'utilisateur et appelle tous les callbacks dans l'ordre */
typedef void (*callback)(void);
void FE_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function);
void FE_keyboard_reload();
#endif