-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.h
79 lines (71 loc) · 2.03 KB
/
app.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* @file app.h
* @author Bernd Giesecke ([email protected])
* @brief Defines, includes, global definitions
* @version 0.1
* @date 2023-05-04
*
* @copyright Copyright (c) 2023
*
*/
#include <Arduino.h>
#include "wisblock_cayenne.h"
// Debug
// Debug output set to 0 to disable app debug output
#ifndef MY_DEBUG
#define MY_DEBUG 1
#endif
#if MY_DEBUG > 0
#if defined(_VARIANT_RAK3172_) || defined(_VARIANT_RAK3172_SIP_)
#define MYLOG(tag, ...) \
do \
{ \
if (tag) \
Serial.printf("[%s] ", tag); \
Serial.printf(__VA_ARGS__); \
Serial.printf("\n"); \
} while (0); \
delay(100)
#else // RAK4630 || RAK11720
#define MYLOG(tag, ...) \
do \
{ \
if (tag) \
Serial.printf("[%s] ", tag); \
Serial.printf(__VA_ARGS__); \
Serial.printf("\r\n"); \
Serial6.printf(__VA_ARGS__); \
Serial6.printf("\r\n"); \
} while (0); \
delay(100)
#endif
#else
#define MYLOG(...)
#endif
/** Custom flash parameters structure */
struct custom_param_s
{
uint8_t valid_flag = 0xAA;
uint32_t send_interval = 0;
};
/** Custom flash parameters */
extern custom_param_s custom_parameters;
// Forward declarations
void send_packet(void);
bool init_status_at(void);
bool init_interval_at(void);
bool get_at_setting(void);
bool save_at_setting(void);
// LoRaWAN stuff
#include "wisblock_cayenne.h"
// Cayenne LPP Channel numbers per sensor value
#define LPP_CHANNEL_HUMID_2 6 // RAK1906
#define LPP_CHANNEL_TEMP_2 7 // RAK1906
#define LPP_CHANNEL_PRESS_2 8 // RAK1906
#define LPP_CHANNEL_GAS_2 9 // RAK1906
extern WisCayenne g_solution_data;
// Sensor functions
bool init_rak1906(void);
void read_rak1906(void);
void startup_rak1906(void);
void shutdown_rak1906(void);