Author: jsuijs
Date: Sun Mar 15 23:39:02 2009
New Revision: 856

Added:
    trunk/test/external/lcd/test_backlight.jal
Modified:
    trunk/include/external/lcd/lcd_backlight.jal
    trunk/include/external/lcd/lcd_hd44780_common.jal
    trunk/include/peripheral/usart/serial_hw_int_cts.jal

Log:
depricated deprecated

Modified: trunk/include/external/lcd/lcd_backlight.jal
==============================================================================
--- trunk/include/external/lcd/lcd_backlight.jal        (original)
+++ trunk/include/external/lcd/lcd_backlight.jal        Sun Mar 15 23:39:02 2009
@@ -1,4 +1,4 @@
---  
--------------------------------------------------------------------------
+--  
----------------------------------------------------------------------------
  -- Title: lcd_backlight.jal
  -- Author: Joep Suijs, Copyright (c) 2009, all rights reserved.
  -- Adapted-by:
@@ -14,7 +14,117 @@
  --
  -- Notes:
  --
---  
--------------------------------------------------------------------------
+--  
----------------------------------------------------------------------------
+
+-- define default
+if (defined(lcd_bl_inverted) == false) then
+   const bit lcd_bl_inverted = false
+end if
+
+
+-- setup
+if (defined(lcd_backlight_pwm) == true) then
+   -- backlight pwm
+   if (lcd_backlight_pwm == 1) then
+
+      --  
----------------------------------------------------------------------
+      -- pwm on ccp1
+      include pwm_ccp1
+      pin_ccp1_direction = output
+      pwm_max_resolution(1)
+      pwm1_on()
+
+      procedure lcd_backlight_variable(byte in value) is
+         pragma inline
+         if (lcd_bl_inverted == false) then
+            pwm1_set_dutycycle(value)
+         else
+            pwm1_set_dutycycle(255 - value)
+         end if
+      end procedure
+      --  
----------------------------------------------------------------------
+
+   elsif (lcd_backlight_pwm == 2) then
+
+      --  
----------------------------------------------------------------------
+      -- pwm on ccp2
+      include pwm_ccp2
+      pin_ccp2_direction = output
+      pwm_max_resolution(1)
+      pwm2_on()
+
+      procedure lcd_backlight_variable(byte in value) is
+         pragma inline
+         if (lcd_bl_inverted == false) then
+            pwm2_set_dutycycle(value)
+         else
+            pwm2_set_dutycycle(255 - value)
+         end if
+      end procedure
+      --  
----------------------------------------------------------------------
+
+   elsif (lcd_backlight_pwm == 3) then
+
+      --  
----------------------------------------------------------------------
+      -- pwm on ccp3
+      include pwm_ccp3
+      pin_ccp3_direction = output
+      pwm_max_resolution(1)
+      pwm3_on()
+
+      procedure lcd_backlight_variable(byte in value) is
+         pragma inline
+         if (lcd_bl_inverted == false) then
+            pwm3_set_dutycycle(value)
+         else
+            pwm3_set_dutycycle(255 - value)
+         end if
+      end procedure
+      --  
----------------------------------------------------------------------
+
+   elsif (lcd_backlight_pwm == 4) then
+
+      --  
----------------------------------------------------------------------
+      -- pwm on ccp4
+      include pwm_ccp4
+      pin_ccp4_direction = output
+      pwm_max_resolution(1)
+      pwm4_on()
+
+      procedure lcd_backlight_variable(byte in value) is
+         pragma inline
+         if (lcd_bl_inverted == false) then
+            pwm4_set_dutycycle(value)
+         else
+            pwm4_set_dutycycle(255 - value)
+         end if
+      end procedure
+      --  
----------------------------------------------------------------------
+
+   elsif (lcd_backlight_pwm == 5) then
+
+      --  
----------------------------------------------------------------------
+      -- pwm on ccp25
+      include pwm_ccp5
+      pin_ccp5_direction = output
+      pwm_max_resolution(1)
+      pwm5_on()
+
+      procedure lcd_backlight_variable(byte in value) is
+         pragma inline
+         if (lcd_bl_inverted == false) then
+            pwm5_set_dutycycle(value)
+         else
+            pwm5_set_dutycycle(255 - value)
+         end if
+      end procedure
+      --  
----------------------------------------------------------------------
+   else
+      pragma error "invalid value of lcd_backlight_pwm (no such cpp)"
+   end if
+
+end if
+

  ;procedure lcd_backlight_variable(byte in value) is
  ;end procedure
@@ -23,7 +133,8 @@
  -- lcd_backlight - turn backlite on/off
  --  
----------------------------------------------------------------------------
  procedure lcd_backlight(bit in onoff) is
-   if(defined(lcd_backlight_variable) == true) then
+   if(defined(lcd_backlight_variable) == true) then
+      -- lcd_backlight_variable exists
        if (onoff) then
           lcd_backlight_variable(255)
        else
@@ -33,10 +144,12 @@
     end if

     if(defined(lcd_bl) == true) then
-      if (defined(lcd_bl_inverted) == true) then
+      -- backlight pin exists
+      if (lcd_bl_inverted == true) then
+         -- lcd_bl_inverted exists & is true
           lcd_bl = ! onoff
-      else
-         lcd_bl = onoff
-      end if
+         return
+      end if
+      lcd_bl = onoff
     end if
  end procedure

