Test cleanups

This commit is contained in:
Dave 2020-04-08 14:23:13 -05:00
parent 30cd305fe6
commit 644efa7122
7 changed files with 163 additions and 37 deletions

View File

@ -386,7 +386,7 @@ void asdf_arch_out1_open_lo_set(uint8_t value)
//
// NOTES: OUT2 is inverted by the 7404 buffer, so clearing the bit sets the output high. OUT2
// cannot be high impedance.
//
/
// SCOPE: public
//
// COMPLEXITY: 2

View File

@ -252,11 +252,12 @@ void asdf_arch_out1_set(uint8_t value)
set_output(PHYSICAL_OUT1, value);
}
// PROCEDURE: asdf_arch_out1_hi_z_set
// PROCEDURE: asdf_arch_out1_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Sets the OUT1 bit to hi-z if value is true, and low if value is false.
// DESCRIPTION: Emulates setting the OUT1 bit to hi-z if value is true, and low
// if value is false. For testing, set PHYSICAL_OUT1_OPEN_HI to the value.
//
// SIDE EFFECTS: See above.
//
@ -266,9 +267,27 @@ void asdf_arch_out1_set(uint8_t value)
//
// COMPLEXITY: 1
//
void asdf_arch_out1_hi_z_set(uint8_t value)
{
set_output(PHYSICAL_OUT1_OC, value);
void asdf_arch_out1_open_hi_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_out1_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Emulates setting the OUT1 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT1_OPEN_LO to the value.
//
// SIDE EFFECTS: See above.
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_out1_open_lo_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_out2_set
@ -289,11 +308,12 @@ void asdf_arch_out2_set(uint8_t value)
}
// PROCEDURE: asdf_arch_out2_hi_z_set
// PROCEDURE: asdf_arch_out2_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Sets the OUT2 bit to hi-z if value is true, and low if value is false.
// DESCRIPTION: Emulates setting the OUT2 bit to hi-z if value is true, and low
// if value is false. For testing, set PHYSICAL_OUT2_OPEN_HI to the value.
//
// SIDE EFFECTS: See above.
//
@ -303,9 +323,27 @@ void asdf_arch_out2_set(uint8_t value)
//
// COMPLEXITY: 1
//
void asdf_arch_out2_hi_z_set(uint8_t value)
{
set_output(PHYSICAL_OUT2_OC, value);
void asdf_arch_out2_open_hi_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_out2_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Emulates setting the OUT2 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT2_OPEN_LO to the value.
//
// SIDE EFFECTS: See above.
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_out2_open_lo_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_out3_set
@ -327,12 +365,12 @@ void asdf_arch_out3_set(uint8_t value)
set_output(PHYSICAL_OUT3, value);
}
// PROCEDURE: asdf_arch_out3_hi_z_set
// PROCEDURE: asdf_arch_out3_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Sets the OUT3 bit to hi-z if value is true, and low if value is false.
// DESCRIPTION: Emulates setting the OUT3 bit to hi-z if value is true, and low
// if value is false. For testing, set PHYSICAL_OUT3_OPEN_HI to the value.
//
// SIDE EFFECTS: See above.
//
@ -342,9 +380,27 @@ void asdf_arch_out3_set(uint8_t value)
//
// COMPLEXITY: 1
//
void asdf_arch_out3_hi_z_set(uint8_t value)
{
set_output(PHYSICAL_OUT3_OC, value);
void asdf_arch_out3_open_hi_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_out3_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
//
// DESCRIPTION: Emulates setting the OUT3 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT3_OPEN_LO to the value.
//
// SIDE EFFECTS: See above.
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_out3_open_lo_set(uint8_t value)
{set_output(PHYSICAL_OUT1_OPEN_HI, value);
}
// PROCEDURE: asdf_arch_check_output
@ -396,9 +452,9 @@ uint8_t asdf_arch_check_pulse(asdf_physical_dev_t device)
//
// NOTES: Set ASDF_PULSE_DELAY_US in asdf_config.h
//
// SCOPE: public
// SCOPE: private
//
// COMPLEXITY: 1
// COMPLEXITY: 2
//
void asdf_arch_pulse_delay(void)
{
@ -407,6 +463,46 @@ void asdf_arch_pulse_delay(void)
}
}
// PROCEDURE: asdf_arch_pulse_delay_long
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Emulates a long delay by advancing the pulse detector state machine
// for each output.
//
// SIDE EFFECTS: see above.
//
// NOTES: Set ASDF_PULSE_DELAY_US in asdf_config.h
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_pulse_delay_long(void)
{
asdf_arch_pulse_delay();
}
// PROCEDURE: asdf_arch_pulse_delay_short
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Emulates a short delay by advancing the pulse detector state machine
// for each output.
//
// SIDE EFFECTS: see above.
//
// NOTES: Set ASDF_PULSE_DELAY_US in asdf_config.h
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_pulse_delay_short(void)
{
asdf_arch_pulse_delay();
}
// PROCEDURE: asdf_arch_init
// INPUTS: none
// OUTPUTS: none

