⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hal_nrf.h

📁 NRf24l01 代码
💻 H
📖 第 1 页 / 共 2 页
字号:
 * Use this function to get the radio's current
 * operation mode, PTX or PRX.
 *
 * @return Operation_Mode
 * @retval 0x00 Primary RX (PRX)
 * @retval 0x01 Primary TX (PTX)
*/
uint8_t hal_nrf_get_operation_mode(void);

/** Get radio's current power mode.
 * Use this function to get the radio's currnet
 * power mode, POWER_UP or POWER_DOWN.
 *
 * @return Power_Mode
 * @retval 0x00 POWER_DOWN
 * @retval 0x01 POWER_UP
*/
uint8_t hal_nrf_get_power_mode(void);

/** Get radio's current RF channel.
 * Use this function to get the radio's current
 * selected RF channel
 *
 * @return RF channel
*/
uint8_t hal_nrf_get_rf_channel(void);

/** Get radio's current TX output power.
 * Use this function to get the radio's current
 * TX output power setting.
 *
 * @return TX_power_output
 * @retval 0x00 -18dBm
 * @retval 0x01 -12dBm
 * @retval 0x02 -6dBm
 * @retval 0x03 0dBm
*/
uint8_t hal_nrf_get_output_power(void);

/** Get radio's current on-air datarate.
 * Use this function to get the radio's current
 * on-air datarate setting.
 *
 * @return On-air datarate
 * @retval 0x00 1Mbps selected
 * @retval 0x01 2Mbps selected
*/
uint8_t hal_nrf_get_datarate(void);

/* Status functions prototypes */

/** Get radio's TX FIFO status.
 * Use this function to get the radio's TX
 * FIFO status.
 *
 * @return TX FIFO status
 * @retval 0x00 TX FIFO NOT empty, but NOT full
 * @retval 0x01 FIFO empty
 * @retval 0x02 FIFO full
 *
*/
uint8_t hal_nrf_get_tx_fifo_status(void);

/** Check for TX FIFO empty.
 * Use this function to check if TX FIFO
 * is empty.
 *
 * @return TX FIFO empty bit
 * @retval FALSE TX FIFO NOT empty
 * @retval TRUE TX FIFO empty
 *
*/
bool hal_nrf_tx_fifo_empty(void);

/** Check for TX FIFO full.
 * Use this function to check if TX FIFO
 * is full.
 *
 * @return TX FIFO full bit
 * @retval FALSE TX FIFO NOT full
 * @retval TRUE TX FIFO full
 *
*/
bool hal_nrf_tx_fifo_full(void);

/** Get radio's RX FIFO status.
 * Use this function to get the radio's TX
 * FIFO status.
 *
 * @return RX FIFO status
 * @retval 0x00 RX FIFO NOT empty, but NOT full
 * @retval 0x01 RX FIFO empty
 * @retval 0x02 RX FIFO full
 *
*/
uint8_t hal_nrf_get_rx_fifo_status(void);

/** Check for RX FIFO empty.
 * Use this function to check if RX FIFO
 * is empty.
 *
 * Reads STATUS register to check this, not FIFO_STATUS  
 *
 * @return RX FIFO empty bit
 * @retval FALSE RX FIFO NOT empty
 * @retval TRUE RX FIFO empty
 *
*/
bool hal_nrf_rx_fifo_empty(void);

/** Check for RX FIFO full.
 * Use this function to check if RX FIFO
 * is full.
 *
 * @return RX FIFO full bit
 * @retval FALSE RX FIFO NOT full
 * @retval TRUE RX FIFO full
 *
*/
bool hal_nrf_rx_fifo_full(void);

/** Get radio's transmit attempts status.
 * Use this function to get number of retransmit
 * attempts and number of packet lost.
 *
 * @return Retransmit attempts counters
*/
uint8_t hal_nrf_get_transmit_attempts(void);

/** Get the carrier detect flag.
 * Use this function to get the carrier detect flag,
 * used to detect stationary disturbance on selected
 * RF channel.
 *
 * @return Carrier Detect
 * @retval FALSE Carrier NOT Detected
 * @retval TRUE Carrier Detected
*/
bool hal_nrf_get_carrier_detect(void);

/* Data operation prototypes */

/** Get RX data source.
 * Use this function to read which RX pipe data
 * was received on for current top level FIFO data packet.
 *
 * @return pipe number of current packet present
*/
uint8_t hal_nrf_get_rx_data_source(void);

