#include "pi433_if.h"
#include "rf69.h"
-
#define N_PI433_MINORS (1U << MINORBITS) /*32*/ /* ... up to 256 */
#define MAX_MSG_SIZE 900 /* min: FIFO_SIZE! */
#define MSG_FIFO_SIZE 65536 /* 65536 = 2^16 */
struct pi433_tx_cfg tx_cfg;
};
-
/*-------------------------------------------------------------------------*/
/* GPIO interrupt handlers */
return 0;
}
-
/*-------------------------------------------------------------------------*/
static int
else
bytes_to_read = bytes_total - dev->rx_position;
-
/* access the fifo */
if (bytes_to_read > FIFO_SIZE - dev->free_in_fifo)
bytes_to_read = FIFO_SIZE - dev->free_in_fifo;
dev->rx_position += bytes_to_read;
}
-
/* rx done, wait was interrupted or error occurred */
abort:
dev->interrupt_rx_allowed = true;
if (kthread_should_stop())
printk("ABORT\n");
-
/* STOP_TRANSMISSION */
dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
retval = rf69_set_mode(spi, standby);
return bytes_received;
}
-
static ssize_t
pi433_write(struct file *filp, const char __user *buf,
size_t count, loff_t *f_pos)
return -EAGAIN;
}
-
static long
pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
return 0;
}
-
/*-------------------------------------------------------------------------*/
static int setup_GPIOs(struct pi433_device *device)
return retval;
}
-
/* configure the pin */
gpiod_unexport(device->gpiod[i]);
retval = gpiod_direction_input(device->gpiod[i]);
if (retval)
return retval;
-
/* configure irq */
device->irq_num[i] = gpiod_to_irq(device->gpiod[i]);
if (device->irq_num[i] < 0) {
#include <linux/types.h>
#include "rf69_enum.h"
-/*---------------------------------------------------------------------------*/
-
-
/*---------------------------------------------------------------------------*/
enum option_on_off {
__u16 repetitions;
-
/* packet format */
enum option_on_off enable_preamble;
enum option_on_off enable_sync;
__u8 address_byte;
};
-
/**
* struct pi433_rx_config - describes the configuration of the radio module for sending
* @frequency:
__u8 bw_exponent; /* during AFC: 0x8b */
enum dagc dagc;
-
-
/* packet format */
enum option_on_off enable_sync;
enum option_on_off enable_length_byte; /* should be used in combination with sync, only */
__u8 broadcast_address;
};
-
#define PI433_IOC_MAGIC 'r'
#define PI433_IOC_RD_TX_CFG _IOR(PI433_IOC_MAGIC, PI433_TX_CFG_IOCTL_NR, char[sizeof(struct pi433_tx_cfg)])
#define MASK_PALEVEL_PA2 0x20
#define MASK_PALEVEL_OUTPUT_POWER 0x1F
-
-
// RegPaRamp
#define PARAMP_3400 0x00
#define PARAMP_2000 0x01
#define LNA_GAIN_MAX_MINUS_36 0x05
#define LNA_GAIN_MAX_MINUS_48 0x06
-
/* RegRxBw (0x19) and RegAfcBw (0x1A) */
#define MASK_BW_DCC_FREQ 0xE0
#define MASK_BW_MANTISSE 0x18
#define BW_MANT_20 0x08
#define BW_MANT_24 0x10 /* default */
-
/* RegOokPeak (0x1B) */
#define MASK_OOKPEAK_THRESTYPE 0xc0
#define MASK_OOKPEAK_THRESSTEP 0x38