https://github.com/koehlma/toavr
https://github.com/koehlma/toavr
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/koehlma/toavr
- Owner: koehlma
- License: lgpl-3.0
- Created: 2015-04-18T08:52:35.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-09T21:21:04.000Z (about 10 years ago)
- Last Synced: 2025-02-14T05:44:09.181Z (4 months ago)
- Language: C++
- Homepage:
- Size: 203 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ToAVR
Type oriented AVR## Examples
### Serial: interrupt driven
```c++
#define F_CPU 16000000UL#include
#include "toavr.h"
volatile uint8_t byte = 0;
ISR(SERIAL_RX_INTERRUPT) {
byte = Serial::get();
}int main(void) {
Serial::begin(115200UL);
Serial::enable_rx_interrupt();
ArduinoD13::output();
ArduinoD13::high();
enable_interrupts();
while(1) {
while (!(Serial::udr_empty())) { };
Serial::put(byte);
}
}
```### Serial: print and read line
```c++
#define F_CPU 16000000UL#include
#include#include "toavr.h"
char line[257];
int main(void) {
Serial::begin(115200UL);
while (1) {
Serial::readline(line, 256);
Serial::printline(line);
}
}
```