1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/include/at86rf231.h
2014-08-21 17:53:37 +02:00

80 lines
2.0 KiB
C

#ifndef AT86RF231_H_
#define AT86RF231_H_
#include <stdio.h>
#include <stdint.h>
#include "kernel_types.h"
#include "board.h"
#include "radio/types.h"
#include "ieee802154_frame.h"
#include "at86rf231/at86rf231_settings.h"
#define AT86RF231_MAX_PKT_LENGTH 127
#define AT86RF231_MAX_DATA_LENGTH 118
/**
* Structure to represent a at86rf231 packet.
*/
typedef struct __attribute__((packed))
{
/* @{ */
uint8_t length; /** < the length of the frame of the frame including fcs*/
ieee802154_frame_t frame; /** < the ieee802154 frame */
int8_t rssi; /** < the rssi value */
uint8_t crc; /** < 1 if crc was successfull, 0 otherwise */
uint8_t lqi; /** < the link quality indicator */
/* @} */
}
at86rf231_packet_t;
extern volatile kernel_pid_t transceiver_pid;
#define AT_DRIVER_STATE_DEFAULT (0)
#define AT_DRIVER_STATE_SENDING (1)
/**
* @brief To keep state inside of at86rf231 driver
* @details This variable is used to determine if a TRX_END IRQ from
* the radio transceiver has to be interpreted as end of
* sending or reception.
*/
extern uint8_t driver_state;
void at86rf231_init(kernel_pid_t tpid);
//void at86rf231_reset(void);
void at86rf231_rx(void);
void at86rf231_rx_handler(void);
void at86rf231_rx_irq(void);
int16_t at86rf231_send(at86rf231_packet_t *packet);
uint8_t at86rf231_set_channel(uint8_t channel);
uint8_t at86rf231_get_channel(void);
uint16_t at86rf231_set_pan(uint16_t pan);
uint16_t at86rf231_get_pan(void);
radio_address_t at86rf231_set_address(radio_address_t address);
radio_address_t at86rf231_get_address(void);
uint64_t at86rf231_get_address_long(void);
uint64_t at86rf231_set_address_long(uint64_t address);
void at86rf231_switch_to_rx(void);
void at86rf231_set_monitor(uint8_t mode);
enum {
RF86RF231_MAX_TX_LENGTH = 125,
RF86RF231_MAX_RX_LENGTH = 127,
RF86RF231_MIN_CHANNEL = 11,
RF86RF231_MAX_CHANNEL = 26
};
extern at86rf231_packet_t at86rf231_rx_buffer[AT86RF231_RX_BUF_SIZE];
#endif