Created
March 27, 2023 21:28
FreeRTOS fonksiyonlari icin hazirladigim snippets ornekleri.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################### | |
# Vim'de ultisnips kullanirken freertos # | |
# fonksiyonlari icin hazirladigim snippets ornekleri # | |
# # | |
# Dokumantasyon: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt # | |
######################################################################################### | |
snippet inc "#include " b | |
#include <$0.h> | |
endsnippet | |
snippet vtdel "vTaskDelete" b | |
vTaskDelete(${1:NULL}); | |
endsnippet | |
snippet vtdly "vTaskDelay" b | |
vTaskDelay(${1:1000}); | |
endsnippet | |
snippet vtdlyu "vTaskDelayUntil" b | |
vTaskDelayUntil(${1:pxPreviousTime},(TickType_t ) ${2:1000}); | |
endsnippet | |
snippet itask "Include freertos task" | |
#include <freertos/task.h> | |
endsnippet | |
snippet iqueue "Include freertos queue" | |
#include <freertos/queue.h> | |
endsnippet | |
snippet isemphr "Include freertos semaphore" | |
#include <freertos/semphr.h> | |
endsnippet | |
snippet thand "TaskHandle_t" | |
TaskHandle_t ${1:xTask} = NULL; | |
endsnippet | |
snippet qhand "QueueHandle_t" | |
QueueHandle_t ${1:xQueue} = NULL; | |
endsnippet | |
snippet st "StaticTask_t" b | |
StaticTask_t ${1:pxStaticTask}; | |
endsnippet | |
snippet ss "StaticSemaphore_t" b | |
StaticSemaphore_t ${1:pxStaticSemaphore}; | |
endsnippet | |
snippet shand "SemaphoreHandle_t" b | |
SemaphoreHandle_t ${1:xSemaphore} = NULL; | |
endsnippet | |
snippet xscb "xSemaphoreCreateBinary" b | |
${1:xSemaphore} = xSemaphoreCreateBinary(); | |
endsnippet | |
snippet xscbs "xSemaphoreCreateBinaryStatic" b | |
xSemaphoreCreateBinaryStatic(${1:pxStaticSemaphore}); | |
endsnippet | |
snippet xst "xSemaphoreTake" b | |
xSemaphoreTake(${1:xSemaphore},${2:( TickType_t ) 1000}); | |
endsnippet | |
snippet xscrm "xSemaphoreCreateRecursiveMutex" b | |
${1:xMutex} = xSemaphoreCreateRecursiveMutex(); | |
endsnippet | |
snippet xstr "xSemaphoreTakeRecursive" b | |
xSemaphoreTakeRecursive(${1:xSemaphore}, ${2:portMAX_DELAY}); | |
endsnippet | |
snippet xsgr "xSemaphoreGiveRecursive" b | |
xSemaphoreGiveRecursive( ${1:xSemaphore} ); | |
endsnippet | |
snippet xsg "xSemaphoreGive" b | |
xSemaphoreGive( ${1:xMutex} ); | |
endsnippet | |
snippet xqc "xQueueCreate" b | |
${1:xQueue} = xQueueCreate(${2:1},${3:sizeof(buf)}); | |
endsnippet | |
snippet xqs "xQueueSend" b | |
xQueueSend(${1:xQueue},(void *) &${2:buffer},portMAX_DELAY); | |
endsnippet | |
snippet xqr "xQueueReceive" b | |
xQueueReceive(${1:xQueue},(void *) &${2:buffer}, portMAX_DELAY); | |
endsnippet | |
snippet vqd "vQueueDelete" b | |
vQueueDelete(${1:xQueue}); | |
endsnippet | |
snippet xtng "xTaskNotifyGive" b | |
xTaskNotifyGive(${1:taskHandle}); | |
endsnippet | |
snippet utnt "ulTaskNotifyTake" b | |
ulTaskNotifyTake(${1:pdTRUE}, ${2:portMAX_DELAY}); | |
endsnippet | |
snippet xtn "xTaskNotify" b | |
xTaskNotify(${1:taskHandle},${2:0},${3:eIncrement}); | |
endsnippet | |
snippet xtnw "xTaskNotifyWait" b | |
xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, | |
uint32_t ulBitsToClearOnExit, | |
uint32_t *pulNotificationValue, | |
TickType_t xTicksToWait ); | |
endsnippet | |
global !p | |
def taskName(val): | |
return ("vMyTask%s" %val) | |
endglobal | |
snippet xtc "xTaskCreate" b | |
xTaskCreate( | |
${1:vMyTask}, | |
${2:"vMyTask"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${6:NULL}); | |
endsnippet | |
snippet "xtc (\d+)" "xTaskCreate" r | |
xTaskCreate( | |
${1:`!p snip.rv=taskName(str(match.group(1)))`}, | |
${2:"`!p snip.rv=taskName(str(match.group(1)))`"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${6:NULL}); | |
endsnippet | |
snippet xtcp "xTaskCreatePinnedToCore" b | |
xTaskCreatePinnedToCore( | |
${1:vMyTask}, | |
${2:"vMyTask"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${6:NULL}, | |
${7:0}); | |
endsnippet | |
snippet "xtcp (\d+)" "xTaskCreatePinnedToCore" r | |
xTaskCreatePinnedToCore( | |
${1:`!p snip.rv=taskName(str(match.group(1)))`}, | |
${2:"`!p snip.rv=taskName(str(match.group(1)))`"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${6:NULL}, | |
${7:0}); | |
endsnippet | |
snippet xtcs "xTaskCreateStatic" b | |
xTaskCreateStatic( | |
${1:vMyTask}, | |
${2:"vMyTask"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${7:puxStackBuffer}, | |
&${8:pxTaskBuffer}); | |
endsnippet | |
snippet "xtcs (\d+)" "xTaskCreateStatic" r | |
xTaskCreateStatic( | |
${1:`!p snip.rv=taskName(str(match.group(1)))`}, | |
${2:"`!p snip.rv=taskName(str(match.group(1)))`"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${7:puxStackBuffer}, | |
&${8:pxTaskBuffer}); | |
endsnippet | |
snippet xtcsp "xTaskCreateStaticPinnedToCore" b | |
xTaskCreateStaticPinnedToCore( | |
${1:vMyTask}, | |
${2:"vMyTask"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${7:puxStackBuffer}, | |
&${8:pxTaskBuffer}, | |
${9:0}); | |
endsnippet | |
snippet "xtcsp (\d+)" "xTaskCreateStaticPinnedToCore" r | |
xTaskCreateStaticPinnedToCore( | |
${1:`!p snip.rv=taskName(str(match.group(1)))`}, | |
${2:"`!p snip.rv=taskName(str(match.group(1)))`"}, | |
${3:1000}, | |
${4:NULL}, | |
${5:10}, | |
${7:puxStackBuffer}, | |
&${8:pxTaskBuffer}, | |
${9:0}); | |
endsnippet | |
snippet task "Task function" | |
void ${1:vMyTask}(void * parameters) | |
{ | |
$0 | |
} | |
endsnippet | |
snippet "task (\d+)" "task value" r | |
void ${1:`!p snip.rv=taskName(str(match.group(1)))`}(void * parameters) | |
{ | |
$0 | |
} | |
endsnippet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment