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
85
91
92//==============================================================================
93// Structs
94//==============================================================================
95
99typedef struct
100{
101 const int32_t min;
102 const int32_t max;
103 const int32_t def;
104 const char* key;
106
107//==============================================================================
108// Function Prototypes
109//==============================================================================
110
111void readAllSettings(void);
112
113#ifdef SW_VOL_CONTROL
114uint16_t getBgmVolumeSetting(void);
115const settingParam_t* getBgmVolumeSettingBounds(void);
116bool setBgmVolumeSetting(uint16_t);
117
118uint16_t getSfxVolumeSetting(void);
119const settingParam_t* getSfxVolumeSettingBounds(void);
120bool setSfxVolumeSetting(uint16_t);
121#endif
122
123uint8_t getTftBrightnessSetting(void);
125bool setTftBrightnessSetting(uint8_t newVal);
126
127uint8_t getLedBrightnessSetting(void);
129bool setLedBrightnessSetting(uint8_t brightness);
130bool incLedBrightnessSetting(void);
131bool decLedBrightnessSetting(void);
132
133uint8_t getMicGainSetting(void);
135bool setMicGainSetting(uint8_t newGain);
136bool decMicGainSetting(void);
137bool incMicGainSetting(void);
138
139uint16_t getScreensaverTimeSetting(void);
141bool setScreensaverTimeSetting(uint16_t val);
142
143colorchordMode_t getColorchordModeSetting(void);
144bool setColorchordModeSetting(colorchordMode_t);
145
146bool getTestModePassedSetting(void);
147bool setTestModePassedSetting(bool status);
148
150bool setTutorialCompletedSetting(bool status);
151
152bool getGamepadAccelSetting(void);
154bool setGamepadAccelSetting(bool status);
155
159
163
164#endif
void readAllSettings(void)
Read all settings from NVM and set the appropriate hardware peripherals, like TFT and LED brightness.
Definition settingsManager.c:145
showSecrets_t
Definition settingsManager.h:87
@ HIDE_SECRETS
Definition settingsManager.h:89
@ SHOW_SECRETS
Definition settingsManager.h:88
bool incMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:418
colorchordMode_t getColorchordModeSetting(void)
Get the current Colorchord LED output setting.
Definition settingsManager.c:464
bool setMicGainSetting(uint8_t newGain)
Set the current microphone gain setting. The new value is immediately used when sampling the micropho...
Definition settingsManager.c:398
gamepadTouch_t getGamepadTouchSetting(void)
Get the current Gamepad touch setting.
Definition settingsManager.c:560
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:602
const settingParam_t * getGamepadTouchSettingBounds(void)
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus.
Definition settingsManager.c:570
bool setShowSecretsMenuSetting(showSecrets_t status)
Set the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:613
bool setGamepadAccelSetting(bool status)
Set the current Gamepad accel setting.
Definition settingsManager.c:550
bool setTftBrightnessSetting(uint8_t newVal)
Set the current TFT brightness setting. This calls setTFTBacklightBrightness() after writing to NVS.
Definition settingsManager.c:292
uint16_t getScreensaverTimeSetting(void)
Get the current screensaver timeout setting.
Definition settingsManager.c:430
bool setScreensaverTimeSetting(uint16_t val)
Set the current screensaver timeout setting. The new value is immediately used for the screensaver ti...
Definition settingsManager.c:451
uint8_t getTftBrightnessSetting(void)
Get the current TFT brightness setting.
Definition settingsManager.c:271
bool setTestModePassedSetting(bool status)
Set the current test mode passed setting.
Definition settingsManager.c:498
bool incLedBrightnessSetting(void)
Increment the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:345
bool setTutorialCompletedSetting(bool status)
Set the current tutorial completed setting.
Definition settingsManager.c:519
bool setLedBrightnessSetting(uint8_t brightness)
Set the current LED brightness setting. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:330
const int32_t def
The default value for this setting, must be between min and max.
Definition settingsManager.h:103
bool setGamepadTouchSetting(gamepadTouch_t status)
Set the current Gamepad touch setting.
Definition settingsManager.c:581
uint8_t getLedBrightnessSetting(void)
Get the current LED brightness.
Definition settingsManager.c:309
const settingParam_t * getScreensaverTimeSettingBounds(void)
Get the bounds for the screensaver timeout setting. Useful for initializing settings items in menus.
Definition settingsManager.c:440
const settingParam_t * getGamepadAccelSettingBounds(void)
Get the bounds for the Gamepad accel setting. Useful for initializing settings items in menus.
Definition settingsManager.c:539
bool decMicGainSetting(void)
Decrement the microphone gain setting by one. The new value is immediately used when sampling the mic...
Definition settingsManager.c:408
const int32_t min
The minimum value for this setting, inclusive.
Definition settingsManager.h:101
uint8_t getMicGainSetting(void)
Get the current microphone gain setting.
Definition settingsManager.c:377
showSecrets_t getShowSecretsMenuSetting(void)
Get the current setting to show Secrets menu on the main menu.
Definition settingsManager.c:591
const settingParam_t * getLedBrightnessSettingBounds(void)
Get the bounds for the LED brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:319
bool getTestModePassedSetting(void)
Get the current test mode passed setting.
Definition settingsManager.c:487
const settingParam_t * getTftBrightnessSettingBounds(void)
Get the bounds for the TFT brightness setting. Useful for initializing settings items in menus.
Definition settingsManager.c:281
const char * key
The NVS key for this setting.
Definition settingsManager.h:104
const settingParam_t * getMicGainSettingBounds(void)
Get the bounds for the microphone gain setting. Useful for initializing settings items in menus.
Definition settingsManager.c:387
bool getTutorialCompletedSetting(void)
Get the current tutorial completed setting.
Definition settingsManager.c:508
bool getGamepadAccelSetting(void)
Get the current Gamepad accel setting.
Definition settingsManager.c:529
bool setColorchordModeSetting(colorchordMode_t)
Set the current Colorchord LED output setting. The new value is immediately used when sampling the mi...
Definition settingsManager.c:475
bool decLedBrightnessSetting(void)
Decrement the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
Definition settingsManager.c:360
const int32_t max
The maximum value for this setting, inclusive.
Definition settingsManager.h:102
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:100