blob: 7b32fe6fd6eebac4b0953f84fb10b2a647dce46b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/*
* Copyright 2020 Birte Kristina Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "driver/stdin3.h"
#include <avr/io.h>
#include <avr/interrupt.h>
void StandardInput3::setup()
{
UCSR3B |= _BV(RXCIE3);
}
bool StandardInput3::hasKey()
{
if (write_pos != read_pos) {
return true;
}
return false;
}
char StandardInput3::getKey()
{
char ret = buffer[read_pos++];
read_pos %= bufsize;
return ret;
}
StandardInput3 kin3;
ISR(USART3_RX_vect)
{
kin3.addKey(UDR3);
}
|