2021-05-23 17:54:11 +01:00
|
|
|
/*
|
|
|
|
xdsp_18_berry_display.ino - Interface to virtual display driver with Berry, complements Universal Display with Berry scripting
|
|
|
|
|
|
|
|
Copyright (C) 2021 Stephan Hadinger and Theo Arends
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef USE_DISPLAY
|
|
|
|
#ifdef USE_BERRY
|
|
|
|
|
|
|
|
#define XDSP_18 18
|
|
|
|
|
|
|
|
/*********************************************************************************************\
|
|
|
|
* Interface
|
|
|
|
\*********************************************************************************************/
|
|
|
|
|
2022-11-11 09:44:56 +00:00
|
|
|
bool Xdsp18(uint32_t function) {
|
2021-05-23 17:54:11 +01:00
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
switch (function) {
|
|
|
|
|
|
|
|
case FUNC_DISPLAY_INIT_DRIVER:
|
2021-11-04 18:29:06 +00:00
|
|
|
result = callBerryEventDispatcher(PSTR("display"), PSTR("init_driver"), 0, nullptr);
|
2021-05-23 17:54:11 +01:00
|
|
|
break;
|
|
|
|
case FUNC_DISPLAY_INIT:
|
2021-11-04 18:29:06 +00:00
|
|
|
result = callBerryEventDispatcher(PSTR("display"), PSTR("init_driver"), 0, nullptr);
|
2021-05-23 17:54:11 +01:00
|
|
|
break;
|
|
|
|
case FUNC_DISPLAY_MODEL:
|
2021-11-04 18:29:06 +00:00
|
|
|
result = callBerryEventDispatcher(PSTR("display"), PSTR("model"), 0, nullptr);
|
2021-05-23 17:54:11 +01:00
|
|
|
break;
|
|
|
|
case FUNC_DISPLAY_DIM:
|
2021-11-04 18:29:06 +00:00
|
|
|
result = callBerryEventDispatcher(PSTR("display"), PSTR("dim"), GetDisplayDimmer(), nullptr);
|
2021-05-23 17:54:11 +01:00
|
|
|
break;
|
|
|
|
case FUNC_DISPLAY_POWER:
|
2021-11-04 18:29:06 +00:00
|
|
|
result = callBerryEventDispatcher(PSTR("display"), PSTR("power"), disp_power ? GetDisplayDimmer() : 0, nullptr);
|
2021-05-23 17:54:11 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // USE_BERRY
|
|
|
|
#endif // USE_DISPLAY
|