An open API service indexing awesome lists of open source software.

https://github.com/koehlma/toavr


https://github.com/koehlma/toavr

Last synced: 2 months ago
JSON representation

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);
}
}
```