Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v4.20 79 lines 3.8 kB view raw
1/* SPDX-License-Identifier: GPL-2.0+ 2 * 3 * hardware abstraction/register access for HopeRf rf69 radio module 4 * 5 * Copyright (C) 2016 Wolf-Entwicklungen 6 * Marcus Wolf <linux@wolf-entwicklungen.de> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 */ 18#ifndef RF69_H 19#define RF69_H 20 21#include "rf69_enum.h" 22#include "rf69_registers.h" 23 24/* NOTE: Modifying FREQUENCY value impacts CE certification */ 25#define F_OSC 32000000 /* Hz */ 26#define FREQUENCY 433920000 /* Hz */ 27#define FIFO_SIZE 66 /* bytes */ 28#define FIFO_THRESHOLD 15 /* bytes */ 29 30int rf69_set_mode(struct spi_device *spi, enum mode mode); 31int rf69_set_data_mode(struct spi_device *spi, u8 data_mode); 32int rf69_set_modulation(struct spi_device *spi, enum modulation modulation); 33int rf69_set_modulation_shaping(struct spi_device *spi, 34 enum mod_shaping mod_shaping); 35int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate); 36int rf69_set_deviation(struct spi_device *spi, u32 deviation); 37int rf69_set_frequency(struct spi_device *spi, u32 frequency); 38int rf69_enable_amplifier(struct spi_device *spi, u8 amplifier_mask); 39int rf69_disable_amplifier(struct spi_device *spi, u8 amplifier_mask); 40int rf69_set_output_power_level(struct spi_device *spi, u8 power_level); 41int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp); 42int rf69_set_antenna_impedance(struct spi_device *spi, 43 enum antenna_impedance antenna_impedance); 44int rf69_set_lna_gain(struct spi_device *spi, enum lna_gain lna_gain); 45int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse, 46 u8 exponent); 47int rf69_set_bandwidth_during_afc(struct spi_device *spi, 48 enum mantisse mantisse, 49 u8 exponent); 50int rf69_set_ook_threshold_dec(struct spi_device *spi, 51 enum threshold_decrement threshold_decrement); 52int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value); 53bool rf69_get_flag(struct spi_device *spi, enum flag flag); 54int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold); 55int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length); 56int rf69_enable_sync(struct spi_device *spi); 57int rf69_disable_sync(struct spi_device *spi); 58int rf69_set_fifo_fill_condition(struct spi_device *spi, 59 enum fifo_fill_condition fifo_fill_condition); 60int rf69_set_sync_size(struct spi_device *spi, u8 sync_size); 61int rf69_set_sync_values(struct spi_device *spi, u8 sync_values[8]); 62int rf69_set_packet_format(struct spi_device *spi, 63 enum packet_format packet_format); 64int rf69_enable_crc(struct spi_device *spi); 65int rf69_disable_crc(struct spi_device *spi); 66int rf69_set_address_filtering(struct spi_device *spi, 67 enum address_filtering address_filtering); 68int rf69_set_payload_length(struct spi_device *spi, u8 payload_length); 69int rf69_set_node_address(struct spi_device *spi, u8 node_address); 70int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address); 71int rf69_set_tx_start_condition(struct spi_device *spi, 72 enum tx_start_condition tx_start_condition); 73int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold); 74int rf69_set_dagc(struct spi_device *spi, enum dagc dagc); 75 76int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size); 77int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size); 78 79#endif