Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Data Structures | |
struct | setting_t |
A setting. The parameters are const, but the value is not. More... | |
Macros | |
#define | DECL_SETTING(NAME, mi, ma, de) |
Helper macro to declare const parameters for settings, and the variable setting. | |
Functions | |
DECL_SETTING (test, 0, 1, 0) | |
DECL_SETTING (tutorial, 0, 1, 0) | |
DECL_SETTING (tft_br, 0, MAX_TFT_BRIGHTNESS, MAX_TFT_BRIGHTNESS) | |
DECL_SETTING (led_br, 0, MAX_LED_BRIGHTNESS, 5) | |
DECL_SETTING (mic, 0, MAX_MIC_GAIN, MAX_MIC_GAIN) | |
DECL_SETTING (cc_mode, ALL_SAME_LEDS, LINEAR_LEDS, ALL_SAME_LEDS) | |
DECL_SETTING (scrn_sv, 0, 300, 20) | |
DECL_SETTING (gp_accel, 0, 1, 1) | |
DECL_SETTING (gp_touch, GAMEPAD_TOUCH_MORE_BUTTONS_SETTING, GAMEPAD_TOUCH_R_STICK_SETTING, GAMEPAD_TOUCH_MORE_BUTTONS_SETTING) | |
DECL_SETTING (show_secrets, SHOW_SECRETS, HIDE_SECRETS, HIDE_SECRETS) | |
void | readAllSettings (void) |
Read all settings from NVM and set the appropriate hardware peripherals, like TFT and LED brightness. | |
uint8_t | getTftBrightnessSetting (void) |
Get the current TFT brightness setting. | |
const settingParam_t * | getTftBrightnessSettingBounds (void) |
Get the bounds for the TFT brightness setting. Useful for initializing settings items in menus. | |
bool | setTftBrightnessSetting (uint8_t newVal) |
Set the current TFT brightness setting. This calls setTFTBacklightBrightness() after writing to NVS. | |
uint8_t | getLedBrightnessSetting (void) |
Get the current LED brightness. | |
const settingParam_t * | getLedBrightnessSettingBounds (void) |
Get the bounds for the LED brightness setting. Useful for initializing settings items in menus. | |
bool | setLedBrightnessSetting (uint8_t brightness) |
Set the current LED brightness setting. This calls setLedBrightness() after writing to NVS. | |
bool | incLedBrightnessSetting (void) |
Increment the LED brightness setting by one. This calls setLedBrightness() after writing to NVS. | |
bool | decLedBrightnessSetting (void) |
Decrement the LED brightness setting by one. This calls setLedBrightness() after writing to NVS. | |
uint8_t | getMicGainSetting (void) |
Get the current microphone gain setting. | |
const settingParam_t * | getMicGainSettingBounds (void) |
Get the bounds for the microphone gain setting. Useful for initializing settings items in menus. | |
bool | setMicGainSetting (uint8_t newGain) |
Set the current microphone gain setting. The new value is immediately used when sampling the microphone. | |
bool | decMicGainSetting (void) |
Decrement the microphone gain setting by one. The new value is immediately used when sampling the microphone. | |
bool | incMicGainSetting (void) |
Decrement the microphone gain setting by one. The new value is immediately used when sampling the microphone. | |
uint16_t | getScreensaverTimeSetting (void) |
Get the current screensaver timeout setting. | |
const settingParam_t * | getScreensaverTimeSettingBounds (void) |
Get the bounds for the screensaver timeout setting. Useful for initializing settings items in menus. | |
bool | setScreensaverTimeSetting (uint16_t val) |
Set the current screensaver timeout setting. The new value is immediately used for the screensaver timeout. | |
colorchordMode_t | getColorchordModeSetting (void) |
Get the current Colorchord LED output setting. | |
bool | setColorchordModeSetting (colorchordMode_t newMode) |
Set the current Colorchord LED output setting. The new value is immediately used when sampling the microphone. | |
bool | getTestModePassedSetting (void) |
Get the current test mode passed setting. | |
bool | setTestModePassedSetting (bool status) |
Set the current test mode passed setting. | |
bool | getTutorialCompletedSetting (void) |
Get the current tutorial completed setting. | |
bool | setTutorialCompletedSetting (bool status) |
Set the current tutorial completed setting. | |
bool | getGamepadAccelSetting (void) |
Get the current Gamepad accel setting. | |
const settingParam_t * | getGamepadAccelSettingBounds (void) |
Get the bounds for the Gamepad accel setting. Useful for initializing settings items in menus. | |
bool | setGamepadAccelSetting (bool status) |
Set the current Gamepad accel setting. | |
gamepadTouch_t | getGamepadTouchSetting (void) |
Get the current Gamepad touch setting. | |
const settingParam_t * | getGamepadTouchSettingBounds (void) |
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus. | |
bool | setGamepadTouchSetting (gamepadTouch_t status) |
Set the current Gamepad touch setting. | |
showSecrets_t | getShowSecretsMenuSetting (void) |
Get the current setting to show Secrets menu on the main menu. | |
const settingParam_t * | getShowSecretsMenuSettingBounds (void) |
Get the bounds for the setting to show Secrets menu on the main menu. Useful for initializing settings items in menus. | |
bool | setShowSecretsMenuSetting (showSecrets_t status) |
Set the current setting to show Secrets menu on the main menu. | |
struct setting_t |
Data Fields | ||
---|---|---|
const settingParam_t * | param | The setting's immutable data (bounds and NVS key) |
int32_t | val | The setting's current value, in RAM. |
#define DECL_SETTING | ( | NAME, | |
mi, | |||
ma, | |||
de ) |
Helper macro to declare const parameters for settings, and the variable setting.
NAME | the key for this setting, also used in variable names |
mi | The minimum value for this setting |
ma | The maximum value for this setting |
de | The default value for this setting |
DECL_SETTING | ( | test | , |
0 | , | ||
1 | , | ||
0 | ) |
DECL_SETTING | ( | tutorial | , |
0 | , | ||
1 | , | ||
0 | ) |
DECL_SETTING | ( | tft_br | , |
0 | , | ||
MAX_TFT_BRIGHTNESS | , | ||
MAX_TFT_BRIGHTNESS | ) |
DECL_SETTING | ( | led_br | , |
0 | , | ||
MAX_LED_BRIGHTNESS | , | ||
5 | ) |
DECL_SETTING | ( | mic | , |
0 | , | ||
MAX_MIC_GAIN | , | ||
MAX_MIC_GAIN | ) |
DECL_SETTING | ( | cc_mode | , |
ALL_SAME_LEDS | , | ||
LINEAR_LEDS | , | ||
ALL_SAME_LEDS | ) |
DECL_SETTING | ( | scrn_sv | , |
0 | , | ||
300 | , | ||
20 | ) |
DECL_SETTING | ( | gp_accel | , |
0 | , | ||
1 | , | ||
1 | ) |
DECL_SETTING | ( | gp_touch | , |
GAMEPAD_TOUCH_MORE_BUTTONS_SETTING | , | ||
GAMEPAD_TOUCH_R_STICK_SETTING | , | ||
GAMEPAD_TOUCH_MORE_BUTTONS_SETTING | ) |
DECL_SETTING | ( | show_secrets | , |
SHOW_SECRETS | , | ||
HIDE_SECRETS | , | ||
HIDE_SECRETS | ) |
void readAllSettings | ( | void | ) |
Read all settings from NVM and set the appropriate hardware peripherals, like TFT and LED brightness.
uint8_t getTftBrightnessSetting | ( | void | ) |
Get the current TFT brightness setting.
const settingParam_t * getTftBrightnessSettingBounds | ( | void | ) |
Get the bounds for the TFT brightness setting. Useful for initializing settings items in menus.
bool setTftBrightnessSetting | ( | uint8_t | newVal | ) |
Set the current TFT brightness setting. This calls setTFTBacklightBrightness() after writing to NVS.
newVal | the new TFT brightness setting, 0 to MAX_TFT_BRIGHTNESS |
uint8_t getLedBrightnessSetting | ( | void | ) |
Get the current LED brightness.
const settingParam_t * getLedBrightnessSettingBounds | ( | void | ) |
Get the bounds for the LED brightness setting. Useful for initializing settings items in menus.
bool setLedBrightnessSetting | ( | uint8_t | brightness | ) |
Set the current LED brightness setting. This calls setLedBrightness() after writing to NVS.
brightness | The new LED brightness setting, 0 to MAX_LED_BRIGHTNESS |
bool incLedBrightnessSetting | ( | void | ) |
Increment the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
bool decLedBrightnessSetting | ( | void | ) |
Decrement the LED brightness setting by one. This calls setLedBrightness() after writing to NVS.
uint8_t getMicGainSetting | ( | void | ) |
Get the current microphone gain setting.
const settingParam_t * getMicGainSettingBounds | ( | void | ) |
Get the bounds for the microphone gain setting. Useful for initializing settings items in menus.
bool setMicGainSetting | ( | uint8_t | newGain | ) |
Set the current microphone gain setting. The new value is immediately used when sampling the microphone.
newGain | The new microphone gain setting, 0 to MAX_MIC_GAIN |
bool decMicGainSetting | ( | void | ) |
Decrement the microphone gain setting by one. The new value is immediately used when sampling the microphone.
bool incMicGainSetting | ( | void | ) |
Decrement the microphone gain setting by one. The new value is immediately used when sampling the microphone.
uint16_t getScreensaverTimeSetting | ( | void | ) |
Get the current screensaver timeout setting.
const settingParam_t * getScreensaverTimeSettingBounds | ( | void | ) |
Get the bounds for the screensaver timeout setting. Useful for initializing settings items in menus.
bool setScreensaverTimeSetting | ( | uint16_t | val | ) |
Set the current screensaver timeout setting. The new value is immediately used for the screensaver timeout.
val | The new screensaver timeout setting |
colorchordMode_t getColorchordModeSetting | ( | void | ) |
Get the current Colorchord LED output setting.
bool setColorchordModeSetting | ( | colorchordMode_t | newMode | ) |
Set the current Colorchord LED output setting. The new value is immediately used when sampling the microphone.
newMode | The new Colorchord LED output setting |
bool getTestModePassedSetting | ( | void | ) |
Get the current test mode passed setting.
bool setTestModePassedSetting | ( | bool | status | ) |
Set the current test mode passed setting.
status | The new test mode passed setting |
bool getTutorialCompletedSetting | ( | void | ) |
Get the current tutorial completed setting.
bool setTutorialCompletedSetting | ( | bool | status | ) |
Set the current tutorial completed setting.
status | The new tutorial completed setting |
bool getGamepadAccelSetting | ( | void | ) |
Get the current Gamepad accel setting.
const settingParam_t * getGamepadAccelSettingBounds | ( | void | ) |
Get the bounds for the Gamepad accel setting. Useful for initializing settings items in menus.
bool setGamepadAccelSetting | ( | bool | status | ) |
Set the current Gamepad accel setting.
status | The new Gamepad accel setting |
gamepadTouch_t getGamepadTouchSetting | ( | void | ) |
Get the current Gamepad touch setting.
const settingParam_t * getGamepadTouchSettingBounds | ( | void | ) |
Get the bounds for the Gamepad touch setting. Useful for initializing settings items in menus.
bool setGamepadTouchSetting | ( | gamepadTouch_t | status | ) |
Set the current Gamepad touch setting.
status | The new Gamepad touch setting |
showSecrets_t getShowSecretsMenuSetting | ( | void | ) |
Get the current setting to show Secrets menu on the main menu.
const settingParam_t * getShowSecretsMenuSettingBounds | ( | void | ) |
Get the bounds for the setting to show Secrets menu on the main menu. Useful for initializing settings items in menus.
bool setShowSecretsMenuSetting | ( | showSecrets_t | status | ) |
Set the current setting to show Secrets menu on the main menu.
status | The new setting to show Secrets menu on the main menu |