Пример #1
0
void save_mesin(void)
{
	printf("Save struct mesin ke flash ..");
	if(prepare_flash(SEKTOR_MESIN, SEKTOR_MESIN)) return;
	printf("..");
	
	if(hapus_flash(SEKTOR_MESIN, SEKTOR_MESIN)) return;
	printf("..");
	
	if(prepare_flash(SEKTOR_MESIN, SEKTOR_MESIN)) return;
	printf("..");
	
	if(tulis_flash(ALMT_MESIN, (unsigned short *) &mesin, sizeof (mesin))) return;
	printf(".. OK\r\n");
	
}
Пример #2
0
static int simpan_sfile( struct t_simpan_file *pgr) {
	printf(" Save struct SIMPAN_FILE ke flash ..");
	if(prepare_flash(SEKTOR_SFILE, SEKTOR_SFILE)) return -1;
	printf("..");
	
	if(hapus_flash(SEKTOR_SFILE, SEKTOR_SFILE)) return -1;
	printf("..");
	
	if(prepare_flash(SEKTOR_SFILE, SEKTOR_SFILE)) return -1;
	printf("..");
	
	if(tulis_flash(ALMT_SFILE, (unsigned short *) pgr, (sizeof (struct t_simpan_file)))) return -1;
	
	printf(".. OK\r\n");
	return 0;
}
Пример #3
0
static int simpan_env( struct t_env *pgr)
{
	printf(" Save struct GROUP ke flash ..");
	if(prepare_flash(SEKTOR_ENV, SEKTOR_ENV)) return -1;
	printf("..");
	
	if(hapus_flash(SEKTOR_ENV, SEKTOR_ENV)) return -1;
	printf("..");
	
	if(prepare_flash(SEKTOR_ENV, SEKTOR_ENV)) return -1;
	printf("..");
	
	if(tulis_flash(ALMT_ENV, (unsigned short *) pgr, (sizeof (struct t_group)))) return -1;
	
	printf(".. OK\r\n");
	return 0;
}