View File

@ -95,7 +95,6 @@ typedef enum {
PD_ST_ERROR_PULSE_FROM_INITIAL_STATE = 15,
} pulse_state_t;
// PROCEDURE: asdf_arch_null_output
// INPUTS: (uint8_t) value - ignored
// OUTPUTS: none
@ -126,11 +125,19 @@ void asdf_arch_led3_set(uint8_t value);
// DESCRIPTION: Sets the OUT1 bit if value is true, and clear OUT1 if value is false.
void asdf_arch_out1_set(uint8_t value);
// PROCEDURE: asdf_arch_out1_hi_z_set
// PROCEDURE: asdf_arch_out1_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Sets the OUT1 bit to hi-z if value is true, and low if value is false.
void asdf_arch_out1_hi_z_set(uint8_t value);
// DESCRIPTION: Emulates setting the OUT1 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT1_OPEN_LO to the value.
void asdf_arch_out1_open_hi_set(uint8_t value);
// PROCEDURE: asdf_arch_out1_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Emulates setting the OUT1 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT1_OPEN_LO to the value.
void asdf_arch_out1_open_lo_set(uint8_t value);
// PROCEDURE: asdf_arch_out2_set
// INPUTS: (uint8_t) value
@ -138,11 +145,19 @@ void asdf_arch_out1_hi_z_set(uint8_t value);
// DESCRIPTION: Sets the OUT2 bit if value is true, and clear OUT2 if value is false.
void asdf_arch_out2_set(uint8_t value);
// PROCEDURE: asdf_arch_out2_hi_z_set
// PROCEDURE: asdf_arch_out2_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Sets the OUT2 bit to hi-z if value is true, and low if value is false.
void asdf_arch_out2_hi_z_set(uint8_t value);
// DESCRIPTION: Emulates setting the OUT2 bit to hi-z if value is true, and low
// if value is false. For testing, set PHYSICAL_OUT2_OPEN_HI to the value.
void asdf_arch_out2_open_hi_set(uint8_t value);
// PROCEDURE: asdf_arch_out2_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Emulates setting the OUT2 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT2_OPEN_LO to the value.
void asdf_arch_out2_open_lo_set(uint8_t value);
// PROCEDURE: asdf_arch_out3_set
// INPUTS: (uint8_t) value
@ -150,11 +165,19 @@ void asdf_arch_out2_hi_z_set(uint8_t value);
// DESCRIPTION: Sets the OUT3 bit if value is true, and clear OUT3 if value is false.
void asdf_arch_out3_set(uint8_t value);
// PROCEDURE: asdf_arch_out3_hi_z_set
// PROCEDURE: asdf_arch_out3_open_hi_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Sets the OUT3 bit to hi-z if value is true, and low if value is false.
void asdf_arch_out3_hi_z_set(uint8_t value);
// DESCRIPTION: Emulates setting the OUT3 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT3_OPEN_LO to the value.
void asdf_arch_out3_open_hi_set(uint8_t value);
// PROCEDURE: asdf_arch_out3_open_lo_set
// INPUTS: (uint8_t) value
// OUTPUTS: none
// DESCRIPTION: Emulates setting the OUT3 bit to high if value is true, and hi-z
// if value is false. For testing, set PHYSICAL_OUT3_OPEN_LO to the value.
void asdf_arch_out3_open_lo_set(uint8_t value);
// PROCEDURE: asdf_arch_check_output
// INPUTS:(asdf_physical_dev_t) device - which device to check
@ -168,12 +191,19 @@ uint8_t asdf_arch_check_output(asdf_physical_dev_t device);
// DESCRIPTION: For a given real device, return the state of the pulse detector
uint8_t asdf_arch_check_pulse(asdf_physical_dev_t device);
// PROCEDURE: asdf_arch_pulse_delay
// PROCEDURE: asdf_arch_pulse_delay_short
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: Emulates a delay by advancing the pulse detector state machine
// DESCRIPTION: Emulates a short delay by advancing the pulse detector state machine
// for each output.
void asdf_arch_pulse_delay(void);
void asdf_arch_pulse_delay_short(void);
// PROCEDURE: asdf_arch_pulse_delay_long
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: Emulates a long delay by advancing the pulse detector state machine
// for each output.
void asdf_arch_pulse_delay_long(void);
// PROCEDURE: asdf_arch_read_row
// INPUTS: (uint8_t) row: the row number to be scanned

