X-Git-Url: http://git.kpe.io/?p=avr_serial_lcd.git;a=blobdiff_plain;f=serial_lcd.c;h=bef0e8c463f004adf5e54eed0adaaca9be901741;hp=75983d2d2b033b1952daba674a4b5576cf026a72;hb=HEAD;hpb=4e88dde09a30fd2105f3fc732cbe4f2edbc72244 diff --git a/serial_lcd.c b/serial_lcd.c index 75983d2..bef0e8c 100644 --- a/serial_lcd.c +++ b/serial_lcd.c @@ -25,13 +25,13 @@ #include "serial_lcd.h" #if defined(__GNUC__) -FUSES = { - .low = SUT1, - .high = (unsigned char) (DWEN & WDTON & RSTDISBL & BODLEVEL1 & BODLEVEL2), - .extended = EFUSE_DEFAULT, -}; +//FUSES = { +// .low = SUT1, + // .high = (unsigned char) (DWEN & WDTON & RSTDISBL & BODLEVEL1 & BODLEVEL2), + // .extended = EFUSE_DEFAULT, + //}; #endif - + // Number of PWM brightness levels supported #define LED_BRIGHTNESS_LEVELS 8 @@ -40,20 +40,20 @@ FUSES = { #define LCD_ON 0x0C // Clear display command #define LCD_CLR 0x01 -// Set 4 data bits -#define LCD_4_Bit 0x20 -// Set 8 data bits -#define LCD_8_Bit 0x30 -// Set number of lines -#define LCD_4_Line 0x08 +// Set 4 data bits +#define LCD_4_Bit 0x20 +// Set 8 data bits +#define LCD_8_Bit 0x30 +// Set number of lines +#define LCD_4_Line 0x08 // Set 8 data bits #define DATA_8 0x30 -// Set character font -#define LCD_Font 0x04 -// Turn the cursor on -#define LCD_CURSOR_ON 0x02 -// Turn on cursor blink -#define LCD_CURSOR_BLINK 0x01 +// Set character font +#define LCD_Font 0x04 +// Turn the cursor on +#define LCD_CURSOR_ON 0x02 +// Turn on cursor blink +#define LCD_CURSOR_BLINK 0x01 ////// Serial command codes /////// // ASCII control code to set brightness level @@ -105,12 +105,12 @@ REGISTER_VAR(unsigned char ledPwmCycling, "r7", 12); #define ledPwmPattern GPIOR0 #if defined(REGISTER_BIT) #define BIT_led_on REGISTER_BIT(GPIOR1,0) -#define BACKLIGHT_STATUS() BIT_led_on +#define IS_BACKLIGHT_ON() BIT_led_on #define BACKLIGHT_OFF() BIT_led_on = 0 #define BACKLIGHT_ON() BIT_led_on = 1 #else -#define BACKLIGHT_STATUS() (GPIOR1 & 0x01) -#define BACKLIGHT_OFF() GPIOR1 &=~ ~0x01 +#define IS_BACKLIGHT_ON() (GPIOR1 & 0x01) +#define BACKLIGHT_OFF() GPIOR1 &= ~0x01 #define BACKLIGHT_ON() GPIOR1 |= 0x01 #endif @@ -159,7 +159,7 @@ static inline void LedPwmSetBrightness (unsigned char brightness) { unsigned char ledPwmPos; if (brightness == 0) { // turn backlight off for 0 brightness - if (BACKLIGHT_STATUS()) { + if (IS_BACKLIGHT_ON()) { LedTimerStop(); ledPwmPattern = 0; ledPwmCycling = 0; @@ -178,12 +178,12 @@ static inline void LedPwmSetBrightness (unsigned char brightness) { ledPwmCycling = ledPwmPattern; if (ledPwmPos >= LED_BRIGHTNESS_LEVELS-1) { // maximum brightness // don't need PWM for continuously on - if (BACKLIGHT_STATUS()) { + if (IS_BACKLIGHT_ON()) { LedTimerStop(); LED_PORT |= (1<