implement EEPROM emulation
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "app_buzzer.h"
|
||||
#include "app_heater.h"
|
||||
#include "cmsis_os2.h"
|
||||
#include "eeprom_emul.h"
|
||||
|
||||
static struct App {
|
||||
float oven_temp;
|
||||
@@ -84,6 +85,28 @@ static void redraw_display() {
|
||||
void app_task_main(void *argument)
|
||||
{
|
||||
PUTS("Main task\r\n");
|
||||
|
||||
/* test the persistent storage */
|
||||
EE_Init(EE_CONDITIONAL_ERASE);
|
||||
|
||||
uint32_t cnt = 0;
|
||||
EE_Status eest = EE_ReadVariable32bits(1, &cnt);
|
||||
|
||||
PRINTF("EE rd status %d, cnt %d\r\n", eest, cnt);
|
||||
|
||||
cnt++;
|
||||
|
||||
eest = EE_WriteVariable32bits(1, cnt);
|
||||
PRINTF("EE wr status %d\r\n", eest);
|
||||
if (eest == EE_CLEANUP_REQUIRED) {
|
||||
eest = EE_CleanUp();
|
||||
PRINTF("EE cleanup status %d\r\n", eest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
app_analog_init();
|
||||
app_buzzer_init();
|
||||
app_knob_init();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file crc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the CRC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "crc.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* CRC init function */
|
||||
void MX_CRC_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN CRC_Init 0 */
|
||||
|
||||
/* USER CODE END CRC_Init 0 */
|
||||
|
||||
/* Peripheral clock enable */
|
||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_CRC);
|
||||
|
||||
/* USER CODE BEGIN CRC_Init 1 */
|
||||
|
||||
/* USER CODE END CRC_Init 1 */
|
||||
/* USER CODE BEGIN CRC_Init 2 */
|
||||
|
||||
/* USER CODE END CRC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "adc.h"
|
||||
#include "crc.h"
|
||||
#include "dma.h"
|
||||
#include "iwdg.h"
|
||||
#include "spi.h"
|
||||
@@ -119,6 +120,7 @@ int main(void)
|
||||
MX_TIM3_Init();
|
||||
MX_SPI2_Init();
|
||||
MX_TIM1_Init();
|
||||
MX_CRC_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
PUTS("Start.\r\n");
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
bool EE_NMI_Callback();
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -74,6 +76,10 @@ void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
if (EE_NMI_Callback()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
while (1)
|
||||
|
||||
Reference in New Issue
Block a user