View File

@ -173,7 +173,7 @@
/* single pulse */ \
.virtual_device = VOUT3, \
.physical_device = PHYSICAL_OUT3, \
.function = V_PULSE, \
.function = V_PULSE_SHORT, \
.initial_value = 0, \
}, \
{ /* first of double assignment attempt */ \

View File

@ -110,7 +110,7 @@
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, 0x1c }, \
{ ACTION_NOTHING, ASCII_CTRL_P, ACTION_NOTHING, ACTION_NOTHING, \
ASCII_SPACE, ASCII_CTRL_Z, ASCII_CTRL_A, ASCII_CTRL_Q }, \
{ ACTION_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, \
{ ACTION_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, \
ASCII_CTRL_B, ASCII_CTRL_V, ASCII_CTRL_C, ASCII_CTRL_X }, \
{ ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, \
ASCII_CTRL_G, ASCII_CTRL_F, ASCII_CTRL_D, ASCII_CTRL_S }, \

View File

@ -55,7 +55,7 @@ TEST2_BUILD = $(BUILD_DIR)/test_$(TEST2)
TEST3 = asdf_keymaps
TEST3_SRC = $(TEST_DIR)/test_$(TEST3).c
TEST3_DEPS = ./$(TEST3).c $(UNITY_DIR)/unity.c ./asdf_physical.c ./asdf_virtual.c ./asdf_arch.c
TEST3_DEPS = ./$(TEST3).c $(UNITY_DIR)/unity.c ./asdf_physical.c ./asdf_virtual.c ./asdf_modifiers.c ./asdf_arch.c
TEST3_BUILD = $(BUILD_DIR)/test_$(TEST3)
TEST4 = asdf_buffer

View File

@ -80,7 +80,7 @@ void test_pulse_high_virtual_output(void)
TEST_ASSERT_EQUAL_INT32(PD_ST_STABLE_LOW, asdf_arch_check_pulse(PHYSICAL_OUT1));
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
asdf_virtual_action(VOUT1, V_PULSE);
asdf_virtual_action(VOUT1, V_PULSE_SHORT);
// output should be low
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
@ -95,7 +95,7 @@ void test_pulse_low_virtual_output(void)
TEST_ASSERT_EQUAL_INT32(PD_ST_STABLE_HIGH, asdf_arch_check_pulse(PHYSICAL_OUT1));
TEST_ASSERT_EQUAL_INT32(1, asdf_arch_check_output(PHYSICAL_OUT1));
asdf_virtual_action(VOUT1, V_PULSE);
asdf_virtual_action(VOUT1, V_PULSE_SHORT);
// output should be high
TEST_ASSERT_EQUAL_INT32(1, asdf_arch_check_output(PHYSICAL_OUT1));