One-time programmable slots holding factory data.
More...
|
| bool | otp_is_locked (const uint8_t index) |
| | Check whether the OTP storage is locked.
|
| |
| char * | otp_get_slot (const uint8_t index) |
| | Read a slot.
|
| |
| int | otp_write_slot (const uint8_t index, const char *value) |
| | Write a string to an unwritten slot.
|
| |
One-time programmable slots holding factory data.
Each slot holds a NUL-terminated string of up to 31 characters, stored in a flash security register. A slot can be written once.
char * otp_get_slot(const uint8_t index)
Read a slot.
@ OTP_SERIAL
Watch serial number.
Definition otp.h:27
◆ anonymous enum
OTP slot indexes.
| Enumerator |
|---|
| OTP_HWVER | Hardware version.
|
| OTP_SERIAL | Watch serial number.
|
| OTP_PCBA_SERIAL | PCBA serial number.
|
| NUM_OTP_SLOTS | Number of slots.
|
◆ otp_get_slot()
| char * otp_get_slot |
( |
const uint8_t |
index | ) |
|
Read a slot.
- Parameters
-
- Returns
- Slot contents, in a static buffer overwritten by the next read, or NULL on error. An unwritten slot reads as 0xFF bytes.
◆ otp_is_locked()
| bool otp_is_locked |
( |
const uint8_t |
index | ) |
|
Check whether the OTP storage is locked.
Locking applies to the whole security register holding the slots.
- Parameters
-
- Returns
- true if locked.
◆ otp_write_slot()
| int otp_write_slot |
( |
const uint8_t |
index, |
|
|
const char * |
value |
|
) |
| |
Write a string to an unwritten slot.
- Parameters
-
| index | Slot index. |
| value | NUL-terminated string, at most 31 characters. |
- Return values
-
| 0 | Written and verified. |
| -EEXIST | The slot already holds data. |
| -EINVAL | Invalid slot or value. |
| -EIO | The write failed or could not be verified. |