avr-fw-modules/core/include/sys/trace.h

36 lines
636 B
C

#pragma once
#include <stdint.h>
uint8_t __trace_get(void) __attribute__((weak));
void __trace_set(uint8_t state) __attribute__((weak));
static inline uint8_t trace_get(void) {
if (__trace_get)
return __trace_get();
return 0;
};
static inline void trace_set(uint8_t state){
if (__trace_set)
__trace_set(state);
};
static inline void trace_on(uint8_t no) {
uint8_t s = trace_get();
s |= (1<<no);
trace_set(s);
};
static inline void trace_off(uint8_t no) {
uint8_t s = trace_get();
s &= ~(1<<no);
trace_set(s);
};
static inline void trace_swap(uint8_t no) {
uint8_t s = trace_get();
s ^= (1<<no);
trace_set(s);
};