-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patharduino.json
183 lines (183 loc) · 6.98 KB
/
arduino.json
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
{
"include": {
"body": "#include \"$0.h\"",
"description": "Generic Include header file",
"prefix": "include"
},
"includeArduino": {
"body": "#include <Arduino.h>",
"description": "Include Arduino header file",
"prefix": "includeArduinoHeader"
},
"setup": {
"prefix": "setup",
"body": [
"void setup() {",
" // Initialize your setup code here",
" Serial.begin(${1|115200,9600|});",
"}",
"",
"void loop() {",
" // Add your main code here, to run repeatedly",
"}"
],
"description": "Empty setup and loop functions with Serial initialization"
},
"analogRead": {
"body": ["int ${1:sensorValue} = analogRead(${2:pinNumber});"],
"description": "Reads analog data from a pin",
"prefix": "analogRead"
},
"analogWrite": {
"body": "analogWrite(${1:pinNumber}, ${2:value});$0",
"description": "Write analog value to a pin",
"prefix": "analogWrite"
},
"define": {
"body": "#define ${1:MYIDENTIFIER} ${2:value}$0",
"description": "define directive",
"prefix": "define"
},
"pinMode": {
"prefix": "pinMode",
"body": "pinMode(${1:pinNumber}, ${2|INPUT,OUTPUT,INPUT_PULLUP|});$0",
"description": "Set up a digital pin to behave either as an input or an output."
},
"Serial Begin": {
"prefix": "serialBegin",
"body": ["Serial.begin(${1|115200,9600|});"],
"description": "Starts Serial communication"
},
"Delay Function": {
"prefix": "delay",
"body": ["delay(${1:1000}); // Delay for ${1} milliseconds"],
"description": "Insert a delay function with customizable time in milliseconds"
},
"Delay Microseconds": {
"prefix": "delayMicroseconds",
"body": ["delayMicroseconds(${1:100}); // Delay for ${1} microseconds"],
"description": "Insert a delayMicroseconds function with customizable time in microseconds"
},
"Digital Read": {
"prefix": "digitalRead",
"body": ["int ${1:pinValue} = digitalRead(${2:pinNumber});"],
"description": "Read the value from a digital pin and store it in a variable"
},
"Digital Write": {
"prefix": "digitalWrite",
"body": ["digitalWrite(${1:pinNumber}, ${2|HIGH,LOW|});"],
"description": "Set the state of a digital pin to HIGH or LOW"
},
"Ifdef Block": {
"prefix": "ifdef",
"body": ["#ifdef ${1:CONDITION}", " ${2:// Code to include if CONDITION is defined}", "#endif"],
"description": "Insert an #ifdef block to conditionally include code"
},
"Random Number": {
"prefix": "random",
"body": [
"int ${1:randomNumber} = random(${2:minValue}, ${3:maxValue});",
"// ${1} will hold a random value between ${2} (inclusive) and ${3} (exclusive)"
],
"description": "Generate a random number within a specified range"
},
"ESP32-xTaskCreatePinnedToCore": {
"prefix": "taskCreatePinnedToCore",
"body": [
"xTaskCreatePinnedToCore(",
" ${1:taskFunction}, // Task function",
" \"${2:taskName}\", // Task name",
" 8192, // Stack size",
" NULL, // Task input parameters",
" 1, // Task priority, be carefull when changing this",
" NULL, // Task handle, add one if you want control over the task (resume or suspend the task) ",
" 1 // Core to run the task on",
");"
],
"description": "Create a FreeRTOS task pinned to Core 1 with default settings"
},
"ESP32-TaskHandle_t Variable": {
"prefix": "TaskHandle_t",
"body": ["TaskHandle_t ${1:taskHandle}; // Handle for managing the task"],
"description": "Create a TaskHandle_t variable for FreeRTOS task management"
},
"ESP32-Task Function": {
"prefix": "taskFunction",
"body": [
"void ${1:taskFunctionName}(void *parameter) {",
" // Setup start here",
" ",
" ",
" // End of your setup",
" ",
" // Loop function, run repeatedly",
" for (;;) {",
" delay(10); // Allow other tasks to run, adjust as needed",
" }",
"}"
],
"description": "Create a FreeRTOS task function with setup and loop sections"
},
"ESP32-LEDC Attach": {
"prefix": "ledcAttach",
"body": ["bool success = ledcAttach(${1:pin}, ${2:freq}, ${3:resolution});"],
"description": "Use ledcAttach to attach a pin to a PWM signal with specified frequency and resolution"
},
"ESP32-LEDC Write": {
"prefix": "ledcWrite",
"body": ["bool success = ledcWrite(${1:pin}, ${2:duty});"],
"description": "Use ledcWrite to set the duty cycle on a pin with specified PWM duty"
},
"ESP32-LEDC Attach Channel": {
"prefix": "ledcAttachChannel",
"body": ["bool success = ledcAttachChannel(${1:pin}, ${2:freq}, ${3:resolution}, ${4:channel});"],
"description": "Use ledcAttachChannel to attach a pin to a PWM channel with specified frequency and resolution"
},
"ESP32-LEDC Write Channel": {
"prefix": "ledcWriteChannel",
"body": ["bool success = ledcWriteChannel(${1:channel}, ${2:duty});"],
"description": "Use ledcWriteChannel to set the duty cycle on a specific PWM channel"
},
"ESP32-LEDC Read": {
"prefix": "ledcRead",
"body": ["uint32_t duty = ledcRead(${1:pin});"],
"description": "Use ledcRead to retrieve the current duty cycle of a specified pin"
},
"ESP32-LEDC Read Frequency": {
"prefix": "ledcReadFreq",
"body": ["uint32_t freq = ledcReadFreq(${1:pin});"],
"description": "Use ledcReadFreq to get the current frequency of a specified pin"
},
"ESP32-LEDC Write Tone": {
"prefix": "ledcWriteTone",
"body": ["uint32_t freq = ledcWriteTone(${1:pin}, ${2:freq}); // Write a tone with ${2} Hz frequency"],
"description": "Use ledcWriteTone to generate a tone on a specified pin at a given frequency"
},
"ESP32-LEDC Write Note": {
"prefix": "ledcWriteNote",
"body": [
"uint32_t freq = ledcWriteNote(${1:pin}, ${2|NOTE_C,NOTE_Cs,NOTE_D,NOTE_Eb,NOTE_E,NOTE_F,NOTE_Fs,NOTE_G,NOTE_Gs,NOTE_A,NOTE_Bb,NOTE_B,NOTE_MAX|}, ${3:4});"
],
"description": "Use ledcWriteNote to generate a musical note on a specified pin"
},
"ESP32-LEDC Detach": {
"prefix": "ledcDetach",
"body": ["bool success = ledcDetach(${1:pin});"],
"description": "Use ledcDetach to detach a PWM signal from a specified pin"
},
"ESP32-LEDC Fade": {
"prefix": "ledcFade",
"body": ["bool success = ledcFade(${1:pin}, ${2:start_duty}, ${3:target_duty}, ${4:max_fade_time_ms});"],
"description": "Use ledcFade to gradually adjust the duty cycle on a pin"
},
"ESP32-Analog Write Frequency": {
"prefix": "analogWriteFrequency",
"body": ["analogWriteFrequency(${1:pin}, ${2:freq});"],
"description": "Use analogWriteFrequency to set the PWM frequency for a pin"
},
"ESP32-Analog Write Resolution": {
"prefix": "analogWriteResolution",
"body": ["analogWriteResolution(${1:pin}, ${2:resolution});"],
"description": "Use analogWriteResolution to set the PWM resolution for a pin"
}
}