|
STC15W408AS library 0.13.0
|
Macros | |
| #define | OP_TRIGGER_SEQ_FIRST_BYTE 0x5A |
| Read operation trigger sequence first byte. | |
| #define | OP_TRIGGER_SEQ_SECOND_BYTE 0xA5 |
| Read operation trigger sequence second byte. | |
| #define | CMD_FAIL_BIT 4 |
| Command fail error code. | |
| #define | ERROR_VALUE 0xFF |
| Error value. | |
| #define | eeprom_disable_iap() |
| Disables IAP. | |
| #define | get_eeprom_last_operation_result() (get_bit(IAP_CONTR, CMD_FAIL_BIT) ? CMD_FAIL_ERROR : CMD_SUCCESS) |
| get last operation result | |
| #define | eeprom_read_byte(addr_high, addr_low, value_ptr, error_ptr) |
| Reads single byte from the EEPROM at the given address. | |
| #define | eeprom_erase_page(sector_start_addr, error_ptr) |
| Erases a sector in the EEPROM starting from a specified address. | |
| #define | eeprom_write_byte(addr_high, addr_low, value, error_ptr) |
| Writes a single byte to the EEPROM at the specified address. | |
Enumerations | |
| enum | eeprom_operation_t { READ_OP = 0x01 , WRITE_OP = 0x02 , ERASE_OP = 0x03 } |
| EEPROM operation types. More... | |
| enum | eeprom_operation_status_t { CMD_SUCCESS = 0 , CMD_FAIL_ERROR = 1 , LOW_VOLTAGE_ERROR = 2 } |
| EEPROM operation status. More... | |
Functions and data structures related to EEPROM
| #define eeprom_disable_iap | ( | ) |
Disables IAP.
This function disables EEPROM operation via IAP registers and clear it.
| #define eeprom_erase_page | ( | sector_start_addr, | |
| error_ptr | |||
| ) |
Erases a sector in the EEPROM starting from a specified address.
This function performs an erase operation on a 512 bytes sector of the EEPROM memory. The sector is identified by its starting address. The function updates the error status via the provided error pointer.
| sector_start_addr | uint8_t The starting address of the EEPROM sector to be erased. Must be a valid sector start address. |
| error_ptr | Pointer to a uint8_t variable where the error status will be stored. Must not be NULL. 0 - no error, otherwise - error code. Error codes:
|
| #define eeprom_read_byte | ( | addr_high, | |
| addr_low, | |||
| value_ptr, | |||
| error_ptr | |||
| ) |
Reads single byte from the EEPROM at the given address.
This function performs a read operation from the EEPROM using the provided high and low bytes of the address. The data read from the EEPROM is stored in the location pointed to by 'value_ptr'. For reading from the EEPROM IAP registers are used.
| addr_high | uint8_t High byte of the EEPROM address to read from. |
| addr_low | uint8_t Low byte of the EEPROM address to read from. |
| value_ptr | Pointer to a uint8_t variable where the read value will be stored. Must not be NULL. If read operation fails, the value is set to ERROR_VALUE. |
| error_ptr | Pointer to a uint8_t variable where the error status will be stored. Must not be NULL. 0 - no error, otherwise - error code. Error codes:
|
| #define eeprom_write_byte | ( | addr_high, | |
| addr_low, | |||
| value, | |||
| error_ptr | |||
| ) |
Writes a single byte to the EEPROM at the specified address.
This function performs a byte write operation to the EEPROM memory using the given high and low bytes of the address. The value to be written is passed as an argument, and any error condition encountered during the operation is reported via the error pointer.
| addr_high | uint8_t High byte of the EEPROM address (bits 15-8). |
| addr_low | uint8_t Low byte of the EEPROM address (bits 7-0). |
| value | uint8_t The byte value to be written to EEPROM. |
| error_ptr | uint8_t* Pointer to a uint8_t variable where the error status will be stored: Must not be NULL. 0 - no error, otherwise - error code. Error codes:
|
| #define get_eeprom_last_operation_result | ( | ) | (get_bit(IAP_CONTR, CMD_FAIL_BIT) ? CMD_FAIL_ERROR : CMD_SUCCESS) |
get last operation result
Last operation result is stored in IAP_CONTR register and dont changed on low voltage error
| enum eeprom_operation_t |