kopia lustrzana https://github.com/k3ng/k3ng_cw_keyer
Add support for STM32F1 boards. (#114)
rodzic
7a3bcf13f2
commit
389077d580
|
@ -46,7 +46,7 @@
|
|||
|
||||
// K3NG Version 2017.05.12.01
|
||||
|
||||
#if !defined(ARDUINO_SAM_DUE)
|
||||
#if !defined(ARDUINO_SAM_DUE) && !defined (__STM32F1__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
@ -64,6 +64,10 @@ static volatile uint8_t head, tail;
|
|||
static uint8_t ps2Keyboard_DataPin;
|
||||
static char ps2Keyboard_CharBuffer=0;
|
||||
|
||||
#if defined (__STM32F1__) // < 2017/01/14 modified by Tamakichi
|
||||
#define gpio_read(pin) gpio_read_bit(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit)?HIGH:LOW
|
||||
#endif
|
||||
|
||||
// The ISR for the external interrupt
|
||||
void k3ng_ps2interrupt(void)
|
||||
{
|
||||
|
@ -72,8 +76,13 @@ void k3ng_ps2interrupt(void)
|
|||
static uint32_t prev_ms=0;
|
||||
uint32_t now_ms;
|
||||
uint8_t n, val;
|
||||
|
||||
|
||||
#if defined (__STM32F1__)
|
||||
val = gpio_read(ps2Keyboard_DataPin);
|
||||
#else
|
||||
val = digitalRead(ps2Keyboard_DataPin);
|
||||
#endif
|
||||
|
||||
now_ms = millis();
|
||||
if (now_ms - prev_ms > 250) {
|
||||
bitcount = 0;
|
||||
|
@ -474,6 +483,13 @@ void K3NG_PS2Keyboard::begin(uint8_t dataPin, uint8_t irq_pin) {
|
|||
|
||||
ps2Keyboard_DataPin = dataPin;
|
||||
|
||||
// initialize the pins
|
||||
#if defined (__STM32F1__) // < 2017/01/14 modified by Tamakichi
|
||||
irq_num = irq_pin;
|
||||
pinMode(irq_pin, INPUT);
|
||||
pinMode(ps2Keyboard_DataPin, INPUT);
|
||||
#else // end>
|
||||
|
||||
// initialize the pins
|
||||
#ifdef INPUT_PULLUP
|
||||
pinMode(irq_pin, INPUT_PULLUP);
|
||||
|
@ -530,6 +546,7 @@ void K3NG_PS2Keyboard::begin(uint8_t dataPin, uint8_t irq_pin) {
|
|||
irq_num = 0;
|
||||
break;
|
||||
}
|
||||
#endif // __STM32F1__ 2017/01/14 modified by Tamakichi
|
||||
head = 0;
|
||||
tail = 0;
|
||||
attachInterrupt(irq_num, k3ng_ps2interrupt, FALLING);
|
||||
|
|
|
@ -34,6 +34,9 @@ K3NG Updates
|
|||
2015101401
|
||||
Fixed issues with CTRL and ALT key combinations with German and French keyboards
|
||||
|
||||
7M4MON Updates
|
||||
20210215
|
||||
Add support for STM32F1 boards. (Marged from "https://github.com/Tamakichi/Arduino_PS2Keyboard" by Tamakichi. Tested with STM32F103C Boads).
|
||||
|
||||
*/
|
||||
|
||||
|
@ -50,12 +53,18 @@ K3NG Updates
|
|||
// #define OPTION_PS2_KEYBOARD_GERMAN
|
||||
// #define OPTION_PS2_KEYBOARD_FRENCH
|
||||
|
||||
#if !defined(ARDUINO_SAM_DUE)
|
||||
#if !defined(ARDUINO_SAM_DUE) && !defined (__STM32F1__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "Arduino.h" // for attachInterrupt, FALLING
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
// Every call to read() returns a single byte for each
|
||||
// keystroke. These configure what byte will be returned
|
||||
// for each "special" key. To ignore a key, use zero.
|
||||
|
|
|
@ -6,5 +6,5 @@ sentence=For use with the K3NG CW Keyer for PS2 keyboard support
|
|||
paragraph=For use with the K3NG CW Keyer for PS2 keyboard support
|
||||
category=Uncategorized
|
||||
url=https://github.com/k3ng/k3ng_cw_keyer
|
||||
architectures=avr
|
||||
architectures=avr,STM32F1
|
||||
includes=K3NG_PS2Keyboard.h
|
Ładowanie…
Reference in New Issue