2007-11-27 00:35:52 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2008-01-31 17:34:48 +00:00
|
|
|
* $Id$
|
2007-11-27 00:35:52 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Chris Allegretta
|
|
|
|
* Copyright (C) 2005 Alastair S - ported to podzilla
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2005 Jonas Häggqvist - ported to rockbox
|
2007-11-27 00:35:52 +00:00
|
|
|
*
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2007-11-27 00:35:52 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
|
|
|
* - The font is a bit large, create smaller one
|
|
|
|
* - For colour/greyscale displays, the font from the xscreensaver xmatrix
|
|
|
|
* should be converted and used
|
|
|
|
* BUGS:
|
|
|
|
* - The animation "dies" after a few seconds, not sure why. Works in sim.
|
|
|
|
* Symtom Fixed Oct 2007 GRaTT (Gerritt Gonzales)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "plugin.h"
|
|
|
|
PLUGIN_HEADER
|
|
|
|
|
|
|
|
/* Images */
|
2009-09-01 03:40:23 +00:00
|
|
|
#include "pluginbitmaps/matrix_bold.h"
|
|
|
|
#include "pluginbitmaps/matrix_normal.h"
|
2007-11-27 00:35:52 +00:00
|
|
|
#define MAXCHARS 27 - 1
|
|
|
|
#define COL_W 14
|
|
|
|
#define COL_H 15
|
|
|
|
|
|
|
|
#define COLS LCD_WIDTH/COL_W
|
|
|
|
#define ROWS LCD_HEIGHT/COL_H
|
|
|
|
|
|
|
|
#define LEFTMARGIN (LCD_WIDTH-(COLS*COL_W))/2
|
|
|
|
#define TOPMARGIN (LCD_HEIGHT-(ROWS*COL_H))/2
|
|
|
|
|
2007-11-27 01:28:00 +00:00
|
|
|
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2007-11-27 00:35:52 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_MENU
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_SCROLL_BACK|BUTTON_REPEAT
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_SCROLL_FWD|BUTTON_REPEAT
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 01:28:00 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2007-11-27 00:35:52 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_OFF
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_SCROLL_UP|BUTTON_REPEAT
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_SCROLL_DOWN|BUTTON_REPEAT
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2008-07-20 10:16:35 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
2007-11-27 00:35:52 +00:00
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_E200_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
2008-01-10 08:08:31 +00:00
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_SCROLL_BACK|BUTTON_REPEAT
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_SCROLL_FWD|BUTTON_REPEAT
|
2007-11-27 00:35:52 +00:00
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2009-01-04 23:33:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZE_PAD
|
2009-04-10 17:28:26 +00:00
|
|
|
#define MATRIX_EXIT (BUTTON_HOME|BUTTON_REPEAT)
|
2009-01-04 23:33:15 +00:00
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_SCROLL_BACK|BUTTON_REPEAT
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_SCROLL_FWD|BUTTON_REPEAT
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_C200_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
|
|
|
#define MATRIX_EXIT BUTTON_BACK
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_RC_REC
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_RC_VOL_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_RC_VOL_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_RC_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
|
2008-03-22 22:03:34 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_VOLUP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_VOLDOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_BACK
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
2009-01-24 22:41:55 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_SELECT
|
|
|
|
|
2009-12-04 03:43:12 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
2009-12-03 23:13:45 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif (CONFIG_KEYPAD == ONDAVX747_PAD) || \
|
|
|
|
CONFIG_KEYPAD == ONDAVX777_PAD || \
|
|
|
|
CONFIG_KEYPAD == MROBE500_PAD
|
2009-04-07 23:41:44 +00:00
|
|
|
#define MATRIX_EXIT BUTTON_POWER
|
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_REC
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
|
|
|
|
2010-02-13 15:46:34 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define MATRIX_EXIT BUTTON_REC
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_PREV
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_NEXT
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
#define MATRIX_EXIT (BUTTON_REC|BUTTON_PLAY)
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_VOL_UP
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_VOL_DOWN
|
|
|
|
#define MATRIX_PAUSE BUTTON_PLAY
|
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#else
|
|
|
|
#error Unsupported keypad
|
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef MATRIX_EXIT
|
|
|
|
#define MATRIX_EXIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef MATRIX_SLEEP_MORE
|
|
|
|
#define MATRIX_SLEEP_MORE BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef MATRIX_SLEEP_LESS
|
|
|
|
#define MATRIX_SLEEP_LESS BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef MATRIX_PAUSE
|
|
|
|
#define MATRIX_PAUSE BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2007-11-27 00:35:52 +00:00
|
|
|
#define SLEEP HZ/50
|
|
|
|
|
|
|
|
/* Each position is of this type */
|
|
|
|
typedef struct cmatrix {
|
|
|
|
int val;
|
|
|
|
int bold;
|
|
|
|
} cmatrix;
|
|
|
|
|
|
|
|
/* The matrix - who'd have guessed it was just a few hundred bytes? */
|
|
|
|
static cmatrix matrix[ROWS][COLS];
|
|
|
|
static int length[COLS];
|
|
|
|
static int spaces[COLS];
|
|
|
|
static int updates[COLS];
|
|
|
|
|
|
|
|
static void matrix_init(void) {
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
/* Seed rand */
|
|
|
|
rb->srand(*rb->current_tick);
|
|
|
|
|
|
|
|
/* Make the matrix */
|
|
|
|
for (i = 0; i <= ROWS; i++) {
|
|
|
|
for (j = 0; j <= COLS - 1; j++ ) {
|
|
|
|
matrix[i][j].val = -1;
|
|
|
|
matrix[i][j].bold = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 0; j <= COLS - 1; j++) {
|
|
|
|
/* Set up spaces[] array of how many spaces to skip */
|
|
|
|
spaces[j] = rb->rand() % ROWS + 1;
|
|
|
|
|
|
|
|
/* And length of the stream */
|
|
|
|
length[j] = rb->rand() % (ROWS - 3) + 3;
|
|
|
|
|
|
|
|
/* Sentinel value for creation of new objects */
|
|
|
|
matrix[1][j].val = 129;
|
|
|
|
|
|
|
|
/* And set updates[] array for update speed. */
|
|
|
|
updates[j] = rb->rand() % 3 + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void matrix_blit_char(const int row, const int col, int cha)
|
|
|
|
{
|
|
|
|
if (cha == 129 || cha == 2 || cha > MAXCHARS)
|
|
|
|
cha = 0;
|
|
|
|
|
|
|
|
if (matrix[row][col].bold == 1) {
|
2009-09-01 03:40:23 +00:00
|
|
|
rb->lcd_bitmap_part(matrix_bold, cha*COL_W, 0,
|
2009-09-04 00:46:24 +00:00
|
|
|
STRIDE( SCREEN_MAIN,
|
|
|
|
BMPWIDTH_matrix_bold, BMPHEIGHT_matrix_bold),
|
2007-11-27 00:35:52 +00:00
|
|
|
col*COL_W + LEFTMARGIN, row*COL_H + TOPMARGIN, COL_W, COL_H);
|
|
|
|
}
|
|
|
|
else {
|
2009-09-01 03:40:23 +00:00
|
|
|
rb->lcd_bitmap_part(matrix_normal, cha*COL_W, 0,
|
2009-09-04 00:46:24 +00:00
|
|
|
STRIDE( SCREEN_MAIN,
|
|
|
|
BMPWIDTH_matrix_normal, BMPHEIGHT_matrix_normal),
|
2007-11-27 00:35:52 +00:00
|
|
|
col*COL_W + LEFTMARGIN, row*COL_H + TOPMARGIN, COL_W, COL_H);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void matrix_loop(void)
|
|
|
|
{
|
|
|
|
int i, j = 0, y, z, firstcoldone = 0;
|
|
|
|
static int count = 0;
|
|
|
|
int randomness = 6;
|
|
|
|
|
|
|
|
count++;
|
|
|
|
if (count > 4)
|
|
|
|
count = 1;
|
|
|
|
|
|
|
|
for (j = 0; j <= COLS - 1; j++) {
|
|
|
|
if (count > updates[j]) {
|
|
|
|
/* New style scrolling */
|
|
|
|
if (matrix[0][j].val == -1 && matrix[1][j].val == 129
|
|
|
|
&& spaces[j] > 0) {
|
|
|
|
matrix[0][j].val = -1;
|
|
|
|
spaces[j]--;
|
|
|
|
} else if (matrix[0][j].val == -1 && matrix[1][j].val == 129){
|
|
|
|
length[j] = rb->rand() % (ROWS - 3) + 3;
|
|
|
|
matrix[0][j].val = rb->rand() % (MAXCHARS-1) + 1;
|
|
|
|
if (rb->rand() % 2 == 1)
|
|
|
|
matrix[0][j].bold = 2;
|
|
|
|
spaces[j] = rb->rand() % ROWS + 1;
|
|
|
|
}
|
|
|
|
i = 0;
|
|
|
|
y = 0;
|
|
|
|
firstcoldone = 0;
|
|
|
|
while (i <= ROWS) {
|
2010-02-07 18:38:47 +00:00
|
|
|
/* Skip over spaces */
|
|
|
|
/* this is whear the characters were disappearing */
|
|
|
|
/*
|
2007-11-27 00:35:52 +00:00
|
|
|
while (i <= ROWS && (matrix[i][j].val == 129 ||
|
|
|
|
matrix[i][j].val == -1))
|
|
|
|
i++;
|
|
|
|
*/
|
2010-02-07 18:38:47 +00:00
|
|
|
/* A little more random now for spaces */
|
2007-11-27 00:35:52 +00:00
|
|
|
if (rb->rand() % randomness == 1){
|
2010-02-07 18:38:47 +00:00
|
|
|
while (i <= ROWS && (matrix[i][j].val == 129 ||
|
2007-11-27 00:35:52 +00:00
|
|
|
matrix[i][j].val == -1)){
|
|
|
|
i++;
|
2010-02-07 18:38:47 +00:00
|
|
|
randomness--;
|
|
|
|
if(randomness <=1)
|
|
|
|
randomness = 6;}
|
2007-11-27 00:35:52 +00:00
|
|
|
}else{
|
2010-02-07 18:38:47 +00:00
|
|
|
randomness++;
|
|
|
|
if(randomness >6)
|
|
|
|
randomness = 6;
|
|
|
|
}
|
2007-11-27 00:35:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (i > ROWS)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Go to the head of this collumn */
|
|
|
|
z = i;
|
|
|
|
y = 0;
|
|
|
|
while (i <= ROWS && (matrix[i][j].val != 129 &&
|
|
|
|
matrix[i][j].val != -1)) {
|
|
|
|
i++;
|
|
|
|
y++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i > ROWS) {
|
|
|
|
matrix[z][j].val = 129;
|
2009-08-06 19:02:59 +00:00
|
|
|
matrix[ROWS - 1][j].bold = 1;
|
2007-11-27 00:35:52 +00:00
|
|
|
matrix_blit_char(z - 1, j, matrix[z][j].val);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
matrix[i][j].val = rb->rand() % (MAXCHARS-1) + 1;
|
|
|
|
|
|
|
|
if (matrix[i - 1][j].bold == 2) {
|
|
|
|
matrix[i - 1][j].bold = 1;
|
|
|
|
matrix[i][j].bold = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we're at the top of the collumn and it's reached its
|
|
|
|
* full length (about to start moving down), we do this
|
|
|
|
* to get it moving. This is also how we keep segments
|
|
|
|
* not already growing from growing accidentally =>
|
|
|
|
*/
|
|
|
|
if (y > length[j] || firstcoldone) {
|
|
|
|
matrix[z][j].val = 129;
|
|
|
|
matrix[0][j].val = -1;
|
|
|
|
}
|
|
|
|
firstcoldone = 1;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
for (i = 1; i <= ROWS; i++) {
|
|
|
|
if (matrix[i][j].val == 0 || matrix[i][j].bold == 2) {
|
|
|
|
if (matrix[i][j].val == 0)
|
|
|
|
matrix_blit_char(i - 1, j, 20);
|
|
|
|
else
|
|
|
|
matrix_blit_char(i - 1, j, matrix[i][j].val);
|
|
|
|
} else {
|
|
|
|
if (matrix[i][j].val == 1)
|
|
|
|
matrix_blit_char(i - 1, j, 2);
|
|
|
|
else if (matrix[i][j].val == -1)
|
|
|
|
matrix_blit_char(i - 1, j, 129);
|
|
|
|
else
|
|
|
|
matrix_blit_char(i - 1, j, matrix[i][j].val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter) {
|
2007-11-27 00:35:52 +00:00
|
|
|
int button;
|
|
|
|
int sleep = SLEEP;
|
|
|
|
bool frozen = false;
|
|
|
|
|
|
|
|
(void)parameter;
|
|
|
|
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
rb->lcd_set_backdrop(NULL);
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
matrix_init();
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
if (!frozen) {
|
|
|
|
matrix_loop();
|
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(sleep);
|
|
|
|
}
|
2008-12-13 07:36:44 +00:00
|
|
|
button = rb->button_get(frozen);
|
2007-11-27 00:35:52 +00:00
|
|
|
switch(button) {
|
|
|
|
case MATRIX_PAUSE:
|
|
|
|
frozen = !frozen;
|
|
|
|
break;
|
|
|
|
case MATRIX_EXIT:
|
|
|
|
return PLUGIN_OK;
|
|
|
|
break;
|
|
|
|
case MATRIX_SLEEP_MORE:
|
|
|
|
/* Sleep longer */
|
|
|
|
sleep += SLEEP;
|
|
|
|
break;
|
|
|
|
case MATRIX_SLEEP_LESS:
|
|
|
|
/* Sleep less */
|
|
|
|
sleep -= SLEEP;
|
|
|
|
if (sleep < 0) sleep = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|