PHP код:
#ifndef PINS_H
#define PINS_H
#include <avr/io.h>
#define PORTD_W (uint16_t) &PORTD
#define PORTB_W (uint16_t) &PORTB
#define PORTC_W (uint16_t) &PORTC
#define DDRD_W (uint16_t) &DDRD
#define DDRB_W (uint16_t) &DDRB
#define DDRC_W (uint16_t) &DDRC
#define PIND_W (uint16_t) &PIND
#define PINB_W (uint16_t) &PINB
#define PINC_W (uint16_t) &PINC
const uint8_t ArduinoRPin[22] = {(1<<0),(1<<1),(1<<2),(1<<3),(1<<4),(1<<5),(1<<6),(1<<7),(1<<0),(1<<1),(1<<2),(1<<3),(1<<4),(1<<5),(1<<0),(1<<1),(1<<2),(1<<3),(1<<4),(1<<5),(1<<6),(1<<7)};
const uint8_t ArduinoPinPORT [22] = {PORTD_W,PORTD_W,PORTD_W,PORTD_W,PORTD_W,PORTD_W,PORTD_W,PORTD_W,
PORTB_W,PORTB_W,PORTB_W,PORTB_W,PORTB_W,PORTB_W,
PORTC_W,PORTC_W,PORTC_W,PORTC_W,PORTC_W,PORTC_W,PORTC_W,PORTC_W};
const uint8_t ArduinoPinDDR [22] = {DDRD_W,DDRD_W,DDRD_W,DDRD_W,DDRD_W,DDRD_W,DDRD_W,DDRD_W,
DDRB_W,DDRB_W,DDRB_W,DDRB_W,DDRB_W,DDRB_W,
DDRC_W,DDRC_W,DDRC_W,DDRC_W,DDRC_W,DDRC_W,DDRC_W,DDRC_W};
const uint8_t ArduinoPinPIN [22] = {PIND_W,PIND_W,PIND_W,PIND_W,PIND_W,PIND_W,PIND_W,PIND_W,
PINB_W,PINB_W,PINB_W,PINB_W,PINB_W,PINB_W,
PINC_W,PINC_W,PINC_W,PINC_W,PINC_W,PINC_W,PINC_W,PINC_W};
#define DigitalWrite1(ArduinoPin) * ((volatile uint8_t *) (uint16_t) ArduinoPinPORT[ArduinoPin]) |= ArduinoRPin[ArduinoPin]
#define DigitalWrite0(ArduinoPin) * ((volatile uint8_t *) (uint16_t) ArduinoPinPORT[ArduinoPin]) &= ~ArduinoRPin[ArduinoPin]
#define PinModeOut(ArduinoPin) * ((volatile uint8_t *) (uint16_t) ArduinoPinDDR[ArduinoPin]) |= ArduinoRPin[ArduinoPin]
#define PinModeIn(ArduinoPin) * ((volatile uint8_t *) (uint16_t) ArduinoPinDDR[ArduinoPin]) &= ~ArduinoRPin[ArduinoPin]
#define DigitalReadF(ArduinoPin) ((* ((volatile uint8_t *) (uint16_t) ArduinoPinPIN[ArduinoPin])& ArduinoRPin[ArduinoPin]))
#endif