--- /dev/null
+/*
+ * OpenI2CRADIO
+ * Backlight Handler
+ * Copyright (C) 2013-08-31 K.Ohta <whatisthis.sowhat ai gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ * This library / program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; see the file COPYING. If not, write to the
+ * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this(includeed from sdcc) library
+ * with other files, some of which are compiled with SDCC,
+ * to produce an executable, this library does not by itself cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+#include "backlight.h"
+#include "idle.h"
+
+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
+}
+
--- /dev/null
+/*
+ * OpenI2CRADIO
+ * Backlight Handler
+ * Copyright (C) 2013-08-31 K.Ohta <whatisthis.sowhat ai gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ * This library / program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; see the file COPYING. If not, write to the
+ * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this(includeed from sdcc) library
+ * with other files, some of which are compiled with SDCC,
+ * to produce an executable, this library does not by itself cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+
+#ifndef BACKLIGHT_H
+#define BACKLIGHT_H
+#include "commondef.h"
+#include "ioports.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void lcd_setbacklight(unsigned char flag, unsigned char level);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BACKLIGHT_H */
+
}
}
-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)
{
ANSELC = AN_C_VAL;
TRISC = TRIS_C_VAL_O;
// lcd_backlightinit();
- io_intcountinit();
+// io_intcountinit();
}
#endif
extern void set_amfmlamp(unsigned char f);
extern void set_powerlamp(unsigned char f);
-extern void lcd_setbacklight(unsigned char flag, unsigned char level);
extern void keyin_ioinit(void);
extern void io_intcountinit(void);
extern void TMR3_set(void);
#include "power.h"
#include "adc_int.h"
#include "i2c_eeprom.h"
+#include "backlight.h"
+
/*
* Config words.
*/
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
# Source Files Quoted if spaced
-SOURCEFILES_QUOTED_IF_SPACED=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c i2c_eeprom.c
+SOURCEFILES_QUOTED_IF_SPACED=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c i2c_eeprom.c backlight.c
# Object Files Quoted if spaced
-OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/ui.p1 ${OBJECTDIR}/i2c_io.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/idle.p1 ${OBJECTDIR}/lcd_acm1602.p1 ${OBJECTDIR}/akc6955.p1 ${OBJECTDIR}/eeprom.p1 ${OBJECTDIR}/ioports.p1 ${OBJECTDIR}/menu.p1 ${OBJECTDIR}/power.p1 ${OBJECTDIR}/adc_int.p1 ${OBJECTDIR}/menu_defs.p1 ${OBJECTDIR}/eepromutil.p1 ${OBJECTDIR}/ui_updown.p1 ${OBJECTDIR}/ui_display.p1 ${OBJECTDIR}/radio_getstat.p1 ${OBJECTDIR}/helps.p1 ${OBJECTDIR}/menu_memoryfreq.p1 ${OBJECTDIR}/i2c_eeprom.p1
-POSSIBLE_DEPFILES=${OBJECTDIR}/ui.p1.d ${OBJECTDIR}/i2c_io.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/idle.p1.d ${OBJECTDIR}/lcd_acm1602.p1.d ${OBJECTDIR}/akc6955.p1.d ${OBJECTDIR}/eeprom.p1.d ${OBJECTDIR}/ioports.p1.d ${OBJECTDIR}/menu.p1.d ${OBJECTDIR}/power.p1.d ${OBJECTDIR}/adc_int.p1.d ${OBJECTDIR}/menu_defs.p1.d ${OBJECTDIR}/eepromutil.p1.d ${OBJECTDIR}/ui_updown.p1.d ${OBJECTDIR}/ui_display.p1.d ${OBJECTDIR}/radio_getstat.p1.d ${OBJECTDIR}/helps.p1.d ${OBJECTDIR}/menu_memoryfreq.p1.d ${OBJECTDIR}/i2c_eeprom.p1.d
+OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/ui.p1 ${OBJECTDIR}/i2c_io.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/idle.p1 ${OBJECTDIR}/lcd_acm1602.p1 ${OBJECTDIR}/akc6955.p1 ${OBJECTDIR}/eeprom.p1 ${OBJECTDIR}/ioports.p1 ${OBJECTDIR}/menu.p1 ${OBJECTDIR}/power.p1 ${OBJECTDIR}/adc_int.p1 ${OBJECTDIR}/menu_defs.p1 ${OBJECTDIR}/eepromutil.p1 ${OBJECTDIR}/ui_updown.p1 ${OBJECTDIR}/ui_display.p1 ${OBJECTDIR}/radio_getstat.p1 ${OBJECTDIR}/helps.p1 ${OBJECTDIR}/menu_memoryfreq.p1 ${OBJECTDIR}/i2c_eeprom.p1 ${OBJECTDIR}/backlight.p1
+POSSIBLE_DEPFILES=${OBJECTDIR}/ui.p1.d ${OBJECTDIR}/i2c_io.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/idle.p1.d ${OBJECTDIR}/lcd_acm1602.p1.d ${OBJECTDIR}/akc6955.p1.d ${OBJECTDIR}/eeprom.p1.d ${OBJECTDIR}/ioports.p1.d ${OBJECTDIR}/menu.p1.d ${OBJECTDIR}/power.p1.d ${OBJECTDIR}/adc_int.p1.d ${OBJECTDIR}/menu_defs.p1.d ${OBJECTDIR}/eepromutil.p1.d ${OBJECTDIR}/ui_updown.p1.d ${OBJECTDIR}/ui_display.p1.d ${OBJECTDIR}/radio_getstat.p1.d ${OBJECTDIR}/helps.p1.d ${OBJECTDIR}/menu_memoryfreq.p1.d ${OBJECTDIR}/i2c_eeprom.p1.d ${OBJECTDIR}/backlight.p1.d
# Object Files
-OBJECTFILES=${OBJECTDIR}/ui.p1 ${OBJECTDIR}/i2c_io.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/idle.p1 ${OBJECTDIR}/lcd_acm1602.p1 ${OBJECTDIR}/akc6955.p1 ${OBJECTDIR}/eeprom.p1 ${OBJECTDIR}/ioports.p1 ${OBJECTDIR}/menu.p1 ${OBJECTDIR}/power.p1 ${OBJECTDIR}/adc_int.p1 ${OBJECTDIR}/menu_defs.p1 ${OBJECTDIR}/eepromutil.p1 ${OBJECTDIR}/ui_updown.p1 ${OBJECTDIR}/ui_display.p1 ${OBJECTDIR}/radio_getstat.p1 ${OBJECTDIR}/helps.p1 ${OBJECTDIR}/menu_memoryfreq.p1 ${OBJECTDIR}/i2c_eeprom.p1
+OBJECTFILES=${OBJECTDIR}/ui.p1 ${OBJECTDIR}/i2c_io.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/idle.p1 ${OBJECTDIR}/lcd_acm1602.p1 ${OBJECTDIR}/akc6955.p1 ${OBJECTDIR}/eeprom.p1 ${OBJECTDIR}/ioports.p1 ${OBJECTDIR}/menu.p1 ${OBJECTDIR}/power.p1 ${OBJECTDIR}/adc_int.p1 ${OBJECTDIR}/menu_defs.p1 ${OBJECTDIR}/eepromutil.p1 ${OBJECTDIR}/ui_updown.p1 ${OBJECTDIR}/ui_display.p1 ${OBJECTDIR}/radio_getstat.p1 ${OBJECTDIR}/helps.p1 ${OBJECTDIR}/menu_memoryfreq.p1 ${OBJECTDIR}/i2c_eeprom.p1 ${OBJECTDIR}/backlight.p1
# Source Files
-SOURCEFILES=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c i2c_eeprom.c
+SOURCEFILES=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c i2c_eeprom.c backlight.c
CFLAGS=
@-${MV} ${OBJECTDIR}/i2c_eeprom.d ${OBJECTDIR}/i2c_eeprom.p1.d
@${FIXDEPS} ${OBJECTDIR}/i2c_eeprom.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
+${OBJECTDIR}/backlight.p1: backlight.c nbproject/Makefile-${CND_CONF}.mk
+ @${MKDIR} ${OBJECTDIR}
+ @${RM} ${OBJECTDIR}/backlight.p1.d
+ ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=require --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,-config,+clib,+plib --output=-mcof,+elf "--errformat=%f:%l: error: %s" "--warnformat=%f:%l: warning: %s" "--msgformat=%f:%l: advisory: %s" -o${OBJECTDIR}/backlight.p1 backlight.c
+ @-${MV} ${OBJECTDIR}/backlight.d ${OBJECTDIR}/backlight.p1.d
+ @${FIXDEPS} ${OBJECTDIR}/backlight.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
+
else
${OBJECTDIR}/ui.p1: ui.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@-${MV} ${OBJECTDIR}/i2c_eeprom.d ${OBJECTDIR}/i2c_eeprom.p1.d
@${FIXDEPS} ${OBJECTDIR}/i2c_eeprom.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
+${OBJECTDIR}/backlight.p1: backlight.c nbproject/Makefile-${CND_CONF}.mk
+ @${MKDIR} ${OBJECTDIR}
+ @${RM} ${OBJECTDIR}/backlight.p1.d
+ ${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=require --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,-config,+clib,+plib --output=-mcof,+elf "--errformat=%f:%l: error: %s" "--warnformat=%f:%l: warning: %s" "--msgformat=%f:%l: advisory: %s" -o${OBJECTDIR}/backlight.p1 backlight.c
+ @-${MV} ${OBJECTDIR}/backlight.d ${OBJECTDIR}/backlight.p1.d
+ @${FIXDEPS} ${OBJECTDIR}/backlight.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
+
endif
# ------------------------------------------------------------------------------------
#
-#Mon Aug 26 22:10:14 JST 2013
+#Sat Aug 31 18:35:05 JST 2013
default.languagetoolchain.dir=/opt/microchip/xc8/v1.20/bin
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=1c49f19f6a43b876c317e0d8d41c0854
default.languagetoolchain.version=1.20
<itemPath>iodef_amp.h</itemPath>
<itemPath>i2c_eeprom.c</itemPath>
<itemPath>i2c_eeprom.h</itemPath>
+ <itemPath>backlight.c</itemPath>
+ <itemPath>backlight.h</itemPath>
</logicalFolder>
<sourceRootList>
<Elem>/usr/local/share/sdcc/lib/src/pic16/libc</Elem>
#include "lcd_acm1602.h"
#include "power.h"
#include "menu.h"
+#include "backlight.h"
/*
* Detect reset condition.
#include "menu_memoryfreq.h"
#include "power.h"
#include "adc_int.h"
+#include "backlight.h"
static void setfreq_updown_amsub(void)
{