MiraOS  v1.0 2016-02-20
miralib.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2016 LumenRadio AB *
3  * *
4  * This file is part of MiraOS. *
5  * *
6  * MiraOS contains software components that are patented by LumenRadio. *
7  * Use of this software is under the terms of the LumenRadio MiraOS *
8  * license.
9  * *
10  * You should have received a copy of the MiraOS license from your *
11  * LumenRadio representative. If not, email to <licenses@lumenradio.com> *
12  ****************************************************************************/
13 
25 #ifndef LIBMIRA_H_
26 #define LIBMIRA_H_
27 
28 #include "sys/autostart.h"
29 #include "sys/process.h"
30 #include "sys/etimer.h"
31 #include "mira_gpio.h"
32 #include "mira_adc.h"
33 #include "mira_pwm.h"
34 #include "mira_i2c.h"
35 #include "mira_spi.h"
36 
37 #include <stdint.h>
38 
44 typedef enum {
49 
55 typedef enum {
56  MIRA_TO_EUI64 = 0x12,
57  MIRA_TO_ROOT = 0x21,
58  MIRA_TO_LOCAL = 0x41,
61 
67 typedef enum {
71 
72 
83 typedef void (*MiraReceivedDataCallback)(uint8_t* data_ptr, uint8_t length, MiraAddressType address_type, uint8_t* address_ptr);
84 
85 
97 MiraErrorType mira_send_data(MiraAddressType address_type, uint8_t* address_ptr, uint8_t* data_ptr, uint8_t length);
98 
109 
124 void mira_set_credentials(uint16_t pan_id, uint8_t* aes_key);
125 
136 void mira_become_root(void);
137 
147 void mira_commit_network_setup(void);
148 
159 void mira_set_name(char* name);
160 
172 
181 void mira_disable_rf_frontend(void);
182 
192 void mira_enable_rf_frontend(void);
193 
199 void mira_reboot(void);
200 
209 void mira_init(void);
210 
211 
212 #endif /* LIBMIRA_H_ */
Definition: miralib.h:59
void mira_set_name(char *name)
Set the node name.
Definition: miralib.h:58
Definition: miralib.h:56
void mira_register_data_received_callback(MiraReceivedDataCallback callback)
Register the received data callback.
MiraOS analog to digital converter driver.
void mira_become_root(void)
Become the network root.
MiraOS SPI driver.
Definition: miralib.h:57
void mira_set_credentials(uint16_t pan_id, uint8_t *aes_key)
Sets the network credentials to use.
Definition: miralib.h:46
void mira_commit_network_setup(void)
Commit the network setup and start routing traffic.
Definition: miralib.h:45
Definition: miralib.h:68
void mira_enable_rf_frontend(void)
Enables the RF frontend.
MiraAddressType
Supported addressing modes for Mira messages.
Definition: miralib.h:55
void mira_select_antenna(MiraAntennaType antenna)
Selects the antenna option.
MiraErrorType mira_send_data(MiraAddressType address_type, uint8_t *address_ptr, uint8_t *data_ptr, uint8_t length)
Function to send a data message.
MiraAntennaType
Antenna options.
Definition: miralib.h:67
void mira_disable_rf_frontend(void)
Disables the RF frontend.
void mira_init(void)
Initializes the library.
MiraOS GPIO driver.
Definition: miralib.h:47
Definition: miralib.h:69
MiraOS I2C driver.
MiraErrorType
Return error codes for Mira library functions.
Definition: miralib.h:44
void(* MiraReceivedDataCallback)(uint8_t *data_ptr, uint8_t length, MiraAddressType address_type, uint8_t *address_ptr)
Function pointer to receive callback.
Definition: miralib.h:83
void mira_reboot(void)
Reboots the module.
MiraOS PWM driver.