From 1d1f320cd8fea966ecf84f3cfec771374c82f338 Mon Sep 17 00:00:00 2001 From: mlalondesvn Date: Thu, 18 Oct 2007 01:30:26 +0000 Subject: [PATCH] General: MODIF - Moved all of the configurations out of the libraries and into the configs git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@7 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b --- configs/ds1337/ds1337.h | 37 +++++++++++++++ configs/ds1624/ds1624.h | 18 ++++++++ configs/ds1803/ds1803.h | 15 ++++++ configs/twiLCD/twiLCD.h | 53 +++++++++++++++++++++ ds1337/ds1337.cpp | 2 - ds1337/ds1337.h | 36 ++------------- ds1624/ds1624.cpp | 1 - ds1624/ds1624.h | 23 +-------- ds1803/ds1803.cpp | 6 ++- ds1803/ds1803.h | 100 +++++++++++++++++++++------------------- twiLCD/twiLCD.cpp | 2 - twiLCD/twiLCD.h | 14 +++--- twiLCD/twiLCDConfig.h | 45 ------------------ 13 files changed, 193 insertions(+), 159 deletions(-) create mode 100644 configs/ds1337/ds1337.h create mode 100644 configs/ds1624/ds1624.h create mode 100644 configs/ds1803/ds1803.h create mode 100644 configs/twiLCD/twiLCD.h delete mode 100644 twiLCD/twiLCDConfig.h diff --git a/configs/ds1337/ds1337.h b/configs/ds1337/ds1337.h new file mode 100644 index 0000000..0c14c42 --- /dev/null +++ b/configs/ds1337/ds1337.h @@ -0,0 +1,37 @@ +#ifndef DS1337_CONFIG +#define DS1337_CONFIG + + /** + * Define the DS1337 I2C addresses + **/ + #define DS1337_WADDR B01101000 /* 0x68 */ + + // Ucomment this to enable setting the clock from a + // unix time stamp with gmt and dst correction + #define DS1337_USE_SET_UTS + + // Uncomment this enable setting the clock using BCD + //#define DS1337_USE_BCD_CLOCKSET + + // Uncomment this if you need to read back unix time stamp (without DTS correction) + //#define DS1337_USE_GET_UTS + + // Uncomment this to support alarms + #define DS1337_USE_ALARMS + + #ifdef DS1337_USE_ALARMS + // Uncomment this to allow use external alarm interrupts + #define DS1337_USE_ALARM_INTERRUPTS + + // Uncomment this to allow alarm functions callback + #define DS1337_USE_ALARMS_CALLBACK + #endif + + // Uncomment this to use integrity check functions + //#define DS1337_USE_OSC_INTEGRITY + + // Uncomment this to support square wave output + // If this is enabled, alarm 2 will output it's interrupt on INTA + #define DS1337_USE_SQW_OUTPUT + +#endif diff --git a/configs/ds1624/ds1624.h b/configs/ds1624/ds1624.h new file mode 100644 index 0000000..f54c6b0 --- /dev/null +++ b/configs/ds1624/ds1624.h @@ -0,0 +1,18 @@ +#ifndef DS1624_CONFIG +#define DS1624_CONFIG + /** + * Address byte selection + * Select 0 for low and 1 for high + **/ + #define DS1624_A0 0 + #define DS1624_A1 0 + #define DS1624_A2 0 + + /** + * Comment this out if you don't want the + * init function to account for the ~1S startup + * delay for the first temperature sample! + **/ + #define DS1624_HANDLE_BOOT_DELAY + +#endif diff --git a/configs/ds1803/ds1803.h b/configs/ds1803/ds1803.h new file mode 100644 index 0000000..0d6edaf --- /dev/null +++ b/configs/ds1803/ds1803.h @@ -0,0 +1,15 @@ +#ifndef DS1803_CONFIG +#define DS1803_CONFIG + + /** + * Address byte selection + * Select 0 for low and 1 for high + **/ + #define DS1803_A0 0 + #define DS1803_A1 0 + #define DS1803_A2 0 + + // Uncomment this to use the the read back function + //#define DS1803_USE_GET_VALUE_FUNC + +#endif \ No newline at end of file diff --git a/configs/twiLCD/twiLCD.h b/configs/twiLCD/twiLCD.h new file mode 100644 index 0000000..683abb8 --- /dev/null +++ b/configs/twiLCD/twiLCD.h @@ -0,0 +1,53 @@ +#ifndef TWILCD_CONFIG +#define TWILCD_CONFIG + + /** + * Address byte selection + * Select 0 for low and 1 for high + **/ + #define PCF8574_A0 0 + #define PCF8574_A1 0 + #define PCF8574_A2 0 + + // Uncomment this to use minimal mode (less functions, not as big) + // #define TWI_LCD_SMALL + + #if defined(__AVR_ATmega168__) && !defined(TWI_LCD_SMALL) + // Uncomment this to enable use of a timeout after which the LCD turns off + #define TWI_LCD_USE_TIMEOUT + + #ifdef TWI_LCD_USE_TIMEOUT + #define TWI_LCD_TIMEOUT 5000 /* In milliseconds (30 sec) */ + #endif + + // Uncomment this to enable control of the backlight on pin 3 + #define TWI_LCD_CTRL + + #ifdef TWI_LCD_CTRL + // Uncomment this to use PWM for backlight control. + //#define TWI_LCD_BL_PWM + + #ifdef TWI_LCD_BL_PWM + // Set this to the default brightness for PWM controlled backlight + #define TWI_LCD_BL_LEVEL 255 + #endif + + #ifndef TWI_LCD_BL_PWM + // Uncomment this use the DS1803 digi-pot for display/backlight brightness + #define TWI_LCD_DPOT_CTRL + + #ifdef TWI_LCD_DPOT_CTRL + // Set this to the default value of the backlight (0 to 254) + #define TWI_LCD_BL_LEVEL 254 + + // Set this to the default value of the display brightness (0 to 254) + #define TWI_LCD_DB_LEVEL 225 + #endif + #endif + // End LCD Control + #endif + + // End Small version + #endif + +#endif diff --git a/ds1337/ds1337.cpp b/ds1337/ds1337.cpp index 3587a1b..ad1507d 100644 --- a/ds1337/ds1337.cpp +++ b/ds1337/ds1337.cpp @@ -2,8 +2,6 @@ extern "C" { #include } -#include "../global.h" -#include "../configs/RTC/rtcConfig.h" #include "ds1337.h" // Internal macro for storing month days! diff --git a/ds1337/ds1337.h b/ds1337/ds1337.h index f97e94e..de35cab 100644 --- a/ds1337/ds1337.h +++ b/ds1337/ds1337.h @@ -9,39 +9,9 @@ // include types & constants of Wiring core API #include "../global.h" -// include types & constants of Wire ic2 lib -#include - -// Include global RTC configs +#include "../global.h" #include "../configs/RTC/rtcConfig.h" - -// Ucomment this to enable setting the clock from a -// unix time stamp with gmt and dst correction -#define DS1337_USE_SET_UTS - -// Uncomment this enable setting the clock using BCD -//#define DS1337_USE_BCD_CLOCKSET - -// Uncomment this if you need to read back unix time stamp (without DTS correction) -//#define DS1337_USE_GET_UTS - -// Uncomment this to support alarms -#define DS1337_USE_ALARMS - -#ifdef DS1337_USE_ALARMS -// Uncomment this to allow use external alarm interrupts -#define DS1337_USE_ALARM_INTERRUPTS - -// Uncomment this to allow alarm functions callback -#define DS1337_USE_ALARMS_CALLBACK -#endif - -// Uncomment this to use integrity check functions -//#define DS1337_USE_OSC_INTEGRITY - -// Uncomment this to support square wave output -// If this is enabled, alarm 2 will output it's interrupt on INTA -#define DS1337_USE_SQW_OUTPUT +#include "../configs/ds1337/ds1337.h" /** * Define the position of the RTC buffer values @@ -68,7 +38,9 @@ /** * Define the DS1337 I2C addresses **/ +#ifndef DS1337_WADDR #define DS1337_WADDR 0x68 +#endif #define DS1337_RADDR DS1337_WADDR | 0x01 /** diff --git a/ds1624/ds1624.cpp b/ds1624/ds1624.cpp index 53cba46..4208035 100644 --- a/ds1624/ds1624.cpp +++ b/ds1624/ds1624.cpp @@ -2,7 +2,6 @@ extern "C" { #include } -#include "../global.h" #include "ds1624.h" DS1624::DS1624() diff --git a/ds1624/ds1624.h b/ds1624/ds1624.h index 930f2cb..7debde0 100644 --- a/ds1624/ds1624.h +++ b/ds1624/ds1624.h @@ -1,27 +1,8 @@ #ifndef DS1624_H #define DS1624_H -// include types & constants of Wiring core API -#include -#include - -// include types & constants of Wire ic2 lib -#include - -/** - * Comment this out if you don't want the - * init function to account for the ~1S startup - * delay for the first temperature sample! -**/ -#define DS1624_HANDLE_BOOT_DELAY - -/** - * Address byte selection - * Select 0 for low and 1 for high -**/ -#define DS1624_A0 0 -#define DS1624_A1 0 -#define DS1624_A2 0 +#include "../global.h" +#include "../configs/ds1624/ds1624.h" #define DS1624_BASE_ADDR B01001000 #define DS1624_ADDR DS1624_BASE_ADDR | (DS1624_A0 * B00000001) | (DS1624_A1 * B00000010) | (DS1624_A2 * B00000100) diff --git a/ds1803/ds1803.cpp b/ds1803/ds1803.cpp index 6e51d9e..6074292 100644 --- a/ds1803/ds1803.cpp +++ b/ds1803/ds1803.cpp @@ -3,6 +3,7 @@ extern "C" { } #include "../global.h" +#include "../configs/ds1803/ds1803.h" #include "ds1803.h" DS1803::DS1803() @@ -30,7 +31,8 @@ void DS1803::setWiper(uint8_t value, uint8_t wiperAddr) Wire.endTransmission(); } -/* + +#ifdef DS1803_USE_GET_VALUE_FUNC uint8_t DS1803::getValue() { if (!Wire.checkAddress(DS1803_WADDR)) return; @@ -43,4 +45,4 @@ uint8_t DS1803::getValue() return 0; } -*/ +#endif diff --git a/ds1803/ds1803.h b/ds1803/ds1803.h index e15c791..d8ff0e4 100644 --- a/ds1803/ds1803.h +++ b/ds1803/ds1803.h @@ -1,53 +1,57 @@ #ifndef DS1803_H #define DS1803_H + #include + #include "../configs/ds1803/ds1803.h" -#include - -/** - * Address byte selection - * Select 0 for low and 1 for high -**/ -#define DS1803_A0 0 -#define DS1803_A1 0 -#define DS1803_A2 0 - -#define DS1803_BASE_ADDR B00101000 -#define DS1803_WADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100) -#define DS1803_RADDR DS1803_WADDR | 0x01 - -/** - * The number of available potentiometer wipers -**/ -#define DS1803_NBR_WIPERS 0x02 - -/** - * Digital pot selection commands -**/ -#define DS1803_WIPERS B10101111 -#define DS1803_WIPER_0 B10101001 -#define DS1803_WIPER_1 B10101010 - -/** - * Macros -**/ -#define setWiper1(value) setWiper(value, DS1803_WIPER_0) -#define setWiper2(value) setWiper(value, DS1803_WIPER_1) -#define setWipers(value) setWiper(value, DS1803_WIPERS) - -/** - * DS1803 I2C Dual Digital Pot. -**/ -class DS1803 -{ - public: - DS1803(); - void setWiper(uint8_t, uint8_t); - //uint8_t getValue(); -}; - -/** - * Define the object's name -**/ -extern DS1803 DPOT; +#ifdef DS1803_A0 + #define DS1803_A0 0 +#endif +#ifdef DS1803_A1 + #define DS1803_A1 0 +#endif +#ifdef DS1803_A2 + #define DS1803_A2 0 +#endif + + #define DS1803_BASE_ADDR B00101000 + #define DS1803_WADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100) + #define DS1803_RADDR DS1803_WADDR | 0x01 + + /** + * The number of available potentiometer wipers + **/ + #define DS1803_NBR_WIPERS 0x02 + + /** + * Digital pot selection commands + **/ + #define DS1803_WIPERS B10101111 + #define DS1803_WIPER_0 B10101001 + #define DS1803_WIPER_1 B10101010 + + /** + * Macros + **/ + #define setWiper1(value) setWiper(value, DS1803_WIPER_0) + #define setWiper2(value) setWiper(value, DS1803_WIPER_1) + #define setWipers(value) setWiper(value, DS1803_WIPERS) + + /** + * DS1803 I2C Dual Digital Pot. + **/ + class DS1803 + { + public: + DS1803(); + void setWiper(uint8_t, uint8_t); + #ifdef DS1803_USE_GET_VALUE_FUNC + uint8_t getValue(); + #endif + }; + + /** + * Define the object's name + **/ + extern DS1803 DPOT; #endif diff --git a/twiLCD/twiLCD.cpp b/twiLCD/twiLCD.cpp index 446e676..5a01c40 100644 --- a/twiLCD/twiLCD.cpp +++ b/twiLCD/twiLCD.cpp @@ -2,8 +2,6 @@ extern "C" { #include } -#include "../global.h" -#include "../configs/LCD/lcd.h" #include "twiLCD.h" #ifdef TWI_LCD_DPOT_CTRL diff --git a/twiLCD/twiLCD.h b/twiLCD/twiLCD.h index 51990d4..476f107 100644 --- a/twiLCD/twiLCD.h +++ b/twiLCD/twiLCD.h @@ -3,16 +3,18 @@ #include "../global.h" #include "../configs/LCD/lcd.h" - #include "twiLCDConfig.h" + #include "../configs/twiLCD/twiLCD.h" - /** - * Address byte selection - * Select 0 for low and 1 for high - **/ +#ifndef PCF8574_A0 #define PCF8574_A0 0 +#endif +#ifndef PCF8574_A1 #define PCF8574_A1 0 +#endif +#ifndef PCF8574_A2 #define PCF8574_A2 0 - +#endif + #define PCF8574_BASE_ADDR B00100000 #define PCF8574_WADDR PCF8574_BASE_ADDR | (PCF8574_A0 * B00000001) | (PCF8574_A1 * B00000010) | (PCF8574_A2 * B00000100) #define PCF8574_RADDR PCF8574_WADDR | 0x01 diff --git a/twiLCD/twiLCDConfig.h b/twiLCD/twiLCDConfig.h deleted file mode 100644 index 8d5754f..0000000 --- a/twiLCD/twiLCDConfig.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef TWI_LCD_CONF_H -#define TWI_LCD_CONF_H - -// Uncomment this to use minimal mode (less functions, not as big) -// #define TWI_LCD_SMALL - -#if defined(__AVR_ATmega168__) && !defined(TWI_LCD_SMALL) - // Uncomment this to enable use of a timeout after which the LCD turns off - #define TWI_LCD_USE_TIMEOUT - -#ifdef TWI_LCD_USE_TIMEOUT - #define TWI_LCD_TIMEOUT 5000 /* In milliseconds (30 sec) */ -#endif - - // Uncomment this to enable control of the backlight on pin 3 - #define TWI_LCD_CTRL - -#ifdef TWI_LCD_CTRL - // Uncomment this to use PWM for backlight control. - //#define TWI_LCD_BL_PWM - -#ifdef TWI_LCD_BL_PWM - // Set this to the default brightness for PWM controlled backlight - #define TWI_LCD_BL_LEVEL 255 -#endif - -#ifndef TWI_LCD_BL_PWM - // Uncomment this use the DS1803 digi-pot for display/backlight brightness - #define TWI_LCD_DPOT_CTRL - -#ifdef TWI_LCD_DPOT_CTRL - // Set this to the default value of the backlight (0 to 254) - #define TWI_LCD_BL_LEVEL 254 - - // Set this to the default value of the display brightness (0 to 254) - #define TWI_LCD_DB_LEVEL 225 -#endif -#endif -// End LCD Control -#endif - -// End Small version -#endif - -#endif