LibDriver NRF905
Loading...
Searching...
No Matches
driver_nrf905.c File Reference

driver nrf905 source file More...

#include "driver_nrf905.h"
Include dependency graph for driver_nrf905.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Nordic nRF905"
 chip information definition
#define MANUFACTURER_NAME   "Nordic"
#define SUPPLY_VOLTAGE_MIN   1.9f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   30.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define NRF905_COMMAND_W_CONFIG   0x00
 chip command definition
#define NRF905_COMMAND_R_CONFIG   0x10
#define NRF905_COMMAND_W_TX_PAYLOAD   0x20
#define NRF905_COMMAND_R_TX_PAYLOAD   0x21
#define NRF905_COMMAND_W_TX_ADDRESS   0x22
#define NRF905_COMMAND_R_TX_ADDRESS   0x23
#define NRF905_COMMAND_R_RX_PAYLOAD   0x24
#define NRF905_COMMAND_CHANNEL_CONFIG   0x80
#define NRF905_REG_CH_NO   0x00
 chip byte definition
#define NRF905_REG_CONF1   0x01
#define NRF905_REG_CONF2   0x02
#define NRF905_REG_RX_PW   0x03
#define NRF905_REG_TX_PW   0x04
#define NRF905_REG_RX_ADDRESS_0   0x05
#define NRF905_REG_RX_ADDRESS_1   0x06
#define NRF905_REG_RX_ADDRESS_2   0x07
#define NRF905_REG_RX_ADDRESS_3   0x08
#define NRF905_REG_CONF3   0x09

Functions

uint8_t nrf905_init (nrf905_handle_t *handle)
 initialize the chip
uint8_t nrf905_deinit (nrf905_handle_t *handle)
 close the chip
uint8_t nrf905_irq_handler (nrf905_handle_t *handle)
 irq handler
uint8_t nrf905_set_power_up (nrf905_handle_t *handle, nrf905_bool_t enable)
 set the power up
uint8_t nrf905_set_enable (nrf905_handle_t *handle, nrf905_bool_t enable)
 enable or disable the chip
uint8_t nrf905_set_mode (nrf905_handle_t *handle, nrf905_mode_t mode)
 set the mode
