mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
New port: Anbernic RG Nano
A bit of context, this device is a clone of the FunKey-S with a different form factor, hardware is mostly identical, the relevant difference is it has audio out (via usb-c, adapter to 3.5mm is included), this is the reason why the FunKey-SDK is needed for bulding. This port is based on the old SDL 1.2 code because the device doesn't have SDL2 support. Alongside what was supported in the SDL 1.2 builds this port supports battery level, charging status and backlight control. Change-Id: I7fcb85be62748644b667c0efebabf59d6e9c5ade
This commit is contained in:
parent
9d3e286454
commit
48392bab94
94 changed files with 1517 additions and 29 deletions
|
|
@ -33,7 +33,9 @@
|
|||
#include "thread-sdl.h"
|
||||
#include "system-sdl.h"
|
||||
#include "sim-ui-defines.h"
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
#include "window-sdl.h"
|
||||
#endif
|
||||
#include "button-sdl.h"
|
||||
#include "lcd-bitmap.h"
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
|
|
@ -50,6 +52,10 @@
|
|||
|
||||
#define SIMULATOR_DEFAULT_ROOT "simdisk"
|
||||
|
||||
#if SDL_MAJOR_VERSION == 1
|
||||
SDL_Surface *gui_surface;
|
||||
#endif
|
||||
|
||||
bool background = true; /* use backgrounds by default */
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
bool showremote = true; /* include remote by default */
|
||||
|
|
@ -92,7 +98,7 @@ static int sdl_event_thread(void * param)
|
|||
SDL_sem *wait_for_maemo_startup;
|
||||
#endif
|
||||
|
||||
#if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA))
|
||||
#if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA)) || defined(RG_NANO)
|
||||
/* SDL touch screen fix: Work around a SDL assumption that returns
|
||||
relative mouse coordinates when you get to the screen edges
|
||||
using the touchscreen and a disabled mouse cursor.
|
||||
|
|
@ -112,6 +118,27 @@ static int sdl_event_thread(void * param)
|
|||
SDL_DestroySemaphore(wait_for_maemo_startup);
|
||||
#endif
|
||||
|
||||
#if SDL_MAJOR_VERSION == 1
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_Surface *picture_surface = NULL;
|
||||
int depth;
|
||||
Uint32 flags;
|
||||
|
||||
depth = LCD_DEPTH;
|
||||
if (depth < 8)
|
||||
depth = 16;
|
||||
|
||||
flags = SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN;
|
||||
|
||||
if ((gui_surface = SDL_SetVideoMode(LCD_WIDTH, LCD_HEIGHT, depth, flags)) == NULL) {
|
||||
panicf("%s", SDL_GetError());
|
||||
}
|
||||
|
||||
if (background && picture_surface != NULL)
|
||||
SDL_BlitSurface(picture_surface, NULL, gui_surface, NULL);
|
||||
#endif
|
||||
|
||||
/* let system_init proceed */
|
||||
SDL_SemPost((SDL_sem *)param);
|
||||
|
||||
|
|
@ -189,8 +216,11 @@ void sim_do_exit()
|
|||
#endif
|
||||
|
||||
sim_kernel_shutdown();
|
||||
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
SDL_UnlockMutex(window_mutex);
|
||||
SDL_DestroyMutex(window_mutex);
|
||||
#endif
|
||||
|
||||
SDL_Quit();
|
||||
exit(EXIT_SUCCESS);
|
||||
|
|
@ -228,12 +258,21 @@ void system_init(void)
|
|||
|
||||
#ifndef __WIN32 /* Fails on Windows */
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
sdl_window_setup();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__ /* MacOS requires events to be handled on main thread */
|
||||
s = SDL_CreateSemaphore(0); /* 0-count so it blocks */
|
||||
evt_thread = SDL_CreateThread(sdl_event_thread, NULL, s);
|
||||
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
evt_thread = SDL_CreateThread(sdl_event_thread, NULL, s);
|
||||
#else
|
||||
evt_thread = SDL_CreateThread(sdl_event_thread, s);
|
||||
#endif /* SDL_MAJOR_VERSION */
|
||||
|
||||
SDL_SemWait(s);
|
||||
/* cleanup */
|
||||
SDL_DestroySemaphore(s);
|
||||
|
|
@ -311,6 +350,7 @@ void sys_handle_argv(int argc, char *argv[])
|
|||
printf("Disabling remote image.\n");
|
||||
}
|
||||
#endif
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
else if (!strcmp("--zoom", argv[x]))
|
||||
{
|
||||
x++;
|
||||
|
|
@ -320,6 +360,7 @@ void sys_handle_argv(int argc, char *argv[])
|
|||
display_zoom = 2;
|
||||
printf("Window zoom is %f\n", display_zoom);
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp("--alarm", argv[x]))
|
||||
{
|
||||
sim_alarm_wakeup = true;
|
||||
|
|
@ -374,7 +415,9 @@ void sys_handle_argv(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
#if SDL_MAJOR_VERSION > 1
|
||||
if (display_zoom != 1) {
|
||||
background = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue