Signed-off-by: Keith Packard <keithp@keithp.com>
#define AO_LCO_BOX_FIRST AO_LCO_BOX_DRAG
#else
#define AO_LCO_LCO_VOLTAGE 0 /* Box number to show LCO voltage */
#define AO_LCO_BOX_FIRST AO_LCO_BOX_DRAG
#else
#define AO_LCO_LCO_VOLTAGE 0 /* Box number to show LCO voltage */
+# ifdef AO_LCO_HAS_BACKLIGHT
+# define AO_LCO_BACKLIGHT -2
+# ifndef AO_LCO_BOX_FIRST
+# define AO_LCO_BOX_FIRST AO_LCO_BACKLIGHT
+# endif
+# endif
# ifdef AO_LCO_HAS_CONTRAST
# define AO_LCO_CONTRAST -1
# ifdef AO_LCO_HAS_CONTRAST
# define AO_LCO_CONTRAST -1
-# define AO_LCO_BOX_FIRST AO_LCO_CONTRAST
-# else
+# ifndef AO_LCO_BOX_FIRST
+# define AO_LCO_BOX_FIRST AO_LCO_CONTRAST
+# endif
+# endif
+# ifndef AO_LCO_BOX_FIRST
# define AO_LCO_BOX_FIRST AO_LCO_LCO_VOLTAGE
# endif
#endif
# define AO_LCO_BOX_FIRST AO_LCO_LCO_VOLTAGE
# endif
#endif
#ifdef AO_LCO_CONTRAST
case AO_LCO_CONTRAST:
return true;
#ifdef AO_LCO_CONTRAST
case AO_LCO_CONTRAST:
return true;
+#endif
+#ifdef AO_LCO_BACKLIGHT
+ case AO_LCO_BACKLIGHT:
+ return true;
#endif
default:
return false;
#endif
default:
return false;
#ifdef AO_LCO_HAS_CONTRAST
void
#ifdef AO_LCO_HAS_CONTRAST
void
-ao_lco_set_contrast(int16_t contrast);
+ao_lco_set_contrast(int32_t contrast);
ao_lco_get_contrast(void);
#endif
ao_lco_get_contrast(void);
#endif
+#ifdef AO_LCO_HAS_BACKLIGHT
+void
+ao_lco_set_backlight(int32_t backlight);
+
+int32_t
+ao_lco_get_backlight(void);
+#endif
+
#ifdef AO_LCO_SEARCH_API
void
#ifdef AO_LCO_SEARCH_API
void
#ifdef AO_LCO_HAS_CONTRAST
if (ao_lco_box == AO_LCO_CONTRAST) {
#ifdef AO_LCO_HAS_CONTRAST
if (ao_lco_box == AO_LCO_CONTRAST) {
- int16_t contrast = ao_lco_get_contrast();
+ int32_t contrast = ao_lco_get_contrast();
- contrast += (int16_t) (dir * AO_LCO_CONTRAST_STEP);
+ contrast = (contrast + AO_LCO_CONTRAST_STEP - 1) / AO_LCO_CONTRAST_STEP;
+ contrast += dir;
+ contrast *= AO_LCO_CONTRAST_STEP;
if (contrast < AO_LCO_MIN_CONTRAST)
contrast = AO_LCO_MIN_CONTRAST;
if (contrast > AO_LCO_MAX_CONTRAST)
contrast = AO_LCO_MAX_CONTRAST;
ao_lco_set_contrast(contrast);
}
if (contrast < AO_LCO_MIN_CONTRAST)
contrast = AO_LCO_MIN_CONTRAST;
if (contrast > AO_LCO_MAX_CONTRAST)
contrast = AO_LCO_MAX_CONTRAST;
ao_lco_set_contrast(contrast);
}
+#endif
+#ifdef AO_LCO_HAS_BACKLIGHT
+ if (ao_lco_box == AO_LCO_BACKLIGHT) {
+ int32_t backlight = ao_lco_get_backlight();
+
+ backlight = (backlight + AO_LCO_BACKLIGHT_STEP - 1) / AO_LCO_BACKLIGHT_STEP;
+ backlight += dir;
+ backlight *= AO_LCO_BACKLIGHT_STEP;
+ if (backlight < AO_LCO_MIN_BACKLIGHT)
+ backlight = AO_LCO_MIN_BACKLIGHT;
+ if (backlight > AO_LCO_MAX_BACKLIGHT)
+ backlight = AO_LCO_MAX_BACKLIGHT;
+ ao_lco_set_backlight(backlight);
+ }
#endif
new_pad = (int16_t) ao_lco_pad;
do {
#endif
new_pad = (int16_t) ao_lco_pad;
do {
new_box += dir;
if (new_box > ao_lco_max_box)
new_box = AO_LCO_BOX_FIRST;
new_box += dir;
if (new_box > ao_lco_max_box)
new_box = AO_LCO_BOX_FIRST;
-#ifdef AO_LCO_HAS_CONTRAST
- else if (new_box < AO_LCO_CONTRAST)
-#else
- else if (new_box < 0)
-#endif
+ else if (new_box < AO_LCO_BOX_FIRST)
new_box = ao_lco_max_box;
if (new_box == ao_lco_box)
break;
new_box = ao_lco_max_box;
if (new_box == ao_lco_box)
break;