#include "config.h"
#include "pic_utils.h"
Go to the source code of this file.
Data Structures | |
struct | _rf_config |
Defines | |
#define | __pic_rf_h defined |
#define | CONF_CRC0 2 |
#define | CONF_EN_CRC 3 |
#define | CONF_PRIM_RX 0 |
#define | CONF_PWR_UP 1 |
#define | ENABLE_1_MBPS 5 |
#define | ENABLE_CH2 7 |
#define | ENABLE_CRC 2 |
#define | ENABLE_RECEIVE 0 |
#define | ENABLE_SHOCKBURST 6 |
#define | LONG_CRC 1 |
#define | MAX_RT 4 |
#define | pic_rf_get_status() pic_rf_read_register(RF_NOP, 0, 0) |
#define | pic_rf_receive_mode() pic_rf_set_mode(RECEIVE_MODE) |
#define | pic_rf_set_status(status) pic_rf_send_command(RF_WR_REG_STATUS, status, 1) |
#define | pic_rf_transmit_mode() pic_rf_set_mode(TRANSMIT_MODE) |
#define | RECEIVE_MODE 1 |
#define | RF_FLUSH_RX 0b11100010 |
#define | RF_FLUSH_TX 0b11100001 |
#define | RF_NOP 0b11111111 |
#define | RF_R_RX_PAYLOAD 0b01100001 |
#define | RF_RD_REG_CONFIG_REG 0b00000000 |
#define | RF_RD_REG_FIFO_STATUS 0b00010111 |
#define | RF_RD_REG_STATUS 0b00000111 |
#define | RF_W_TX_PAYLOAD 0b10100000 |
#define | RF_WR_REG_CONFIG_REG 0b00100000 |
#define | RF_WR_REG_EN_AA 0b00100001 |
#define | RF_WR_REG_RF_CH 0b00100101 |
#define | RF_WR_REG_RF_SETUP 0b00100110 |
#define | RF_WR_REG_RX_ADDR_P0 0b00101010 |
#define | RF_WR_REG_RX_PW_P0 0b00110001 |
#define | RF_WR_REG_SETUP_AW 0b00100011 |
#define | RF_WR_REG_SETUP_RETR 0b00100100 |
#define | RF_WR_REG_STATUS 0b00100111 |
#define | RF_WR_REG_TX_ADDR 0b00110000 |
#define | STAT_RX_DR 6 |
#define | STAT_TX_DS 5 |
#define | TRANSMIT_MODE 0 |
#define | TX_FULL 0 |
Typedefs | |
typedef struct _rf_config | rf_config |
Functions | |
uns8 | pic_rf_handle_irq_receive (uns8 *data, uns8 bytes_to_receive) |
void | pic_rf_init (rf_config *my_config) |
void | pic_rf_quick_init (char *my_config, uns8 my_channel, bit my_receive_on) |
uns8 | pic_rf_read_register (uns8 cmd, uns8 *data, uns8 data_len) |
uns8 | pic_rf_read_register_inline (uns8 cmd, uns8 *data, uns8 data_len) |
void | pic_rf_receive_inline (uns8 *data, uns8 bytes_to_receive) |
uns8 | pic_rf_send_byte (uns8 b) |
uns8 | pic_rf_send_byte_int (uns8 b) |
void | pic_rf_send_bytes (char *bytes, uns8 num_bytes) |
uns8 | pic_rf_send_command (uns8 cmd, uns8 *data, uns8 data_len) |
uns8 | pic_rf_send_command_inline (uns8 cmd, uns8 *data, uns8 data_len) |
void | pic_rf_set_channel (uns8 channel) |
void | pic_rf_set_mode (uns8 mode) |
void | pic_rf_setup () |
void | pic_rf_transmit (uns8 *data, uns8 bytes_to_transmit) |
Variables | |
static uns8 | rf_current_channel = 2 |
static bit | rf_current_mode_receive = 0 |
#define __pic_rf_h defined |
Definition at line 2 of file pic_rf_24l01.h.
#define CONF_CRC0 2 |
Definition at line 92 of file pic_rf_24l01.h.
#define CONF_EN_CRC 3 |
Definition at line 93 of file pic_rf_24l01.h.
#define CONF_PRIM_RX 0 |
#define CONF_PWR_UP 1 |
Definition at line 91 of file pic_rf_24l01.h.
#define ENABLE_1_MBPS 5 |
Definition at line 59 of file pic_rf_24l01.h.
#define ENABLE_CH2 7 |
Definition at line 61 of file pic_rf_24l01.h.
#define ENABLE_CRC 2 |
Definition at line 57 of file pic_rf_24l01.h.
#define ENABLE_RECEIVE 0 |
Definition at line 55 of file pic_rf_24l01.h.
#define ENABLE_SHOCKBURST 6 |
Definition at line 60 of file pic_rf_24l01.h.
#define LONG_CRC 1 |
Definition at line 56 of file pic_rf_24l01.h.
#define MAX_RT 4 |
Definition at line 97 of file pic_rf_24l01.h.
#define pic_rf_get_status | ( | ) | pic_rf_read_register(RF_NOP, 0, 0) |
Definition at line 169 of file pic_rf_24l01.h.
#define pic_rf_receive_mode | ( | ) | pic_rf_set_mode(RECEIVE_MODE) |
Definition at line 175 of file pic_rf_24l01.h.
#define pic_rf_set_status | ( | status | ) | pic_rf_send_command(RF_WR_REG_STATUS, status, 1) |
Definition at line 172 of file pic_rf_24l01.h.
#define pic_rf_transmit_mode | ( | ) | pic_rf_set_mode(TRANSMIT_MODE) |
Definition at line 176 of file pic_rf_24l01.h.
#define RECEIVE_MODE 1 |
Definition at line 63 of file pic_rf_24l01.h.
#define RF_FLUSH_RX 0b11100010 |
#define RF_FLUSH_TX 0b11100001 |
#define RF_NOP 0b11111111 |
Definition at line 88 of file pic_rf_24l01.h.
#define RF_R_RX_PAYLOAD 0b01100001 |
Definition at line 86 of file pic_rf_24l01.h.
Referenced by pic_rf_handle_irq_receive(), and pic_rf_receive_inline().
#define RF_RD_REG_CONFIG_REG 0b00000000 |
#define RF_RD_REG_FIFO_STATUS 0b00010111 |
#define RF_RD_REG_STATUS 0b00000111 |
Definition at line 78 of file pic_rf_24l01.h.
#define RF_W_TX_PAYLOAD 0b10100000 |
#define RF_WR_REG_CONFIG_REG 0b00100000 |
#define RF_WR_REG_EN_AA 0b00100001 |
#define RF_WR_REG_RF_CH 0b00100101 |
Definition at line 76 of file pic_rf_24l01.h.
Referenced by pic_rf_init(), and pic_rf_set_channel().
#define RF_WR_REG_RF_SETUP 0b00100110 |
#define RF_WR_REG_RX_ADDR_P0 0b00101010 |
#define RF_WR_REG_RX_PW_P0 0b00110001 |
#define RF_WR_REG_SETUP_AW 0b00100011 |
#define RF_WR_REG_SETUP_RETR 0b00100100 |
#define RF_WR_REG_STATUS 0b00100111 |
#define RF_WR_REG_TX_ADDR 0b00110000 |
#define STAT_RX_DR 6 |
Definition at line 95 of file pic_rf_24l01.h.
#define STAT_TX_DS 5 |
Definition at line 96 of file pic_rf_24l01.h.
#define TRANSMIT_MODE 0 |
Definition at line 64 of file pic_rf_24l01.h.
#define TX_FULL 0 |
Definition at line 98 of file pic_rf_24l01.h.
typedef struct _rf_config rf_config |
Definition at line 51 of file pic_rf_24l01.h.
uns8 pic_rf_handle_irq_receive | ( | uns8 * | data, | |
uns8 | bytes_to_receive | |||
) |
Definition at line 5 of file pic_rf_24l01.c.
References clear_pin, pic_rf_read_register_inline(), pic_rf_send_command_inline(), RF_R_RX_PAYLOAD, RF_RD_REG_FIFO_STATUS, RF_WR_REG_STATUS, set_pin, and uns8.
void pic_rf_init | ( | rf_config * | my_config | ) |
Definition at line 47 of file pic_rf_2401a.c.
References _rf_config::address_ch1, _rf_config::address_ch2, _rf_config::address_width, _rf_config::channel, clear_pin, _rf_config::crystal, end_crit_sec, make_output, _rf_config::options, _rf_config::output_power, _rf_config::payload_width_ch1, _rf_config::payload_width_ch2, pic_rf_chip_enable, pic_rf_chip_select, pic_rf_send_byte(), pic_rf_send_bytes(), pic_rf_send_command(), rf_current_channel, rf_current_mode_receive, RF_FLUSH_RX, RF_FLUSH_TX, RF_WR_REG_CONFIG_REG, RF_WR_REG_EN_AA, RF_WR_REG_RF_CH, RF_WR_REG_RF_SETUP, RF_WR_REG_RX_ADDR_P0, RF_WR_REG_RX_PW_P0, RF_WR_REG_SETUP_AW, RF_WR_REG_SETUP_RETR, RF_WR_REG_TX_ADDR, set_pin, start_crit_sec, and uns8.
void pic_rf_quick_init | ( | char * | my_config, | |
uns8 | my_channel, | |||
bit | my_receive_on | |||
) |
Definition at line 26 of file pic_rf_2401a.c.
References clear_pin, make_output, pic_rf_chip_enable, pic_rf_chip_select, pic_rf_send_byte(), rf_current_channel, rf_current_mode_receive, and uns8.
uns8 pic_rf_read_register | ( | uns8 | cmd, | |
uns8 * | data, | |||
uns8 | data_len | |||
) |
Definition at line 45 of file pic_rf_24l01.c.
References clear_pin, pic_rf_send_byte(), set_pin, and uns8.
Referenced by pic_rf_set_mode().
uns8 pic_rf_read_register_inline | ( | uns8 | cmd, | |
uns8 * | data, | |||
uns8 | data_len | |||
) | [inline] |
Definition at line 124 of file pic_rf_24l01.h.
References clear_pin, pic_rf_send_byte_int(), set_pin, and uns8.
Referenced by pic_rf_handle_irq_receive(), and pic_rf_receive_inline().
void pic_rf_receive_inline | ( | uns8 * | data, | |
uns8 | bytes_to_receive | |||
) | [inline] |
Definition at line 165 of file pic_rf_24l01.h.
References pic_rf_read_register_inline(), and RF_R_RX_PAYLOAD.
uns8 pic_rf_send_byte | ( | uns8 | b | ) |
Definition at line 5 of file pic_rf_2401a.c.
References change_pin, clear_pin, set_pin, test_pin, and uns8.
Referenced by pic_rf_init(), pic_rf_quick_init(), pic_rf_read_register(), pic_rf_send_bytes(), pic_rf_send_bytes_inline(), pic_rf_send_command(), and pic_rf_set_channel().
uns8 pic_rf_send_byte_int | ( | uns8 | b | ) |
Definition at line 108 of file pic_rf_24l01.c.
References change_pin, clear_pin, set_pin, test_pin, and uns8.
Referenced by pic_rf_read_register_inline(), pic_rf_read_register_int(), and pic_rf_send_command_inline().
void pic_rf_send_bytes | ( | char * | bytes, | |
uns8 | num_bytes | |||
) |
Definition at line 18 of file pic_rf_2401a.c.
References pic_rf_send_byte(), and uns8.
Referenced by pic_rf_init().
uns8 pic_rf_send_command | ( | uns8 | cmd, | |
uns8 * | data, | |||
uns8 | data_len | |||
) |
Definition at line 26 of file pic_rf_24l01.c.
References clear_pin, pic_rf_send_byte(), set_pin, and uns8.
Referenced by pic_rf_init(), pic_rf_set_channel(), pic_rf_set_mode(), and pic_rf_transmit().
uns8 pic_rf_send_command_inline | ( | uns8 | cmd, | |
uns8 * | data, | |||
uns8 | data_len | |||
) | [inline] |
Definition at line 141 of file pic_rf_24l01.h.
References clear_pin, pic_rf_send_byte_int(), set_pin, and uns8.
Referenced by pic_rf_handle_irq_receive().
void pic_rf_set_channel | ( | uns8 | channel | ) |
Definition at line 163 of file pic_rf_2401a.c.
References clear_pin, end_crit_sec, kill_interrupts, pic_rf_chip_enable, pic_rf_chip_select, pic_rf_send_byte(), pic_rf_send_command(), PORTA, rf_current_channel, rf_current_mode_receive, RF_WR_REG_RF_CH, set_pin, and start_crit_sec.
void pic_rf_set_mode | ( | uns8 | mode | ) |
Definition at line 142 of file pic_rf_2401a.c.
References change_pin, clear_pin, CONF_PRIM_RX, end_crit_sec, kill_interrupts, make_output, pic_rf_chip_enable, pic_rf_chip_select, pic_rf_read_register(), pic_rf_send_command(), RECEIVE_MODE, rf_current_mode_receive, RF_RD_REG_CONFIG_REG, RF_WR_REG_CONFIG_REG, set_pin, start_crit_sec, TRANSMIT_MODE, and uns8.
Referenced by pic_rf_transmit().
void pic_rf_setup | ( | ) |
Definition at line 185 of file pic_rf_2401a.c.
References clear_pin, make_input, make_output, and set_pin.
void pic_rf_transmit | ( | uns8 * | data, | |
uns8 | bytes_to_transmit | |||
) |
Definition at line 208 of file pic_rf_24l01.c.
References clear_pin, end_crit_sec, pic_rf_send_command(), pic_rf_set_mode(), RECEIVE_MODE, rf_current_mode_receive, RF_FLUSH_TX, RF_W_TX_PAYLOAD, set_pin, start_crit_sec, TRANSMIT_MODE, and uns8.
uns8 rf_current_channel = 2 [static] |
Definition at line 102 of file pic_rf_24l01.h.
bit rf_current_mode_receive = 0 [static] |
Definition at line 101 of file pic_rf_24l01.h.