aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/snippets/arduino.snippets
blob: 77ee46fa4ba126f4088092377791d8568fe13249 (plain)
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
snippet setup
	void setup()
	{
		${0}
		Serial.begin(9600);
	}

snippet loop
	void loop()
	{
		${0}
	}

snippet inc
	#include <${1}.h>

# if
snippet if
	if (${1:/* condition */}) {
		${2}
	}
# else
snippet el
	else {
		${1}
	}
# else if
snippet elif
	else if (${1:/* condition */}) {
		${2}
	}
# ifi
snippet ifi
	if (${1:/* condition */}) ${2};

# switch
snippet switch
	switch (${1:/* variable */}) {
		case ${2:/* variable case */}:
			${3}
			${4:break;}${5}
		default:
			${6}
	}

snippet case
	case ${1:/* variable case */}:
		${2}
		${3:break;}

# for
snippet for
	for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
		${4}
	}
# for (custom)
snippet forr
	for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
		${5}
	}
# while
snippet wh
	while (${1:/* condition */}) {
		${2}
	}
# do... while
snippet do
	do {
		${2}
	} while (${1:/* condition */});
##
## Functions
# function definition
snippet fun
	${1:void} ${2:function_name}(${3})
	{
		${4}
	}

## IO
# pinMode OUTPUT
snippet pinout
	pinMode(${1}, OUTPUT);
# pinMode INPUT
snippet pinin
	pinMode(${1}, INPUT);
# digitalWrite HIGH
snippet dwHigh
	digitalWrite(${1}, HIGH);
# digitalWrite LOW
snippet dwLow
	digitalWrite(${1}, LOW);
# digitalRead
snippet dr
	digitalRead(${1});
# serialRead
snippet sr
	serialRead();
# serial.println
snippet sp
	serial.println(${1});


# delay
snippet dl
	delay(${1});