semilimes mcu sdk 1.1.2
semilimes Software Development Kit for microcontrollers
Loading...
Searching...
No Matches
device.h
1#ifndef _device_
2#define _device_
3
4#include "../defines.h"
5
6class Device
7{
8private:
9 #define headerSize 25
10 #define headerPinSize 68
11 #define headerFunctionSize 29
12 #define headerFunctionA1Size 44
13 #define headerFunctionA2Size 59
14 SmeJson json_data;
15 char* json = nullptr;
16 char* jsonGPIOs = nullptr;
17 char* jsonFunctions = nullptr;
18
19public:
20// variable: Device.GPIOType
21
22// describes the type of the pin
24 char GPIOType[5][10] = {"out", "in", "analogIn", "analogOut", "pwm"};
25
26// describes the type of the pull config
28 char pullType[3][5] = {"none", "up", "down"};
29
30// Function: Device.set
31
32// an object that describes the device from the hw perspective
33
34// Prototype:
35// void Device::set(char* name);
36
37// Parameters:
40
41// Returns:
43 void set(char* deviceId, char* name);
44
45// Function: Device.gpioTypeIndex
46
47// turn the GPIOType into the corresponding index
48
49// Prototype:
50// void gpioTypeIndex(char* GPIOType, char* GPIOTypeIndex);
51
52// Parameters:
55
56// Returns:
58 void gpioTypeIndex(char* gpioType, char* GPIOTypeIndex);
59
60// Function: Device.addGPIO
61
62// add a GPIO to an array that describes the hw interface capabilities of the device
63
64// Prototype:
65// void Device::addGPIO(char* name, char* pinType, char* portName, int pinNumber, int value);
66
67// Parameters:
73
74// Returns:
76 void addGPIO(char* name, char* GPIOType, char* portName, char* pinNumber, char* pullType);
77
78// Function: Device.appendGPIOs
79
80// Append the selected GPIO
81
82// Prototype:
83// void Device::appendGPIOs();
84
85// Parameters:
86
87// Returns:
89 void appendGPIOs();
90
91// Function: Device.addFunction
92
93// add an array of internal methods/functions
94
95// Prototype:
96// void Device::addFunction(char* name, char* functionName);
97
98// Parameters:
103
104// Returns:
106 void addFunction(char* name, char* functionName);
107 void addFunction(char* name, char* functionName, char* arg1);
108 void addFunction(char* name, char* functionName, char* arg1, char* arg2);
109
110// Function: Device.appendFunctions
111
112// Append the selected functions
113
114// Prototype:
115// void Device::appendFunctions();
116
117// Parameters:
118
119// Returns:
121
122 void appendFunctions();
123
124// Function: Device.get
125
126// return the json script
127
128// Prototype:
129// void Device::get();
130
131// Parameters:
132
133// Returns:
135 char* get();
136};
137
138#endif
Definition device.h:7
void appendFunctions()
Definition device.cpp:241
char * get()
Definition device.cpp:260
void set(char *deviceId, char *name)
Definition device.cpp:17
char GPIOType[5][10]
Definition device.h:24
char pullType[3][5]
Definition device.h:28
void addFunction(char *name, char *functionName)
Definition device.cpp:107
void addGPIO(char *name, char *GPIOType, char *portName, char *pinNumber, char *pullType)
Definition device.cpp:67
void gpioTypeIndex(char *gpioType, char *GPIOTypeIndex)
Definition device.cpp:41
void appendGPIOs()
Definition device.cpp:222