diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 25cab34430..dbe2be079a 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -12401,3 +12401,17 @@ *: "As whole numbers" + + id: LANG_ENABLE_SPEAKER + desc: in Settings -> Sound Settings + user: + + *: "Enable Speaker" + + + *: "Enable Speaker" + + + *: "Enable Speaker" + + diff --git a/apps/lang/nederlands.lang b/apps/lang/nederlands.lang index 833ae3df5b..489a31b66d 100644 --- a/apps/lang/nederlands.lang +++ b/apps/lang/nederlands.lang @@ -12288,3 +12288,17 @@ serial_port: "Automatisch" + + id: LANG_ENABLE_SPEAKER + desc: in Settings -> Sound Settings + user: + + *: "Enable Speaker" + + + *: "Luidspreker inschakelen" + + + *: "Luidspreker inschakelen" + + diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index d953db93b3..70730a1e5a 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c @@ -102,6 +102,10 @@ MENUITEM_SETTING(stereo_width, &global_settings.stereo_width, MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL); #endif +#ifdef HAVE_SPEAKER + MENUITEM_SETTING(speaker_enabled, &global_settings.speaker_enabled, NULL); +#endif + MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, @@ -121,6 +125,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength ,&mdb_harmonics,&mdb_center,&mdb_shape +#endif +#ifdef HAVE_SPEAKER + ,&speaker_enabled #endif ); diff --git a/apps/settings.c b/apps/settings.c index 30b056da53..71c29f67c4 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -806,6 +806,10 @@ void settings_apply(bool read_disk) global_settings.peak_meter_clip_hold); #endif +#ifdef HAVE_SPEAKER + audiohw_enable_speaker(global_settings.speaker_enabled); +#endif + if (read_disk) { diff --git a/apps/settings.h b/apps/settings.h index 669000ea42..201cd8f772 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -730,6 +730,10 @@ struct user_settings bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */ #endif +#ifdef HAVE_SPEAKER + bool speaker_enabled; +#endif + /* If values are just added to the end, no need to bump plugin API version. */ /* new stuff to be added at the end */ diff --git a/apps/settings_list.c b/apps/settings_list.c index 5729cdcf4a..f5b49f3447 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1458,6 +1458,10 @@ const struct settings_list settings[] = { qs_load_from_cfg, qs_write_to_cfg, qs_is_changed, qs_set_default), #endif +#ifdef HAVE_SPEAKER + OFFON_SETTING(0, speaker_enabled, LANG_ENABLE_SPEAKER, false, "speaker", + audiohw_enable_speaker), +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings); diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 423b520dc5..e53db7e7b9 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h @@ -305,4 +305,10 @@ void audiohw_set_stereo_width(int val); #endif /* CONFIG_CODEC != SWCODEC */ +#ifdef HAVE_SPEAKER + +void audiohw_enable_speaker(bool on); + +#endif /* HAVE_SPEAKER */ + #endif /* _AUDIOHW_H_ */ diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/speaker-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/speaker-onda_vx747.c new file mode 100644 index 0000000000..12dd03e8c7 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/speaker-onda_vx747.c @@ -0,0 +1,34 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Maurus Cuelenaere + * + * 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 "jz4740.h" +#include "audiohw.h" + +#define SPEAKER_PIN (32*2 + 27) + +void audiohw_enable_speaker(bool on) +{ + __gpio_as_output(SPEAKER_PIN); + if(on) + __gpio_set_pin(SPEAKER_PIN); + else + __gpio_clear_pin(SPEAKER_PIN); +}