-
Notifications
You must be signed in to change notification settings - Fork 1k
/
RF24_arch_config.h
61 lines (50 loc) · 1.69 KB
/
RF24_arch_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
/*
* Copyright (C)
* 2021 Jannis Achstetter (kripton)
* 2021 Brendan Doherty (2bndy5)
*
* 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.
*/
/**
* @file RF24_arch_config.h
* General defines and includes for RF24 using The Pico SDK
*/
#ifndef RF24_UTILITY_RP2_RF24_ARCH_CONFIG_H_
#define RF24_UTILITY_RP2_RF24_ARCH_CONFIG_H_
#include "spi.h"
#include "gpio.h"
#include <string.h>
#include <stdio.h>
/** Define a specific platform name for this configuration */
#define RF24_RP2
#define _BV(x) (1 << (x))
#define _SPI SPI
#define RF24_SPI_PTR
static SPI spi;
#ifdef SERIAL_DEBUG
#define IF_SERIAL_DEBUG(x) ({ x; })
#else
#define IF_SERIAL_DEBUG(x)
#endif
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) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))
// 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) sleep_ms(milisec)
#define delayMicroseconds(usec) sleep_us(usec)
#define millis() to_ms_since_boot(get_absolute_time())
#endif // RF24_UTILITY_RP2_RF24_ARCH_CONFIG_H_