include/debug.h
changeset 3 24bc72470027
equal deleted inserted replaced
2:3420bd6d2d10 3:24bc72470027
       
     1 #ifndef QMSK_DEBUG_H
       
     2 #define QMSK_DEBUG_H
       
     3 
       
     4 #include <avr/io.h>
       
     5 
       
     6 #include "stdlib.h"
       
     7 
       
     8 #if !defined(DEBUG_DDR) || !defined(DEBUG_PIN) || !defined(DEBUG_PORT)
       
     9 #   error("#define DEBUG_{DDR_PIN_PORT} before #include")
       
    10 #endif
       
    11 
       
    12 static inline void debug_init (void)
       
    13 {
       
    14     sbi(&DEBUG_DDR, DEBUG_PIN);
       
    15 }
       
    16 
       
    17 static inline void debug_set (void)
       
    18 {
       
    19     sbi(&DEBUG_PORT, DEBUG_PIN);
       
    20 }
       
    21 
       
    22 static inline void debug_clear (void)
       
    23 {
       
    24     cbi(&DEBUG_PORT, DEBUG_PIN);
       
    25 }
       
    26 
       
    27 static inline void debug_toggle (void)
       
    28 {
       
    29     xbi(&DEBUG_PORT, DEBUG_PIN);
       
    30 }
       
    31 
       
    32 #endif