123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- #ifndef __INCLUDE_INPUT_DEV_H__
- #define __INCLUDE_INPUT_DEV_H__
- #include <stdint.h>
- #include <device.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define KEY_RESERVED 0
- #define KEY_POWER 1
- #define KEY_PREVIOUSSONG 2
- #define KEY_NEXTSONG 3
- #define KEY_VOL 4
- #define KEY_VOLUMEUP 5
- #define KEY_VOLUMEDOWN 6
- #define KEY_MENU 7
- #define KEY_CONNECT 8
- #define KEY_TBD 9
- #define KEY_MUTE 10
- #define KEY_PAUSE_AND_RESUME 11
- #define KEY_FOLDER_ADD 12
- #define KEY_FOLDER_SUB 13
- #define KEY_NEXT_VOLADD 14
- #define KEY_PREV_VOLSUB 15
- #define KEY_NUM0 16
- #define KEY_NUM1 17
- #define KEY_NUM2 18
- #define KEY_NUM3 19
- #define KEY_NUM4 20
- #define KEY_NUM5 21
- #define KEY_NUM6 22
- #define KEY_NUM7 23
- #define KEY_NUM8 24
- #define KEY_NUM9 25
- #define KEY_CH_ADD 26
- #define KEY_CH_SUB 27
- #define KEY_PAUSE 28
- #define KEY_RESUME 29
- #define KEY_KONB_CLOCKWISE 30
- #define KEY_KONB_ANTICLOCKWISE 31
- #define KEY_F1 40
- #define KEY_F2 41
- #define KEY_F3 42
- #define KEY_F4 43
- #define KEY_F5 44
- #define KEY_F6 45
- #define KEY_ADFU 46
- #define KEY_MIN_INTERESTING KEY_MUTE
- #define LINEIN_DETECT 100
- #define KEY_MAX 0x2ff
- #define KEY_CNT (KEY_MAX+1)
- #define EV_SYN 0x00
- #define EV_KEY 0x01
- #define EV_REL 0x02
- #define EV_ABS 0x03
- #define EV_MSC 0x04
- #define EV_SW 0x05
- #define EV_SR 0x06
- #define EV_LED 0x11
- #define EV_SND 0x12
- #define EV_REP 0x14
- #define EV_FF 0x15
- #define EV_PWR 0x16
- #define EV_FF_STATUS 0x17
- #define EV_MAX 0x1f
- #define EV_CNT (EV_MAX+1)
- #define INPUT_DEV_TYPE_KEYBOARD 1
- #define INPUT_DEV_TYPE_TOUCHPAD 2
- struct input_dev_config {
- uint8_t type;
- };
- struct input_value {
- union {
- struct{
- int16_t loc_x;
- int16_t loc_y;
- uint16_t pessure_value;
- uint16_t gesture;
- } point;
- struct{
- uint16_t type;
- uint16_t code;
- uint32_t value;
- } keypad;
- struct{
- union {
- struct{
- uint16_t mode;
- uint32_t *data;
- uint16_t carry_rate;
- }protocol;
- struct{
- uint16_t mode;
- uint16_t onoff;
- uint32_t *cmd;
- }data;
- };
- } ir;
- };
- };
- enum {
-
- INPUT_GESTURE_DIRECTION = BIT(0),
- };
- struct input_capabilities {
- union {
- struct {
- uint32_t supported_gestures;
- } pointer;
- };
- };
- typedef void (*input_notify_t) (struct device *dev, struct input_value *val);
- struct input_dev_driver_api {
- void (*enable)(const struct device *dev);
- void (*disable)(const struct device *dev);
- void (*inquiry)(const struct device *dev, struct input_value *val);
- void (*register_notify)(const struct device *dev, input_notify_t notify);
- void (*unregister_notify)(const struct device *dev, input_notify_t notify);
- void (*get_capabilities)(const struct device *dev, struct input_capabilities *capabilities);
- };
- static inline void input_dev_enable(const struct device *dev)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->enable)
- api->enable(dev);
- }
- static inline void input_dev_disable(const struct device *dev)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->disable)
- api->disable(dev);
- }
- static inline void input_dev_inquiry(const struct device *dev,
- struct input_value *val)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->inquiry)
- api->inquiry(dev, val);
- }
- static inline void input_dev_register_notify(const struct device *dev,
- input_notify_t notify)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->register_notify)
- api->register_notify(dev, notify);
- }
- static inline void input_dev_unregister_notify(const struct device *dev,
- input_notify_t notify)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->unregister_notify)
- api->unregister_notify(dev, notify);
- }
- static inline void input_dev_get_capabilities(const struct device *dev,
- struct input_capabilities *capabilities)
- {
- const struct input_dev_driver_api *api = dev->api;
- if (api->get_capabilities) {
- api->get_capabilities(dev, capabilities);
- }
- }
- #ifdef __cplusplus
- }
- #endif
- #endif
|