前提:
自己规划 Partition table,要求 nvs 大小100KB,自定义参数区大小 100KB
目的:基于两个 task 实现如下功能(使用用NVS api)
1.1 task1 保存长度为 100 的字符串,形式为 “12345678901234567890…",然后通知 到 task2
1.2 task2 取出 task1 保存到数据,并按照 字符串打印出来
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "rom/ets_sys.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include <assert.h>
#include "esp_partition.h"
#include "esp_log.h"
#define MY_STRING_LEN 100
static EventGroupHandle_t receive_data_event;
const int CONNECTED_BIT = BIT0;
void vTask1( void *pvParameters )
{
char str[MY_STRING_LEN + 1] = {
0};
for (int i=0;i<MY_STRING_LEN;i++) {
str[i]=(</