#ifndef __avrcommon_h
  #define __avrcommon_h
  
  
  #define SetBit(BIT, PORT)    (PORT |= (1<<BIT))
  #define ClearBit(BIT, PORT)  (PORT &= ~(1<<BIT))
  #define IsHigh(BIT, PORT)    (PORT & (1<<BIT)) != 0
  #define IsLow(BIT, PORT)     (PORT & (1<<BIT)) == 0
  #define NOP()                 asm volatile ("nop"::)
  #define ABS(a)                ((a) < 0 ? -(a) : (a))
  #define SIGN(x)               (x)==0?0:(x)>0?1:-1
  #define limit(v, l, h)        ((v) > (h)) ? (h) : ((v) < (l)) ? (l) : (v)
  #define inBounds(v, l, h)        ((v) > (h)) ? (0) : ((v) < (l)) ? (0) : (1)
  
  
  
  
#endif
