Skip to content

Commit

Permalink
Merge pull request #22 from Rodot/volume-control
Browse files Browse the repository at this point in the history
Volume control and Library Manager compliance
  • Loading branch information
Aurélien Rodot authored Nov 14, 2016
2 parents 10e39b4 + def2981 commit 64de814
Show file tree
Hide file tree
Showing 817 changed files with 50 additions and 141,435 deletions.
27 changes: 23 additions & 4 deletions libraries/Gamebuino/Gamebuino.cpp → Gamebuino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ void Gamebuino::begin() {
display.begin(SCR_CLK, SCR_DIN, SCR_DC, SCR_CS, SCR_RST);
sound.begin();

//mute when B is held during start up
if(buttons.pressed(BTN_B)){
//mute when B is held during start up or if battery is low
battery.update();
if(buttons.pressed(BTN_B) || (battery.level == 0)){
sound.setVolume(0);
}
else{ //play the startup sound on each channel for it to be louder
Expand Down Expand Up @@ -137,7 +138,7 @@ void Gamebuino::titleScreen(const __FlashStringHelper* name, const uint8_t *log

//toggle volume when B is pressed
if(buttons.pressed(BTN_B)){
sound.setVolume(sound.globalVolume+1);
sound.setVolume(sound.getVolume() + 1);
sound.playTick();
}
//leave the menu
Expand Down Expand Up @@ -172,6 +173,22 @@ boolean Gamebuino::update() {

} else {
if (!frameEndMicros) { //runs once at the end of the frame

//increase volume shortcut : hold C + press B
if(buttons.repeat(BTN_C, 1) && buttons.pressed(BTN_B)){
sound.setVolume(sound.getVolume() + 1);
popup(F("\027+\026 \23\24"), 60);
sound.playTick();
}

//flash loader shortcut : hold C + A
if(buttons.repeat(BTN_C, 1) && buttons.pressed(BTN_A)){
popup(F("\027+\025 \020 LOADER"), 60);
}
if(buttons.repeat(BTN_C, 1) && buttons.held(BTN_A,40)){
changeGame();
}

sound.updateTrack();
sound.updatePattern();
sound.updateNote();
Expand Down Expand Up @@ -538,7 +555,9 @@ void Gamebuino::readSettings(){
backlight.ambientLightMin = pgm_read_word(SETTINGS_PAGE+OFFSET_LIGHT_MIN);
backlight.ambientLightMax = pgm_read_word(SETTINGS_PAGE+OFFSET_LIGHT_MAX);

sound.volumeMax = pgm_read_byte(SETTINGS_PAGE+OFFSET_VOLUME_MAX);
//sound.volumeMax = pgm_read_byte(SETTINGS_PAGE+OFFSET_VOLUME_MAX);
sound.volumeMax = VOLUME_GLOBAL_MAX; //max volume is no longer read from settings

sound.globalVolume = pgm_read_byte(SETTINGS_PAGE+OFFSET_VOLUME_DEFAULT);

startMenuTimer = pgm_read_byte(SETTINGS_PAGE+OFFSET_START_MENU_TIMER);
Expand Down
12 changes: 6 additions & 6 deletions libraries/Gamebuino/Gamebuino.h → Gamebuino.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include <Arduino.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
#include "settings.c"
#include "Backlight.h"
#include "Display.h"
#include "Buttons.h"
#include "Battery.h"
#include "Sound.h"
#include "utility/settings.c"
#include "utility/Backlight.h"
#include "utility/Display.h"
#include "utility/Buttons.h"
#include "utility/Battery.h"
#include "utility/Sound.h"

#define load_game (*((void(*)(const char* filename))(0x7ffc/2)))
#define write_flash_page (*((void(*)(const char * page, unsigned char * buffer))(0x7ffa/2)))
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#2016-11-14
* Volume control added
* Mute on startup if batty is low
* Arduino Libraries Manager compliance
* External libraries and /hardware moved to other repos

#2015-03-29
* Critical battery level alert can be skipped
* Critical battery alert can be disabled in settings
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 0 additions & 23 deletions hardware/gamebuino/avr/boards.txt

This file was deleted.

91 changes: 0 additions & 91 deletions hardware/gamebuino/avr/bootloaders/gamebuino_boot/README.TXT

This file was deleted.

Loading

0 comments on commit 64de814

Please sign in to comment.