Add functions to adjust display mode
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
f1aa74c960
commit
17f791bfd8
2 changed files with 63 additions and 2 deletions
|
@ -87,11 +87,20 @@
|
|||
#define DEVICE4_BUTTON_PHYS_BRIGHTNESS_UP 0x2
|
||||
#define DEVICE4_BUTTON_PHYS_BRIGHTNESS_DOWN 0x3
|
||||
|
||||
#define DEVICE4_DISPLAY_MODE_1920x1080_60 0x1
|
||||
#define DEVICE4_DISPLAY_MODE_3840x1080_60_SBS 0x3
|
||||
#define DEVICE4_DISPLAY_MODE_3840x1080_72_SBS 0x4
|
||||
#define DEVICE4_DISPLAY_MODE_1920x1080_72 0x5
|
||||
#define DEVICE4_DISPLAY_MODE_1920x1080_60_SBS 0x8
|
||||
#define DEVICE4_DISPLAY_MODE_3840x1080_90_SBS 0x9
|
||||
#define DEVICE4_DISPLAY_MODE_1920x1080_90 0xA
|
||||
#define DEVICE4_DISPLAY_MODE_1920x1080_120 0xB
|
||||
|
||||
#define DEVICE4_BUTTON_VIRT_DISPLAY_TOGGLE 0x1
|
||||
#define DEVICE4_BUTTON_VIRT_BRIGHTNESS_UP 0x6
|
||||
#define DEVICE4_BUTTON_VIRT_BRIGHTNESS_DOWN 0x7
|
||||
#define DEVICE4_BUTTON_VIRT_MODE_UP 0x8
|
||||
#define DEVICE4_BUTTON_VIRT_MODE_DOWN 0x9
|
||||
#define DEVICE4_BUTTON_VIRT_UP 0x8
|
||||
#define DEVICE4_BUTTON_VIRT_DOWN 0x9
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -170,6 +179,10 @@ device4_error_type device4_clear(device4_type* device);
|
|||
|
||||
device4_error_type device4_read(device4_type* device, int timeout);
|
||||
|
||||
device4_error_type device4_poll_display_mode(device4_type* device);
|
||||
|
||||
device4_error_type device4_update_display_mode(device4_type* device);
|
||||
|
||||
device4_error_type device4_update_mcu_firmware(device4_type* device, const char* path);
|
||||
|
||||
device4_error_type device4_close(device4_type* device);
|
||||
|
|
|
@ -464,12 +464,60 @@ device4_error_type device4_read(device4_type* device, int timeout) {
|
|||
return DEVICE4_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
device4_error_type device4_poll_display_mode(device4_type* device) {
|
||||
if (!device) {
|
||||
device4_error("No device");
|
||||
return DEVICE4_ERROR_NO_DEVICE;
|
||||
}
|
||||
|
||||
if (!device->handle) {
|
||||
device4_error("No handle");
|
||||
return DEVICE4_ERROR_NO_HANDLE;
|
||||
}
|
||||
|
||||
if (!send_payload_action(device, DEVICE4_MSG_R_DISP_MODE, 0, NULL)) {
|
||||
device4_error("Requesting display mode failed");
|
||||
return DEVICE4_ERROR_PAYLOAD_FAILED;
|
||||
}
|
||||
|
||||
if (!recv_payload_msg(device, DEVICE4_MSG_R_DISP_MODE, 1, &device->disp_mode)) {
|
||||
device4_error("Receiving display mode failed");
|
||||
return DEVICE4_ERROR_PAYLOAD_FAILED;
|
||||
}
|
||||
|
||||
return DEVICE4_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
device4_error_type device4_update_display_mode(device4_type* device) {
|
||||
if (!device) {
|
||||
device4_error("No device");
|
||||
return DEVICE4_ERROR_NO_DEVICE;
|
||||
}
|
||||
|
||||
if (!device->handle) {
|
||||
device4_error("No handle");
|
||||
return DEVICE4_ERROR_NO_HANDLE;
|
||||
}
|
||||
|
||||
if (!do_payload_action(device, DEVICE4_MSG_W_DISP_MODE, 1, &device->disp_mode)) {
|
||||
device4_error("Sending display mode failed");
|
||||
return DEVICE4_ERROR_PAYLOAD_FAILED;
|
||||
}
|
||||
|
||||
return DEVICE4_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
device4_error_type device4_update_mcu_firmware(device4_type* device, const char* path) {
|
||||
if (!device) {
|
||||
device4_error("No device");
|
||||
return DEVICE4_ERROR_NO_DEVICE;
|
||||
}
|
||||
|
||||
if (!device->handle) {
|
||||
device4_error("No handle");
|
||||
return DEVICE4_ERROR_NO_HANDLE;
|
||||
}
|
||||
|
||||
if (!device->activated) {
|
||||
device4_error("Device is not activated");
|
||||
return DEVICE4_ERROR_NO_ACTIVATION;
|
||||
|
|
Reference in a new issue