-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
38 lines (29 loc) · 848 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef UTILS_H_RFF2FPSB
#define UTILS_H_RFF2FPSB
#include <inttypes.h>
#include "config.h"
#include "portAccess.h"
#include "uart.h"
uint32_t millis();
void clock_init();
void reset();
void clock_callback();
void led_activity_on();
void led_activity_off();
void led_update();
#define LED_ON led_activity_on
#define LED_OFF led_activity_off
#define _LED_ON() PORT(LED_PORT)|=_BV(LED_PIN)
#define _LED_OFF() PORT(LED_PORT)&=~_BV(LED_PIN)
#ifdef DEBUG
#include <stdio.h>
extern UART uart3;
#define DEBUG_OUT(s) { for (uint8_t __x=0;s[__x];__x++) uart3.send(s[__x]); }
#define DEBUG_OUTB(b) { uart3.send(b); }
#define DEBUG_OUTF(f,args...) { char _buf[256]; sprintf(_buf, f,## args); DEBUG_OUT(_buf); }
#else
#define DEBUG_OUT(s)
#define DEBUG_OUTB(b)
#define DEBUG_OUTF(f,args...)
#endif
#endif /* end of include guard: UTILS_H_RFF2FPSB */