[deutsch] PHP version

Source file: /~heha/Mikrocontroller/Sternhimmel/Schnecke.zip[Download]/PWM32.h

Show line numbers
/************************
 * Interface zu PWM32.S *
 ************************/

#ifndef _PWM32_H_
#define _PWM32_H_

#define DIFF 2		// Takte zum LED schalten, zwischen TIMER1_CAPT und TIMER1_COMPA
#define CYCLE (8191+6)	// Taktzyklen pro Katode
#define SAVEY		// Y retten
#define DOSEI		// Interrupts für V-USB früh freigeben

#ifndef __ASSEMBLER__ 
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
typedef struct{BYTE r,g,b;} RGB;	// Farbtripel

extern BYTE bzt[7*3];
extern BYTE repid3;
extern RGB lht[54];
extern BYTE repid2;
extern BYTE adu[3];

register BYTE rsv2 asm("r2");
register BYTE rsv3 asm("r3");
register BYTE rsv4 asm("r4");
register BYTE rsv5 asm("r5");
register BYTE rsv6 asm("r6");
volatile register BYTE CurKatode asm("r7");

// Initialisierer
void calc_abt(void);
void TIMER1_CAPT_vect();	// Implizites sei()

// Makros
#define PWM32_INIT() {	\
 BYTE *p=bzt;		\
 WORD m=1<<8;		\
 do{			\
  m+=DIFF;		\
  *p++=(BYTE)m;		\
  *p++=(BYTE)(m>>8);	\
  p++;			\
  m-=DIFF;		\
  m<<=1;		\
 }while(m<1<<13);	\
 m=(1<<7)+DIFF;		\
 *p++=(BYTE)m;		\
 *p=(BYTE)(m>>8);	\
 calc_abt();		\
}

#define PWM32_START() {	\
 ICR1=CYCLE-1;		\
 OCR1A=(1<<7)+DIFF;	\
 OCR1B=(1<<12)+100;	\
 TIMSK=0x38;		\
 TCCR1B=0x19;		\
 TIMER1_CAPT_vect();	\
}

// Unterprogramme
BYTE* GetPtr(BYTE nr);
void SetLed(BYTE nr, DWORD rgb);
DWORD GetLed(BYTE nr);
#endif

#endif//_PWM32_H_
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded
Assume file is OEM (CP437) encoded