27#ifndef LIBWS_EEPROM_H_
28#define LIBWS_EEPROM_H_
30#define WS_IEEP_SIZE_MONO 0x80
31#define WS_IEEP_SIZE_COLOR 0x800
33#define WS_IEEP_USER_ADDR 0x00
34#define WS_IEEP_USER_SIZE 0x60
36#define WS_IEEP_OWNER_NAME_ADDR 0x60
37#define WS_IEEP_OWNER_NAME_SIZE 16
38#define WS_IEEP_OWNER_BIRTHDAY_YEAR_ADDR 0x70
39#define WS_IEEP_OWNER_BIRTHDAY_MONTH_ADDR 0x72
40#define WS_IEEP_OWNER_BIRTHDAY_DAY_ADDR 0x73
41#define WS_IEEP_OWNER_GENDER_ADDR 0x74
45#define WS_IEEP_GENDER_UNK 0
46#define WS_IEEP_GENDER_MALE 1
47#define WS_IEEP_GENDER_FEMALE 2
62#define WS_IEEP_OWNER_BLOOD_TYPE_ADDR 0x75
66#define WS_IEEP_BLOOD_TYPE_UNK 0
67#define WS_IEEP_BLOOD_TYPE_A 1
68#define WS_IEEP_BLOOD_TYPE_B 2
69#define WS_IEEP_BLOOD_TYPE_0 3
70#define WS_IEEP_BLOOD_TYPE_AB 4
87#define WS_IEEP_LAST_CART_PUBLISHER_ADDR 0x76
88#define WS_IEEP_LAST_CART_PLATFORM_ADDR 0x77
89#define WS_IEEP_LAST_CART_GAME_ID_ADDR 0x78
90#define WS_IEEP_CART_CHANGE_COUNT_ADDR 0x7C
91#define WS_IEEP_NAME_CHANGE_COUNT_ADDR 0x7D
92#define WS_IEEP_STARTUP_COUNT_ADDR 0x7E
94#define WS_IEEP_COLOR_SETTINGS_ADDR 0x83
95#define WS_IEEP_COLOR_SETTINGS_CUSTOM_SPLASH 0x80
96#define WS_IEEP_COLOR_SETTINGS_WSC_HIGH_CONTRAST 0x40
97#define WS_IEEP_COLOR_SETTINGS_VOLUME(x) ((x) & 3)
98#define WS_IEEP_COLOR_SETTINGS_VOLUME_MASK 0x03
100#define WS_IEEP_NAME_COLOR_ADDR 0x84
104#define WS_IEEP_NAME_COLOR_BLACK 0x00
105#define WS_IEEP_NAME_COLOR_RED 0x01
106#define WS_IEEP_NAME_COLOR_ORANGE 0x02
107#define WS_IEEP_NAME_COLOR_YELLOW 0x03
108#define WS_IEEP_NAME_COLOR_LIME 0x04
109#define WS_IEEP_NAME_COLOR_GREEN 0x05
110#define WS_IEEP_NAME_COLOR_TEAL 0x06
111#define WS_IEEP_NAME_COLOR_CYAN 0x07
112#define WS_IEEP_NAME_COLOR_SEABLUE 0x08
113#define WS_IEEP_NAME_COLOR_BLUE 0x09
114#define WS_IEEP_NAME_COLOR_PURPLE 0x0A
115#define WS_IEEP_NAME_COLOR_PINK 0x0B
116#define WS_IEEP_NAME_COLOR_FUCHSIA 0x0C
117#define WS_IEEP_NAME_COLOR_WHITE 0x0D
@ WS_IEEP_NAME_COLOR_RED
RGB(15, 0, 0)
@ WS_IEEP_NAME_COLOR_GREEN
RGB(0, 15, 0)
@ WS_IEEP_NAME_COLOR_BLACK
RGB(0, 0, 0)
@ WS_IEEP_NAME_COLOR_FUCHSIA
RGB(15, 0, 7)
@ WS_IEEP_NAME_COLOR_WHITE
RGB(15, 15, 15)
@ WS_IEEP_NAME_COLOR_BLUE
RGB(0, 0, 15)
@ WS_IEEP_NAME_COLOR_LIME
RGB(7, 15, 0)
@ WS_IEEP_NAME_COLOR_PINK
RGB(15, 0, 15)
@ WS_IEEP_NAME_COLOR_CYAN
RGB(0, 15, 15)
@ WS_IEEP_NAME_COLOR_PURPLE
RGB(7, 0, 15)
@ WS_IEEP_NAME_COLOR_TEAL
RGB(0, 15, 7)
@ WS_IEEP_NAME_COLOR_YELLOW
RGB(15, 15, 0)
@ WS_IEEP_NAME_COLOR_SEABLUE
RGB(0, 7, 15)
@ WS_IEEP_NAME_COLOR_ORANGE
RGB(15, 7, 0)
void ws_ieep_read_owner_name(uint8_t *data)
Read the owner name, as raw data.
static void ws_ieep_set_protect(void)
Protect the non-cartridge area of the internal EEPROM.
static bool ws_ieep_is_protected(void)
Check if the non-cartridge area of the internal EEPROM is currently protected.
void ws_ieep_read_owner_name_ascii(char *str)
Read the owner name, as an ASCII string.
uint16_t ws_ieep_name_color_to_rgb(uint8_t value)
Convert a given name color to its RGB value.
bool ws_eeprom_write_lock(ws_eeprom_handle_t handle)
Lock the EEPROM, preventing writes and erases.
void ws_eeprom_read_data(ws_eeprom_handle_t handle, uint16_t address, uint8_t *data, uint16_t length)
Read bytes from the EEPROM.
bool ws_eeprom_erase_word(ws_eeprom_handle_t handle, uint16_t address)
Erase a word from the EEPROM, setting it to 0xFFFF.
bool ws_eeprom_write_unlock(ws_eeprom_handle_t handle)
Unlock the EEPROM, allowing writes and erases.
uint8_t ws_eeprom_read_byte(ws_eeprom_handle_t handle, uint16_t address)
Read a byte from the EEPROM.
bool ws_eeprom_write_word(ws_eeprom_handle_t handle, uint16_t address, uint16_t value)
Write a word to the EEPROM.
uint16_t ws_eeprom_read_word(ws_eeprom_handle_t handle, uint16_t address)
Read an aligned word from the EEPROM.
static ws_eeprom_handle_t ws_eeprom_handle_cartridge(uint8_t bits)
ws_eeprom_handle_t ws_eeprom_handle_internal(void)
#define WS_IEEP_CTRL_PORT
#define WS_IEEP_CTRL_PROTECT