mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-12-22 06:29:17 +00:00
Add support for "hi-z when low" outputs
The apple 1 CLEAR input requires a high-impedance inactive state to avoid conflict with the pin output of the 7404 at D12 (via CR4). So, to cover this condition most generally, this patch changes the adds a Hi-Z when low physical device for each output line, to complement the Hi-Z-when-high open collector emulation. The nomenclature is changed from OUT*_OC (emulated open collector) to OUT*_OPEN_HI and OUT*_OPEN_LO to indicate which condition gets the Hi-Z state. - added the set() functions to the asdf_arch_atmega328p.[ch] files and applied the above nomenclature. - Added the set() functions to the asdf_physical.[ch] files and applied the above nomenclature - Modified the SCREEN_CLEAR device to PHYSICAL_OUT1_OPEN_LO in the apple2 and ascii keymaps. - Changed the RESET from PHYSICAL_OUT1_OC to PHYSICAL_OUT1_OPEN_HI in the apple2 and ascii keymaps.
This commit is contained in:
parent
702ed71d60
commit
93349ed6e9
@ -324,7 +324,7 @@ void asdf_arch_out1_set(uint8_t value)
|
|||||||
set_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
set_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out1_hi_z_set
|
// PROCEDURE: asdf_arch_out1_open_hi_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
//
|
//
|
||||||
@ -338,7 +338,7 @@ void asdf_arch_out1_set(uint8_t value)
|
|||||||
//
|
//
|
||||||
// COMPLEXITY: 2
|
// COMPLEXITY: 2
|
||||||
//
|
//
|
||||||
void asdf_arch_out1_hi_z_set(uint8_t value)
|
void asdf_arch_out1_open_hi_set(uint8_t value)
|
||||||
{
|
{
|
||||||
if (value) {
|
if (value) {
|
||||||
clear_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
clear_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
||||||
@ -350,6 +350,32 @@ void asdf_arch_out1_hi_z_set(uint8_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out1_open_lo_set
|
||||||
|
// INPUTS: (uint8_t) value
|
||||||
|
// OUTPUTS: none
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Sets the OUT1 bit to high if value is true, and hi-z if value is false.
|
||||||
|
//
|
||||||
|
// SIDE EFFECTS: See above.
|
||||||
|
//
|
||||||
|
// NOTES:
|
||||||
|
//
|
||||||
|
// SCOPE: public
|
||||||
|
//
|
||||||
|
// COMPLEXITY: 2
|
||||||
|
//
|
||||||
|
void asdf_arch_out1_open_lo_set(uint8_t value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
set_bit(&ASDF_OUT1_PORT, ASDF_OUT1_BIT);
|
||||||
|
set_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clear_bit(&ASDF_OUT1_DDR, ASDF_OUT1_BIT);
|
||||||
|
clear_bit(&ASDF_OUT1_PORT, ASDF_OUT1_BIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out2_set
|
// PROCEDURE: asdf_arch_out2_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
@ -395,7 +421,7 @@ void asdf_arch_null_output(uint8_t value)
|
|||||||
(void) value;
|
(void) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out2_hi_z_set
|
// PROCEDURE: asdf_arch_out2_open_hi_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
//
|
//
|
||||||
@ -409,7 +435,26 @@ void asdf_arch_null_output(uint8_t value)
|
|||||||
//
|
//
|
||||||
// COMPLEXITY: 2
|
// COMPLEXITY: 2
|
||||||
//
|
//
|
||||||
void asdf_arch_out2_hi_z_set(uint8_t value)
|
void asdf_arch_out2_open_hi_set(uint8_t value)
|
||||||
|
{
|
||||||
|
asdf_arch_null_output(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out2_open_lo_set
|
||||||
|
// INPUTS: (uint8_t) value
|
||||||
|
// OUTPUTS: none
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Sets the OUT2 bit to high if value is true, and hi-z if value is false.
|
||||||
|
//
|
||||||
|
// SIDE EFFECTS: See above.
|
||||||
|
//
|
||||||
|
// NOTES: Not supported for the ATMega-328 ASCII interface.
|
||||||
|
//
|
||||||
|
// SCOPE: public
|
||||||
|
//
|
||||||
|
// COMPLEXITY: 2
|
||||||
|
//
|
||||||
|
void asdf_arch_out2_open_lo_set(uint8_t value)
|
||||||
{
|
{
|
||||||
asdf_arch_null_output(value);
|
asdf_arch_null_output(value);
|
||||||
}
|
}
|
||||||
@ -439,7 +484,7 @@ void asdf_arch_out3_set(uint8_t value)
|
|||||||
set_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
set_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out3_hi_z_set
|
// PROCEDURE: asdf_arch_out3_open_hi_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
//
|
//
|
||||||
@ -453,7 +498,7 @@ void asdf_arch_out3_set(uint8_t value)
|
|||||||
//
|
//
|
||||||
// COMPLEXITY: 2
|
// COMPLEXITY: 2
|
||||||
//
|
//
|
||||||
void asdf_arch_out3_hi_z_set(uint8_t value)
|
void asdf_arch_out3_open_hi_set(uint8_t value)
|
||||||
{
|
{
|
||||||
if (value) {
|
if (value) {
|
||||||
clear_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
clear_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
||||||
@ -465,6 +510,32 @@ void asdf_arch_out3_hi_z_set(uint8_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out3_open_lo_set
|
||||||
|
// INPUTS: (uint8_t) value
|
||||||
|
// OUTPUTS: none
|
||||||
|
//
|
||||||
|
// DESCRIPTION: Sets the OUT3 bit to high if value is true, and hi-z if value is false.
|
||||||
|
//
|
||||||
|
// SIDE EFFECTS: See above.
|
||||||
|
//
|
||||||
|
// NOTES:
|
||||||
|
//
|
||||||
|
// SCOPE: public
|
||||||
|
//
|
||||||
|
// COMPLEXITY: 2
|
||||||
|
//
|
||||||
|
void asdf_arch_out3_open_lo_set(uint8_t value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
set_bit(&ASDF_OUT3_PORT, ASDF_OUT3_BIT);
|
||||||
|
set_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clear_bit(&ASDF_OUT3_DDR, ASDF_OUT3_BIT);
|
||||||
|
clear_bit(&ASDF_OUT3_PORT, ASDF_OUT3_BIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_init_strobe
|
// PROCEDURE: asdf_arch_init_strobe
|
||||||
// INPUTS: none
|
// INPUTS: none
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
|
@ -279,11 +279,17 @@ void asdf_arch_led3_set(uint8_t value);
|
|||||||
// DESCRIPTION: Sets the OUT1 bit if value is true, and clear OUT1 if value is false.
|
// DESCRIPTION: Sets the OUT1 bit if value is true, and clear OUT1 if value is false.
|
||||||
void asdf_arch_out1_set(uint8_t value);
|
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
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
// DESCRIPTION: Sets the OUT1 bit to hi-z if value is true, and low if value is false.
|
// 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);
|
void asdf_arch_out1_open_hi_set(uint8_t value);
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out1_open_lo_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_open_lo_set(uint8_t value);
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out2_set
|
// PROCEDURE: asdf_arch_out2_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
@ -291,25 +297,36 @@ 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.
|
// DESCRIPTION: Sets the OUT2 bit if value is true, and clear OUT2 if value is false.
|
||||||
void asdf_arch_out2_set(uint8_t value);
|
void asdf_arch_out2_set(uint8_t value);
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
// NOTES: Not supported for the ATMega-328 ASCII interface.
|
||||||
|
void asdf_arch_out2_open_hi_set(uint8_t value);
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out2_open_lo_set
|
||||||
|
// INPUTS: (uint8_t) value
|
||||||
|
// OUTPUTS: none
|
||||||
|
// DESCRIPTION: Sets the OUT2 bit to high if value is true, and hi-z if value is false.
|
||||||
|
void asdf_arch_out2_open_lo_set(uint8_t value);
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out3_set
|
// PROCEDURE: asdf_arch_out3_set
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
// DESCRIPTION: Sets the OUT3 bit if value is true, and clear OUT3 if value is false.
|
// DESCRIPTION: Sets the OUT3 bit if value is true, and clear OUT3 if value is false.
|
||||||
void asdf_arch_out3_set(uint8_t value);
|
void asdf_arch_out3_set(uint8_t value);
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out2_hi_z_set
|
// PROCEDURE: asdf_arch_out3_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.
|
|
||||||
// NOTES: Not supported for the ATMega-328 ASCII interface.
|
|
||||||
void asdf_arch_out2_hi_z_set(uint8_t value);
|
|
||||||
|
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_out3_hi_z_set
|
|
||||||
// INPUTS: (uint8_t) value
|
// INPUTS: (uint8_t) value
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
// DESCRIPTION: Sets the OUT3 bit to hi-z if value is true, and low if value is false.
|
// 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);
|
void asdf_arch_out3_open_hi_set(uint8_t value);
|
||||||
|
|
||||||
|
// PROCEDURE: asdf_arch_out3_open_lo_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_open_lo_set(uint8_t value);
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_read_row
|
// PROCEDURE: asdf_arch_read_row
|
||||||
// INPUTS: (uint8_t) row: the row number to be scanned
|
// INPUTS: (uint8_t) row: the row number to be scanned
|
||||||
|
@ -49,12 +49,12 @@
|
|||||||
|
|
||||||
#define ACTION_RESET ACTION_VOUT1
|
#define ACTION_RESET ACTION_VOUT1
|
||||||
#define VIRTUAL_RESET VOUT1
|
#define VIRTUAL_RESET VOUT1
|
||||||
#define RESET_OUTPUT PHYSICAL_OUT3_OC
|
#define RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
|
||||||
#define RESET_ACTIVE_VALUE 0
|
#define RESET_ACTIVE_VALUE 0
|
||||||
|
|
||||||
#define ACTION_CLEAR ACTION_VOUT2
|
#define ACTION_CLEAR ACTION_VOUT2
|
||||||
#define VIRTUAL_CLR_SCR VOUT2
|
#define VIRTUAL_CLR_SCR VOUT2
|
||||||
#define CLR_SCR_OUTPUT PHYSICAL_OUT1
|
#define CLR_SCR_OUTPUT PHYSICAL_OUT1_OPEN_LO
|
||||||
#define CLR_SCR_ACTIVE_VALUE 1
|
#define CLR_SCR_ACTIVE_VALUE 1
|
||||||
|
|
||||||
#define VIRTUAL_POWER_LED VLED1
|
#define VIRTUAL_POWER_LED VLED1
|
||||||
|
@ -40,11 +40,11 @@
|
|||||||
#define ACTION_BREAK ACTION_NOTHING
|
#define ACTION_BREAK ACTION_NOTHING
|
||||||
|
|
||||||
#define VIRTUAL_RESET VOUT1
|
#define VIRTUAL_RESET VOUT1
|
||||||
#define RESET_OUTPUT PHYSICAL_OUT3_OC
|
#define RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
|
||||||
#define RESET_ACTIVE_VALUE 0
|
#define RESET_ACTIVE_VALUE 0
|
||||||
|
|
||||||
#define VIRTUAL_CLR_SCR VOUT2
|
#define VIRTUAL_CLR_SCR VOUT2
|
||||||
#define CLR_SCR_OUT PHYSICAL_OUT1
|
#define CLR_SCR_OUT PHYSICAL_OUT1_OPEN_LO
|
||||||
#define CLR_SCR_ACTIVE_VALUE 1
|
#define CLR_SCR_ACTIVE_VALUE 1
|
||||||
|
|
||||||
#define VIRTUAL_POWER_LED VLED1
|
#define VIRTUAL_POWER_LED VLED1
|
||||||
|
@ -37,9 +37,12 @@ static void (*const physical_out_set[])(uint8_t) = {
|
|||||||
[PHYSICAL_OUT1] = &asdf_arch_out1_set, //
|
[PHYSICAL_OUT1] = &asdf_arch_out1_set, //
|
||||||
[PHYSICAL_OUT2] = &asdf_arch_out2_set, //
|
[PHYSICAL_OUT2] = &asdf_arch_out2_set, //
|
||||||
[PHYSICAL_OUT3] = &asdf_arch_out3_set, //
|
[PHYSICAL_OUT3] = &asdf_arch_out3_set, //
|
||||||
[PHYSICAL_OUT1_OC] = &asdf_arch_out1_hi_z_set, //
|
[PHYSICAL_OUT1_OPEN_HI] = &asdf_arch_out1_open_hi_set, //
|
||||||
[PHYSICAL_OUT2_OC] = &asdf_arch_out2_hi_z_set, //
|
[PHYSICAL_OUT2_OPEN_HI] = &asdf_arch_out2_open_hi_set, //
|
||||||
[PHYSICAL_OUT3_OC] = &asdf_arch_out3_hi_z_set, //
|
[PHYSICAL_OUT3_OPEN_HI] = &asdf_arch_out3_open_hi_set, //
|
||||||
|
[PHYSICAL_OUT1_OPEN_LO] = &asdf_arch_out1_open_lo_set, //
|
||||||
|
[PHYSICAL_OUT2_OPEN_LO] = &asdf_arch_out2_open_lo_set, //
|
||||||
|
[PHYSICAL_OUT3_OPEN_LO] = &asdf_arch_out3_open_lo_set, //
|
||||||
[PHYSICAL_LED1] = &asdf_arch_led1_set, //
|
[PHYSICAL_LED1] = &asdf_arch_led1_set, //
|
||||||
[PHYSICAL_LED2] = &asdf_arch_led2_set, //
|
[PHYSICAL_LED2] = &asdf_arch_led2_set, //
|
||||||
[PHYSICAL_LED3] = &asdf_arch_led3_set //
|
[PHYSICAL_LED3] = &asdf_arch_led3_set //
|
||||||
|
@ -34,11 +34,14 @@
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
PHYSICAL_NO_OUT = 0,
|
PHYSICAL_NO_OUT = 0,
|
||||||
PHYSICAL_OUT1,
|
PHYSICAL_OUT1,
|
||||||
PHYSICAL_OUT1_OC,
|
PHYSICAL_OUT1_OPEN_HI,
|
||||||
|
PHYSICAL_OUT1_OPEN_LO,
|
||||||
PHYSICAL_OUT2,
|
PHYSICAL_OUT2,
|
||||||
PHYSICAL_OUT2_OC,
|
PHYSICAL_OUT2_OPEN_HI,
|
||||||
|
PHYSICAL_OUT2_OPEN_LO,
|
||||||
PHYSICAL_OUT3,
|
PHYSICAL_OUT3,
|
||||||
PHYSICAL_OUT3_OC,
|
PHYSICAL_OUT3_OPEN_HI,
|
||||||
|
PHYSICAL_OUT3_OPEN_LO,
|
||||||
PHYSICAL_LED1,
|
PHYSICAL_LED1,
|
||||||
PHYSICAL_LED2,
|
PHYSICAL_LED2,
|
||||||
PHYSICAL_LED3,
|
PHYSICAL_LED3,
|
||||||
|
Loading…
Reference in New Issue
Block a user