Rev 9 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| Download
| RSS feed
/*
* nvram.h
*
* Created on: 4 Jun 2017, modified for STM32F1 series using 2 pages of Flash rather than NVRAM
* Author: Mike
*
* The design stores 8 bit data with an 8 bit tag value : this allows up to 253 different tags to be used (0x00 and 0xFF are reserved)
*
* In the application here, each element in a 10x10 ignition timing map is given its own tag, along with the rpm and vacuum axis values,
* and an overall timing correction tag.
*
*/
#pragma once
#include "stdint.h"
#if defined __cplusplus
extern "C"
{
#endif
#pragma pack(push, 1)
///\brief State of item
/// this is expected to be packed into 16 bits
typedef union
{
struct
{
unsigned tag : 8;
int val : 8;
} data;
uint16_t u16;
} nvram_info_t;
#pragma pack(pop)
// Save data according to its tag field
extern void write_nvram_data(nvram_info_t data);
// find data according to the tag field or return null if no info
extern nvram_info_t *find_nvram_data(uint8_t tag);
#if defined __cplusplus
}
#endif