From aa05eda641f8152bfa7349f24cb67e12e479737d Mon Sep 17 00:00:00 2001 From: Gert Date: Sat, 16 May 2015 16:59:48 +0200 Subject: [PATCH 1/2] arduino --- snippets/arduino.snippets | 107 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 snippets/arduino.snippets diff --git a/snippets/arduino.snippets b/snippets/arduino.snippets new file mode 100644 index 0000000..2332544 --- /dev/null +++ b/snippets/arduino.snippets @@ -0,0 +1,107 @@ +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}); From 10f2e6ebcf28b8214ed7a02d989a5867f286eed0 Mon Sep 17 00:00:00 2001 From: Gert Date: Mon, 18 May 2015 16:44:24 +0200 Subject: [PATCH 2/2] tabs --- snippets/arduino.snippets | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/snippets/arduino.snippets b/snippets/arduino.snippets index 2332544..717397c 100644 --- a/snippets/arduino.snippets +++ b/snippets/arduino.snippets @@ -1,18 +1,18 @@ snippet setup - void setup() - { - ${0} - Serial.begin(9600); - } + void setup() + { + ${0} + Serial.begin(9600); + } snippet loop - void loop() - { - ${0} - } + void loop() + { + ${0} + } snippet inc - #include <${1}.h> + #include <${1}.h> # if snippet if @@ -81,27 +81,27 @@ snippet fun ## IO # pinMode OUTPUT snippet pinout - pinMode(${1}, OUTPUT); + pinMode(${1}, OUTPUT); # pinMode INPUT snippet pinin - pinMode(${1}, INPUT); + pinMode(${1}, INPUT); # digitalWrite HIGH snippet dwHigh - digitalWrite(${1}, HIGH); + digitalWrite(${1}, HIGH); # digitalWrite LOW snippet dwLow - digitalWrite(${1}, LOW); + digitalWrite(${1}, LOW); # digitalRead snippet dr - digitalRead(${1}); + digitalRead(${1}); # serialRead snippet sr - serialRead(); + serialRead(); # serial.println snippet sp - serial.println(${1}); + serial.println(${1}); # delay snippet dl - delay(${1}); + delay(${1});