File lt_flash.h
File List > api > lt_flash.h
Go to the documentation of this file.
/* Copyright (c) Kuba Szczodrzyński 2023-03-09. */
#pragma once
#include <libretiny.h>
typedef struct {
uint8_t manufacturer_id;
uint8_t chip_id;
uint8_t chip_size_id;
} lt_flash_id_t;
lt_flash_id_t lt_flash_get_id();
uint32_t lt_flash_get_size();
bool lt_flash_erase(uint32_t offset, size_t length);
bool lt_flash_erase_block(uint32_t offset);
uint32_t lt_flash_read(uint32_t offset, uint8_t *data, size_t length);
uint32_t lt_flash_write(uint32_t offset, const uint8_t *data, size_t length);