Fx2lib  0.2
include/lights.h
Go to the documentation of this file.
00001 // Copyright (C) 2009 Ubixum, Inc. 
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License, or (at your option) any later version.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00016 
00021 #ifndef LIGHTS_H
00022 #define LIGHTS_H
00023 
00024 #include "fx2types.h"
00025 
00026 #ifndef FX1
00027 // FX2 Dev board lights
00028 #define D2ONH #0x88 // assembly high byte of light addr 
00029 #define D2OFFH #0x80 
00030 #define D3ONH #0x98 
00031 #define D3OFFH #0x90 
00032 #define D4ONH #0xA8 
00033 #define D4OFFH #0xA0 
00034 #define D5ONH #0xB8 
00035 #define D5OFFH #0xB0 
00036 volatile __xdata __at 0x8800 BYTE D2ON;
00037 volatile __xdata __at 0x8000 BYTE D2OFF;
00038 volatile __xdata __at 0x9800 BYTE D3ON;
00039 volatile __xdata __at 0x9000 BYTE D3OFF;
00040 volatile __xdata __at 0xA800 BYTE D4ON;
00041 volatile __xdata __at 0xA000 BYTE D4OFF;
00042 volatile __xdata __at 0xB800 BYTE D5ON;
00043 volatile __xdata __at 0xB000 BYTE D5OFF;
00044 #else
00045 // FX1 dev board lights
00046 #define D2ONH #0x80 // assembly high byte of light addr 
00047 #define D2OFFH #0x81 
00048 #define D3ONH #0x90 
00049 #define D3OFFH #0x91 
00050 #define D4ONH #0xA0 
00051 #define D4OFFH #0xA1 
00052 #define D5ONH #0xB0 
00053 #define D5OFFH #0xB1 
00054 volatile __xdata __at 0x8000 BYTE D2ON;
00055 volatile __xdata __at 0x8100 BYTE D2OFF;
00056 volatile __xdata __at 0x9000 BYTE D3ON;
00057 volatile __xdata __at 0x9100 BYTE D3OFF;
00058 volatile __xdata __at 0xA000 BYTE D4ON;
00059 volatile __xdata __at 0xA100 BYTE D4OFF;
00060 volatile __xdata __at 0xB000 BYTE D5ON;
00061 volatile __xdata __at 0xB100 BYTE D5OFF;
00062 #endif
00063 
00067 #define activate_light(LIGHT_ADDR) __asm \
00068  mov __XPAGE, LIGHT_ADDR \
00069  __endasm; __asm \
00070  movx a, @r0 \
00071 __endasm \
00072 
00073 
00087 #define d2on() activate_light(D2ONH)
00088 #define d2off() activate_light(D2OFFH)
00089 #define d3on() activate_light(D3ONH)
00090 #define d3off() activate_light(D3OFFH)
00091 #define d4on() activate_light(D4ONH)
00092 #define d4off() activate_light(D4OFFH)
00093 #define d5on() activate_light(D5ONH)
00094 #define d5off() activate_light(D5OFFH)
00095 
00096 #endif