Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

gdm.h

00001 /* gdm.h -- Graphics Dot Matrix Display
00002    Copyright 2003 Free Software Foundation, Inc.
00003    Written by Stephane Carrez (stcarrez@nerim.fr)
00004 
00005 This file is part of GEL.
00006 
00007 GEL is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2, or (at your option)
00010 any later version.
00011 
00012 GEL is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with GEL; see the file COPYING.  If not, write to
00019 the Free Software Foundation, 59 Temple Place - Suite 330,
00020 Boston, MA 02111-1307, USA.  */
00021 
00022 #ifndef _M68HC11_ARCH_CME11_GDM_H
00023 #define _M68HC11_ARCH_CME11_GDM_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 #include <sys/ports.h>
00030 
00041 extern volatile unsigned char _gdm_lcd_cmd;
00042 extern volatile unsigned char _gdm_lcd_data;
00043 
00044 #define M6811_PA4 (1 << 4)
00045 #define M6811_PA5 (1 << 5)
00046 
00055 extern inline void _gdm_hw_set_side (gdm_display* dp, unsigned short side)
00056 {
00057   _io_ports[M6811_PORTA] &= ~(M6811_PA5 | M6811_PA4);
00058   if (side)
00059     _io_ports[M6811_PORTA] |= M6811_PA4;
00060   else
00061     _io_ports[M6811_PORTA] |= M6811_PA5;
00062 }
00063 
00073 extern inline void _gdm_hw_set_y (gdm_display* dp, unsigned short y)
00074 {
00075   /* Set the LCD Y register.  'y' is guarranteed to be <= 63.  */
00076   _gdm_lcd_cmd = 0x40 | y;
00077 }
00078 
00087 extern inline void _gdm_hw_set_x (gdm_display* dp, unsigned short x)
00088 {
00089   /* Set the LCD X register.  'x' is guarranteed to be <= 7.  */
00090   _gdm_lcd_cmd = 0xB8 | x;
00091 }
00092 
00102 extern inline void _gdm_hw_set_data (gdm_display* dp, unsigned char data)
00103 {
00104   _gdm_lcd_data = data;
00105 }
00106 
00114 extern inline void _gdm_hw_set_line (gdm_display* dp, unsigned short line)
00115 {
00116   /* Set the LCD start page.  'line' is guarranteed to be <= 63.  */
00117   _gdm_lcd_cmd = 0xC0 | line;
00118 }
00119 
00131 extern inline void _gdm_hw_set_mode (gdm_display* dp, unsigned short mode)
00132 {
00133   if (mode & GDM_DISPLAY_ON)
00134     _gdm_lcd_cmd = 0x3F;
00135   else
00136     _gdm_lcd_cmd = 0x3E;
00137 }
00138 
00141 #ifdef __cplusplus
00142 };
00143 #endif
00144 #endif