include/debug.h
author Tero Marttila <terom@paivola.fi>
Wed, 24 Sep 2014 22:40:48 +0300
changeset 3 24bc72470027
permissions -rw-r--r--
debug
#ifndef QMSK_DEBUG_H
#define QMSK_DEBUG_H

#include <avr/io.h>

#include "stdlib.h"

#if !defined(DEBUG_DDR) || !defined(DEBUG_PIN) || !defined(DEBUG_PORT)
#   error("#define DEBUG_{DDR_PIN_PORT} before #include")
#endif

static inline void debug_init (void)
{
    sbi(&DEBUG_DDR, DEBUG_PIN);
}

static inline void debug_set (void)
{
    sbi(&DEBUG_PORT, DEBUG_PIN);
}

static inline void debug_clear (void)
{
    cbi(&DEBUG_PORT, DEBUG_PIN);
}

static inline void debug_toggle (void)
{
    xbi(&DEBUG_PORT, DEBUG_PIN);
}

#endif