First Release
Embed:
(wiki syntax)
Show/hide line numbers
Out_FC.h
00001 /** Class: Out_FC 00002 * 00003 * Output class for Famicom 00004 * 00005 */ 00006 #include "mbed.h" 00007 #include "InputStatus.h" 00008 00009 class Out_FC 00010 { 00011 public: 00012 /** Constructor: Out_FC 00013 * 00014 * Parameters: 00015 * pn_LATCH - InterruptIn for LATCH (pin12) 00016 * pn_DATA - DigitalOut for DATA (pin13) 00017 * pn_CLOCK - InterruptIn for LATCH (pin14) 00018 * pn_POWDETECT - InterruptIn for PowerDetect (pin15) 00019 * inputStatus - Input status 00020 */ 00021 00022 Out_FC( 00023 PinName pn_LATCH, PinName pn_DATA, PinName pn_CLOCK, PinName pn_POWDETECT, 00024 InputStatus *inputStatus 00025 ); 00026 00027 private: 00028 // Private constants 00029 static const int FC_INPUTSTATE_RENEWINTERVAL__MICROSEC = 2000; 00030 00031 // mbed pins 00032 InterruptIn _INTR_LATCH; 00033 DigitalOut _OUT_DATA; 00034 InterruptIn _INTR_CLOCK; 00035 InterruptIn _INTR_POWDETECT; 00036 00037 // Variable 00038 volatile int _Buttons; 00039 volatile char _Ch0; 00040 volatile char _Ch1; 00041 volatile char _Ch2; 00042 volatile char _InputDeviceType; 00043 InputStatus *_InputStatus; 00044 Ticker _RenewFCInputTicker; 00045 // volatile char _RapidFireValue; 00046 FunctionPointer _pEnableInput; 00047 FunctionPointer _pDisableInput; 00048 00049 // Private Method 00050 void Initialize(void); 00051 void RenewFCInputDataPeriodically(void); 00052 // void InitInterruptPriority(void); 00053 00054 00055 00056 00057 00058 00059 // for InputControll 00060 public: 00061 void SetupInputControll(void (*startInputFunction)(void), void (*stopInputFunction)(void)); 00062 class CDummy; 00063 template<class T> 00064 void SetupInputControll(T* inputInstance, void (T::*startInputMethod)(void), void (T::*stopInputMethod)(void)) 00065 { 00066 _InputInstance = (CDummy*) inputInstance; 00067 StartInputMethod = (void (CDummy::*)(void)) startInputMethod; 00068 StopInputMethod = (void (CDummy::*)(void)) stopInputMethod; 00069 } 00070 00071 private: 00072 CDummy* _InputInstance; 00073 void (CDummy::*StartInputMethod)(void); 00074 void (CDummy::*StopInputMethod)(void); 00075 void (*StartInputFunction)(void); 00076 void (*StopInputFunction)(void); 00077 void EnableInput(void); 00078 void DisableInput(void); 00079 00080 }; 00081 00082
Generated on Thu Jul 14 2022 14:49:55 by 1.7.2