mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-09-30 04:56:32 +00:00
Move F_CPU to header file and clean up 2560 read_row() code
This commit is contained in:
parent
9b41a77ea4
commit
3c1d050abb
@ -33,6 +33,7 @@
|
|||||||
// 23-25 PORTC0-2 ROW outputs (row number)
|
// 23-25 PORTC0-2 ROW outputs (row number)
|
||||||
// 27 PORTC4
|
// 27 PORTC4
|
||||||
|
|
||||||
|
#include "asdf_arch.h"
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
@ -40,7 +41,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "asdf_config.h"
|
#include "asdf_config.h"
|
||||||
#include "asdf_arch.h"
|
|
||||||
#include "asdf_keymap_defs.h"
|
#include "asdf_keymap_defs.h"
|
||||||
|
|
||||||
// Tick is true every 1 ms.
|
// Tick is true every 1 ms.
|
||||||
@ -728,6 +728,10 @@ void asdf_arch_init(void)
|
|||||||
// "1". So, if a keypress pulls the column line low, then the reading of the
|
// "1". So, if a keypress pulls the column line low, then the reading of the
|
||||||
// physical bits must be inverted.
|
// physical bits must be inverted.
|
||||||
//
|
//
|
||||||
|
// 2) A small delay (2usec) is required between setting the keyboard row outputs
|
||||||
|
// and reading the columns, which I think is due to capacitance across the
|
||||||
|
// reverse-biased diodes.
|
||||||
|
//
|
||||||
// SCOPE: public
|
// SCOPE: public
|
||||||
//
|
//
|
||||||
// COMPLEXITY: 1
|
// COMPLEXITY: 1
|
||||||
@ -735,13 +739,13 @@ void asdf_arch_init(void)
|
|||||||
asdf_cols_t asdf_arch_read_row(uint8_t row)
|
asdf_cols_t asdf_arch_read_row(uint8_t row)
|
||||||
{
|
{
|
||||||
uint32_t rows = ~(1L << row);
|
uint32_t rows = ~(1L << row);
|
||||||
asdf_cols_t cols;
|
|
||||||
ASDF_LOROW_PORT = (uint8_t)(rows & 0xff);
|
ASDF_LOROW_PORT = (uint8_t)(rows & 0xff);
|
||||||
ASDF_HIROW_PORT = (uint8_t)((rows >> 8) & 0xff);
|
ASDF_HIROW_PORT = (uint8_t)((rows >> 8) & 0xff);
|
||||||
cols = ~(asdf_cols_t) ASDF_COLUMNS_PIN;
|
|
||||||
ASDF_HIROW_PORT = 0xff;
|
_delay_us(ASDF_KEYBOARD_ROW_SETTLING_TIME_US);
|
||||||
ASDF_LOROW_PORT = 0xff;
|
|
||||||
return cols;
|
return ~(asdf_cols_t) ASDF_COLUMNS_PIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_arch_osi_read_row
|
// PROCEDURE: asdf_arch_osi_read_row
|
||||||
|
@ -33,8 +33,11 @@
|
|||||||
|
|
||||||
// ASDF keyboard definitions:
|
// ASDF keyboard definitions:
|
||||||
|
|
||||||
#define ASDF_STROBE_LENGTH_US 10 // strobe length in microseconds
|
#define F_CPU 16000000L
|
||||||
|
|
||||||
|
#define ASDF_STROBE_LENGTH_US 10 // strobe length in microseconds
|
||||||
|
#define ASDF_KEYBOARD_ROW_SETTLING_TIME_US 2 // time for keyboard capacitance to
|
||||||
|
// settle before sampling
|
||||||
|
|
||||||
// Clock definitions:
|
// Clock definitions:
|
||||||
#define SYSCLK_DIV1 0
|
#define SYSCLK_DIV1 0
|
||||||
|
@ -33,13 +33,13 @@
|
|||||||
// 23-25 PORTC0-2 ROW outputs (row number)
|
// 23-25 PORTC0-2 ROW outputs (row number)
|
||||||
// 27 PORTC4
|
// 27 PORTC4
|
||||||
|
|
||||||
|
#include "asdf_arch.h"
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "asdf_config.h"
|
#include "asdf_config.h"
|
||||||
#include "asdf_arch.h"
|
|
||||||
#include "asdf_keymap_defs.h"
|
#include "asdf_keymap_defs.h"
|
||||||
|
|
||||||
static volatile uint8_t tick = 0;
|
static volatile uint8_t tick = 0;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
// ASDF keyboard definitions:
|
// ASDF keyboard definitions:
|
||||||
|
|
||||||
|
#define F_CPU 8000000L
|
||||||
|
|
||||||
#define ASDF_STROBE_LENGTH_US 10 // strobe length in microseconds
|
#define ASDF_STROBE_LENGTH_US 10 // strobe length in microseconds
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user