Changeset 67 in svn
- Timestamp:
- May 29, 2015 1:06:52 PM (11 years ago)
- File:
-
- 1 edited
-
branches/remocon/zasc/app_c/DST_Main.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/remocon/zasc/app_c/DST_Main.c
r64 r67 58 58 } 59 59 60 static unsigned int g_ir_code = 0; 61 static void IRCallback(unsigned int code, unsigned int repeat) 62 { 63 int i = 0; 64 unsigned int _code = 0; 65 for (i = 0; i < 32; i++) // ºñÆ® ¹ÝÀü 66 { 67 _code |= ((code >> i) & 0x1) << (31-i); 68 } 69 g_ir_code = _code; 70 unsigned int g_ir_repeat = (repeat == 85) ? 0 : 1; 71 DST_Printf("g_ir_code = 0x%X\n", g_ir_code); 72 } 73 74 static void SaveFlash(DS_U8* flash, unsigned int ir_code, unsigned int duration) 75 { 76 memset(flash, 0, 16); 77 flash[0] = 0xCA; 78 flash[1] = 0xFE; 79 flash[2] = 0xBA; 80 flash[3] = 0xBE; 81 flash[4] = 0x00; 82 flash[5] = (ir_code >> 24) & 0xFF; 83 flash[6] = (ir_code >> 16) & 0xFF; 84 flash[7] = (ir_code >> 8) & 0xFF; 85 flash[8] = (ir_code >> 0) & 0xFF; 86 flash[9] = duration & 0xFF; 87 DHL_Flash_Write(FLASH_CH_MAP_POS, 16, flash); 88 DST_Printf("SaveFlash ir_code = 0x%X duration = %d\n", ir_code, duration); 89 } 60 90 /*extern "C" */void Print_All_MemUnit(void); 61 91 void CT_ChMapUpdate(void); … … 93 123 // DST_CCManagerInit(); 94 124 // DST_UI_SetVolume(DST_EEPROM_GetVolume()); 125 IR_Open(IRCallback); 126 unsigned int ir_code = 0xFC030820; 127 unsigned int duration = 3; 128 129 DS_U8* flash = DHL_Flash_Read(FLASH_CH_MAP_POS, 16); 130 if (flash[0] == 0xCA && flash[1] == 0xFE && flash[2] == 0xBA && flash[3] == 0xBE && flash[4] == 0x00) 131 { 132 ir_code = flash[5] * 0x1000000 + flash[6] * 0x10000 + flash[7] * 0x100 + flash[8]; 133 duration = flash[9]; 134 DST_Printf("FLASH READ ir_code = 0x%X duration = %d\n", ir_code, duration); 135 } 136 else 137 { 138 DST_Printf("FLASH READ FAIL!! . SAVE DEFAULT VALUE ir_code = 0x%X duration = %d\n", ir_code, duration); 139 SaveFlash(flash, ir_code, duration); 140 } 141 142 unsigned int loop_count = 0; 95 143 while (1) 96 144 { 97 DST_OS_Delay(1000); 98 DS_U32 hour = 0, min = 0, sec = 0; 99 DST_OS_GetRunTime(&hour, &min, &sec); 100 DST_Printf("Current Time = %02d:%02d:%02d\n", (int)hour, (int)min, (int)sec); 101 // DST_OS_PrintMemUnit(); 102 DST_NEC_IR_Send(0x20, 0x08, 0x03); // CMB ¸®¸ðÄÜÀÇ Mute Ű 145 DST_OS_Delay(10); 146 if (g_ir_code == 0xFF003411) // POWER KEYPAD 147 { 148 g_ir_code = 0; 149 int i = 0; 150 for (i=0; i < 500; i++) // 5ÃÊ µ¿¾È Ű ÇнÀ 151 { 152 DST_OS_Delay(10); 153 if (g_ir_code == 0xFF003411) g_ir_code = 0; // POWER 154 if (g_ir_code == 0xF7083411) g_ir_code = 0; // CH+ 155 if (g_ir_code == 0xF6093411) g_ir_code = 0; // CH- 156 if (g_ir_code == 0) continue; 157 ir_code = g_ir_code; 158 DST_Printf("ir_code = 0x%X\n", ir_code); 159 // FLASH ¿¡ ÀúÀå 160 g_ir_code = 0; 161 SaveFlash(flash, ir_code, duration); 162 break; 163 } 164 continue; 165 } 166 if (g_ir_code == 0xF7083411) // CH+ 167 { 168 duration++; 169 if (duration > 15) duration = 15; 170 DST_Printf("duration = %d\n", duration); 171 g_ir_code = 0; 172 SaveFlash(flash, ir_code, duration); 173 } 174 if (g_ir_code == 0xF6093411) // CH- 175 { 176 duration--; 177 if (duration < 1) duration = 1; 178 DST_Printf("duration = %d\n", duration); 179 g_ir_code = 0; 180 SaveFlash(flash, ir_code, duration); 181 } 182 if (duration > 15) duration = 15; 183 if (duration < 1) duration = 1; 184 g_ir_code = 0; 185 //DS_U32 hour = 0, min = 0, sec = 0; 186 //DST_OS_GetRunTime(&hour, &min, &sec); 187 //DST_Printf("Current Time = %02d:%02d:%02d\n", (int)hour, (int)min, (int)sec); 188 // DST_OS_PrintMemUnit(); 189 //ir_code = 0xFC030820; 190 if (loop_count == 0) 191 { 192 DST_NEC_IR_Send(ir_code & 0xFF, (ir_code >>8) & 0xFF, (ir_code>>16) & 0xFF); // CMB ¸®¸ðÄÜÀÇ Mute Ű 193 194 DS_U32 hour = 0, min = 0, sec = 0; 195 DST_OS_GetRunTime(&hour, &min, &sec); 196 DST_Printf("Current Time = %02d:%02d:%02d\n", (int)hour, (int)min, (int)sec); 197 } 198 loop_count++; 199 if (loop_count > duration * 100) loop_count = 0; 103 200 #ifndef DSTAR 104 201 // m_report();
Note: See TracChangeset
for help on using the changeset viewer.
