treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / staging / pi433 / rf69.h
blobd43a8d87d5d318f42639b586df8c129e0d393a5c
1 /* SPDX-License-Identifier: GPL-2.0+
3 * hardware abstraction/register access for HopeRf rf69 radio module
5 * Copyright (C) 2016 Wolf-Entwicklungen
6 * Marcus Wolf <linux@wolf-entwicklungen.de>
7 */
8 #ifndef RF69_H
9 #define RF69_H
11 #include "rf69_enum.h"
12 #include "rf69_registers.h"
14 /* NOTE: Modifying FREQUENCY value impacts CE certification */
15 #define F_OSC 32000000 /* Hz */
16 #define FREQUENCY 433920000 /* Hz */
17 #define FIFO_SIZE 66 /* bytes */
18 #define FIFO_THRESHOLD 15 /* bytes */
20 int rf69_set_mode(struct spi_device *spi, enum mode mode);
21 int rf69_set_data_mode(struct spi_device *spi, u8 data_mode);
22 int rf69_set_modulation(struct spi_device *spi, enum modulation modulation);
23 int rf69_set_modulation_shaping(struct spi_device *spi,
24 enum mod_shaping mod_shaping);
25 int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate);
26 int rf69_set_deviation(struct spi_device *spi, u32 deviation);
27 int rf69_set_frequency(struct spi_device *spi, u32 frequency);
28 int rf69_enable_amplifier(struct spi_device *spi, u8 amplifier_mask);
29 int rf69_disable_amplifier(struct spi_device *spi, u8 amplifier_mask);
30 int rf69_set_output_power_level(struct spi_device *spi, u8 power_level);
31 int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp);
32 int rf69_set_antenna_impedance(struct spi_device *spi,
33 enum antenna_impedance antenna_impedance);
34 int rf69_set_lna_gain(struct spi_device *spi, enum lna_gain lna_gain);
35 int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse,
36 u8 exponent);
37 int rf69_set_bandwidth_during_afc(struct spi_device *spi,
38 enum mantisse mantisse,
39 u8 exponent);
40 int rf69_set_ook_threshold_dec(struct spi_device *spi,
41 enum threshold_decrement threshold_decrement);
42 int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value);
43 bool rf69_get_flag(struct spi_device *spi, enum flag flag);
44 int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold);
45 int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length);
46 int rf69_enable_sync(struct spi_device *spi);
47 int rf69_disable_sync(struct spi_device *spi);
48 int rf69_set_fifo_fill_condition(struct spi_device *spi,
49 enum fifo_fill_condition fifo_fill_condition);
50 int rf69_set_sync_size(struct spi_device *spi, u8 sync_size);
51 int rf69_set_sync_values(struct spi_device *spi, u8 sync_values[8]);
52 int rf69_set_packet_format(struct spi_device *spi,
53 enum packet_format packet_format);
54 int rf69_enable_crc(struct spi_device *spi);
55 int rf69_disable_crc(struct spi_device *spi);
56 int rf69_set_address_filtering(struct spi_device *spi,
57 enum address_filtering address_filtering);
58 int rf69_set_payload_length(struct spi_device *spi, u8 payload_length);
59 int rf69_set_node_address(struct spi_device *spi, u8 node_address);
60 int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address);
61 int rf69_set_tx_start_condition(struct spi_device *spi,
62 enum tx_start_condition tx_start_condition);
63 int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold);
64 int rf69_set_dagc(struct spi_device *spi, enum dagc dagc);
66 int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size);
67 int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size);
69 #endif