|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
#include "stm32wlxx_hal.h"Go to the source code of this file.
Data Structures | |
| struct | flash_at25CS_t |
| Configuration and state descriptor for one AT25EU0041A flash chip. Pass a pointer to this struct to every flash_at25_XXX function. Populate the IN fields before calling flash_at25_Init(); the OUT fields are filled by the initialisation routine. More... | |
Macros | |
| #define | AT25_MANUFACTURER_ID 0x1F |
| #define | AT25_MEMSIZE (1<<19) |
Functions | |
| int8_t | flash_at25_Is (flash_at25CS_t *s, int8_t tryInit) |
| |
| HAL_StatusTypeDef | flash_at25_Init (flash_at25CS_t *s) |
| Initialization for AT25EU0041A flash chip Performs proper device identification and verification Suitable for frequent operations with improved error checking. | |
| HAL_StatusTypeDef | flash_at25_Read (const flash_at25CS_t *s, uint32_t addr, void *buffer, uint16_t size) |
| Fast read from flash memory Uses fast read command (0x0B) for improved performance in frequent read operations Includes boundary checking and ready state verification. | |
| HAL_StatusTypeDef | flash_at25_Write (const flash_at25CS_t *s, uint32_t addr, const void *data, uint16_t size) |
| Write to flash memory with sector preservation Handles page-aligned writes efficiently with proper verification Preserves existing data in flash sectors by reading, modifying, and writing back. | |
| #define AT25_MANUFACTURER_ID 0x1F |
Definition at line 23 of file flash_at25.h.
Referenced by flash_at25_Init().
| #define AT25_MEMSIZE (1<<19) |
Definition at line 24 of file flash_at25.h.
Referenced by flash_at25_Init(), and mens_MainBlockInit().
| HAL_StatusTypeDef flash_at25_Init | ( | flash_at25CS_t * | s | ) |
Initialization for AT25EU0041A flash chip Performs proper device identification and verification Suitable for frequent operations with improved error checking.
| s | Pointer to flash configuration structure |
| HAL_OK | if device identified correctly, HAL_ERROR otherwise |
Definition at line 98 of file flash_at25.c.
References AT25_MANUFACTURER_ID, AT25_MEMSIZE, CMD_READ_ID, flash_Select(), flash_Unselect(), flash_at25CS_t::Is, flash_at25CS_t::Size, and flash_at25CS_t::Spi.
Referenced by flash_at25_Is(), and mems_Init().
| int8_t flash_at25_Is | ( | flash_at25CS_t * | s, |
| int8_t | tryInit ) |
| tryInit | - in case sensor is not yet initialized, 1 - attempt to initialize again, 0 - no |
Definition at line 133 of file flash_at25.c.
References flash_at25_Init(), and flash_at25CS_t::Is.
| HAL_StatusTypeDef flash_at25_Read | ( | const flash_at25CS_t * | s, |
| uint32_t | addr, | ||
| void * | buffer, | ||
| uint16_t | size ) |
Fast read from flash memory Uses fast read command (0x0B) for improved performance in frequent read operations Includes boundary checking and ready state verification.
| s | Pointer to flash configuration structure |
| addr | Starting address to read from (24-bit address, 0x000000 to 0x07FFFF for 512KB) |
| buffer | Pointer to destination buffer |
| size | Number of bytes to read |
| HAL_OK | on success, HAL_ERROR on failure, HAL_TIMEOUT on timeout |
Definition at line 140 of file flash_at25.c.
References CMD_FAST_READ, flash_Select(), flash_Unselect(), flashNew_WaitReadyWithTimeout(), flash_at25CS_t::Is, and flash_at25CS_t::Spi.
Referenced by flash_at25_Write(), flash_WritePage(), mems_Check(), mems_GetLastData(), and mems_ReadMainBlock().
| HAL_StatusTypeDef flash_at25_Write | ( | const flash_at25CS_t * | s, |
| uint32_t | addr, | ||
| const void * | data, | ||
| uint16_t | size ) |
Write to flash memory with sector preservation Handles page-aligned writes efficiently with proper verification Preserves existing data in flash sectors by reading, modifying, and writing back.
This function implements a read-modify-write approach:
Handles sector boundaries automatically - if data crosses sector boundary, both sectors are processed
Includes boundary checking, write enable verification, and proper timeout handling
| s | Pointer to flash configuration structure |
| addr | Starting address to write to (24-bit address, 0x000000 to 0x07FFFF for 512KB) |
| data | Pointer to source data buffer |
| size | Number of bytes to write |
| HAL_OK | on success, HAL_ERROR on failure, HAL_TIMEOUT on timeout |
Definition at line 229 of file flash_at25.c.
References Error_Handler(), flash_at25_Read(), flash_WritePage(), and writeLog().
Referenced by mems_AddData(), mems_Reset(), and mems_WriteMainBlock().