Modified: trunk/include/external/lcd/lcd_hd44780_common.jal
==============================================================================
--- trunk/include/external/lcd/lcd_hd44780_common.jal   (original)
+++ trunk/include/external/lcd/lcd_hd44780_common.jal   Sun Mar 15 23:39:02  
2009
@@ -5,7 +5,7 @@
  --
  -- Adapted-by: Joep Suijs
  --
--- Compiler: =2.4
+-- Compiler: >=2.4j
  --
  -- This file is part of jallib (http://jallib.googlecode.com)
  -- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
@@ -312,15 +312,15 @@



--- depricated procedures
+-- deprecated procedures
  procedure lcd_clearscreen()  is
-   _warn "lcd_clearsceen() is depricated - please use lcd_clear_screen()"
+   _warn "lcd_clearsceen() is deprecated - please use lcd_clear_screen()"
     _lcd_write_command( lcd_clear_display )
     delay_10us( 180 )
  end procedure

  procedure lcd_writechar(byte in data) is
-   _warn "lcd_writechar() is depricated - please use lcd_write_char()"
+   _warn "lcd_writechar() is deprecated - please use lcd_write_char()"
     _lcd_write_data(data)
  end procedure


Modified: trunk/include/peripheral/usart/serial_hw_int_cts.jal
==============================================================================
--- trunk/include/peripheral/usart/serial_hw_int_cts.jal        (original)
+++ trunk/include/peripheral/usart/serial_hw_int_cts.jal        Sun Mar 15  
23:39:02 2009
@@ -134,7 +134,7 @@

  if (defined(serial_hw_baudrate) == false) then
     if (defined(SERIAL_BPSRATE) == true) then
-      _warn "SERIAL_BPSRATE is depricated - please use serial_hw_baudrate"
+      _warn "SERIAL_BPSRATE is deprecated - please use serial_hw_baudrate"
        const serial_hw_baudrate = SERIAL_BPSRATE
     else
        pragma error -- no baudrate defined
@@ -294,7 +294,7 @@

  function  serial_receive_byte(byte out data) return bit is
     pragma inline
-   -- depricated function, for compatibility only
+  _warn "serial_receive_byte() is deprecated - please use   
serial_hw_read()"
     return serial_hw_read(data)
  end function

@@ -381,7 +381,7 @@
  end procedure

  procedure serial_init() is
-   -- depricated function, for compatibility only
+   _warn "serial_init() is deprecated - please use  serial_hw_init()"
     serial_hw_init()
  end procedure


Added: trunk/test/external/lcd/test_backlight.jal
==============================================================================
--- (empty file)
+++ trunk/test/external/lcd/test_backlight.jal  Sun Mar 15 23:39:02 2009
@@ -0,0 +1,108 @@
+-- ------------------------------------------------------
+-- Title: Test program for lcd_backlight test (extended test)
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2008, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4g
+--
+-- This file is part of jallib (http://jallib.googlecode.com)
+-- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: Testing lcd_hd44780_4 and lcd_hd44780_common
+-- This is to test all hd44780_common features. See test_lcd_*
+-- for a basic display test.
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+--  defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+-- setup: an hd44780 compatible display, used in 4-bit mode.
+--
+-- ------------------------------------------------------
+
+enable_digital_io() -- disable analog I/O (if any)
+
+;@jallib use chipdef
+;@jallib use lcd_hd44780_4
+;@jallib use led
+
+--  
----------------------------------------------------------------------------
+-- optionally include this file to gain access to the tc_var* variables
+--  
----------------------------------------------------------------------------
+include serial_tc_header
+
+-- setup libs, io etc
+lcd_rs_direction        = output
+lcd_en_direction        = output
+lcd_dataport_direction  = output
+
+include print
+include lcd_hd44780_4
+include delay
+lcd_init()                              -- initialize LCD
+
+var byte value = 0
+
+lcd_clear_screen()
+lcd_home()
+
+const byte teststring[] = "Serial TC ready."
+print_string(lcd, teststring)
+
+const byte lcd_backlight_pwm = 6
+
+-- setup for digital backlight control
+var volatile bit lcd_bl is pin_b0
+pin_b0_direction = output
+;const bit lcd_bl_inverted = true
+include lcd_backlight
+
+
+
+--  
-----------------------------------------------------------------------------
+-- Define all unit tests required
+-- (testname string constants are optional)
+--  
-----------------------------------------------------------------------------
+
+-- test support function
+var byte testchar = "a"
+procedure increment_testchar() is
+   testchar = testchar + 1;
+   if (testchar > "z") then
+      testchar = "a"
+   end if
+end procedure
+-- test support function end
+
+const byte testname_a[] = "backlight on"
+procedure unit_test_a() is
+   lcd_backlight(on)
+end procedure
+
+const byte testname_b[] = "backlight off"
+procedure unit_test_b() is
+   lcd_backlight(off)
+end procedure
+
+const byte testname_c[] = "backlight 50%"
+procedure unit_test_c() is
+   lcd_backlight_variable(128)
+end procedure
+
+--  
-----------------------------------------------------------------------------
+--  
-----------------------------------------------------------------------------
+-- include testconsole after definition of unit tests
+--  
-----------------------------------------------------------------------------
+--  
-----------------------------------------------------------------------------
+include serial_testconsole
+testconsole_init()
+
+tc_var2 = 1 -- default (used for left/right shift)
+
+testconsole()  -- contains forever loop
+
+

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to