• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

Commit MetaInfo

Révision5dcc4ad6b7aeb3a8db5a084259417869a4206ed1 (tree)
l'heure2013-06-11 12:03:55
AuteurK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Message de Log

[Tuner] Re-order functions.

Change Summary

Modification

--- a/akc6955.c
+++ b/akc6955.c
@@ -94,14 +94,26 @@ void akc6955_do_tune(void)
9494 akc6955_writecmd(AKC6955_POWER, b);
9595 }
9696
97-unsigned int akc6955_set_tune(unsigned char mode_3k, unsigned int ch)
97+unsigned char akc6955_tune(void)
98+{
99+ unsigned char b;
100+ b = akc6955_readcmd(AKC6955_RCH_HI) & 0x20;
101+ if(b == 0x00) {
102+ return 0;
103+ } else {
104+ return 0xff;
105+ }
106+}
107+
108+
109+void akc6955_set_tune(unsigned char mode_3k, unsigned int ch)
98110 {
99111 unsigned char band;
100112 unsigned char fm;
101113 unsigned char b;
102114 unsigned int i;
103115
104- i = ch & 0x1fff;
116+ i = ch;
105117 fm = akc6955_readcmd(AKC6955_POWER) & 0x40;
106118 if(fm == 0){
107119 // AM
@@ -113,8 +125,9 @@ unsigned int akc6955_set_tune(unsigned char mode_3k, unsigned int ch)
113125 // BAND=AM && MW2
114126 i = (i / 3) * 3;
115127 }
116- if(i < 0) i = 0;
117128 if(i > 0x1fff) i = 0x1fff;
129+ //i = ch & 0x1fff;
130+
118131 if(mode_3k == 0){
119132 b = ((i >> 8) & 0x1f) | 0x40; // 32.768KHz clock
120133 } else {
@@ -124,12 +137,15 @@ unsigned int akc6955_set_tune(unsigned char mode_3k, unsigned int ch)
124137 b = i & 0xff;
125138 akc6955_writecmd(AKC6955_CH_LO, b);
126139 akc6955_do_tune();
140+ do{
141+ // Use software-delay, but recommands hardware-delay ;-(
142+ delay1ktcy(100); // Wait 100000 cycles = 12.5ms
143+ } while(akc6955_tune() == 0);
127144 }
128145
129146 void akc6955_do_scan(unsigned char up)
130147 {
131148 unsigned char b;
132- unsigned char m;
133149 akc6955_do_tune();
134150 b = akc6955_readcmd(AKC6955_POWER);
135151 b &= 0xe3;
@@ -186,9 +202,8 @@ unsigned int akc6955_get_freq(void)
186202 void akc6955_set_freq(unsigned int freq)
187203 {
188204 unsigned int ch;
189- unsigned char b;
190205 unsigned char fm;
191- unsigned char mode3k;
206+ unsigned char mode3k = 0;
192207
193208 fm = akc6955_readcmd(AKC6955_POWER) & 0x40;
194209 if(fm != 0) { // FM
@@ -206,16 +221,6 @@ void akc6955_set_freq(unsigned int freq)
206221 akc6955_set_tune(mode3k, ch);
207222 }
208223
209-unsigned char akc6955_tune(void)
210-{
211- unsigned char b;
212- b = akc6955_readcmd(AKC6955_RCH_HI) & 0x20;
213- if(b == 0x00) {
214- return 0;
215- } else {
216- return 0xff;
217- }
218-}
219224
220225 unsigned char akc6955_get_cnr(void)
221226 {
@@ -264,10 +269,6 @@ unsigned int akc6955_up_freq(unsigned int step)
264269 freq = akc6955_get_freq();
265270 freq += step;
266271 akc6955_set_freq(freq);
267- do{
268- // Use software-delay, but recommands hardware-delay ;-(
269- delay1ktcy(100); // Wait 100000 cycles = 12.5ms
270- } while(akc6955_tune() == 0);
271272 return akc6955_get_freq();
272273 }
273274
@@ -279,9 +280,5 @@ unsigned int akc6955_down_freq(unsigned int step)
279280 if(freq <= step) return freq;
280281 freq -= step;
281282 akc6955_set_freq(freq);
282- do{
283- // Use software-delay, but recommands hardware-delay ;-(
284- delay1ktcy(100); // Wait 100000 cycles = 12.5ms
285- } while(akc6955_tune() == 0);
286283 return akc6955_get_freq();
287284 }