smartboard: less led flicker

This commit is contained in:
hap 2021-04-13 00:04:38 +02:00
parent 438c191102
commit 8bb5feac20
3 changed files with 45 additions and 38 deletions

View File

@ -13,9 +13,11 @@ license:CC0
<element name="black3b"><rect><color red="0.12" green="0.11" blue="0.10" /></rect></element>
<element name="static_lcd"><rect><color red="0.5412" green="0.57255" blue="0.5804" /></rect></element>
<element name="ledo">
<disk><color red="0.1" green="0.05" blue="0.07" /></disk>
</element>
<element name="ledr" defstate="0">
<disk state="0"> <color red="0.12" green="0.11" blue="0.1" /> </disk>
<disk state="1"> <color red="1" green="0.01" blue="0.15" /> </disk>
<disk state="1"> <color red="1" green="0" blue="0" /> </disk>
</element>
<element name="ledg" defstate="0">
<disk state="0"> <color red="0.05" green="0.15" blue="0.05" /> </disk>
@ -310,20 +312,43 @@ license:CC0
<element name="piece_h~i~" ref="piece"><bounds x="71" y="~y~" width="10" height="10" /></element>
</repeat>
<!-- LEDs -->
<!-- 81 LEDs from 64 outputs -->
<repeat count="9">
<param name="x" start="0.5" increment="10" />
<repeat count="9">
<param name="y" start="0.5" increment="10" />
<element ref="ledo"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
</repeat>
<repeat count="8">
<param name="x" start="80.5" increment="-10" />
<param name="i" start="0" increment="1" />
<repeat count="8">
<param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" />
<element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
<repeat count="8">
<param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" />
<element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
</repeat>
<element name="led_0~i~" ref="ledr"><bounds x="~x~" y="0.5" width="1" height="1" /></element>
<element name="led_1~i~" ref="ledr"><bounds x="~x~" y="10.5" width="1" height="1" /></element>
<element name="led_2~i~" ref="ledr"><bounds x="~x~" y="20.5" width="1" height="1" /></element>
<element name="led_3~i~" ref="ledr"><bounds x="~x~" y="30.5" width="1" height="1" /></element>
<element name="led_4~i~" ref="ledr"><bounds x="~x~" y="40.5" width="1" height="1" /></element>
<element name="led_5~i~" ref="ledr"><bounds x="~x~" y="50.5" width="1" height="1" /></element>
<element name="led_6~i~" ref="ledr"><bounds x="~x~" y="60.5" width="1" height="1" /></element>
<element name="led_7~i~" ref="ledr"><bounds x="~x~" y="70.5" width="1" height="1" /></element>
<element name="led_8~i~" ref="ledr"><bounds x="~x~" y="80.5" width="1" height="1" /></element>
<repeat count="8">
<param name="x" start="70.5" increment="-10" />
<param name="i" start="0" increment="1" />
<repeat count="8">
<param name="y" start="0.5" increment="10" />
<param name="j" start="0" increment="1" />
<element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
<repeat count="8">
<param name="y" start="10.5" increment="10" />
<param name="j" start="0" increment="1" />
<element name="led_~j~~i~" ref="ledr" blend="add"><bounds x="~x~" y="~y~" width="1" height="1" /></element>
</repeat>
</repeat>
</group>

View File

@ -4,6 +4,9 @@
Tasc SmartBoard
SB30 (91 LEDs) is "SmartBoard I"
SB20 (64 LEDs) is "SmartBoard II"
The SmartBoard can detect which piece is present on a specific square, more
info on the technology used in the piece recognition system can be found in
the US patent 5,129,654
@ -78,7 +81,6 @@ tasc_sb30_device::tasc_sb30_device(const machine_config &mconfig, const char *ta
void tasc_sb30_device::device_start()
{
m_out_leds.resolve();
m_leds_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tasc_sb30_device::leds_off_cb), this));
save_item(NAME(m_data));
save_item(NAME(m_position));
@ -112,13 +114,6 @@ void tasc_sb30_device::device_add_mconfig(machine_config &config)
}
TIMER_CALLBACK_MEMBER(tasc_sb30_device::leds_off_cb)
{
for (int y=0; y<9; y++)
for (int x=0; x<9; x++)
m_out_leds[y][x] = 0;
}
void tasc_sb30_device::init_cb(int state)
{
m_board->clear_board();
@ -242,16 +237,16 @@ uint8_t tasc_sb30_device::read()
return BIT(sb30_id, m_shift & 0x1f);
}
void tasc_sb30_device::write(uint8_t data)
{
if (BIT(data, 3) && !BIT(m_data, 3))
m_position = 0;
if (BIT(data, 7) && BIT(data, 6) && !BIT(m_data, 6))
if (BIT(data, 6) && !BIT(m_data, 6))
{
out_led(m_position);
m_leds_off_timer->adjust(attotime::from_hz(5));
int x = (m_position & 0x3f) / 8;
int y = (m_position & 0x3f) % 8;
m_out_leds[y][x] = BIT(data, 7);
}
if (!BIT(data, 7) && BIT(m_data, 7))
@ -267,15 +262,3 @@ void tasc_sb30_device::write(uint8_t data)
m_data = data;
}
void tasc_sb30_device::out_led(int pos)
{
pos &= 0x3f;
int x = pos / 8;
int y = pos % 8;
m_out_leds[y + 0][x + 0] = 1;
m_out_leds[y + 0][x + 1] = 1;
m_out_leds[y + 1][x + 0] = 1;
m_out_leds[y + 1][x + 1] = 1;
}

View File

@ -38,14 +38,13 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
TIMER_CALLBACK_MEMBER(leds_off_cb);
void out_led(int pos);
bool piece_available(uint8_t id);
void init_cb(int state);
uint8_t spawn_cb(offs_t offset);
required_device<sensorboard_device> m_board;
output_finder<9,9> m_out_leds;
output_finder<8,8> m_out_leds;
emu_timer * m_leds_off_timer;
uint8_t m_data;
uint8_t m_position;