Only drive wait line low in peripheral
This commit is contained in:
parent
e79620989f
commit
49bde8176f
@ -245,14 +245,14 @@ void parallel_peripheral(void) {
|
|||||||
struct Parallel * port = &PORT;
|
struct Parallel * port = &PORT;
|
||||||
parallel_hiz(port);
|
parallel_hiz(port);
|
||||||
|
|
||||||
// Set wait line to low output
|
|
||||||
gpio_set_dir(port->wait_n, true);
|
|
||||||
|
|
||||||
// Strobes are high when inactive
|
// Strobes are high when inactive
|
||||||
bool last_data_n = true;
|
bool last_data_n = true;
|
||||||
bool last_addr_n = true;
|
bool last_addr_n = true;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
// Pull wait line low
|
||||||
|
gpio_set_dir(port->wait_n, true);
|
||||||
|
|
||||||
// Read data strobe and edge detect
|
// Read data strobe and edge detect
|
||||||
bool data_n = gpio_get(port->data_n);
|
bool data_n = gpio_get(port->data_n);
|
||||||
bool data_edge = last_data_n && !data_n;
|
bool data_edge = last_data_n && !data_n;
|
||||||
@ -277,8 +277,8 @@ void parallel_peripheral(void) {
|
|||||||
|
|
||||||
//TODO: Check if strobe fell while reading
|
//TODO: Check if strobe fell while reading
|
||||||
|
|
||||||
// Set wait line high
|
// Release wait line
|
||||||
gpio_set(port->wait_n, true);
|
gpio_set_dir(port->wait_n, false);
|
||||||
|
|
||||||
if (data_edge) {
|
if (data_edge) {
|
||||||
putchar('d');
|
putchar('d');
|
||||||
@ -299,8 +299,6 @@ void parallel_peripheral(void) {
|
|||||||
// Delay 5 usecs
|
// Delay 5 usecs
|
||||||
_delay_us(5);
|
_delay_us(5);
|
||||||
|
|
||||||
// Set wait line low
|
|
||||||
gpio_set(port->wait_n, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user