view ds.h @ 8:dec5fe6cd0d0

Open the uinput device in write-only, and display every error.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 18 Aug 2015 02:09:15 +0100
parents eafcd170dc6d
children
line wrap: on
line source

#ifndef DS_H
#define DS_H

#include <stdint.h>


/* Describe Device */
typedef struct {
    struct {
        uint32_t a:1;      /* Pressed or held buttons */
        uint32_t b:1;
        uint32_t select:1;
        uint32_t start:1;
        uint32_t right:1;
        uint32_t left:1;
        uint32_t up:1;
        uint32_t down:1;
        uint32_t r:1;
        uint32_t l:1;
        uint32_t x:1;
        uint32_t y:1;
        uint32_t padding1:2;
        uint32_t zl:1;
        uint32_t zr:1;
        uint32_t padding2:4;
        uint32_t touched:1;
        uint32_t padding3:3;
        uint32_t c_right:1;
        uint32_t c_left:1;
        uint32_t c_up:1;
        uint32_t c_down:1;
        uint32_t circle_right:1;
        uint32_t circle_left:1;
        uint32_t circle_up:1;
        uint32_t circle_down:1;
    };
    struct {
        int16_t x;
        int16_t y;
    } pad, cpad;
    struct {
        uint16_t x;
        uint16_t y;
    } touch;
} __attribute__((packed)) ds_t;


/*
    Throws events according to ds keys status
*/
extern void ds_process_evt(ds_t* ds, int uinput_fd);


#endif /* DS_H */