forked from riyas-org/rf24pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RF24_config.h
executable file
·103 lines (84 loc) · 2.13 KB
/
RF24_config.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
Copyright (C) 2011 J. Coliz <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
#ifndef __RF24_CONFIG_H__
#define __RF24_CONFIG_H__
#ifdef ARDUINO
//#warning "Arduino enabled"
#if ARDUINO < 100
//#include <WProgram.h>
#else
//#include <Arduino.h>
#endif
#else
//#warning "Arduino disabled"
#include "spi.h"
#include "gpio.h"
#include "compatibility.h"
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <sys/time.h>
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#endif
#include <stddef.h>
// Stuff that is normally provided by Arduino
//#ifdef ARDUINO
//#include <SPI.h>
//#else
//#include <stdint.h>
//#//include <stdio.h>
//#include <string.h>
//extern HardwareSPI SPI;
//#define _BV(x) (1<<(x))
//#else
//#endif
//#include "../spi/spi.h"
//#include "../gpio/gpio.h"
#define _BV(x) (1<<(x))
// #endif
#undef SERIAL_DEBUG
#ifdef SERIAL_DEBUG
#define IF_SERIAL_DEBUG(x) ({x;})
#else
#define IF_SERIAL_DEBUG(x)
#endif
// Avoid spurious warnings
#if 1
#if ! defined( NATIVE ) && defined( ARDUINO )
#undef PROGMEM
#define PROGMEM __attribute__(( section(".progmem.data") ))
#undef PSTR
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif
#endif
// Progmem is Arduino-specific
//#ifdef ARDUINO
//#include <avr/pgmspace.h>
//#define PRIPSTR "%S"
//#else
//typedef char const char;
typedef uint16_t prog_uint16_t;
#define PSTR(x) (x)
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define PRIPSTR "%s"
// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
#define HIGH GPIO::OUTPUT_HIGH
#define INPUT GPIO::DIRECTION_IN
#define OUTPUT GPIO::DIRECTION_OUT
#define digitalWrite(pin, value) GPIO::write(pin, value)
#define pinMode(pin, direction) GPIO::open(pin, direction)
#define delay(milisec) __msleep(milisec)
#define delayMicroseconds(usec) __usleep(usec)
//#endif
#endif // __RF24_CONFIG_H__
// vim:ai:cin:sts=2 sw=2 ft=cpp