/** \file * \brief This file contains functions that implement the settings interface for SystemK. * */ /* Include Files */ #include "KTag.h" SystemKResult_T SETTINGS_get_uint8_t(SystemKSettingID_T id, uint8_t * value) { SystemKResult_T result = SYSTEMK_RESULT_SUCCESS; switch (id) { case SYSTEMK_SETTING_IS_RIGHT_HANDED: *value = NVM_IS_RIGHT_HANDED; break; case SYSTEMK_SETTING_AUDIO_VOLUME: *value = NVM_VOLUME; break; case SYSTEMK_SETTING_TEAMID: *value = NVM_TEAM_ID; break; case SYSTEMK_SETTING_PLAYERID: *value = NVM_PLAYER_ID; break; case SYSTEMK_SETTING_WEAPONID: *value = NVM_WEAPON_ID; break; default: result = SYSTEMK_RESULT_WRONG_DATATYPE; break; } return result; } SystemKResult_T SETTINGS_set_uint8_t(SystemKSettingID_T id, uint8_t value) { SystemKResult_T result = SYSTEMK_RESULT_SUCCESS; switch (id) { case SYSTEMK_SETTING_IS_RIGHT_HANDED: NVM_IS_RIGHT_HANDED = value; break; case SYSTEMK_SETTING_AUDIO_VOLUME: NVM_VOLUME = value; break; case SYSTEMK_SETTING_TEAMID: NVM_TEAM_ID = value; break; case SYSTEMK_SETTING_PLAYERID: NVM_PLAYER_ID = value; break; case SYSTEMK_SETTING_WEAPONID: NVM_WEAPON_ID = value; break; default: result = SYSTEMK_RESULT_WRONG_DATATYPE; break; } return result; } SystemKResult_T SETTINGS_get_uint32_t(SystemKSettingID_T id, uint32_t * value) { SystemKResult_T result = SYSTEMK_RESULT_SUCCESS; switch (id) { case SYSTEMK_SETTING_T_START_GAME_in_ms: *value = CONFIG_KTAG_T_DEFAULT_START_GAME_in_ms; break; default: result = SYSTEMK_RESULT_WRONG_DATATYPE; break; } return result; } SystemKResult_T SETTINGS_set_uint32_t(SystemKSettingID_T id, uint32_t value) { SystemKResult_T result = SYSTEMK_RESULT_SUCCESS; switch (id) { case SYSTEMK_SETTING_T_START_GAME_in_ms: result = SYSTEMK_RESULT_NOT_IMPLEMENTED; break; default: result = SYSTEMK_RESULT_WRONG_DATATYPE; break; } return result; } SystemKResult_T SETTINGS_Save(void) { #if (CONFIG__HAS_EXTERNAL_NVM) NVM_SaveExternalEEPROMEntry(&NVM_Hardware_Settings); NVM_SaveExternalEEPROMEntry(&NVM_Game_Settings); #else // CONFIG__HAS_EXTERNAL_NVM NVM_SaveOnChipEEPROMEntry(&NVM_Hardware_Settings); NVM_SaveOnChipEEPROMEntry(&NVM_Game_Settings); #endif // CONFIG__HAS_EXTERNAL_NVM return SYSTEMK_RESULT_SUCCESS; }