The firmware of the Grove Node
Dependencies: BLE_API color_pixels mbed-src-nrf51822 nRF51822
Fork of BLE_LoopbackUART by
udriver/udriver.h@10:f34ff4e47741, 2015-06-04 (annotated)
- Committer:
- yihui
- Date:
- Thu Jun 04 09:34:13 2015 +0000
- Revision:
- 10:f34ff4e47741
0.01 - sync input & output with android app
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 10:f34ff4e47741 | 1 | |
yihui | 10:f34ff4e47741 | 2 | #ifndef __UDRIVER_H__ |
yihui | 10:f34ff4e47741 | 3 | #define __UDRIVER_H__ |
yihui | 10:f34ff4e47741 | 4 | |
yihui | 10:f34ff4e47741 | 5 | #include <stdint.h> |
yihui | 10:f34ff4e47741 | 6 | |
yihui | 10:f34ff4e47741 | 7 | typedef struct _driver_t driver_t; |
yihui | 10:f34ff4e47741 | 8 | typedef enum _data_type_t data_type_t; |
yihui | 10:f34ff4e47741 | 9 | |
yihui | 10:f34ff4e47741 | 10 | struct _driver_t { |
yihui | 10:f34ff4e47741 | 11 | int (*init)(void *obj, void *params); |
yihui | 10:f34ff4e47741 | 12 | int (*read)(void *obj, void *data); |
yihui | 10:f34ff4e47741 | 13 | int (*write)(void *obj, void *data); |
yihui | 10:f34ff4e47741 | 14 | int (*fini)(void *obj); |
yihui | 10:f34ff4e47741 | 15 | |
yihui | 10:f34ff4e47741 | 16 | uint8_t d; // dimention |
yihui | 10:f34ff4e47741 | 17 | data_type_t *type; |
yihui | 10:f34ff4e47741 | 18 | |
yihui | 10:f34ff4e47741 | 19 | uint16_t id; |
yihui | 10:f34ff4e47741 | 20 | char *name; |
yihui | 10:f34ff4e47741 | 21 | }; |
yihui | 10:f34ff4e47741 | 22 | |
yihui | 10:f34ff4e47741 | 23 | enum _data_type_t { |
yihui | 10:f34ff4e47741 | 24 | DATA_TYPE_PENCENTAGE = 1, |
yihui | 10:f34ff4e47741 | 25 | DATA_TYPE_TEMPERATURE = 2, |
yihui | 10:f34ff4e47741 | 26 | DATA_TYPE_HUMIDITY = 3, |
yihui | 10:f34ff4e47741 | 27 | DATA_TYPE_LIGHT = 4, |
yihui | 10:f34ff4e47741 | 28 | DATA_TYPE_RED = 5, |
yihui | 10:f34ff4e47741 | 29 | DATA_TYPE_GREEN = 6, |
yihui | 10:f34ff4e47741 | 30 | DATA_TYPE_BLUE = 7, |
yihui | 10:f34ff4e47741 | 31 | DATA_TYPE_ACCELERATION = 8, |
yihui | 10:f34ff4e47741 | 32 | DATA_TYPE_ACCELERATION_X = 9, |
yihui | 10:f34ff4e47741 | 33 | DATA_TYPE_ACCELERATION_Y = 10, |
yihui | 10:f34ff4e47741 | 34 | DATA_TYPE_ACCELERATION_Z = 11, |
yihui | 10:f34ff4e47741 | 35 | DATA_TYPE_ROTATION = 12, |
yihui | 10:f34ff4e47741 | 36 | DATA_TYPE_ROTATION_X = 13, |
yihui | 10:f34ff4e47741 | 37 | DATA_TYPE_ROTATION_Y = 14, |
yihui | 10:f34ff4e47741 | 38 | DATA_TYPE_ROTATION_Z = 15, |
yihui | 10:f34ff4e47741 | 39 | }; |
yihui | 10:f34ff4e47741 | 40 | |
yihui | 10:f34ff4e47741 | 41 | |
yihui | 10:f34ff4e47741 | 42 | #endif // __UDRIVER_H__ |