uint8_t nrf905_send (nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
 send data
uint8_t nrf905_write_conf (nrf905_handle_t *handle)
 write the conf
uint8_t nrf905_read_conf (nrf905_handle_t *handle, uint8_t conf[10])
 read the conf
uint8_t nrf905_update_conf (nrf905_handle_t *handle, uint8_t conf[10])
 update the conf
uint8_t nrf905_set_tx_payload (nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
 set the tx payload
uint8_t nrf905_get_tx_payload (nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
 get the tx payload
uint8_t nrf905_get_rx_payload (nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
 get the rx payload
uint8_t nrf905_set_tx_address (nrf905_handle_t *handle, uint8_t *addr, uint8_t len)
 set the tx address
uint8_t nrf905_get_tx_address (nrf905_handle_t *handle, uint8_t *addr, uint8_t len)
 get the tx address
uint8_t nrf905_channel_config (nrf905_handle_t *handle, uint16_t freq, nrf905_pll_mode_t mode, nrf905_output_power_t power)
 config the channel
uint8_t nrf905_get_status (nrf905_handle_t *handle, uint8_t *status)
 get the status
uint8_t nrf905_set_frequency (nrf905_handle_t *handle, uint16_t freq)
 set the frequency
uint8_t nrf905_get_frequency (nrf905_handle_t *handle, uint16_t *freq)
 get the frequency
uint8_t nrf905_frequency_convert_to_register (nrf905_handle_t *handle, float mhz, uint16_t *reg)
 convert the frequency to the register raw data
uint8_t nrf905_frequency_convert_to_data (nrf905_handle_t *handle, uint16_t reg, float *mhz)
 convert the register raw data to the frequency
uint8_t nrf905_set_pll_mode (nrf905_handle_t *handle, nrf905_pll_mode_t mode)
 set the pll mode
uint8_t nrf905_get_pll_mode (nrf905_handle_t *handle, nrf905_pll_mode_t *mode)
 get the pll mode
uint8_t nrf905_set_output_power (nrf905_handle_t *handle, nrf905_output_power_t output_power)
 set the output power
uint8_t nrf905_get_output_power (nrf905_handle_t *handle, nrf905_output_power_t *output_power)
 get the output power
uint8_t nrf905_set_rx_mode (nrf905_handle_t *handle, nrf905_rx_mode_t mode)
 set the rx mode
uint8_t nrf905_get_rx_mode (nrf905_handle_t *handle, nrf905_rx_mode_t *mode)
 get the rx mode
uint8_t nrf905_set_auto_retransmit (nrf905_handle_t *handle, nrf905_bool_t enable)
 enable or disable the auto retransmit
uint8_t nrf905_get_auto_retransmit (nrf905_handle_t *handle, nrf905_bool_t *enable)
 get the auto retransmit status
uint8_t nrf905_set_rx_address_width (nrf905_handle_t *handle, nrf905_address_width_t width)
 set the rx address width
uint8_t nrf905_get_rx_address_width (nrf905_handle_t *handle, nrf905_address_width_t *width)
 get the rx address width
uint8_t nrf905_set_tx_address_width (nrf905_handle_t *handle, nrf905_address_width_t width)
 set the tx address width
uint8_t nrf905_get_tx_address_width (nrf905_handle_t *handle, nrf905_address_width_t *width)
 get the tx address width
uint8_t nrf905_set_rx_payload_width (nrf905_handle_t *handle, uint8_t width)
 set the rx payload width
uint8_t nrf905_get_rx_payload_width (nrf905_handle_t *handle, uint8_t *width)
 get the rx payload width
uint8_t nrf905_set_tx_payload_width (nrf905_handle_t *handle, uint8_t width)
 set the tx payload width
uint8_t nrf905_get_tx_payload_width (nrf905_handle_t *handle, uint8_t *width)
 get the tx payload width
uint8_t nrf905_set_rx_address (nrf905_handle_t *handle, uint8_t addr[4])
 set the rx address
uint8_t nrf905_get_rx_address (nrf905_handle_t *handle, uint8_t addr[4])
 get the rx address
uint8_t nrf905_set_output_clock_frequency (nrf905_handle_t *handle, nrf905_output_clock_frequency_t freq)
 set the output clock frequency
uint8_t nrf905_get_output_clock_frequency (nrf905_handle_t *handle, nrf905_output_clock_frequency_t *freq)
 get the output clock frequency
uint8_t nrf905_set_output_clock (nrf905_handle_t *handle, nrf905_bool_t enable)
 enable or disable the output clock
uint8_t nrf905_get_output_clock (nrf905_handle_t *handle, nrf905_bool_t *enable)
 get the output clock status
uint8_t nrf905_set_crystal_oscillator_frequency (nrf905_handle_t *handle, nrf905_crystal_oscillator_frequency_t freq)
 set the crystal oscillator frequency
uint8_t nrf905_get_crystal_oscillator_frequency (nrf905_handle_t *handle, nrf905_crystal_oscillator_frequency_t *freq)
 get the crystal oscillator frequency
uint8_t nrf905_set_crc (nrf905_handle_t *handle, nrf905_bool_t enable)
 enable or disable the crc
uint8_t nrf905_get_crc (nrf905_handle_t *handle, nrf905_bool_t *enable)
 get the crc status
uint8_t nrf905_set_crc_mode (nrf905_handle_t *handle, nrf905_crc_mode_t mode)
 set the crc mode
uint8_t nrf905_get_crc_mode (nrf905_handle_t *handle, nrf905_crc_mode_t *mode)
 get the crc mode
uint8_t nrf905_set_reg (nrf905_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t nrf905_get_reg (nrf905_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t nrf905_info (nrf905_info_t *info)
 get chip's information

Detailed Description

driver nrf905 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-03-31

history

Date Version Author Description
2022/03/31 1.0 Shifeng Li first upload

Definition in file driver_nrf905.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Nordic nRF905"

chip information definition

chip name

Definition at line 42 of file driver_nrf905.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_nrf905.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Nordic"

manufacturer name

Definition at line 43 of file driver_nrf905.c.

◆ MAX_CURRENT

#define MAX_CURRENT   30.0f

chip max current

Definition at line 46 of file driver_nrf905.c.

◆ NRF905_COMMAND_CHANNEL_CONFIG

#define NRF905_COMMAND_CHANNEL_CONFIG   0x80

special command for fast setting command

Definition at line 61 of file driver_nrf905.c.

◆ NRF905_COMMAND_R_CONFIG

#define NRF905_COMMAND_R_CONFIG   0x10

read configuration register command

Definition at line 55 of file driver_nrf905.c.

◆ NRF905_COMMAND_R_RX_PAYLOAD

#define NRF905_COMMAND_R_RX_PAYLOAD   0x24

read rx address command

Definition at line 60 of file driver_nrf905.c.

◆ NRF905_COMMAND_R_TX_ADDRESS

#define NRF905_COMMAND_R_TX_ADDRESS   0x23

read tx address command

Definition at line 59 of file driver_nrf905.c.

◆ NRF905_COMMAND_R_TX_PAYLOAD

#define NRF905_COMMAND_R_TX_PAYLOAD   0x21

read tx payload command

Definition at line 57 of file driver_nrf905.c.

◆ NRF905_COMMAND_W_CONFIG

#define NRF905_COMMAND_W_CONFIG   0x00

chip command definition

write configuration register command

Definition at line 54 of file driver_nrf905.c.

◆ NRF905_COMMAND_W_TX_ADDRESS

#define NRF905_COMMAND_W_TX_ADDRESS   0x22

write tx address command

Definition at line 58 of file driver_nrf905.c.

◆ NRF905_COMMAND_W_TX_PAYLOAD

#define NRF905_COMMAND_W_TX_PAYLOAD   0x20

write tx payload command

Definition at line 56 of file driver_nrf905.c.

◆ NRF905_REG_CH_NO

#define NRF905_REG_CH_NO   0x00

chip byte definition

ch_no byte

Definition at line 66 of file driver_nrf905.c.

◆ NRF905_REG_CONF1

#define NRF905_REG_CONF1   0x01

conf1 byte

Definition at line 67 of file driver_nrf905.c.

◆ NRF905_REG_CONF2

#define NRF905_REG_CONF2   0x02

conf2 byte

Definition at line 68 of file driver_nrf905.c.

◆ NRF905_REG_CONF3

#define NRF905_REG_CONF3   0x09

conf3 byte

Definition at line 75 of file driver_nrf905.c.

◆ NRF905_REG_RX_ADDRESS_0

#define NRF905_REG_RX_ADDRESS_0   0x05

rx address 0 byte

Definition at line 71 of file driver_nrf905.c.

◆ NRF905_REG_RX_ADDRESS_1

#define NRF905_REG_RX_ADDRESS_1   0x06

rx address 1 byte

Definition at line 72 of file driver_nrf905.c.

◆ NRF905_REG_RX_ADDRESS_2

#define NRF905_REG_RX_ADDRESS_2   0x07

rx address 2 byte

Definition at line 73 of file driver_nrf905.c.

◆ NRF905_REG_RX_ADDRESS_3

#define NRF905_REG_RX_ADDRESS_3   0x08

rx address 3 byte

Definition at line 74 of file driver_nrf905.c.

◆ NRF905_REG_RX_PW

#define NRF905_REG_RX_PW   0x03

rx pw byte

Definition at line 69 of file driver_nrf905.c.

◆ NRF905_REG_TX_PW

#define NRF905_REG_TX_PW   0x04

tx pw byte

Definition at line 70 of file driver_nrf905.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_nrf905.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.9f

chip min supply voltage

Definition at line 44 of file driver_nrf905.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_nrf905.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_nrf905.c.