예제 #1
0
uint8 ICACHE_FLASH_ATTR read_sys_const(uint8 idx) {
#ifdef USE_FIX_SDK_FLASH_SIZE	
	return get_sys_const(idx);
#else	
	uint8 ret = 0xff;
	if (idx < MAX_IDX_SYS_CONST)
		spi_flash_read(esp_init_data_default_addr + idx, (uint32 *)&ret, 1);
	return ret;
#endif	
}
예제 #2
0
bool ICACHE_FLASH_ATTR write_sys_const(uint8 idx, uint8 data) {
	if (idx >= MAX_IDX_SYS_CONST)
		return false;
	uint32 faddr = esp_init_data_default_addr;
	if (get_sys_const(idx) != data) {
		uint8 * buf = rd_buf_sec_blk(faddr, SIZE_SAVE_SYS_CONST);
		if(buf != NULL) {
			buf[idx] = data;
			return wr_buf_sec_blk(faddr, SIZE_SAVE_SYS_CONST, buf);
		}
	}
	else return true;
	return false;
}