Difference between revisions of "MansOS Radio"

From DiLab
Jump to: navigation, search
(Examples)
(Function reference)
Line 34: Line 34:
 
  int8_t radioSend(const void *data, uint16_t len)
 
  int8_t radioSend(const void *data, uint16_t len)
 
  // Transmit one byte over radio. Radio must be turned on before calling this function!
 
  // Transmit one byte over radio. Radio must be turned on before calling this function!
int8_t radioSendByte(uint8_t data)
+
int8_t radioSendByte(uint8_t data)
 +
 
 +
// Write received data into the buffer. It should be called after the radio driver has signaled
 +
// data availability. Non-blocking function (does not wait for data to arrive)
 +
int16_t radioRecv(void *buffer, uint16_t bufferLength)
 +
 
 +
// Similar to radioRecv(), but does not keep the result, just clear radio chip data buffers
 +
void radioDiscard()
  
  

Revision as of 08:20, 31 December 2011

mos/hil/radio.h

MansOS provides API for Radio communication in physical layer. Platforms without radio modules are also supported, with NULL-radio implementation.

Currently, only one default radio module is supported. When using multiple radio chips on one platform, other radios should be interfaced directly, using chip drivers.

Usage and configuration

Radio support is turned ON by default. It can be disabled by adding the following line to the application config file:

USE_RADIO = n

Dependencies

There are no dependencies for using Radio. However, when using remote reprogramming depends on radio, therefore radio usage is turned on, if remote reprogramming is used.

Function reference

All platform-independent radio functions are described in mos/hil/radio.h . Implementation can be found under mos/hal/platforms/<platform-name>/radio_hal.h

 // Initialize radio, called by the kernel on startup
 void radioInit() 
 
 // Turn the radio listening on. Note that listening is not required if radio is used only to send data
 void radioOn()

 // Turn the radio listening off (and save energy)
 void radioOff()


 // Transmit ''len'' bytes long data buffer over radio. Radio must be turned on before calling this function!
 int8_t radioSend(const void *data, uint16_t len)
 // Transmit one byte over radio. Radio must be turned on before calling this function!
 int8_t radioSendByte(uint8_t data)

 // Write received data into the buffer. It should be called after the radio driver has signaled
 // data availability. Non-blocking function (does not wait for data to arrive)
 int16_t radioRecv(void *buffer, uint16_t bufferLength)

 // Similar to radioRecv(), but does not keep the result, just clear radio chip data buffers
 void radioDiscard()


Examples

TODO