예제 #1
0
def test_register_invalid_val():
    reg = RegsRegister(TEST_REG_NAME, TEST_REG_OFFSET, TEST_REG_WIDTH,
                       TEST_REG_DESCR, TEST_REG_REV, TEST_REG_ACCESS)

    reg.set_value("Invalid")
    assert reg.get_value() == b''

    reg.set_value([1, 2])
    assert reg.get_value() == b''
예제 #2
0
def test_register_invalid_val():
    """Invalid value register test."""
    reg = RegsRegister(
        TEST_REG_NAME,
        TEST_REG_OFFSET,
        TEST_REG_WIDTH,
        TEST_REG_DESCR,
        TEST_REG_REV,
        TEST_REG_ACCESS,
    )

    val = reg.get_value()
    with pytest.raises(SPSDKError):
        reg.set_value("Invalid")
    assert reg.get_value() == val

    with pytest.raises(SPSDKError):
        reg.set_value([1, 2])
    assert reg.get_value() == val
예제 #3
0
    def reload_register(self, reg: RegsRegister) -> None:
        """Reload the value in requested register.

        :param reg: The register to reload from the HW.
        """
        reg.set_value(self.get_register(reg.name))