MiraOS
v1.0 2016-02-20
|
Main include file for the MiraOS library. More...
#include "sys/autostart.h"
#include "sys/process.h"
#include "sys/etimer.h"
#include "mira_gpio.h"
#include "mira_adc.h"
#include "mira_pwm.h"
#include "mira_i2c.h"
#include "mira_spi.h"
#include <stdint.h>
Go to the source code of this file.
Typedefs | |
typedef void(* | MiraReceivedDataCallback) (uint8_t *data_ptr, uint8_t length, MiraAddressType address_type, uint8_t *address_ptr) |
Function pointer to receive callback. More... | |
Enumerations | |
enum | MiraErrorType { MIRA_NOERROR = 0, MIRA_ERROR_UNKNOWN_ADDRESS = -1, MIRA_ERROR_UNSUPPORTED_SIZE = -2 } |
Return error codes for Mira library functions. More... | |
enum | MiraAddressType { MIRA_TO_EUI64 = 0x12, MIRA_TO_ROOT = 0x21, MIRA_TO_LOCAL = 0x41, MIRA_TO_BROADCAST = 0x81 } |
Supported addressing modes for Mira messages. More... | |
enum | MiraAntennaType { MIRA_CHIP_ANTENNA = 0, MIRA_EXT_ANTENNA = 1 } |
Antenna options. More... | |
Functions | |
MiraErrorType | mira_send_data (MiraAddressType address_type, uint8_t *address_ptr, uint8_t *data_ptr, uint8_t length) |
Function to send a data message. More... | |
void | mira_register_data_received_callback (MiraReceivedDataCallback callback) |
Register the received data callback. More... | |
void | mira_set_credentials (uint16_t pan_id, uint8_t *aes_key) |
Sets the network credentials to use. More... | |
void | mira_become_root (void) |
Become the network root. More... | |
void | mira_commit_network_setup (void) |
Commit the network setup and start routing traffic. More... | |
void | mira_set_name (char *name) |
Set the node name. More... | |
void | mira_select_antenna (MiraAntennaType antenna) |
Selects the antenna option. More... | |
void | mira_disable_rf_frontend (void) |
Disables the RF frontend. More... | |
void | mira_enable_rf_frontend (void) |
Enables the RF frontend. More... | |
void | mira_reboot (void) |
Reboots the module. More... | |
void | mira_init (void) |
Initializes the library. More... | |
Main include file for the MiraOS library.
typedef void(* MiraReceivedDataCallback) (uint8_t *data_ptr, uint8_t length, MiraAddressType address_type, uint8_t *address_ptr) |
Function pointer to receive callback.
data_ptr | a pointer to the received data |
length | the length of the received data |
address_type | addressing mode that was used for the message |
address_ptr | a pointer to the destination address, NULL of none. |
enum MiraAddressType |
enum MiraAntennaType |
enum MiraErrorType |
void mira_become_root | ( | void | ) |
Become the network root.
Each network must have a network root that sets up the network and coordinates and synchronizes the frequency hopping as well as setting up routes. Calling this function causes this node to become a root. Currently, there may not be more than one root on one network at a time.
void mira_commit_network_setup | ( | void | ) |
Commit the network setup and start routing traffic.
When setting up the network, this function shall be called to make all network settings take effect. This will start the routing protocol. If this function is not called, only broadcast traffic will work.
void mira_disable_rf_frontend | ( | void | ) |
Disables the RF frontend.
If RF frontend is disabled, the module will run at the maximum output power it can without the PA. Note: this also disables the LNA.
void mira_enable_rf_frontend | ( | void | ) |
Enables the RF frontend.
This enabled both PA and LNA in the RF frontend. The module will consume some more energy, but will get greater range due to better receiver sensitivity and higher output power.
void mira_init | ( | void | ) |
Initializes the library.
The Mira library must be initialized before any other mira functions are used. Failure to do so may result in unexpected behaviour.
void mira_reboot | ( | void | ) |
Reboots the module.
void mira_register_data_received_callback | ( | MiraReceivedDataCallback | callback | ) |
Register the received data callback.
The received data callback will be called every time a new data message is received.
callback | a function pointer to the callback function |
void mira_select_antenna | ( | MiraAntennaType | antenna | ) |
Selects the antenna option.
Selects if to use the internal chip antenna or if to use the antenna connector connected to an external antenna.
antenna | the antenna option to use. |
MiraErrorType mira_send_data | ( | MiraAddressType | address_type, |
uint8_t * | address_ptr, | ||
uint8_t * | data_ptr, | ||
uint8_t | length | ||
) |
Function to send a data message.
address_type | adressing mode to use for this message |
address_ptr | pointer to the destination address, format must match address_type parameters |
data_ptr | pointer to the data to be sent |
length | the length of the data |
void mira_set_credentials | ( | uint16_t | pan_id, |
uint8_t * | aes_key | ||
) |
Sets the network credentials to use.
Each network uses a set of credentials to be able to communicate. Network ID (aka. PAN ID) and AES encryption key need to be set to be able to participate in the communication on a network. This function overrides whatever may (or may not) be set using the comissioning application.
pan_id | the PAN ID (network ID) to use |
aes_key | a pointer to the AES key to use |
void mira_set_name | ( | char * | name | ) |
Set the node name.
Sets the human readable node name for this node. This name will be returned as the device label of this node in the network statistics commands.
name | A pointer to a null terminated string with the name. |