libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
Functions - EEPROM

Data Structures

struct  ws_eeprom_handle_t
 

Functions

ws_eeprom_handle_t ws_eeprom_handle_internal (void)
 
static ws_eeprom_handle_t ws_eeprom_handle_cartridge (uint8_t bits)
 
uint16_t ws_eeprom_read_word (ws_eeprom_handle_t handle, uint16_t address)
 Read an aligned word from the EEPROM.
 
uint8_t ws_eeprom_read_byte (ws_eeprom_handle_t handle, uint16_t address)
 Read a byte from the EEPROM.
 
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_write_word (ws_eeprom_handle_t handle, uint16_t address, uint16_t value)
 Write a word to 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_lock (ws_eeprom_handle_t handle)
 Lock the EEPROM, preventing writes and erases.
 
bool ws_eeprom_write_unlock (ws_eeprom_handle_t handle)
 Unlock the EEPROM, allowing writes and erases.
 

Detailed Description

Function Documentation

◆ ws_eeprom_erase_word()

bool ws_eeprom_erase_word ( ws_eeprom_handle_t handle,
uint16_t address )

Erase a word from the EEPROM, setting it to 0xFFFF.

Parameters
addressThe address to erase.
Returns
True if the erase was successful (no timeout).

◆ ws_eeprom_handle_cartridge()

static ws_eeprom_handle_t ws_eeprom_handle_cartridge ( uint8_t bits)
inlinestatic

Definition at line 47 of file eeprom.h.

◆ ws_eeprom_handle_internal()

ws_eeprom_handle_t ws_eeprom_handle_internal ( void )

◆ ws_eeprom_read_byte()

uint8_t ws_eeprom_read_byte ( ws_eeprom_handle_t handle,
uint16_t address )

Read a byte from the EEPROM.

Parameters
addressThe address to read from.
Returns
uint8_t The value read.

◆ ws_eeprom_read_data()

void ws_eeprom_read_data ( ws_eeprom_handle_t handle,
uint16_t address,
uint8_t * data,
uint16_t length )

Read bytes from the EEPROM.

Parameters
addressThe address to read from.
dataThe pointer to write to.
lengthThe number of bytes to read.

◆ ws_eeprom_read_word()

uint16_t ws_eeprom_read_word ( ws_eeprom_handle_t handle,
uint16_t address )

Read an aligned word from the EEPROM.

Parameters
addressThe address to read from. The lowest bit is ignored.
Returns
uint16_t The value read.

◆ ws_eeprom_write_lock()

bool ws_eeprom_write_lock ( ws_eeprom_handle_t handle)

Lock the EEPROM, preventing writes and erases.

Returns
True if the command was successful (no timeout).

◆ ws_eeprom_write_unlock()

bool ws_eeprom_write_unlock ( ws_eeprom_handle_t handle)

Unlock the EEPROM, allowing writes and erases.

◆ ws_eeprom_write_word()

bool ws_eeprom_write_word ( ws_eeprom_handle_t handle,
uint16_t address,
uint16_t value )

Write a word to the EEPROM.

Parameters
addressThe address to write to. The lowest bit is ignored.
valueThe word to write.
Returns
True if the write was successful (no timeout).