/*
 * @author  xamidev <xamidev@riseup.net>
 * @brief   PS/2 Keyboard driver
 * @license GPL-3.0-only
 */

#ifndef PS2_H
#define PS2_H

#include <stddef.h>

void keyboard_handler(void);
char keyboard_getchar();
int keyboard_putchar(char c);
int keyboard_getline(char* output, size_t size);

#define SHIFT_PRESSED_BIT 0b00000001
#define ALT_PRESSED_BIT   0b00000010
#define CTRL_PRESSED_BIT  0b00000100

enum SpecialKeys {
    SHIFT = 255,
    ALT = 254,
    CTRL = 253
};

enum SpecialScancodes {
    LEFT_SHIFT_PRESSED = 0x2A,
    LEFT_SHIFT_RELEASED = 0xAA,
    RIGHT_SHIFT_PRESSED = 0x36,
    RIGHT_SHIFT_RELEASED = 0xB6,
    CTRL_PRESSED = 0x1D,
    CTRL_RELEASED = 0x9D,
    ALT_PRESSED = 0x38,
    ALT_RELEASED = 0xB8  
};

enum KeyboardLayout {
    US,
    FR  
};

void keyboard_init(unsigned char layout);

#endif