OSDN Git Service

[UI][USERBAND][SAVE] Save userbands to external eeprom.
[openi2cradio/OpenI2CRadio.git] / ioports.c
index 77a9eab..1301222 100644 (file)
--- a/ioports.c
+++ b/ioports.c
@@ -70,67 +70,6 @@ void set_powerlamp(unsigned char f)
     }
 }
 
-void lcd_setbacklight(unsigned char flag, unsigned char level)
-{
-    __bitops_t  b;
-    __bitops_t d;
-#if 0
-    d.byte = _LCD_BACKLIGHT_TRIS;
-    d._LCD_BACKLIGHT_BIT = 0;
-   _LCD_BACKLIGHT_TRIS = d.byte;
-
-    b.byte = _LCD_BACKLIGHT;
-    b._LCD_BACKLIGHT_BIT = 0;
-    if(flag != 0){
-       b._LCD_BACKLIGHT_BIT = 1;
-    }
-    _LCD_BACKLIGHT = b.byte;
-#else
-    if(flag == 0) {
-        d.byte = _LCD_BACKLIGHT_TRIS;
-        d._LCD_BACKLIGHT_BIT = 1;
-        _LCD_BACKLIGHT_TRIS = d.byte;
-        PSTRCONbits.STRA = 0;
-        T2CONbits.TMR2ON = 0;
-        TMR2 = 0x00;
-        CCP2CON = 0x00;
-        CCPR2L = 0;
-        CCPR2H = 0;
-    } else {
-      unsigned char h,l;
-//      lv = level;
-//      lv <<= 2;
-//      level = (level * 25) / 10;
-//      level = 255;
-      h = level >> 1;
-      if(h == CCPR1L) return;
- //     l = 2 << 4; //(lv & 0x0300) >> 4;
-      d.byte = _LCD_BACKLIGHT_TRIS;
-      d._LCD_BACKLIGHT_BIT = 1;
-      _LCD_BACKLIGHT_TRIS = d.byte;
-      //PSTRCON = 0;
-      CCPR2L = h;
-      CCPR2H = h;
-      b.b2 = 1;
-      b.b3 = 1;
-      CCP2CON = b.byte;
-      PR2 = 50;
-      PIR1bits.TMR2IF = 0;
-      T2CON = 0b01111000; // Pre-scaler=1/1,Post-scaler = 1/16
-      // -> Freq = 2.44KHz * 16 = 39.4KHz.
-      TMR2 = 0x00;
-      T2CONbits.TMR2ON = 1;
-      do {
-          idle_time_ms(1);
-      } while(PIR1bits.TMR2IF ==0);
-      d.byte = _LCD_BACKLIGHT_TRIS;
-      d._LCD_BACKLIGHT_BIT = 0;
-      _LCD_BACKLIGHT_TRIS = d.byte;
-
-//      _LCD_PORT |= _LCD_BACKLIGHT;
-    }
-#endif
-}
 
 void TMR3_set(void)
 {
@@ -154,25 +93,11 @@ void io_intcountinit(void)
     TMR3_set();
 }
 
-void lcd_backlightinit(void)
-{
-#if 0
-    PSTRCON = 0b00000001; // P1A = PWM, P1B~P1D=PORT, Steeling sync to PWM.
-    CCP1CON = 0b00001100; // PWM, Low-Active.
-    ECCP1AS = 0b10000111; // Auto shutdown is disabled
-    // Use TMR2 as source.
-    PIE1   &= ~0b00000010; // TMR2 Interrupt disabled.
-    PIR1   &= ~0b00000010; // TMR2 Interrupt clear.
-    IPR1   &= ~0b00000010; // Priority = LOW
-    T2CON   = 0b00000011; // Prescaler/Postscaler = 1:1, Temporally disabled TMR2.
-    TMR2 = 0x00; // Value;
-    PR2 = 0x65; // 19.61KHz
-    CCPR1L = 100; // Duty = 100;
-#endif
-}
 
 
-#if defined(pic18f23k22) || defined(pic18f24k22) || defined(pic18f25k22) || defined(pic18f26k22)
+#if defined(pic18f23k22) || defined(pic18f24k22) || defined(pic18f25k22) || defined(pic18f26k22) || \
+    defined(_18F23K22)  || defined(_18F24K22)  || defined(_18F25K22)  || defined(_18F26K22)
+
 /*
  * For 28Pin PIC(18F2xK22), I2C lcd using.
  */
@@ -195,11 +120,13 @@ void keyin_ioinit(void)
     ANSELC = AN_C_VAL;
     TRISC = TRIS_C_VAL_O;
  //   lcd_backlightinit();
-    io_intcountinit();
+//    io_intcountinit();
 }
 #endif
 
-#if defined(pic18f23k20) || defined(pic18f24k20) || defined(pic18f25k20) || defined(pic18f26k20)
+#if defined(pic18f23k20) || defined(pic18f24k20) || defined(pic18f25k20) || defined(pic18f26k20) || \
+    defined(_18F23K20)  || defined(_18F24K20)  || defined(_18F25K20)  || defined(_18F26K20)
+
 /*
  * For 28Pin PIC(18F2xK20), I2C lcd using.
  */
@@ -225,7 +152,9 @@ void keyin_ioinit(void)
 }
 #endif
 
-#if defined(pic18f43k20) || defined(pic18f44k20) || defined(pic18f45k20) || defined(pic18f46k20)
+#if defined(pic18f43k20) || defined(pic18f44k20) || defined(pic18f45k20) || defined(pic18f46k20) || \
+    defined(_18F43K20)  || defined(_18F44K20)  || defined(_18F45K20)  || defined(_18F46K20)
+
 /*
  * For 40Pin PIC(18F4xK20), paralell or I2C lcd using.
  */