Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
settingsManager.h
Go to the documentation of this file.
1
63#ifndef _SETTINGS_MANAGER_H_
64#define _SETTINGS_MANAGER_H_
65
66//==============================================================================
67// Includes
68//==============================================================================
69
70#include <stdint.h>
71#include <stdbool.h>
72
73#include "colorchordTypes.h"
74
75//==============================================================================
76// Enums
77//==============================================================================
78
84
90
91//==============================================================================
92// Structs
93//==============================================================================
94
98typedef struct
99{
100 const int32_t min;
101 const int32_t max;
102 const int32_t def;
103 const char* key;
105
106//==============================================================================
107// Function Prototypes
108//==============================================================================
109
110void readAllSettings(void);
111
112uint16_t getBgmVolumeSetting(void);
114bool setBgmVolumeSetting(uint16_t);
115
116uint16_t getSfxVolumeSetting(void);
118bool setSfxVolumeSetting(uint16_t);
119
120uint8_t getTftBrightnessSetting(void);
122bool setTftBrightnessSetting(uint8_t newVal);
123
124uint8_t getLedBrightnessSetting(void);
126bool setLedBrightnessSetting(uint8_t brightness);
127bool incLedBrightnessSetting(void);
128bool decLedBrightnessSetting(void);
129
130uint8_t getMicGainSetting(void);
132bool setMicGainSetting(uint8_t newGain);
133bool decMicGainSetting(void);
134bool incMicGainSetting(void);
135
136uint16_t getScreensaverTimeSetting(void);
138bool setScreensaverTimeSetting(uint16_t val);
139
140colorchordMode_t getColorchordModeSetting(void);
141bool setColorchordModeSetting(colorchordMode_t);
142
143bool getTestModePassedSetting(void);
144bool setTestModePassedSetting(bool status);
145
147bool setTutorialCompletedSetting(bool status);
148
149bool getGamepadAccelSetting(void);
151bool setGamepadAccelSetting(bool status);
152
156
160
161#endif
void readAllSettings(void)
Read all settings from NVM and set the appropriate hardware peripherals, like TFT and LED brightness.
Definition settingsManager.c:142
const settingParam_t * getSfxVolumeSettingBounds(void)
Get the bounds for the background volume setting. Useful for initializing settings items in menus.
Definition settingsManager.c:234
showSecrets_t
Definition settingsManager.h:86
@ HIDE_SECRETS
Definition settingsManager.h:88
@ SHOW_SECRETS
Definition settingsManager.h:87
bool incMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:409
colorchordMode_t getColorchordModeSetting(void)
Get the current Colorchord LED output setting.
Definition settingsManager.c:455
bool setBgmVolumeSetting(uint16_t)
Set the current background music volume setting. This calls bzrSetBgmVolume() after writing to NVS.
Definition settingsManager.c:207
bool setMicGainSetting(uint8_t newGain)
Set the current microphone gain setting. The new value is immediately used when sampling the micropho...
Definition settingsManager.c:389
gamepadTouch_t getGamepadTouchSetting(void)
Get the current Gamepad touch setting.
Definition settingsManager.c:551
const settingParam_t * getShowSecretsMenuSettingBounds(void)
Get the bounds for the setting to show Secrets menu on the main menu. Useful for initializing setting...
Definition settingsManager.c:593
const settingParam_t * getGamepadTouchSettingBounds(void)
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus.
Definition settingsManager.c:561
bool setShowSecretsMenuSetting(showSecrets_t status)
Set the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:604
bool setGamepadAccelSetting(bool status)
Set the current Gamepad accel setting.
Definition settingsManager.c:541
bool setSfxVolumeSetting(uint16_t)
Set the current sound effects volume setting. This calls bzrSetSfxVolume() after writing to NVS.
Definition settingsManager.c:245
bool setTftBrightnessSetting(uint8_t newVal)
Set the current TFT brightness setting. This calls setTFTBacklightBrightness() after writing to NVS.
Definition settingsManager.c:283
uint16_t getScreensaverTimeSetting(void)
Get the current screensaver timeout setting.
Definition settingsManager.c:421
bool setScreensaverTimeSetting(uint16_t val)
Set the current screensaver timeout setting. The new value is immediately used for the screensaver ti...
Definition settingsManager.c:442
uint8_t getTftBrightnessSetting(void)
Get the current TFT brightness setting.
Definition settingsManager.c:262
bool setTestModePassedSetting(bool status)
Set the current test mode passed setting.
Definition settingsManager.c:489
bool incLedBrightnessSetting(void)
Increment the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:336
bool setTutorialCompletedSetting(bool status)
Set the current tutorial completed setting.
Definition settingsManager.c:510
bool setLedBrightnessSetting(uint8_t brightness)
Set the current LED brightness setting. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:321
const int32_t def
The default value for this setting, must be between min and max.
Definition settingsManager.h:102
bool setGamepadTouchSetting(gamepadTouch_t status)
Set the current Gamepad touch setting.
Definition settingsManager.c:572
uint8_t getLedBrightnessSetting(void)
Get the current LED brightness.
Definition settingsManager.c:300
const settingParam_t * getScreensaverTimeSettingBounds(void)
Get the bounds for the screensaver timeout setting. Useful for initializing settings items in menus.
Definition settingsManager.c:431
const settingParam_t * getGamepadAccelSettingBounds(void)
Get the bounds for the Gamepad accel setting. Useful for initializing settings items in menus.
Definition settingsManager.c:530
bool decMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:399
const int32_t min
The minimum value for this setting, inclusive.
Definition settingsManager.h:100
const settingParam_t * getBgmVolumeSettingBounds(void)
Get the bounds for the background volume setting. Useful for initializing settings items in menus.
Definition settingsManager.c:196
uint8_t getMicGainSetting(void)
Get the current microphone gain setting.
Definition settingsManager.c:368
showSecrets_t getShowSecretsMenuSetting(void)
Get the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:582
const settingParam_t * getLedBrightnessSettingBounds(void)
Get the bounds for the LED brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:310
bool getTestModePassedSetting(void)
Get the current test mode passed setting.
Definition settingsManager.c:478
uint16_t getSfxVolumeSetting(void)
Get the current sound effects volume setting.
Definition settingsManager.c:224
const settingParam_t * getTftBrightnessSettingBounds(void)
Get the bounds for the TFT brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:272
const char * key
The NVS key for this setting.
Definition settingsManager.h:103
const settingParam_t * getMicGainSettingBounds(void)
Get the bounds for the microphone gain setting. Useful for initializing settings items in menus.
Definition settingsManager.c:378
bool getTutorialCompletedSetting(void)
Get the current tutorial completed setting.
Definition settingsManager.c:499
bool getGamepadAccelSetting(void)
Get the current Gamepad accel setting.
Definition settingsManager.c:520
bool setColorchordModeSetting(colorchordMode_t)
Set the current Colorchord LED output setting. The new value is immediately used when sampling the mi...
Definition settingsManager.c:466
bool decLedBrightnessSetting(void)
Decrement the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:351
const int32_t max
The maximum value for this setting, inclusive.
Definition settingsManager.h:101
uint16_t getBgmVolumeSetting(void)
Get the current background music volume setting.
Definition settingsManager.c:186
gamepadTouch_t
Definition settingsManager.h:80
@ GAMEPAD_TOUCH_L_STICK_SETTING
Definition settingsManager.h:81
@ GAMEPAD_TOUCH_R_STICK_SETTING
Definition settingsManager.h:82
Immutable data for a setting, including minimum, maximum, and default values, and the NVS key.
Definition settingsManager.h:99