summaryrefslogtreecommitdiff
path: root/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio
diff options
context:
space:
mode:
authorkrolyxon <me@krolyxon.com>2026-06-08 23:10:46 +0530
committerkrolyxon <me@krolyxon.com>2026-06-08 23:10:46 +0530
commit3120783000d0025b183b0397acaa8b769499eb38 (patch)
tree1c4f93be213f1b1d48f59e554562d847b4e7c25e /.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio
Initial gh-pages firmware hosting
Diffstat (limited to '.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio')
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/RF24_arch_config.h71
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.cpp45
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.h25
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.cpp39
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.h63
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/includes.h10
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.cpp32
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.h30
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.cpp40
-rw-r--r--.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.h68
10 files changed, 423 insertions, 0 deletions
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/RF24_arch_config.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/RF24_arch_config.h
new file mode 100644
index 0000000..3d05c09
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/RF24_arch_config.h
@@ -0,0 +1,71 @@
+/*
+ Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
+
+ 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_UTILITY_PIGPIO_RF24_ARCH_CONFIG_H_
+#define RF24_UTILITY_PIGPIO_RF24_ARCH_CONFIG_H_
+
+#define RF24_LINUX
+
+#include <stdint.h> // uint16_t
+#include <stdio.h> // printf
+#include <string.h> // strlen
+#include "spi.h"
+#include "gpio.h"
+#include "compatibility.h"
+
+//#define RF24_SPI_SPEED RF24_SPIDEV_SPEED
+
+#define _BV(x) (1 << (x))
+#define _SPI spi
+
+#ifdef RF24_DEBUG
+ #define IF_RF24_DEBUG(x) ({ x; })
+#else
+ #define IF_RF24_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
+
+#if RF24_SPI_SPEED > 1000000
+ #undef RF24_SPI_SPEED
+ #define RF24_SPI_SPEED 1000000
+#endif
+
+typedef uint16_t prog_uint16_t;
+typedef uint8_t rf24_gpio_pin_t;
+#define RF24_PIN_INVALID 0xFF
+
+#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(millisec) __msleep(millisec)
+#define delayMicroseconds(usec) __usleep(usec)
+#define millis() __millis()
+
+#endif // RF24_UTILITY_PIGPIO_RF24_ARCH_CONFIG_H_
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.cpp b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.cpp
new file mode 100644
index 0000000..f28cf3d
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.cpp
@@ -0,0 +1,45 @@
+#include <time.h>
+#include <chrono>
+#include "compatibility.h"
+
+long long mtime, seconds, useconds;
+//static struct timeval start, end;
+//struct timespec start, end;
+
+void __msleep(int millisec)
+{
+ struct timespec req; // = {0};
+ req.tv_sec = (time_t)millisec / 1000;
+ req.tv_nsec = (millisec % 1000) * 1000000L;
+ //nanosleep(&req, (struct timespec *)NULL);
+ clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL);
+}
+
+void __usleep(int microsec)
+{
+ struct timespec req; // = {0};
+ req.tv_sec = (time_t)microsec / 1000000;
+ req.tv_nsec = (microsec % 1000000) * 1000;
+ //nanosleep(&req, (struct timespec *)NULL);
+ clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL);
+}
+
+/**
+ * This function is added in order to simulate arduino millis() function
+ */
+
+bool timerStarted = false;
+
+void __start_timer()
+{
+}
+
+auto start = std::chrono::steady_clock::now();
+
+uint32_t __millis()
+{
+
+ auto end = std::chrono::steady_clock::now();
+
+ return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
+}
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.h
new file mode 100644
index 0000000..b94c571
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/compatibility.h
@@ -0,0 +1,25 @@
+/*
+ * Time keeping functions
+ */
+#ifndef RF24_UTILITY_PIGPIO_COMPATIBLITY_H_
+#define RF24_UTILITY_PIGPIO_COMPATIBLITY_H_
+
+#include <stdint.h> // for uintXX_t types
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void __msleep(int millisec);
+
+void __usleep(int microsec);
+
+void __start_timer();
+
+uint32_t __millis();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RF24_UTILITY_PIGPIO_COMPATIBLITY_H_ */
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.cpp b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.cpp
new file mode 100644
index 0000000..3c9a63e
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.cpp
@@ -0,0 +1,39 @@
+/*
+ * GPIO Functions
+ */
+#include <pigpio.h>
+#include "gpio.h"
+
+bool initialized = 0;
+
+GPIO::GPIO()
+{
+}
+
+GPIO::~GPIO()
+{
+ gpioTerminate();
+}
+
+void GPIO::open(int port, int DDR)
+{
+ if (!initialized) {
+ gpioInitialise();
+ }
+ initialized = true;
+ gpioSetMode(port, PI_OUTPUT);
+}
+
+void GPIO::close(int port)
+{
+}
+
+int GPIO::read(int port)
+{
+ return gpioRead(port);
+}
+
+void GPIO::write(int port, int value)
+{
+ gpioWrite(port, value);
+}
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.h
new file mode 100644
index 0000000..8fe245c
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/gpio.h
@@ -0,0 +1,63 @@
+/*
+ *
+ */
+
+#ifndef RF24_UTILITY_PIGPIO_GPIO_H_
+#define RF24_UTILITY_PIGPIO_GPIO_H_
+
+#include <stdexcept>
+
+/** Specific exception for GPIO errors */
+class GPIOException : public std::runtime_error
+{
+public:
+ explicit GPIOException(const std::string& msg)
+ : std::runtime_error(msg)
+ {
+ }
+};
+
+class GPIO
+{
+public:
+ /* Constants */
+ static const int DIRECTION_OUT = 1;
+ static const int DIRECTION_IN = 0;
+
+ static const int OUTPUT_HIGH = 1;
+ static const int OUTPUT_LOW = 0;
+
+ GPIO();
+
+ /**
+ * Similar to Arduino pinMode(pin,mode);
+ * @param port
+ * @param DDR
+ */
+ static void open(int port, int DDR);
+
+ /**
+ *
+ * @param port
+ */
+ static void close(int port);
+
+ /**
+ * Similar to Arduino digitalRead(pin);
+ * @param port
+ */
+ static int read(int port);
+
+ /**
+ * Similar to Arduino digitalWrite(pin,state);
+ * @param port
+ * @param value
+ */
+ static void write(int port, int value);
+
+ virtual ~GPIO();
+
+private:
+};
+
+#endif /* RF24_UTILITY_PIGPIO_GPIO_H_ */
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/includes.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/includes.h
new file mode 100644
index 0000000..9f4c2e8
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/includes.h
@@ -0,0 +1,10 @@
+#ifndef RF24_UTILITY_INCLUDES_H_
+#define RF24_UTILITY_INCLUDES_H_
+
+#define RF24_PIGPIO
+
+#include <cstring> // memcpy() used in RF24.cpp
+#include "pigpio/RF24_arch_config.h"
+#include "pigpio/interrupt.h"
+
+#endif
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.cpp b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.cpp
new file mode 100644
index 0000000..ad89af4
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.cpp
@@ -0,0 +1,32 @@
+/**
+ * Interrupt implementation wrapped from pigpio library
+ */
+#include <pigpio.h>
+#include "interrupt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int attachInterrupt(int pin, int mode, void (*function)(void))
+{
+ gpioInitialise();
+ return gpioSetISRFunc(pin, mode, 0, (gpioISRFunc_t)function);
+}
+
+int detachInterrupt(int pin)
+{
+ return gpioSetISRFunc(pin, 0, 0, NULL);
+}
+
+void rfNoInterrupts()
+{
+}
+
+void rfInterrupts()
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.h
new file mode 100644
index 0000000..80272cd
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/interrupt.h
@@ -0,0 +1,30 @@
+/**
+ * Interrupt functions wrapped from pigpio library
+ */
+#ifndef RF24_UTILITY_PIGPIO_INTERRUPT_H_
+#define RF24_UTILITY_PIGPIO_INTERRUPT_H_
+
+#include <pigpio.h>
+
+#define INT_EDGE_FALLING FALLING_EDGE
+#define INT_EDGE_RISING RISING_EDGE
+#define INT_EDGE_BOTH EITHER_EDGE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int attachInterrupt(int pin, int mode, void (*function)(void));
+
+int detachInterrupt(int pin);
+
+/* Deprecated, no longer functional */
+void rfNoInterrupts();
+
+/* Deprecated, no longer functional */
+void rfInterrupts();
+
+#ifdef __cplusplus
+}
+#endif
+#endif // RF24_UTILITY_PIGPIO_INTERRUPT_H_ \ No newline at end of file
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.cpp b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.cpp
new file mode 100644
index 0000000..8698a14
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.cpp
@@ -0,0 +1,40 @@
+/*
+ *
+ */
+
+#include <pigpio.h>
+#include "spi.h"
+
+SPI::SPI()
+{
+}
+
+void SPI::begin(int busNo, uint32_t spi_speed)
+{
+ if (this->spiIsInitialized) {
+ return;
+ }
+ spiIsInitialized = true;
+ gpioInitialise();
+ spiHandle = spiOpen((unsigned int)(busNo & 2), spi_speed, (unsigned int)((busNo / 10) << 7));
+}
+
+void SPI::init(uint32_t speed)
+{
+}
+
+uint8_t SPI::transfer(char tx)
+{
+ char rbuf = 0;
+ spiXfer(spiHandle, &tx, &rbuf, 1);
+ return rbuf;
+}
+
+void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len)
+{
+ spiXfer(spiHandle, txBuf, rxBuf, len);
+}
+
+SPI::~SPI()
+{
+}
diff --git a/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.h b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.h
new file mode 100644
index 0000000..9c5fa2a
--- /dev/null
+++ b/.pio/libdeps/esp32-s3-n16r8/RF24/utility/pigpio/spi.h
@@ -0,0 +1,68 @@
+/*
+ *
+ */
+
+#ifndef RF24_UTILITY_PIGPIO_SPI_H_
+#define RF24_UTILITY_PIGPIO_SPI_H_
+
+#include <cstdint>
+#include <stdexcept>
+
+/** Specific exception for SPI errors */
+class SPIException : public std::runtime_error
+{
+public:
+ explicit SPIException(const std::string& msg)
+ : std::runtime_error(msg)
+ {
+ }
+};
+
+class SPI
+{
+
+public:
+ /**
+ * SPI constructor
+ */
+ SPI();
+
+ /**
+ * Start SPI
+ */
+ void begin(int busNo, uint32_t spi_speed);
+
+ /**
+ * Transfer a single byte
+ * @param tx Byte to send
+ * @return Data returned via spi
+ */
+ uint8_t transfer(char tx);
+
+ /**
+ * Transfer a buffer of data
+ * @param txBuf Transmit buffer
+ * @param rxBuf Receive buffer
+ * @param len Length of the data
+ */
+ void transfernb(char* txBuf, char* rxBuf, uint32_t len);
+
+ /**
+ * Transfer a buffer of data without an rx buffer
+ * @param buf Pointer to a buffer of data
+ * @param len Length of the data
+ */
+ void transfern(char* buf, uint32_t len)
+ {
+ transfernb(buf, buf, len);
+ }
+
+ ~SPI();
+
+private:
+ unsigned spiHandle;
+ bool spiIsInitialized = false;
+ void init(uint32_t spi_speed);
+};
+
+#endif /* RF24_UTILITY_PIGPIO_SPI_H_ */