removed adc083x_interface (nw)

This commit is contained in:
smf- 2013-05-29 15:29:21 +00:00
parent cf2556e193
commit 5c699047b1
5 changed files with 33 additions and 74 deletions

View File

@ -44,11 +44,6 @@ enum
TYPE DEFINITIONS
***************************************************************************/
struct adc0831_state
{
adc083x_input_convert_func input_callback_r;
};
const device_type ADC0831 = &device_creator<adc0831_device>;
const device_type ADC0832 = &device_creator<adc0832_device>;
const device_type ADC0834 = &device_creator<adc0834_device>;
@ -95,22 +90,6 @@ adc0838_device::adc0838_device(const machine_config &mconfig, const char *tag, d
m_mux_bits = 4;
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void adc083x_device::device_config_complete()
{
const adc083x_interface *intf = (const adc083x_interface *) static_config();
/* resolve callbacks */
m_input_callback_r = intf->input_callback_r;
}
/*-------------------------------------------------
adc083x_device::device_start
-------------------------------------------------*/
@ -199,8 +178,8 @@ UINT8 adc083x_device::conversion()
int negative_channel = ADC083X_AGND;
double positive = 0;
double negative = 0;
double gnd = m_input_callback_r( this, ADC083X_AGND );
double vref = m_input_callback_r( this, ADC083X_VREF );
double gnd = m_input_callback( this, ADC083X_AGND );
double vref = m_input_callback( this, ADC083X_VREF );
if( type() == ADC0831 )
{
@ -246,12 +225,12 @@ UINT8 adc083x_device::conversion()
if( positive_channel != ADC083X_AGND )
{
positive = m_input_callback_r( this, positive_channel ) - gnd;
positive = m_input_callback( this, positive_channel ) - gnd;
}
if( negative_channel != ADC083X_AGND )
{
negative = m_input_callback_r( this, negative_channel ) - gnd;
negative = m_input_callback( this, negative_channel ) - gnd;
}
result = (int) ( ( ( positive - negative ) * 255 ) / vref );

View File

@ -15,12 +15,10 @@
TYPE DEFINITIONS
***************************************************************************/
typedef double (*adc083x_input_convert_func)(device_t *device, UINT8 input);
typedef double (*adc083x_input_callback)(device_t *device, UINT8 input);
struct adc083x_interface
{
adc083x_input_convert_func input_callback_r;
};
#define MCFG_ADC083X_INPUT_CALLBACK(input_callback) \
adc083x_device::set_input_callback(*device, input_callback);
/***************************************************************************
CONSTANTS
@ -47,6 +45,9 @@ class adc083x_device : public device_t
public:
adc083x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
// static configuration helpers
static void set_input_callback(device_t &device, adc083x_input_callback input_callback) { downcast<adc083x_device &>(device).m_input_callback = input_callback; }
DECLARE_WRITE_LINE_MEMBER( cs_write );
DECLARE_WRITE_LINE_MEMBER( clk_write );
DECLARE_WRITE_LINE_MEMBER( di_write );
@ -56,7 +57,6 @@ public:
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
INT32 m_mux_bits;
@ -81,7 +81,7 @@ private:
INT32 m_bit;
INT32 m_output;
adc083x_input_convert_func m_input_callback_r;
adc083x_input_callback m_input_callback;
};
class adc0831_device : public adc083x_device
@ -90,43 +90,34 @@ public:
adc0831_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
extern const device_type ADC0831;
class adc0832_device : public adc083x_device
{
public:
adc0832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
extern const device_type ADC0832;
class adc0834_device : public adc083x_device
{
public:
adc0834_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
extern const device_type ADC0834;
class adc0838_device : public adc083x_device
{
public:
adc0838_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
#define MCFG_ADC0831_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, ADC0831, 0) \
MCFG_DEVICE_CONFIG(_config)
#define MCFG_ADC0832_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, ADC0832, 0) \
MCFG_DEVICE_CONFIG(_config)
#define MCFG_ADC0834_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, ADC0834, 0) \
MCFG_DEVICE_CONFIG(_config)
#define MCFG_ADC0838_ADD(_tag, _config) \
MCFG_DEVICE_ADD(_tag, ADC0838, 0) \
MCFG_DEVICE_CONFIG(_config)
extern const device_type ADC0831;
extern const device_type ADC0832;
extern const device_type ADC0834;
extern const device_type ADC0838;
#endif /* __ADC083X_H__ */

View File

@ -879,10 +879,6 @@ static double adc0834_callback( device_t *device, UINT8 input )
return 0;
}
static const adc083x_interface konamigx_adc_interface = {
adc0834_callback
};
READ32_MEMBER(konamigx_state::le2_gun_H_r)
{
@ -1840,7 +1836,8 @@ static MACHINE_CONFIG_DERIVED( opengolf, konamigx )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(gx_type1_map)
MCFG_ADC0834_ADD( "adc0834", konamigx_adc_interface )
MCFG_DEVICE_ADD("adc0834", ADC0834, 0)
MCFG_ADC083X_INPUT_CALLBACK(adc0834_callback)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( racinfrc, konamigx )
@ -1853,7 +1850,8 @@ static MACHINE_CONFIG_DERIVED( racinfrc, konamigx )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(gx_type1_map)
MCFG_ADC0834_ADD( "adc0834", konamigx_adc_interface )
MCFG_DEVICE_ADD("adc0834", ADC0834, 0)
MCFG_ADC083X_INPUT_CALLBACK(adc0834_callback)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )

View File

@ -2475,10 +2475,6 @@ void ksys573_state::punchmania_output_callback( int offset, int data )
popmessage( "%s", pad );
}
static const adc083x_interface punchmania_adc_interface = {
punchmania_inputs_callback
};
DRIVER_INIT_MEMBER(ksys573_state,pnchmn)
{
gx700pwfbf_init( &ksys573_state::punchmania_output_callback );
@ -2641,10 +2637,6 @@ static double analogue_inputs_callback( device_t *device, UINT8 input )
}
static const adc083x_interface konami573_adc_interface = {
analogue_inputs_callback
};
static MACHINE_CONFIG_START( konami573, ksys573_state )
/* basic machine hardware */
MCFG_CPU_ADD( "maincpu", CXD8530CQ, XTAL_67_7376MHz )
@ -2688,7 +2680,8 @@ static MACHINE_CONFIG_START( konami573, ksys573_state )
MCFG_M48T58_ADD( "m48t58" )
MCFG_ADC0834_ADD( "adc0834", konami573_adc_interface )
MCFG_DEVICE_ADD( "adc0834", ADC0834, 0 )
MCFG_ADC083X_INPUT_CALLBACK(analogue_inputs_callback)
MACHINE_CONFIG_END
// Variants with additional digital sound board
@ -3004,7 +2997,8 @@ static MACHINE_CONFIG_DERIVED( pnchmn, konami573 )
MCFG_FRAGMENT_ADD( cassxi )
MCFG_FRAGMENT_ADD( pccard1 )
MCFG_ADC0838_ADD( "adc0838", punchmania_adc_interface )
MCFG_DEVICE_ADD( "adc0838", ADC0838, 0 )
MCFG_ADC083X_INPUT_CALLBACK(punchmania_inputs_callback)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( pnchmn2, pnchmn )

View File

@ -690,11 +690,6 @@ static double adc0838_callback( device_t *device, UINT8 input )
}
static const adc083x_interface zr107_adc_interface = {
adc0838_callback
};
void zr107_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
@ -798,7 +793,8 @@ static MACHINE_CONFIG_START( zr107, zr107_state )
MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
MCFG_ADC0838_ADD("adc0838", zr107_adc_interface)
MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
MCFG_ADC083X_INPUT_CALLBACK(adc0838_callback)
MACHINE_CONFIG_END
@ -856,7 +852,8 @@ static MACHINE_CONFIG_START( jetwave, zr107_state )
MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
MCFG_ADC0838_ADD("adc0838", zr107_adc_interface)
MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
MCFG_ADC083X_INPUT_CALLBACK(adc0838_callback)
MACHINE_CONFIG_END
/*****************************************************************************/