Button queue handling is split from main button driver

First half of
https://gerrit.rockbox.org/r/c/rockbox/+/570

Change-Id: Icc64dfd8194c18f69564ed5f8bf7dd70a4330eb9
This commit is contained in:
William Wilgus 2024-11-27 17:11:03 -05:00
parent 5954a2fd48
commit da9d67a0fe
30 changed files with 266 additions and 221 deletions

View file

@ -694,7 +694,7 @@ static int kinetic_callback(struct timeout *tmo)
/* let get_action() timeout, which loads to a
* gui_synclist_draw() call from the main thread */
queue_post(&button_queue, BUTTON_REDRAW, 0);
button_queue_post(BUTTON_REDRAW, 0);
/* stop if the velocity hit or crossed zero */
if (!data->velocity)
{

View file

@ -198,7 +198,7 @@ void do_sbs_update_callback(unsigned short id, void *param)
skin_request_full_update(CUSTOM_STATUSBAR);
force_waiting = true;
/* force timeout in wps main loop, so that the update is instantly */
queue_post(&button_queue, BUTTON_NONE, 0);
button_queue_post(BUTTON_NONE, 0);
}
void sb_skin_set_update_delay(int delay)

View file

@ -514,7 +514,7 @@ static void wps_lcd_activation_hook(unsigned short id, void *param)
(void)param;
skin_request_full_update(WPS);
/* force timeout in wps main loop, so that the update is instantly */
queue_post(&button_queue, BUTTON_NONE, 0);
button_queue_post(BUTTON_NONE, 0);
}
#endif

View file

@ -249,7 +249,7 @@ static const struct plugin_api rockbox_api = {
lcd_set_mode,
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
&button_queue,
button_queue_post,
#endif
bidi_l2v,
is_diacritic,
@ -448,6 +448,7 @@ static const struct plugin_api rockbox_api = {
talk_idarray,
talk_file,
talk_file_or_spell,
talk_fullpath,
talk_dir_or_spell,
talk_number,
talk_value_decimal,
@ -840,8 +841,6 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
talk_fullpath,
};
static int plugin_buffer_handle;

View file

@ -163,7 +163,7 @@ int plugin_open(const char *plugin, const char *parameter);
* when this happens please take the opportunity to sort in
* any new functions "waiting" at the end of the list.
*/
#define PLUGIN_API_VERSION 271
#define PLUGIN_API_VERSION 272
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -282,7 +282,7 @@ struct plugin_api {
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
struct event_queue *button_queue;
void (*button_queue_post)(long id, intptr_t data);
#endif
unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
bool (*is_diacritic)(const unsigned short char_code, bool *is_rtl);
@ -511,6 +511,7 @@ struct plugin_api {
const char *ext, const long *prefix_ids, bool enqueue);
int (*talk_file_or_spell)(const char *dirname, const char* filename,
const long *prefix_ids, bool enqueue);
int (*talk_fullpath)(const char* path, bool enqueue);
int (*talk_dir_or_spell)(const char* filename,
const long *prefix_ids, bool enqueue);
int (*talk_number)(long n, bool enqueue);
@ -977,8 +978,6 @@ struct plugin_api {
#endif
/* new stuff at the end, sort into place next time
the API gets incompatible */
int (*talk_fullpath)(const char* path, bool enqueue);
};
/* plugin header */

View file

@ -772,7 +772,7 @@ static void get_start_time_lcd_enable_hook(unsigned short id, void *param)
{
(void)id;
(void)param;
rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0);
rb->button_queue_post(LCD_ENABLE_EVENT_0, 0);
}
#endif /* HAVE_LCD_ENABLE */

View file

@ -1208,7 +1208,7 @@ static void osd_lcd_enable_hook(unsigned short id, void* param)
{
(void)id;
(void)param;
rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0);
rb->button_queue_post(LCD_ENABLE_EVENT_1, 0);
}
#endif

View file

@ -338,6 +338,7 @@ backlight-sw-fading.c
/* Misc. */
drivers/led.c
drivers/button.c
drivers/button_queue.c
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
#ifdef HAVE_DAC3550A
drivers/audio/dac3550a.c

View file

@ -45,11 +45,8 @@
#include "lcd.h" /* lcd_active() prototype */
#endif
struct event_queue button_queue SHAREDBSS_ATTR;
static long lastbtn; /* Last valid button status */
static long last_read; /* Last button status, for debouncing/filtering */
static intptr_t button_data; /* data value from last message dequeued */
static bool flipped; /* buttons can be flipped to match the LCD flip */
#ifdef HAVE_BACKLIGHT /* Filter first keypress function pointer */
@ -95,7 +92,7 @@ static void button_remote_post(void)
/* Post events for the remote control */
int btn = remote_control_rx();
if(btn)
button_try_post(btn, 0);
button_queue_try_post(btn, 0);
#endif
}
@ -104,8 +101,7 @@ static int hp_detect_callback(struct timeout *tmo)
{
/* Try to post only transistions */
const long id = tmo->data ? SYS_PHONE_PLUGGED : SYS_PHONE_UNPLUGGED;
queue_remove_from_head(&button_queue, id);
queue_post(&button_queue, id, 0);
button_queue_post_remove_head(id, 0);
return 0;
/*misc.c:hp_unplug_change*/
}
@ -116,8 +112,7 @@ static int lo_detect_callback(struct timeout *tmo)
{
/* Try to post only transistions */
const long id = tmo->data ? SYS_LINEOUT_PLUGGED : SYS_LINEOUT_UNPLUGGED;
queue_remove_from_head(&button_queue, id);
queue_post(&button_queue, id, 0);
button_queue_post_remove_head(id, 0);
return 0;
/*misc.c:lo_unplug_change*/
}
@ -151,40 +146,11 @@ static void check_audio_peripheral_state(void)
#endif
}
static bool button_try_post(int button, int data)
{
#ifdef HAVE_TOUCHSCREEN
/* one can swipe over the scren very quickly,
* for this to work we want to forget about old presses and
* only respect the very latest ones */
const bool force_post = true;
#else
/* Only post events if the queue is empty,
* to avoid afterscroll effects.
* i.e. don't post new buttons if previous ones haven't been
* processed yet - but always post releases */
const bool force_post = button & BUTTON_REL;
#endif
bool ret = queue_empty(&button_queue);
if (!ret && force_post)
{
queue_remove_from_head(&button_queue, button);
ret = true;
}
if (ret)
queue_post(&button_queue, button, data);
/* on touchscreen we posted unconditionally */
return ret;
}
#ifdef HAVE_BACKLIGHT
/* disabled function is shared between Main & Remote LCDs */
static bool filter_first_keypress_disabled(int button, int data)
{
button_try_post(button, data);
button_queue_try_post(button, data);
return false;
}
@ -248,17 +214,17 @@ static void button_tick(void)
#ifdef HAVE_REMOTE_LCD
if(diff & BUTTON_REMOTE)
if(!skip_remote_release)
button_try_post(BUTTON_REL | diff, data);
button_queue_try_post(BUTTON_REL | diff, data);
else
skip_remote_release = false;
else
#endif
if(!skip_release)
button_try_post(BUTTON_REL | diff, data);
button_queue_try_post(BUTTON_REL | diff, data);
else
skip_release = false;
#else
button_try_post(BUTTON_REL | diff, data);
button_queue_try_post(BUTTON_REL | diff, data);
#endif
}
else
@ -367,7 +333,7 @@ static void button_tick(void)
{
/* Only post repeat events if the queue is empty,
* to avoid afterscroll effects. */
if (button_try_post(BUTTON_REPEAT | btn, data))
if (button_queue_try_post(BUTTON_REPEAT | btn, data))
{
#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
@ -394,7 +360,7 @@ static void button_tick(void)
buttonlight_on();
}
#else /* no backlight, nothing to skip */
button_try_post(btn, data);
button_queue_try_post(btn, data);
#endif
post = false;
}
@ -412,119 +378,11 @@ static void button_tick(void)
lastdata = data;
}
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
static bool button_boosted = false;
static long button_unboost_tick;
#define BUTTON_UNBOOST_TMO HZ
static void button_boost(bool state)
{
if (state)
{
button_unboost_tick = current_tick + BUTTON_UNBOOST_TMO;
if (!button_boosted)
{
button_boosted = true;
cpu_boost(true);
}
}
else if (!state && button_boosted)
{
button_boosted = false;
cpu_boost(false);
}
}
static void button_queue_wait(struct queue_event *evp, int timeout)
{
/* Loop once after wait time if boosted in order to unboost and wait the
full remaining time */
do
{
int ticks = timeout;
if (ticks == 0) /* TIMEOUT_NOBLOCK */
;
else if (ticks > 0)
{
if (button_boosted && ticks > BUTTON_UNBOOST_TMO)
ticks = BUTTON_UNBOOST_TMO;
timeout -= ticks;
}
else /* TIMEOUT_BLOCK (ticks < 0) */
{
if (button_boosted)
ticks = BUTTON_UNBOOST_TMO;
}
queue_wait_w_tmo(&button_queue, evp, ticks);
if (evp->id != SYS_TIMEOUT)
{
/* GUI boost build gets immediate kick, otherwise at least 3
messages had to be there */
#ifndef HAVE_GUI_BOOST
if (queue_count(&button_queue) >= 2)
#endif
button_boost(true);
break;
}
if (button_boosted && TIME_AFTER(current_tick, button_unboost_tick))
button_boost(false);
}
while (timeout);
}
#else /* ndef HAVE_ADJUSTABLE_CPU_FREQ */
static inline void button_queue_wait(struct queue_event *evp, int timeout)
{
queue_wait_w_tmo(&button_queue, evp, timeout);
}
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
int button_queue_count( void )
{
return queue_count(&button_queue);
}
long button_get(bool block)
{
struct queue_event ev;
button_queue_wait(&ev, block ? TIMEOUT_BLOCK : TIMEOUT_NOBLOCK);
if (ev.id == SYS_TIMEOUT)
ev.id = BUTTON_NONE;
else
button_data = ev.data;
return ev.id;
}
long button_get_w_tmo(int ticks)
{
struct queue_event ev;
button_queue_wait(&ev, ticks);
if (ev.id == SYS_TIMEOUT)
ev.id = BUTTON_NONE;
else
button_data = ev.data;
return ev.id;
}
intptr_t button_get_data(void)
{
return button_data;
}
void button_init(void)
{
int temp;
/* Init used objects first */
queue_init(&button_queue, true);
button_queue_init();
/* hardware inits */
button_init_device();
@ -714,11 +572,6 @@ int button_status_wdata(int *pdata)
}
#endif
void button_clear_queue(void)
{
queue_clear(&button_queue);
}
#ifdef HAVE_TOUCHSCREEN
long touchscreen_last_touch(void)
{

View file

@ -0,0 +1,185 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Daniel Stenberg
*
* 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 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "system.h"
#include "kernel.h"
#include "button.h"
static struct event_queue button_queue SHAREDBSS_ATTR;
static intptr_t button_data; /* data value from last message dequeued */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
static bool button_boosted = false;
static long button_unboost_tick;
#define BUTTON_UNBOOST_TMO HZ
static void button_boost(bool state)
{
if (state)
{
/* update the unboost time each button_boost(true) call */
button_unboost_tick = current_tick + BUTTON_UNBOOST_TMO;
if (!button_boosted)
{
button_boosted = true;
cpu_boost(true);
}
}
else if (!button_boosted && TIME_AFTER(current_tick, button_unboost_tick))
{
button_boosted = false;
cpu_boost(false);
}
}
static void button_queue_wait(struct queue_event *evp, int timeout)
{
/* Loop once after wait time if boosted in order to unboost and wait the
full remaining time */
do
{
int ticks = timeout;
if (ticks == TIMEOUT_NOBLOCK)
;
else if (ticks > 0)
{
if (button_boosted && ticks > BUTTON_UNBOOST_TMO)
ticks = BUTTON_UNBOOST_TMO;
timeout -= ticks;
}
else if (button_boosted) /* TIMEOUT_BLOCK (ticks < 0) */
{
ticks = BUTTON_UNBOOST_TMO;
}
queue_wait_w_tmo(&button_queue, evp, ticks);
if (evp->id != SYS_TIMEOUT)
{
/* GUI boost build gets immediate kick, otherwise at least 3
messages had to be there */
#ifndef HAVE_GUI_BOOST
if (queue_count(&button_queue) >= 2)
#endif
button_boost(true);
break;
}
button_boost(false);
}
while (timeout);
}
#else /* ndef HAVE_ADJUSTABLE_CPU_FREQ */
static inline void button_queue_wait(struct queue_event *evp, int timeout)
{
queue_wait_w_tmo(&button_queue, evp, timeout);
}
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
void button_queue_post(long id, intptr_t data)
{
queue_post(&button_queue, id, data);
}
void button_queue_post_remove_head(long id, intptr_t data)
{
queue_remove_from_head(&button_queue, id);
queue_post(&button_queue, id, data);
}
bool button_queue_try_post(long button, int data)
{
#ifdef HAVE_TOUCHSCREEN
/* one can swipe over the scren very quickly,
* for this to work we want to forget about old presses and
* only respect the very latest ones */
const bool force_post = true;
#else
/* Only post events if the queue is empty,
* to avoid afterscroll effects.
* i.e. don't post new buttons if previous ones haven't been
* processed yet - but always post releases */
const bool force_post = button & BUTTON_REL;
#endif
if (!queue_empty(&button_queue))
{
if (force_post)
queue_remove_from_head(&button_queue, button);
else
return false;
}
queue_post(&button_queue, button, data);
/* on touchscreen we posted unconditionally */
return true;
}
int button_queue_count(void)
{
return queue_count(&button_queue);
}
bool button_queue_empty(void)
{
return queue_empty(&button_queue);
}
bool button_queue_full(void)
{
return queue_full(&button_queue);
}
void button_clear_queue(void)
{
queue_clear(&button_queue);
}
long button_get_w_tmo(int ticks)
{
struct queue_event ev;
button_queue_wait(&ev, ticks);
if (ev.id == SYS_TIMEOUT)
ev.id = BUTTON_NONE;
else
button_data = ev.data;
return ev.id;
}
long button_get(bool block)
{
return button_get_w_tmo(block ? TIMEOUT_BLOCK : TIMEOUT_NOBLOCK);
}
intptr_t button_get_data(void)
{
return button_data;
}
void INIT_ATTR button_queue_init(void)
{
queue_init(&button_queue, true);
}

View file

@ -32,8 +32,6 @@
# define BUTTON_REMOTE 0
#endif
extern struct event_queue button_queue;
void button_init_device(void);
#ifdef HAVE_BUTTON_DATA
int button_read_device(int *);
@ -50,15 +48,12 @@ bool remote_button_hold(void);
void button_init (void) INIT_ATTR;
void button_close(void);
int button_queue_count(void);
long button_get (bool block);
long button_get_w_tmo(int ticks);
intptr_t button_get_data(void);
int button_status(void);
#ifdef HAVE_BUTTON_DATA
int button_status_wdata(int *pdata);
#endif
void button_clear_queue(void);
void button_set_flip(bool flip); /* turn 180 degrees */
#ifdef HAVE_BACKLIGHT
void set_backlight_filter_keypress(bool value);
@ -67,6 +62,19 @@ void set_remote_backlight_filter_keypress(bool value);
#endif
#endif
/* button queue functions (in button_queue.c) */
void button_queue_init(void);
void button_queue_post(long id, intptr_t data);
void button_queue_post_remove_head(long id, intptr_t data);
bool button_queue_try_post(long button, int data);
int button_queue_count(void);
bool button_queue_empty(void);
bool button_queue_full(void);
void button_clear_queue(void);
long button_get(bool block);
long button_get_w_tmo(int ticks);
intptr_t button_get_data(void);
#ifdef HAVE_HEADPHONE_DETECTION
bool headphones_inserted(void);
#endif

View file

@ -163,9 +163,9 @@ static void scrollwheel(unsigned int wheel_value)
last_wheel_post = time;
if (queue_empty(&button_queue))
if (button_queue_empty())
{
queue_post(&button_queue, btn, wheel_fast_mode |
button_queue_post(btn, wheel_fast_mode |
(wheel_delta << 24) | wheel_velocity*360/WHEELCLICKS_PER_ROTATION);
/* message posted - reset delta and poke backlight on*/
wheel_delta = 1;

View file

@ -105,12 +105,12 @@ void scrollwheel(unsigned int wheel_value)
/* the wheel is more reliable if we don't send every change,
* every WHEEL_COUNTER_DIVth is basically one "physical click"
* which should make up 1 item in lists */
if (++counter >= WHEEL_COUNTER_DIV && queue_empty(&button_queue))
if (++counter >= WHEEL_COUNTER_DIV && button_queue_empty())
{
buttonlight_on();
backlight_on();
reset_poweroff_timer();
queue_post(&button_queue, btn, ((wheel_delta+1)<<24));
button_queue_post(btn, ((wheel_delta+1)<<24));
/* message posted - reset count and remember post */
counter = 0;
last_wheel_post = current_tick;

View file

@ -159,7 +159,7 @@ static void handle_scroll_wheel(int new_scroll)
wheel_velocity = (7*wheel_velocity + v) / 8;
}
if (queue_empty(&button_queue)) {
if (button_queue_empty()) {
int key = wheel_keycode;
if (v >= WHEEL_REPEAT_VELOCITY && prev_keypost == key) {
@ -171,7 +171,7 @@ static void handle_scroll_wheel(int new_scroll)
prev_keypost = wheel_keycode;
/* post wheel keycode with wheel data */
queue_post(&button_queue, key,
button_queue_post(key,
(wheel_velocity >= WHEEL_ACCEL_START ? (1ul << 31) : 0)
| wheel_delta | wheel_velocity);
/* message posted - reset delta */

View file

@ -223,7 +223,7 @@ static inline int ipod_4g_button_read(void)
if (send_events)
#endif
/* The queue should have no other events when scrolling */
if (queue_empty(&button_queue))
if (button_queue_empty())
{
/* each WHEEL_SENSITIVITY clicks = scrolling 1 item */
accumulated_wheel_delta /= WHEEL_SENSITIVITY;
@ -232,11 +232,11 @@ static inline int ipod_4g_button_read(void)
/* always use acceleration mode (1<<31) */
/* always set message post count to (1<<24) for iPod */
/* this way the scrolling is always calculated from wheel_velocity */
queue_post(&button_queue, wheel_keycode | repeat,
button_queue_post(wheel_keycode | repeat,
(1<<31) | (1 << 24) | wheel_velocity);
#else
queue_post(&button_queue, wheel_keycode | repeat,
button_queue_post(wheel_keycode | repeat,
(accumulated_wheel_delta << 16) | new_wheel_value);
#endif
accumulated_wheel_delta = 0;

View file

@ -151,7 +151,7 @@ static void handle_scroll_wheel(int new_scroll)
wheel_velocity = (7*wheel_velocity + v) / 8;
}
if (queue_empty(&button_queue)) {
if (button_queue_empty()) {
int key = wheel_keycode;
if (v >= WHEEL_REPEAT_VELOCITY && prev_keypost == key) {
@ -163,7 +163,7 @@ static void handle_scroll_wheel(int new_scroll)
prev_keypost = wheel_keycode;
/* post wheel keycode with wheel data */
queue_post(&button_queue, key,
button_queue_post(key,
(wheel_velocity >= WHEEL_ACCEL_START ? (1ul << 31) : 0)
| wheel_delta | wheel_velocity);
/* message posted - reset delta */

View file

@ -126,7 +126,7 @@ int button_read_device(void)
/* Scrollstrip direct button post - much better response */
if ((buttons==BUTTON_UP) || (buttons==BUTTON_DOWN))
{
queue_post(&button_queue,buttons|repeat,0);
button_queue_post(buttons|repeat,0);
backlight_on();
buttonlight_on();
reset_poweroff_timer();

View file

@ -144,7 +144,7 @@ int button_read_device(void)
/* Scrollstrip direct button post - much better response */
if ((btn == BUTTON_UP) || (btn == BUTTON_DOWN))
{
queue_post(&button_queue,btn|repeat,0);
button_queue_post(btn|repeat,0);
backlight_on();
buttonlight_on();
reset_poweroff_timer();

View file

@ -133,12 +133,12 @@ int button_read_device(void)
if ((~GPIOA_INPUT_VAL & 0x40) != rec_switch)
{
if (rec_switch) {
queue_post(&button_queue,BUTTON_REC_SW_OFF,0);
queue_post(&button_queue,BUTTON_REC_SW_OFF|BUTTON_REL,0);
button_queue_post(BUTTON_REC_SW_OFF,0);
button_queue_post(BUTTON_REC_SW_OFF|BUTTON_REL,0);
}
else {
queue_post(&button_queue,BUTTON_REC_SW_ON,0);
queue_post(&button_queue,BUTTON_REC_SW_ON|BUTTON_REL,0);
button_queue_post(BUTTON_REC_SW_ON,0);
button_queue_post(BUTTON_REC_SW_ON|BUTTON_REL,0);
}
rec_switch = ~GPIOA_INPUT_VAL & 0x40;
backlight_on();

View file

@ -246,7 +246,7 @@ void clickwheel_int(void)
count = 0;
if (queue_empty(&button_queue))
if (button_queue_empty())
{
/* Post wheel keycode with wheel data */
int key = keycode;
@ -260,7 +260,7 @@ void clickwheel_int(void)
prev_keypost = keycode;
queue_post(&button_queue, key, (fast_mode << 31) | delta | velocity);
button_queue_post(key, (fast_mode << 31) | delta | velocity);
/* Message posted - reset delta */
delta = 1ul << 24;
}

View file

@ -195,7 +195,7 @@ static void handle_wheel(uint8_t wheel)
}
/* TODO: take velocity into account */
if (queue_empty(&button_queue))
if (button_queue_empty())
{
if (prev_key_post == key)
{
@ -204,7 +204,7 @@ static void handle_wheel(uint8_t wheel)
/* Post directly, don't update btn as avr doesn't give
interrupt on scroll stop */
queue_post(&button_queue, key, wheel_delta);
button_queue_post(key, wheel_delta);
wheel_delta = 1ul << 24;

View file

@ -109,8 +109,8 @@ void scrollstrip_isr(void)
if (direction != scroll_dir)
{
/* post release event to the button queue */
if (queue_empty(&button_queue))
queue_post(&button_queue, direction|BUTTON_REL, 0);
if (button_queue_empty())
button_queue_post(direction|BUTTON_REL, 0);
scroll.rel = true;
@ -134,8 +134,8 @@ void scrollstrip_isr(void)
count = 0;
/* post scrollstrip event to the button queue */
if (queue_empty(&button_queue))
queue_post(&button_queue, scroll_dir, 0);
if (button_queue_empty())
button_queue_post(scroll_dir, 0);
scroll.dir = scroll_dir;
scroll.timeout = current_tick + SLIDER_REL_TIMEOUT;
@ -264,9 +264,9 @@ int button_read_device(void)
if (!scroll.rel)
if (TIME_AFTER(current_tick, scroll.timeout))
{
if (queue_empty(&button_queue))
if (button_queue_empty())
{
queue_post(&button_queue, scroll.dir|BUTTON_REL, 0);
button_queue_post(scroll.dir|BUTTON_REL, 0);
scroll.rel = true;
}
}

View file

@ -84,7 +84,7 @@ Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass class,
/* ensure button_queue can be safely posted to */
wait_rockbox_ready();
reset_poweroff_timer();
queue_post(&button_queue, button, 0);
button_queue_post(button, 0);
return true;
}
}

View file

@ -140,7 +140,7 @@ Java_org_rockbox_RockboxFramebuffer_surfaceCreated(JNIEnv *env, jobject this,
send_event(LCD_EVENT_ACTIVATION, NULL);
/* Force an update, since the newly created surface is initially black
* waiting for the next normal update results in a longish black screen */
queue_post(&button_queue, BUTTON_REDRAW, 0);
button_queue_post(BUTTON_REDRAW, 0);
}
/*

View file

@ -181,14 +181,14 @@ int button_read_device(void)
{
while (wheel_ticks-- > 0)
{
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
button_queue_post(BUTTON_SCROLL_FWD, 0);
}
}
else if (wheel_ticks < 0)
{
while (wheel_ticks++ < 0)
{
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
button_queue_post(BUTTON_SCROLL_BACK, 0);
}
}
#endif /* HAVE_SCROLLWHEEL */

View file

@ -103,17 +103,17 @@ static void on_bt_button_pressed(LibHalContext *ctx,
sim_enter_irq_handler();
if (g_str_equal(condition_detail, "play-cd") || g_str_equal(condition_detail, "pause-cd"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_PLAYPAUSE, 0);
button_queue_post(BUTTON_MULTIMEDIA_PLAYPAUSE, 0);
else if (g_str_equal(condition_detail, "stop-cd"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_STOP, 0);
button_queue_post(BUTTON_MULTIMEDIA_STOP, 0);
else if (g_str_equal(condition_detail, "next-song"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_NEXT, 0);
button_queue_post(BUTTON_MULTIMEDIA_NEXT, 0);
else if (g_str_equal(condition_detail, "previous-song"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_PREV, 0);
button_queue_post(BUTTON_MULTIMEDIA_PREV, 0);
else if (g_str_equal(condition_detail, "fast-forward"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_FFWD, 0);
button_queue_post(BUTTON_MULTIMEDIA_FFWD, 0);
else if (g_str_equal(condition_detail, "rewind"))
queue_post(&button_queue, BUTTON_MULTIMEDIA_REW, 0);
button_queue_post(BUTTON_MULTIMEDIA_REW, 0);
sim_exit_irq_handler();
}

View file

@ -125,8 +125,8 @@ static void scrollwheel_event(int x, int y)
buttonlight_on();
#endif
reset_poweroff_timer();
if (new_btn && !queue_full(&button_queue))
queue_post(&button_queue, new_btn, 1<<24);
if (new_btn && !button_queue_full())
button_queue_post(new_btn, 1<<24);
(void)x;
}

View file

@ -305,7 +305,7 @@ int button_read_device(void)
{
/* need to use queue_post() in order to do BUTTON_SCROLL_*,
* Rockbox treats these buttons differently. */
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
button_queue_post(BUTTON_SCROLL_FWD, 0);
enc_position = 0;
reset_poweroff_timer();
backlight_on();
@ -314,7 +314,7 @@ int button_read_device(void)
{
/* need to use queue_post() in order to do BUTTON_SCROLL_*,
* Rockbox treats these buttons differently. */
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
button_queue_post(BUTTON_SCROLL_BACK, 0);
enc_position = 0;
reset_poweroff_timer();
backlight_on();

View file

@ -296,9 +296,9 @@ static void ft_step_state(uint32_t t, int evt, int tx, int ty)
* should not be necessary but better to be safe. */
if(fsm.active) {
if(dy < 0) {
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
button_queue_post(BUTTON_SCROLL_BACK, 0);
} else {
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
button_queue_post(BUTTON_SCROLL_FWD, 0);
}
/* Poke the backlight */

View file

@ -136,8 +136,8 @@ int button_read_device(int* data)
wheel_pos = 0;
/* Post the event (rapid motion is more reliable this way) */
queue_post(&button_queue, wheel_btn, 0);
queue_post(&button_queue, wheel_btn|BUTTON_REL, 0);
button_queue_post(wheel_btn, 0);
button_queue_post(wheel_btn|BUTTON_REL, 0);
/* Poke the backlight */
backlight_on();