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
62
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
85
92
98
99//==============================================================================
100// Structs
101//==============================================================================
102
106typedef struct
107{
108 const int32_t min;
109 const int32_t max;
110 const int32_t def;
111 const char* key;
113
114//==============================================================================
115// Function Prototypes
116//==============================================================================
117
118void readAllSettings(void);
119
120#ifdef SW_VOL_CONTROL
121uint16_t getBgmVolumeSetting(void);
122const settingParam_t* getBgmVolumeSettingBounds(void);
123bool setBgmVolumeSetting(uint16_t);
124
125uint16_t getSfxVolumeSetting(void);
126const settingParam_t* getSfxVolumeSettingBounds(void);
127bool setSfxVolumeSetting(uint16_t);
128#endif
129
130uint8_t getTftBrightnessSetting(void);
132bool setTftBrightnessSetting(uint8_t newVal);
133
134uint8_t getLedBrightnessSetting(void);
136bool setLedBrightnessSetting(uint8_t brightness);
137bool incLedBrightnessSetting(void);
138bool decLedBrightnessSetting(void);
139
140uint8_t getMicGainSetting(void);
142bool setMicGainSetting(uint8_t newGain);
143bool decMicGainSetting(void);
144bool incMicGainSetting(void);
145
146uint16_t getScreensaverTimeSetting(void);
148bool setScreensaverTimeSetting(uint16_t val);
149
150colorchordMode_t getColorchordModeSetting(void);
151bool setColorchordModeSetting(colorchordMode_t);
152
153bool getTestModePassedSetting(void);
154bool setTestModePassedSetting(bool status);
155
157bool setTutorialCompletedSetting(bool status);
158
159bool getGamepadPcAccelSetting(void);
161bool setGamepadPcAccelSetting(bool status);
174
187
191
192#endif
void readAllSettings(void)
Read all settings from NVM and set the appropriate hardware peripherals, like TFT and LED brightness.
Definition settingsManager.c:156
const settingParam_t * getGamepadNsDpadSettingBounds(void)
Get the bounds for the Gamepad dpad setting. Useful for initializing settings items in menus.
Definition settingsManager.c:754
gamepadTouch_t getGamepadPcDpadSetting(void)
Get the current Gamepad dpad setting.
Definition settingsManager.c:620
showSecrets_t
Definition settingsManager.h:94
@ HIDE_SECRETS
Definition settingsManager.h:96
@ SHOW_SECRETS
Definition settingsManager.h:95
bool setGamepadNsDpadSetting(gamepadDpad_t status)
Set the current Gamepad dpad setting.
Definition settingsManager.c:765
bool incMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:447
gamepadTouch_t getGamepadNsDpadSetting(void)
Get the current Gamepad dpad setting.
Definition settingsManager.c:744
colorchordMode_t getColorchordModeSetting(void)
Get the current Colorchord LED output setting.
Definition settingsManager.c:493
bool setMicGainSetting(uint8_t newGain)
Set the current microphone gain setting. The new value is immediately used when sampling the micropho...
Definition settingsManager.c:427
bool setGamepadPcDpadStickIntensitySetting(gamepadDpad_t status)
Set the current Gamepad dpad stick intensity setting.
Definition settingsManager.c:672
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:848
bool setShowSecretsMenuSetting(showSecrets_t status)
Set the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:859
gamepadTouch_t getGamepadNsTouchSetting(void)
Get the current Gamepad touch setting.
Definition settingsManager.c:713
const settingParam_t * getGamepadNsTouchStickRecenterSettingBounds(void)
Get the bounds for the Gamepad touch stick recenter setting. Useful for initializing settings items i...
Definition settingsManager.c:816
int32_t getGamepadNsDpadStickIntensitySetting(void)
Get the current Gamepad dpad stick intensity setting.
Definition settingsManager.c:775
bool setTftBrightnessSetting(uint8_t newVal)
Set the current TFT brightness setting. This calls setTFTBacklightBrightness() after writing to NVS.
Definition settingsManager.c:321
uint16_t getScreensaverTimeSetting(void)
Get the current screensaver timeout setting.
Definition settingsManager.c:459
const settingParam_t * getGamepadPcDpadSettingBounds(void)
Get the bounds for the Gamepad dpad setting. Useful for initializing settings items in menus.
Definition settingsManager.c:630
bool setScreensaverTimeSetting(uint16_t val)
Set the current screensaver timeout setting. The new value is immediately used for the screensaver ti...
Definition settingsManager.c:480
uint8_t getTftBrightnessSetting(void)
Get the current TFT brightness setting.
Definition settingsManager.c:300
bool setGamepadNsDpadStickIntensitySetting(gamepadDpad_t status)
Set the current Gamepad dpad stick intensity setting.
Definition settingsManager.c:796
bool setTestModePassedSetting(bool status)
Set the current test mode passed setting.
Definition settingsManager.c:527
gamepadDpad_t
Definition settingsManager.h:87
@ GAMEPAD_DPAD_R_STICK_SETTING
Definition settingsManager.h:90
@ GAMEPAD_DPAD_L_STICK_SETTING
Definition settingsManager.h:89
@ GAMEPAD_DPAD_NORMAL_SETTING
Definition settingsManager.h:88
bool setGamepadPcTouchStickRecenterSetting(gamepadDpad_t status)
Set the current Gamepad touch stick recenter setting.
Definition settingsManager.c:703
bool incLedBrightnessSetting(void)
Increment the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:374
bool setGamepadPcAccelSetting(bool status)
Set the current Gamepad accel setting.
Definition settingsManager.c:579
bool setTutorialCompletedSetting(bool status)
Set the current tutorial completed setting.
Definition settingsManager.c:548
bool setLedBrightnessSetting(uint8_t brightness)
Set the current LED brightness setting. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:359
int32_t getGamepadPcDpadStickIntensitySetting(void)
Get the current Gamepad dpad stick intensity setting.
Definition settingsManager.c:651
const int32_t def
The default value for this setting, must be between min and max.
Definition settingsManager.h:110
uint8_t getLedBrightnessSetting(void)
Get the current LED brightness.
Definition settingsManager.c:338
bool getGamepadPcTouchStickRecenterSetting(void)
Get the current Gamepad touch stick recenter setting.
Definition settingsManager.c:682
const settingParam_t * getScreensaverTimeSettingBounds(void)
Get the bounds for the screensaver timeout setting. Useful for initializing settings items in menus.
Definition settingsManager.c:469
bool setGamepadNsTouchSetting(gamepadTouch_t status)
Set the current Gamepad touch setting.
Definition settingsManager.c:734
bool decMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:437
const int32_t min
The minimum value for this setting, inclusive.
Definition settingsManager.h:108
bool setGamepadPcDpadSetting(gamepadDpad_t status)
Set the current Gamepad dpad setting.
Definition settingsManager.c:641
bool setGamepadNsTouchStickRecenterSetting(gamepadDpad_t status)
Set the current Gamepad touch stick recenter setting.
Definition settingsManager.c:827
const settingParam_t * getGamepadNsDpadStickIntensitySettingBounds(void)
Get the bounds for the Gamepad dpad stick intensity setting. Useful for initializing settings items i...
Definition settingsManager.c:785
uint8_t getMicGainSetting(void)
Get the current microphone gain setting.
Definition settingsManager.c:406
const settingParam_t * getGamepadPcTouchStickRecenterSettingBounds(void)
Get the bounds for the Gamepad touch stick recenter setting. Useful for initializing settings items i...
Definition settingsManager.c:692
showSecrets_t getShowSecretsMenuSetting(void)
Get the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:837
const settingParam_t * getLedBrightnessSettingBounds(void)
Get the bounds for the LED brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:348
const settingParam_t * getGamepadPcAccelSettingBounds(void)
Get the bounds for the Gamepad accel setting. Useful for initializing settings items in menus.
Definition settingsManager.c:568
bool getTestModePassedSetting(void)
Get the current test mode passed setting.
Definition settingsManager.c:516
const settingParam_t * getGamepadPcDpadStickIntensitySettingBounds(void)
Get the bounds for the Gamepad dpad stick intensity setting. Useful for initializing settings items i...
Definition settingsManager.c:661
const settingParam_t * getGamepadPcTouchSettingBounds(void)
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus.
Definition settingsManager.c:599
const settingParam_t * getTftBrightnessSettingBounds(void)
Get the bounds for the TFT brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:310
const char * key
The NVS key for this setting.
Definition settingsManager.h:111
const settingParam_t * getMicGainSettingBounds(void)
Get the bounds for the microphone gain setting. Useful for initializing settings items in menus.
Definition settingsManager.c:416
const settingParam_t * getGamepadNsTouchSettingBounds(void)
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus.
Definition settingsManager.c:723
bool getTutorialCompletedSetting(void)
Get the current tutorial completed setting.
Definition settingsManager.c:537
bool setGamepadPcTouchSetting(gamepadTouch_t status)
Set the current Gamepad touch setting.
Definition settingsManager.c:610
bool getGamepadPcAccelSetting(void)
Get the current Gamepad accel setting.
Definition settingsManager.c:558
bool setColorchordModeSetting(colorchordMode_t)
Set the current Colorchord LED output setting. The new value is immediately used when sampling the mi...
Definition settingsManager.c:504
bool decLedBrightnessSetting(void)
Decrement the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:389
const int32_t max
The maximum value for this setting, inclusive.
Definition settingsManager.h:109
bool getGamepadNsTouchStickRecenterSetting(void)
Get the current Gamepad touch stick recenter setting.
Definition settingsManager.c:806
gamepadTouch_t getGamepadPcTouchSetting(void)
Get the current Gamepad touch setting.
Definition settingsManager.c:589
gamepadTouch_t
Definition settingsManager.h:80
@ GAMEPAD_TOUCH_L_STICK_SETTING
Definition settingsManager.h:82
@ GAMEPAD_TOUCH_R_STICK_SETTING
Definition settingsManager.h:83
@ GAMEPAD_TOUCH_MORE_BUTTONS_SETTING
Definition settingsManager.h:81
Immutable data for a setting, including minimum, maximum, and default values, and the NVS key.
Definition settingsManager.h:107