Remote control support added
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1685 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1cf6fa07d5
commit
18239b831d
5 changed files with 97 additions and 40 deletions
|
@ -36,6 +36,9 @@
|
|||
#ifndef SIMULATOR
|
||||
#include "dmalloc.h"
|
||||
#include "bmalloc.h"
|
||||
#ifndef DEBUG
|
||||
#include "serial.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "mpeg.h"
|
||||
#include "main_menu.h"
|
||||
|
@ -50,6 +53,7 @@
|
|||
#include "unicode.h"
|
||||
#endif
|
||||
|
||||
|
||||
char appsversion[]=APPSVERSION;
|
||||
|
||||
void init(void);
|
||||
|
@ -98,6 +102,8 @@ void init(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
debug_init();
|
||||
#else
|
||||
serial_setup();
|
||||
#endif
|
||||
set_irq_level(0);
|
||||
|
||||
|
|
|
@ -296,6 +296,9 @@ int wps_show(void)
|
|||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
case BUTTON_UP:
|
||||
case BUTTON_UP | BUTTON_REPEAT:
|
||||
#else
|
||||
case BUTTON_VOL_UP:
|
||||
#endif
|
||||
if (keys_locked)
|
||||
{
|
||||
display_keylock_text(keys_locked);
|
||||
|
@ -310,8 +313,12 @@ int wps_show(void)
|
|||
status_draw();
|
||||
break;
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
case BUTTON_DOWN:
|
||||
case BUTTON_DOWN | BUTTON_REPEAT:
|
||||
#else
|
||||
case BUTTON_VOL_DOWN:
|
||||
#endif
|
||||
if (keys_locked)
|
||||
{
|
||||
display_keylock_text(keys_locked);
|
||||
|
@ -325,7 +332,6 @@ int wps_show(void)
|
|||
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
status_draw();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case BUTTON_LEFT:
|
||||
if (keys_locked)
|
||||
|
|
|
@ -38,6 +38,10 @@ int button_set_release(int newmask);
|
|||
#define BUTTON_LEFT 0x0040
|
||||
#define BUTTON_RIGHT 0x0080
|
||||
|
||||
/* remote control buttons */
|
||||
#define BUTTON_VOL_UP 0x1000
|
||||
#define BUTTON_VOL_DOWN 0x1001
|
||||
|
||||
/* Button modifiers */
|
||||
#define BUTTON_REPEAT 0x4000
|
||||
#define BUTTON_REL 0x8000
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Alan Korr
|
||||
* Copyright (C) 2002 by Alan Korr & Nick Robinson
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
|
@ -16,54 +16,101 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
#include "sh7034.h"
|
||||
#include "system.h"
|
||||
#include "kernel.h"
|
||||
#include "backlight.h"
|
||||
#include "adc.h"
|
||||
#include "lcd.h"
|
||||
#include "serial.h"
|
||||
|
||||
static int serial_byte,serial_flag;
|
||||
/* Recieved byte identifiers */
|
||||
#define PLAY 0xC1
|
||||
#define STOP 0xC2
|
||||
#define PREV 0xC4
|
||||
#define NEXT 0xC8
|
||||
#define VOLUP 0xD0
|
||||
#define VOLDN 0xE0
|
||||
|
||||
void serial_setup (void)
|
||||
{
|
||||
char dummy;
|
||||
int i;
|
||||
int j;
|
||||
dummy = SSR1;
|
||||
SSR1=0;
|
||||
SMR1 = 0x00;
|
||||
SCR1=0;
|
||||
BRR1 = (FREQ/(32*9600))-1;
|
||||
|
||||
/* let the hardware settle */
|
||||
for (i = 0; i < 1000; i++)
|
||||
j++;
|
||||
|
||||
SCR1 = 0x50;
|
||||
|
||||
/* This enables the serial Rx interrupt*/
|
||||
IPRE = (IPRE & 0x0FFF) | 0x8000; /* Set to medium priority */
|
||||
|
||||
void serial_putc (char byte)
|
||||
{
|
||||
while (!(SSR1 & 0x80)); /* Wait for TDRE */
|
||||
TDR1 = byte;
|
||||
SSR1 &= 0x80; /* Clear TDRE */
|
||||
}
|
||||
|
||||
void serial_puts (char const *string)
|
||||
static void process_byte(char byte)
|
||||
{
|
||||
int byte;
|
||||
while ((byte = *string++))
|
||||
serial_putc (byte);
|
||||
}
|
||||
int btn = 0;
|
||||
|
||||
int serial_getc( void )
|
||||
{
|
||||
int byte;
|
||||
while (!serial_flag);
|
||||
byte = serial_byte;
|
||||
serial_flag = 0;
|
||||
serial_putc (byte);
|
||||
return byte;
|
||||
}
|
||||
switch (byte)
|
||||
{
|
||||
case STOP:
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
btn = BUTTON_OFF;
|
||||
#else
|
||||
btn = BUTTON_STOP;
|
||||
#endif
|
||||
break;
|
||||
|
||||
void serial_setup (int baudrate)
|
||||
{
|
||||
SCR1 = 0;
|
||||
SSR1 = 0;
|
||||
SMR1 = 0;
|
||||
BRR1 = (FREQ/(32*baudrate))-1;
|
||||
SCR1 = 0x70;
|
||||
case PLAY:
|
||||
btn = BUTTON_PLAY;
|
||||
break;
|
||||
|
||||
case VOLUP:
|
||||
btn = BUTTON_VOL_UP;
|
||||
break;
|
||||
|
||||
case VOLDN:
|
||||
btn = BUTTON_VOL_DOWN;
|
||||
break;
|
||||
|
||||
case PREV:
|
||||
btn = BUTTON_LEFT;
|
||||
break;
|
||||
|
||||
case NEXT:
|
||||
btn = BUTTON_RIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( btn ) {
|
||||
queue_post(&button_queue, btn, NULL);
|
||||
backlight_on();
|
||||
queue_post(&button_queue, btn | BUTTON_REL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma interrupt
|
||||
void REI1 (void)
|
||||
{
|
||||
SSR1 &= 0x10; /* Clear FER */
|
||||
SSR1 = SSR1 & ~0x10; /* Clear FER */
|
||||
SSR1 = SSR1 & ~0x40; /* Clear RDRF */
|
||||
}
|
||||
|
||||
#pragma interrupt
|
||||
void RXI1 (void)
|
||||
{
|
||||
char serial_byte;
|
||||
serial_byte = RDR1;
|
||||
serial_flag = 1;
|
||||
SSR1 &= 0x40; /* Clear RDRF */
|
||||
SSR1 = SSR1 & ~0x40; /* Clear RDRF */
|
||||
process_byte(serial_byte);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
#ifndef __SERIAL_H__
|
||||
#define __SERIAL_H__
|
||||
|
||||
#include <sh7034.h>
|
||||
#include <system.h>
|
||||
|
||||
extern void serial_putc (char);
|
||||
extern void serial_puts (char const *);
|
||||
extern int serial_getc (void);
|
||||
extern void serial_setup (int);
|
||||
extern void serial_setup (void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue