#include <p24FJ64GA002.h>
#include "types.h"
#include "table.h"
#include "libeeprom.h"
#include "libuart.h"
#include "libvideo.h"
#include "ssm.h"
#include "main.h"
#include "extmeter.h"
#include "screen.h"
#include "config.h"
データ構造 | |
struct | CONFIG |
型定義 | |
typedef struct CONFIG | CONFIG_T |
typedef CONFIG_T * | pCONFIG_T |
関数 | |
BOOL | CONFIG_init (void) |
BOOL | CONFIG_save (void) |
BOOL | CONFIG_load (void) |
void | CONFIG_dump_config (void) |
void CONFIG_dump_config | ( | void | ) |
参照先 CONFIG::ptr, CONFIG::size, UART1_get_sendbuf(), UART1_putch(), と UART1_puthex().
{ unsigned char *ptr; unsigned int i, j; for(i = 0; config[i].size != NULL; i++){ ptr = config[i].ptr; UART1_puthex(i); UART1_puthex(config[i].size); UART1_putch(' '); for(j = 0; j < config[i].size; j++){ ClrWdt(); UART1_puthex(*ptr); UART1_putch(' '); ptr++; while(UART1_get_sendbuf() < 10); } UART1_putch('¥r'); UART1_putch('¥n'); } return; }
BOOL CONFIG_load | ( | void | ) |
参照先 EEPROM_read(), FALSE, CONFIG::ptr, CONFIG::size, と TRUE.
参照元 main().
{ unsigned char *target_ptr; unsigned int i, j, eeprom_ptr, checksum, verify, buf; eeprom_ptr = 0; /* チェックサムを確認する */ checksum = CONFIG_make_checksum(); verify = CONFIG_read_checksum(); /* チェックサムが異なるときはエラーを返す */ if(checksum != verify) return(FALSE); /* メモリに書き込む */ for(i = 0; config[i].size != 0; i++){ ClrWdt(); target_ptr = config[i].ptr; /* 保存対象の構造体を読込 */ for(j = 0; j < config[i].size; j++){ while((buf = EEPROM_read(eeprom_ptr)) == -1); *target_ptr = buf; target_ptr++; eeprom_ptr++; } } return(TRUE); }
BOOL CONFIG_save | ( | void | ) |
参照先 CONFIG::ptr, CONFIG::size, と TRUE.
参照元 SCREEN_main().
{ unsigned char *target_ptr; unsigned int i, j, eeprom_ptr, checksum; eeprom_ptr = 0; /* CONFIGリストの処理 */ for(i = 0; config[i].size != 0; i++){ ClrWdt(); target_ptr = config[i].ptr; /* 保存対象の構造体を書き込む */ for(j = 0; j < config[i].size; j++){ while(!CONFIG_write_and_verify(eeprom_ptr, *target_ptr)); target_ptr++; eeprom_ptr++; } } /* チェックサムの記録 */ checksum = CONFIG_make_checksum(); while(!CONFIG_write_and_verify(eeprom_ptr, (checksum >> 8))); eeprom_ptr++; while(!CONFIG_write_and_verify(eeprom_ptr, (checksum ))); return(TRUE); }