traces
This commit is contained in:
@@ -2,7 +2,17 @@ import argparse
|
||||
import unittest
|
||||
|
||||
from h8536.emulator import H8536Emulator, SCI1_RDR, SCI1_SSR, SCI_SSR_ORER, SCI_SSR_RDRF
|
||||
from h8536.emulator.rx_probe import RunContext, UartTiming, _inject_frame_uart_timed, frame_checksum, frame_checksum_ok, parse_frame
|
||||
from h8536.emulator.rx_probe import (
|
||||
RunContext,
|
||||
UartTiming,
|
||||
_inject_frame_uart_timed,
|
||||
frame_checksum,
|
||||
frame_checksum_ok,
|
||||
parse_frame,
|
||||
parse_panel_action_arg,
|
||||
parse_panel_press_arg,
|
||||
parse_panel_release_arg,
|
||||
)
|
||||
|
||||
|
||||
def rom_with_reset(*, reset: int = 0x1000, size: int = 0x1020) -> bytearray:
|
||||
@@ -30,6 +40,25 @@ class EmulatorRxProbeTest(unittest.TestCase):
|
||||
with self.assertRaises(argparse.ArgumentTypeError):
|
||||
parse_frame("04 00 00 40")
|
||||
|
||||
def test_parse_panel_action_accepts_alias_state_and_raw_shadow_bit(self):
|
||||
action = parse_panel_action_arg("cam-power=release")
|
||||
self.assertEqual(action.panel_input.shadow, 0xF6D4)
|
||||
self.assertEqual(action.panel_input.bit, 3)
|
||||
self.assertFalse(action.pressed)
|
||||
|
||||
raw = parse_panel_press_arg("F6D4.6")
|
||||
self.assertEqual(raw.panel_input.source, 0xF105)
|
||||
self.assertEqual(raw.panel_input.dirty, 0xF6F2)
|
||||
self.assertEqual(raw.panel_input.dirty_bit, 4)
|
||||
self.assertTrue(raw.pressed)
|
||||
|
||||
def test_parse_panel_release_accepts_source_address_lane(self):
|
||||
action = parse_panel_release_arg("F006.5")
|
||||
|
||||
self.assertEqual(action.panel_input.shadow, 0xF6DB)
|
||||
self.assertEqual(action.panel_input.previous, 0xF6EB)
|
||||
self.assertFalse(action.pressed)
|
||||
|
||||
def test_uart_timed_injection_does_not_wait_for_rdrf_consumption(self):
|
||||
emulator = H8536Emulator(bytes(rom_with_reset()), clock_hz=10_000_000)
|
||||
context = RunContext()
|
||||
|
||||
Reference in New Issue
Block a user