µracoli Manual Version foo

- µracoli
- User Guide
- Reference Guide

Data Structures
Arduino Radio Functions

Description of the UASP functions. More...

## Data Structures
struct | radio_buffer_t
class | HardwareRadio

## Detailed Description

## Data Structure Documentation

struct radio_buffer_t

Element of a chained list of frame buffers

Definition at line 56 of file HardwareRadio.h.

Data Fields
uint8_t | frm[PHY_MAX_FRAME_SIZE] | array that can store a maximum IEEE 802.15.4 frame
uint8_t | idx | read/write index
uint8_t | len | Length of payload
struct radio_buffer * | next | pointer to next list element or NULL if list terminates

class HardwareRadio

Hardware Radio class

Definition at line 71 of file HardwareRadio.h.

### Public Member Functions
radio_buffer_t * | alloc_buffer (void)
void | free_buffer (radio_buffer_t *pbuf)
| HardwareRadio (void)
void | begin (void)
void | begin (uint8_t channel, uint8_t idlestate)
virtual int | available (void)
virtual int | peek (void)
virtual int | read (void)
virtual void | flush (void)
virtual size_t | write (uint8_t)
void | write (char *str)
void | write (uint8_t *buf, uint8_t size)

#### Constructor & Destructor Documentation

HardwareRadio::HardwareRadio | ( | void |  | ) |

constructor

#### Member Function Documentation

radio_buffer_t* HardwareRadio::alloc_buffer | ( | void |  | ) |

Allocate a radio buffer

virtual int HardwareRadio::available | ( | void |  | ) |
| virtual

return number of available bytes in current RX buffer

Examples:
  Gateway.ino, and RadioUart.ino.

void HardwareRadio::begin | ( | void |  | ) |

Starting the hardware radio class with default parameters

Examples:
  Gateway.ino, HelloRadio.ino, IoCheck.ino, IoRadio.ino, RadioUart.ino, and Remote.ino.

void HardwareRadio::begin | ( | uint8_t | channel,
|  | uint8_t | idlestate
| ) |  |

Starting the hardware radio class with explicit parameters

Parameters

  channel | radio channel (11 - 26 for 2.4GHz radios, 0 - 10 for SubGHz radios)
  idlestate | default state of the radio, supported values are listed in radio_state_t.

virtual void HardwareRadio::flush | ( | void |  | ) |
| virtual

flush TX and RX queues. RX queue data are discarded, TX data is sent.

Examples:
  HelloRadio.ino, IoRadio.ino, RadioUart.ino, and Remote.ino.

void HardwareRadio::free_buffer | ( | radio_buffer_t * | pbuf | ) |

Free a radio buffer

virtual int HardwareRadio::peek | ( | void |  | ) |
| virtual

Returns the next byte (character) of incoming data (RX) without removing it from the internal serial buffer.

Returns
  EOF (-1) if no data available, otherwise a value from 0 ... 255

virtual int HardwareRadio::read | ( | void |  | ) |
| virtual

Returns the next byte (character) of incoming data (RX)

Returns
  EOF (-1) if no data available, otherwise a value from 0 ... 255

Examples:
  Gateway.ino, and RadioUart.ino.

virtual size_t HardwareRadio::write | ( | uint8_t |  | ) |
| virtual

write a byte to the TX stream

Examples:
  HelloRadio.ino, and IoRadio.ino.

void HardwareRadio::write | ( | char * | str | ) |

write a string to the TX stream

Parameters

  str | \0 terminated string

void HardwareRadio::write | ( | uint8_t * | buf,
|  | uint8_t | size
| ) |  |

write a binary buffer (buf, size) to the TX stream

Parameters

  buf | pointer to the buffer
  size | number of bytes in the buffer.

## Defines

#define PHY_DEFAULT_CHANNEL (17)

Default radio channel number in 2.4 GHz band

Definition at line 50 of file HardwareRadio.h.

#define PHY_MAX_CHANNEL (26)

Maximun radio channel number in 2.4 GHz band

Definition at line 48 of file HardwareRadio.h.

#define PHY_MAX_FRAME_SIZE (127)

Maximum size of a IEEE 802.15.4 frame

Definition at line 53 of file HardwareRadio.h.

#define PHY_MIN_CHANNEL (11)

Minimun radio channel number in 2.4 GHz band

Definition at line 46 of file HardwareRadio.h.