mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
mmboard: shorthand variable types
This commit is contained in:
parent
0c3cd2504b
commit
31f42b1f24
@ -23,22 +23,22 @@ DEFINE_DEVICE_TYPE(MEPHISTO_BUTTONS_BOARD, mephisto_buttons_board_device, "mbboa
|
||||
// constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
mephisto_board_device::mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
mephisto_board_device::mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, m_board(*this, "board")
|
||||
, m_led_pwm(*this, "led_pwm")
|
||||
, m_sensordelay(attotime::from_msec(150))
|
||||
, m_led_out(*this, "led%u", 0U)
|
||||
, m_sensordelay(attotime::from_msec(150))
|
||||
, m_disable_leds(false)
|
||||
{
|
||||
}
|
||||
|
||||
mephisto_sensors_board_device::mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
mephisto_sensors_board_device::mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: mephisto_board_device(mconfig, MEPHISTO_SENSORS_BOARD, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
mephisto_buttons_board_device::mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
mephisto_buttons_board_device::mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: mephisto_board_device(mconfig, MEPHISTO_BUTTONS_BOARD, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -102,15 +102,15 @@ void mephisto_board_device::device_reset()
|
||||
// I/O handlers
|
||||
//-------------------------------------------------
|
||||
|
||||
void mephisto_board_device::refresh_leds_w(offs_t offset, uint8_t data)
|
||||
void mephisto_board_device::refresh_leds_w(offs_t offset, u8 data)
|
||||
{
|
||||
if (!m_disable_leds)
|
||||
m_led_out[(offset >> 6 & 7) | (offset & 7) << 3] = data;
|
||||
}
|
||||
|
||||
uint8_t mephisto_board_device::input_r()
|
||||
u8 mephisto_board_device::input_r()
|
||||
{
|
||||
uint8_t data = 0xff;
|
||||
u8 data = 0xff;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (!BIT(m_mux, i))
|
||||
@ -119,18 +119,18 @@ uint8_t mephisto_board_device::input_r()
|
||||
return data;
|
||||
}
|
||||
|
||||
uint8_t mephisto_board_device::mux_r()
|
||||
u8 mephisto_board_device::mux_r()
|
||||
{
|
||||
return m_mux;
|
||||
}
|
||||
|
||||
void mephisto_board_device::mux_w(uint8_t data)
|
||||
void mephisto_board_device::mux_w(u8 data)
|
||||
{
|
||||
m_mux = data;
|
||||
update_led_pwm();
|
||||
}
|
||||
|
||||
void mephisto_board_device::led_w(uint8_t data)
|
||||
void mephisto_board_device::led_w(u8 data)
|
||||
{
|
||||
m_led_data = data;
|
||||
update_led_pwm();
|
||||
|
@ -21,18 +21,18 @@ class mephisto_board_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
mephisto_board_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// configuration helpers
|
||||
void set_disable_leds(int disable_leds) { m_disable_leds = disable_leds; }
|
||||
void set_delay(attotime sensordelay) { m_sensordelay = sensordelay; }
|
||||
void set_disable_leds(bool disable_leds) { m_disable_leds = disable_leds; }
|
||||
void set_delay(attotime sensordelay) { m_sensordelay = sensordelay; }
|
||||
|
||||
sensorboard_device *get() { return m_board; }
|
||||
|
||||
uint8_t input_r();
|
||||
void led_w(uint8_t data);
|
||||
uint8_t mux_r();
|
||||
void mux_w(uint8_t data);
|
||||
u8 input_r();
|
||||
void led_w(u8 data);
|
||||
u8 mux_r();
|
||||
void mux_w(u8 data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -40,25 +40,27 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
|
||||
void set_config(machine_config &config, sensorboard_device::sb_type board_type);
|
||||
void refresh_leds_w(offs_t offset, uint8_t data);
|
||||
void refresh_leds_w(offs_t offset, u8 data);
|
||||
void update_led_pwm() { m_led_pwm->matrix(~m_mux, m_led_data); }
|
||||
|
||||
required_device<sensorboard_device> m_board;
|
||||
required_device<pwm_display_device> m_led_pwm;
|
||||
attotime m_sensordelay;
|
||||
output_finder<64> m_led_out;
|
||||
bool m_disable_leds;
|
||||
uint8_t m_led_data;
|
||||
uint8_t m_mux;
|
||||
output_finder<64> m_led_out;
|
||||
|
||||
attotime m_sensordelay;
|
||||
bool m_disable_leds;
|
||||
u8 m_led_data;
|
||||
u8 m_mux;
|
||||
};
|
||||
|
||||
|
||||
// ======================> mephisto_sensors_board_device
|
||||
|
||||
class mephisto_sensors_board_device : public mephisto_board_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
mephisto_sensors_board_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
|
||||
|
||||
protected:
|
||||
// optional information overrides
|
||||
@ -72,7 +74,7 @@ class mephisto_buttons_board_device : public mephisto_board_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
mephisto_buttons_board_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
|
||||
|
||||
protected:
|
||||
// optional information overrides
|
||||
|
Loading…
Reference in New Issue
Block a user