2023-10-19 16:20:41 -07:00
|
|
|
/*
|
|
|
|
* flash.h: flashing user config and system option bytes
|
|
|
|
*
|
|
|
|
* file creation: 20231019 0129
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INC_FLASH_H
|
|
|
|
#define _INC_FLASH_H
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-21 16:44:31 -07:00
|
|
|
#define FLASH_HSI_4MHz (uint32_t *)0x1FFF0F1C
|
|
|
|
#define FLASH_HSI_8MHz (uint32_t *)0x1FFF0F30
|
|
|
|
#define FLASH_HSI_16MHz (uint32_t *)0x1FFF0F44
|
|
|
|
#define FLASH_HSI_22_12MHz (uint32_t *)0x1FFF0F58
|
|
|
|
#define FLASH_HSI_24MHz (uint32_t *)0x1FFF0F6C
|
|
|
|
|
2023-10-19 16:20:41 -07:00
|
|
|
|
2023-11-01 07:45:44 -07:00
|
|
|
#define UCONF_FLASH_SIZE 512
|
|
|
|
#define UCONF_FLASH_START (FLASH_END + 1) - UCONF_FLASH_SIZE
|
|
|
|
|
|
|
|
#define UCONF_SIZE 64 // size in bytes
|
|
|
|
#define UCONF_COUNT (UCONF_FLASH_SIZE / UCONF_SIZE)
|
|
|
|
|
|
|
|
#define UCONF_KEY 0x3713
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct UConf {
|
|
|
|
uint16_t conf_key; // should read 0x3713
|
|
|
|
uint8_t cont_buzzer; // continuity buzzer on/off
|
|
|
|
uint8_t cont_sensitivity; // continuity sensitivity high/low
|
|
|
|
uint16_t cont_shorted; // ADC counts when probes shorted in continuity mode
|
|
|
|
uint16_t diode_shorted; // unused, unneeded
|
|
|
|
uint32_t rsvd_1[4];
|
|
|
|
uint32_t rsvd_2[8];
|
2023-11-01 10:15:18 -07:00
|
|
|
uint32_t update_cntr; // increment every update of config
|
2023-11-01 07:45:44 -07:00
|
|
|
uint32_t crc32; // CRC of preceding 60 bytes
|
|
|
|
} UConf; // 64 bytes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern struct UConf conf;
|
|
|
|
|
|
|
|
|
2023-10-19 16:20:41 -07:00
|
|
|
|
|
|
|
void flash_init();
|
|
|
|
|
2023-11-01 07:45:44 -07:00
|
|
|
void flash_load_conf();
|
|
|
|
void flash_commit_conf();
|
|
|
|
|
2023-10-19 16:20:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* _INC_FLASH_H */
|