/** Read RX payload.
 * Use this function to read top level payload
 * available in the RX FIFO.
 *
 * @param  *rx_pload pointer to buffer in which RX payload are stored
 * @return pipe number (MSB byte) and packet length (LSB byte)
*/
uint16_t hal_nrf_read_rx_pload(uint8_t *rx_pload);

/** Write TX payload to radio.
 * Use this function to write a packet of
 * TX payload into the radio.
 * <I>length</I> number of bytes, which are stored in <I>*tx_pload</I>.
 *
 * @param *tx_pload pointer to buffer in which TX payload are present
 * @param length number of bytes to write
*/
void hal_nrf_write_tx_pload(uint8_t *tx_pload, uint8_t length);

/** Reuse TX payload.
 * Use this function to set that the radio is using
 * the last transmitted payload for the next packet as well.
 *
*/
void hal_nrf_reuse_tx(void);

/** Get status of reuse TX function.
 * Use this function to check if reuse TX payload is
 * activated
 *
 * @return Reuse TX payload mode
 * @retval FALSE Not activated
 * @retval TRUE Activated
*/
bool hal_nrf_get_reuse_tx_status(void);

/** Flush RX FIFO.
 * Use this function to flush the radio's
 * RX FIFO.
 *
*/
void hal_nrf_flush_rx(void);

/** Flush TX FIFO.
 * Use this function to flush the radio's
 * TX FIFO.
 *
*/
void hal_nrf_flush_tx(void);

/** No Operation command.
 * Use this function to receive the radio's
 * status register.
 *
 * @return Status register
*/
uint8_t hal_nrf_nop(void);
//@}

/** @name  << TEST FUNCTIONS >> */
//@{
/* Test functions prototypes */

/** Set radio's PLL mode.
 * Use this function to either LOCK
 * or UNLOCK the radio's PLL.
 *
 * @param pll_mode PLL locked, TRUE or FALSE
*/
void hal_nrf_set_pll_mode(hal_nrf_pll_mode_t pll_mode);

/** Get PLL mode.
 * Use this function to get the radio's
 * current PLL mode.
 *
 * @return PLL_mode
*/
hal_nrf_pll_mode_t hal_nrf_get_pll_mode(void);

/** Set radio's LNA gain mode.
 * Use this function to either use HI
 * current or LOW current mode for the radio.
 *
 * @param lna_gain LNA gain mode
*/
void hal_nrf_set_lna_gain(hal_nrf_lna_mode_t lna_gain);

/** Get LNA gain mode.
 * Use this function to get the radio's
 * current LNA gain mode.
 *
 * @return LNA gain mode
 * @retval 0 LNA LOW current
 * @retval 1 LNA HI current
*/
hal_nrf_lna_mode_t hal_nrf_get_lna_gain(void);

/* hal_nrf_l01 basic functions, used by all the other functions */

//@}

/** @name  << BASIS FUNCTIONS >> */
//@{

/** Basis function read_reg.
 * Use this function to read the contents
 * of one radios register.
 *
 * @param reg Register to read
 * @return Register contents
*/
uint8_t hal_nrf_read_reg(uint8_t reg);

/** Basis function write_reg.
 * Use this function to write a new value to
 * a radio register.
 *
 * @param reg Register to write
 * @param value New value to write
 * @return Status register
*/
uint8_t hal_nrf_write_reg(uint8_t reg, uint8_t value);

/** Basis function, read_multibyte register .
 * Use this function to read multiple bytes from
 * a multibyte radio-register
 *
 * @param reg Multibyte register to read from
 * @param *pbuf Pointer to buffer in which to store read bytes to
 *
 * @return pipe# of received data (MSB), if operation used by a hal_nrf_read_rx_pload
 * @return length of read data (LSB), either for hal_nrf_read_rx_pload or
 * for hal_nrf_get_address.
*/
uint16_t hal_nrf_read_multibyte_reg(uint8_t reg, uint8_t *pbuf);

/** Basis function, write_multibyte register.
 * Use this function to write multiple bytes to
 * a multiple radio register.
 *
 * @param reg Register to write
 * @param *pbuf pointer to buffer in which data to write is
 * @param length \# of bytes to write
*/
void hal_nrf_write_multibyte_reg(uint8_t reg, uint8_t *pbuf, uint8_t length);


/** Basis function, nrf_rw
 * This function is used by the basis functions
 * to exchange data with the data.
 *
 * @param value Databyte to write
 *
 * @return Databyte from radio.
*/
uint8_t hal_nrf_rw(uint8_t value);
//@}
#endif // HAL_NRF_H__
/** 
@} 
@} */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -