00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "pb.h"
00013 #include <signal.h>
00014 #include <cdefBF53x.h>
00015 #include <shortfract>
00016 #include <ccblkfn.h>
00017
00018 namespace pb{
00019 void enableInterrupt( eSwitch sw )
00020 {
00021 unsigned short bit = (1<<sw);
00022
00023 *pPORTF_FER &= ~bit;
00024 *pPORTFIO_DIR &= ~bit;
00025 *pPORTFIO_INEN |= bit;
00026 *pPORTFIO_EDGE |= bit;
00027 *pPORTFIO_CLEAR = bit;
00028 *pPORTFIO_MASKA_SET = bit;
00029 *pSIC_IMASK |= IRQ_PFA_PORTFG;
00030 }
00031
00032 void disableInterrupt( eSwitch sw )
00033 {
00034 unsigned short bit = (1<<sw);
00035
00036 *pPORTFIO_MASKA_CLEAR = bit;
00037 ssync();
00038 }
00039
00040 bool interruptRequested( void )
00041 {
00042 return ( *pSIC_ISR & IRQ_PFA_PORTFG );
00043 }
00044
00045 bool pushed( eSwitch sw )
00046 {
00047 unsigned short bit = (1<<sw);
00048
00049 return( *pPORTFIO & bit );
00050 }
00051
00052 void clearInterrupt( eSwitch sw )
00053 {
00054 unsigned short bit = (1<<sw);
00055
00056 *pPORTFIO_CLEAR = bit;
00057 ssync();
00058 }
00059 };