OSDN Git Service

[Build] Add some sourcefiles.
[openi2cradio/OpenI2CRadio.git] / eepromutil.c
index 9fe5616..833a427 100644 (file)
@@ -101,7 +101,7 @@ unsigned int calcsum_frequencies(__freqset_t *p, unsigned int start)
  *  0x0fff : User frequencies ( 12*2*28 = 672chs Max.)
  *  0x1000- : Reserve.
  */
-char load_frequencies(unsigned int page, unsigned char check_only)
+int load_frequencies(unsigned int page, unsigned char check_only)
 {
 
     __freqset_t *p;
@@ -213,7 +213,7 @@ static unsigned int calcsum_userband(__userband_t_t *p, unsigned int start)
     return sum;
 }
 
-char load_userbands(void)
+int load_userbands(void)
 {
 
     __userband_t_t *p = &userband;
@@ -242,7 +242,7 @@ void save_userbands(void)
     unsigned int sum;
 
     // Pass 0 Calc checksum
-    userband.magic = EEPROM_FREQSET_MAGIC;
+    userband.magic = EEPROM_BANDSET_MAGIC;
     userband.version = 0x0001;
     sum = calcsum_userband(&userband, 0x5a5a);
     userband.checksum = sum;
@@ -257,15 +257,15 @@ void format_userbands(void)
    for(i = 0; i < USER_BAND_NUM; i++) {
        userband.am_usrbands[i].start = 0x19;
         userband.am_usrbands[i].stop = 0x32;
-        userband.am_usrbands[i].freq = 1216; //0x32 - (0x32-0x19) / 2 *32
+        userband.am_usrbands[i].freq = 5600; //(0x32 - (0x32-0x19) / 2 *32) * 5
         userband.am_usrbands[i].mode3k = 0;
-   }
-   for(i = 0; i < USER_BAND_NUM; i++) {
+        //
        userband.fm_usrbands[i].start = 0x19;
         userband.fm_usrbands[i].stop = 0x32;
-        userband.fm_usrbands[i].freq = 1216; //0x32 - (0x32-0x19) / 2 *32
+        userband.fm_usrbands[i].freq = 8600;
         userband.fm_usrbands[i].mode3k = 0;
    }
+   save_userbands(); // Re-init
 }
 
 
@@ -300,10 +300,10 @@ unsigned char load_eeprom(void)
 static void check_eeprom_sub(void)
 {
  _CLS();
- _LOCATE(0,0);
+ _LOCATE_0_0();
  printstr("Formatting...  ");
  format_eeprom(2,250);
- _LOCATE(0,0);
+ _LOCATE_0_0();
  printstr("Save defaults  ");
  setdefault();
  save_eeprom();
@@ -316,12 +316,12 @@ void check_eeprom(void)
 
     switch(load_eeprom()) {
         case 0x01: // No magic-word
-            idle_time_ms(2000);
+//            idle_time_ms(2000);
             c = printhelp_2lines("EEPROM FORMAT", "Press any key");
             check_eeprom_sub();
             break;
         case 0x00: // Checksum error
-           idle_time_ms(2000);
+//           idle_time_ms(2000);
             c = printhelp_2lines("X-) Sum error", "Press any key");
             check_eeprom_sub();
             break;