#pragma once
#include <avr/io.h>
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
#define NOINIT __attribute__((section(".noinit")))
#define LAWTBL __attribute__((section(".lawtbl")))
register byte usbCfg asm("r2");
// Bit 0: Konfiguriert ja/nein
// Bit 1: Remote Wakeup ja/nein
// Bit 2: Alternate Setting für Interface2 (EP3)
// Bit 3: Höre B2, sonst B1 (Audio-Selektor)
// Bit 4: frei
// Bit 5: frei
// Bit 6: Flash = Quelle für Deskriptordaten (sonst RAM)
// Bit 7: EEPROM = Quelle
register byte rsv3 asm("r3");
register byte rsv4 asm("r4");
register byte rsv5 asm("r5");
register byte rsv6 asm("r6");
register byte rsv7 asm("r7");
register byte rsv8 asm("r8");
register byte rsv9 asm("r9");
// law.cpp
extern const byte law[];
extern const byte lawPWM[];
// s0isr.S
extern "C" void s0Init();
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
// Ein const-Zeiger, der in RAM, EEPROM oder Flash zeigen darf
// (Nur für AVRs mit <= 32 KB Flash — sonst fest im Bereich 0x8000..0xFFFF)
// Macht sich Wrap-Around zunutze.
struct Multiptr{
const byte*p;
byte operator*() const {return word(p)&0x8000?pgm_read_byte(p):word(p)&0x4000?eeprom_read_byte(p):*p;}
Multiptr operator++() {return Multiptr(++p);} // Präfix-Inkrement
Multiptr operator++(int) {return Multiptr(p++);} // Postfix-Inkrement
Multiptr() {} // Nichtinitialisierender Konstruktor
Multiptr(const byte*x):p(x) {} // Initialisierender Konstruktor
Multiptr operator=(const byte*x) {p=x; return*this;} // Zuweisung
};
#define FP(x) Multiptr((byte*)(word(x)|0x8000)) // Flash-Pointer
#define EP(x) Multiptr((byte*)(word(x)|0x4000)) // EEPROM-Pointer
| Detected encoding: UTF-8 | 0
|