39e12e33b62b0148168bd8963683bb8369cd1345
[libam7xxx.git] / src / am7xxx.h
1 /* am7xxx - communication with AM7XXX based USB Pico Projectors and DPFs
2  *
3  * Copyright (C) 2012  Antonio Ospite <ospite@studenti.unina.it>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __AM7XXX_H
20 #define __AM7XXX_H
21
22 #include <stdint.h>
23 #include <libusb-1.0/libusb.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef libusb_device_handle *am7xxx_device;
30
31 typedef enum {
32         AM7XXX_IMAGE_FORMAT_JPEG = 1,
33         AM7XXX_IMAGE_FORMAT_NV12 = 2,
34 } am7xxx_image_format;
35
36 typedef enum {
37         AM7XXX_POWER_OFF    = 0,
38         AM7XXX_POWER_LOW    = 1,
39         AM7XXX_POWER_MIDDLE = 2,
40         AM7XXX_POWER_HIGH   = 3,
41         AM7XXX_POWER_TURBO  = 4,
42 } am7xxx_power_mode;
43
44 am7xxx_device am7xxx_init(void);
45
46 void am7xxx_shutdown(am7xxx_device dev);
47
48 int am7xxx_get_device_info(am7xxx_device dev,
49                            unsigned int *native_width,
50                            unsigned int *native_height,
51                            unsigned int *unknown0,
52                            unsigned int *unknown1);
53
54 int am7xxx_send_image(am7xxx_device dev,
55                       am7xxx_image_format format,
56                       unsigned int width,
57                       unsigned int height,
58                       uint8_t *image,
59                       unsigned int size);
60
61 /*
62  * NOTE: if we set the mode to AM7XXX_POWER_OFF we can't turn the
63  * display on again by using only am7xxx_set_power_mode().
64  *
65  * Remember to mention that when writing the API doc.
66  */
67 int am7xxx_set_power_mode(am7xxx_device dev, am7xxx_power_mode mode);
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif /* __AM7XXX_H */