adc1213x.cpp : Simplify handlers

This commit is contained in:
cam900 2019-05-01 17:36:50 +09:00
parent 5501b8c228
commit 2cce7ba692
4 changed files with 22 additions and 22 deletions

View File

@ -113,7 +113,7 @@ void adc12138_device::device_reset()
di_w di_w
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER( adc12138_device::di_w ) void adc12138_device::di_w(u8 data)
{ {
m_data_in = data & 1; m_data_in = data & 1;
} }
@ -211,7 +211,7 @@ void adc12138_device::convert(int channel, int bits16, int lsbfirst)
cs_w cs_w
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER( adc12138_device::cs_w ) void adc12138_device::cs_w(u8 data)
{ {
if (data) if (data)
{ {
@ -292,7 +292,7 @@ WRITE8_MEMBER( adc12138_device::cs_w )
sclk_w sclk_w
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER( adc12138_device::sclk_w ) void adc12138_device::sclk_w(u8 data)
{ {
if (data) if (data)
{ {
@ -312,7 +312,7 @@ WRITE8_MEMBER( adc12138_device::sclk_w )
conv_w conv_w
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_MEMBER( adc12138_device::conv_w ) void adc12138_device::conv_w(u8 data)
{ {
m_end_conv = 1; m_end_conv = 1;
} }
@ -321,7 +321,7 @@ WRITE8_MEMBER( adc12138_device::conv_w )
do_r do_r
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER( adc12138_device::do_r ) u8 adc12138_device::do_r()
{ {
//printf("ADC: DO\n"); //printf("ADC: DO\n");
return m_data_out; return m_data_out;
@ -331,7 +331,7 @@ READ8_MEMBER( adc12138_device::do_r )
eoc_r eoc_r
-------------------------------------------------*/ -------------------------------------------------*/
READ8_MEMBER( adc12138_device::eoc_r ) u8 adc12138_device::eoc_r()
{ {
return m_end_conv; return m_end_conv;
} }

View File

@ -36,12 +36,12 @@ public:
set_ipt_convert_callback(ipt_convert_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); set_ipt_convert_callback(ipt_convert_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
} }
DECLARE_WRITE8_MEMBER( di_w ); void di_w(u8 data);
DECLARE_WRITE8_MEMBER( cs_w ); void cs_w(u8 data);
DECLARE_WRITE8_MEMBER( sclk_w ); void sclk_w(u8 data);
DECLARE_WRITE8_MEMBER( conv_w ); void conv_w(u8 data = 0);
DECLARE_READ8_MEMBER( do_r ); u8 do_r();
DECLARE_READ8_MEMBER( eoc_r ); u8 eoc_r();
protected: protected:
adc12138_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); adc12138_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);

View File

@ -556,7 +556,7 @@ READ8_MEMBER(hornet_state::sysreg_r)
0x01 = ADDO (ADC DO) 0x01 = ADDO (ADC DO)
*/ */
r = 0xf0; r = 0xf0;
r |= m_adc12138->do_r(space, 0) | (m_adc12138->eoc_r(space, 0) << 2); r |= m_adc12138->do_r() | (m_adc12138->eoc_r() << 2);
break; break;
case 4: /* I/O port 4 - DIP switches */ case 4: /* I/O port 4 - DIP switches */
@ -607,10 +607,10 @@ WRITE8_MEMBER(hornet_state::sysreg_w)
0x02 = ADDI (ADC DI) 0x02 = ADDI (ADC DI)
0x01 = ADDSCLK (ADC SCLK) 0x01 = ADDSCLK (ADC SCLK)
*/ */
m_adc12138->cs_w(space, 0, (data >> 3) & 0x1); m_adc12138->cs_w((data >> 3) & 0x1);
m_adc12138->conv_w(space, 0, (data >> 2) & 0x1); m_adc12138->conv_w((data >> 2) & 0x1);
m_adc12138->di_w(space, 0, (data >> 1) & 0x1); m_adc12138->di_w((data >> 1) & 0x1);
m_adc12138->sclk_w(space, 0, data & 0x1); m_adc12138->sclk_w(data & 0x1);
m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
osd_printf_debug("System register 1 = %02X\n", data); osd_printf_debug("System register 1 = %02X\n", data);

View File

@ -426,7 +426,7 @@ READ32_MEMBER(nwktr_state::sysreg_r)
} }
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
r |= m_adc12138->do_r(space, 0) | (m_adc12138->eoc_r(space, 0) << 2); r |= m_adc12138->do_r() | (m_adc12138->eoc_r() << 2);
} }
} }
else if (offset == 1) else if (offset == 1)
@ -462,10 +462,10 @@ WRITE32_MEMBER(nwktr_state::sysreg_w)
int di = (data >> 25) & 0x1; int di = (data >> 25) & 0x1;
int sclk = (data >> 24) & 0x1; int sclk = (data >> 24) & 0x1;
m_adc12138->cs_w(space, 0, cs); m_adc12138->cs_w(cs);
m_adc12138->conv_w(space, 0, conv); m_adc12138->conv_w(conv);
m_adc12138->di_w(space, 0, di); m_adc12138->di_w(di);
m_adc12138->sclk_w(space, 0, sclk); m_adc12138->sclk_w(sclk);
} }
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {