firmware/user.c
changeset 25 96f051df5d60
parent 2 2f55e5dd591d
     1.1 --- a/firmware/user.c	Fri Jun 27 18:09:13 2008 +0200
     1.2 +++ b/firmware/user.c	Sat Jul 26 14:22:38 2008 +0200
     1.3 @@ -86,6 +86,9 @@
     1.4  unsigned char	gg_pwm1dc	= 0x00;
     1.5  unsigned char	gg_mode		= MODE_UNMANAGED;
     1.6  
     1.7 +unsigned char	ee_display;
     1.8 +unsigned char	ee_features;
     1.9 +
    1.10  unsigned char	nKeys1, nKeys2;
    1.11  unsigned char	oKeys1, oKeys2;
    1.12  unsigned char	dKeys1, dKeys2;
    1.13 @@ -110,6 +113,10 @@
    1.14  	// make sure, PC wont start...
    1.15  	PIN_POWER	= 0;
    1.16  
    1.17 +	// read saved settings
    1.18 +	ee_display 		= Read_b_eep (EE_ADDR_DISPLAY);
    1.19 +	ee_features		= Read_b_eep (EE_ADDR_FEATURES);
    1.20 +
    1.21  
    1.22  	// reset INT settings...
    1.23  	INTCON			= 0x00;	// first disable all ints..
    1.24 @@ -133,16 +140,22 @@
    1.25  	INTCON2bits.RBIP	= 0;	//make this a low-priority-interrupt
    1.26  	PIN_I2C_INT			= 1;	//switch pin to high-level (doesnt really work.. its an open collector. BUT i've got pullups)
    1.27  	DDR_I2C_INT			= 1;	//woo woo! this one has to be an input, for interrupts to work
    1.28 -	nKeys1 				= 0xFF - LDByteReadI2C(pcf8574A_1);		// make sure to reset i2c_int... just in case...
    1.29 -	oKeys1				= nKeys1;
    1.30 -	nKeys2				= 0xFF - LDByteReadI2C(pcf8574A_2);
    1.31 -	oKeys2				= nKeys2;
    1.32 +	if (ee_features && 0x01)
    1.33 +	{
    1.34 +		nKeys1 				= 0xFF - LDByteReadI2C(pcf8574A_1);		// make sure to reset i2c_int... just in case...
    1.35 +		oKeys1				= nKeys1;
    1.36 +		nKeys2				= 0xFF - LDByteReadI2C(pcf8574A_2);
    1.37 +		oKeys2				= nKeys2;
    1.38 +	}
    1.39  	INTCONbits.RBIF		= 0;	// then clear the flag!
    1.40  	INTCONbits.RBIE		= 1;	// Activate PortB interrupts
    1.41  
    1.42  
    1.43  	// enable alarm
    1.44 -	LDByteWriteI2C(pcf8583,0x00,0x04);
    1.45 +	if (ee_features && 0x00)
    1.46 +	{
    1.47 +		LDByteWriteI2C(pcf8583,0x00,0x04);
    1.48 +	}
    1.49  
    1.50  
    1.51  	// Timer3 acts as 'event-ticker'
    1.52 @@ -181,8 +194,11 @@
    1.53  
    1.54  
    1.55  	// init & clear Display
    1.56 -	lcd_InitDisplay();			
    1.57 -	lcd_InitDisplay();			// ugly workaround...
    1.58 +	if (ee_display)
    1.59 +	{
    1.60 +		lcd_InitDisplay();			
    1.61 +		lcd_InitDisplay();			// ugly workaround...
    1.62 +	}
    1.63  }//end UserInit
    1.64  
    1.65