// initialize Timer and IO pins, needs to be called once void IrWidget::setup(boolean pullup) { #ifdef ARDUINO // configure signal capture ICP pin as input cbi(CAT2(DDR, CAP_PORT), CAP_PIN); if (pullup) sbi(CAT2(PORT, CAP_PORT), CAP_PIN); // enable the internal 10k pull-up resistor #if defined(DEBUG_PIN) && defined(DEBUG_PORT) sbi(CAT2(DDR, DEBUG_PORT), DEBUG_PIN); // configure logic analyzer debug pin as output #endif // init timer, disable power save mode of timer #ifdef PRR0 // for ATmega32U4 and ATmega2560 #if PRTIM <= 2 cbi(PRR0, CAT2(PRTIM, CAP_TIM)); // for ATmega32U4 and ATmega2560 #else cbi(PRR1, CAT2(PRTIM, CAP_TIM)); // for ATmega2560 #endif #else cbi(PRR, CAT2(PRTIM, CAP_TIM)); #endif CAT3(TCCR, CAP_TIM, A) = 0; // Timer mode 0 = normal CAT3(TCCR, CAP_TIM, B) = _BV(CAT2(ICNC, CAP_TIM)) | CAPTURE_PRESCALER_SETTING; // prescaler according to setting, enable noise canceler #else std::cout << "pinMode(CAPTURE_PIN_1, " << (pullup ? "INPUT_PULLUP)" : "INPUT)") << std::endl; #endif }
} /*---------------------------- / S11 CPU board sound /-----------------------------*/ #define S11S_PIA0 6 #define S11S_BANK0 1 #define S11S_BANK1 2 /* sound board interface */ static void s11s_init(struct sndbrdData *brdData); static void s11s_diag(int button); static WRITE_HANDLER(s11s_manCmd_w); static WRITE_HANDLER(s11s_bankSelect); const struct sndbrdIntf s11sIntf = { "WMSS11", s11s_init, NULL, s11s_diag, s11s_manCmd_w, soundlatch_w, NULL, CAT3(pia_,S11S_PIA0,_ca1_w), NULL }; /* machine interface */ static MEMORY_READ_START(s9s_readmem) { 0x0000, 0x0fff, MRA_RAM}, { 0x2000, 0x2003, pia_r(S11S_PIA0)}, { 0x8000, 0xffff, MRA_ROM}, /* U22 */ MEMORY_END static MEMORY_WRITE_START(s9s_writemem) { 0x0000, 0x0fff, MWA_RAM }, { 0x2000, 0x2003, pia_w(S11S_PIA0)}, MEMORY_END static struct DACinterface s9s_dacInt = { 1, { 50 }}; static struct hc55516_interface s9s_hc55516Int = { 1, { 100 }};