2013-03-31 21:13:51 -06:00
|
|
|
#ifndef AVR_H
|
|
|
|
#define AVR_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
2013-04-01 21:17:18 -06:00
|
|
|
#define bit(pin, bit, on) pin = (on ? (pin | bit) : (pin & ~bit))
|
|
|
|
|
2013-05-04 19:46:18 -06:00
|
|
|
#define mode(on) bit(PORTA, _BV(0), on)
|
|
|
|
#define sin(on) bit(PORTA, _BV(1), on)
|
|
|
|
#define sclk(on) bit(PORTA, _BV(2), on)
|
|
|
|
#define xlat(on) bit(PORTA, _BV(3), on)
|
2013-03-31 21:13:51 -06:00
|
|
|
// Connect GSCLK to SCLK
|
|
|
|
// Connect BLANK to XLAT
|
|
|
|
// TRUST ME, THIS TOTALLY WORKS
|
|
|
|
|
|
|
|
#define NESOUT 6
|
2013-05-04 19:46:18 -06:00
|
|
|
#define nesclk(on) bit(PORTA, _BV(4), on)
|
|
|
|
#define nesltch(on) bit(PORTA, _BV(5), on)
|
|
|
|
#define nesout() ((PINA & _BV(NESOUT)) << NESOUT)
|
2013-03-31 21:13:51 -06:00
|
|
|
|
|
|
|
void init(void);
|
|
|
|
|
|
|
|
#endif
|