me-no-dev
2016-12-12 02:12:13 +02:00
parent 54b1b8b1d3
commit a6c02bc710
11 changed files with 28 additions and 18 deletions

View File

@ -100,12 +100,20 @@ extern "C" {
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
// avr-libc defines _NOP() since 1.6.2
#ifndef _NOP
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
#endif
typedef unsigned int word;
#define bit(b) (1UL << (b))
#define _BV(b) (1UL << (b))
#define digitalPinToPort(pin) (((pin)>31)?1:0)
#define digitalPinToBitMask(pin) (1UL << (pin))
#define digitalPinToBitMask(pin) (1UL << (((pin)>31)?((pin)-31):(pin)))
#define digitalPinToTimer(pin) (0)
#define analogInPinToBit(P) (P)
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
@ -118,6 +126,13 @@ extern "C" {
typedef bool boolean;
typedef uint8_t byte;
void init(void);
void initVariant(void);
void initArduino(void);
void setup(void);
void loop(void);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);