Registered User mNo edit summary |
Registered User mNo edit summary |
||
Line 6: | Line 6: | ||
Where: | Where: | ||
* {{HighlightParam|<category>}} is the '''mandatory''' category article to | * {{HighlightParam|<category>}} is the '''mandatory''' category article to that the licenses and copyright associated to the snippet are refering to: | ||
** '''AI''': to refer to the AI licences page | ** '''AI''': to refer to the AI licences page | ||
* {{HighlightParam|<component>}} is the '''mandatory''' component name the snippet is refering to. | * {{HighlightParam|<component>}} is the '''mandatory''' component name the snippet is refering to. | ||
Line 189: | Line 189: | ||
| AI = {{#vardefine:cat|AI licences}} | | AI = {{#vardefine:cat|AI licences}} | ||
| #default = {{#vardefine:cat|{{Highlight|unknown category}}}} | | #default = {{#vardefine:cat|{{Highlight|unknown category}}}} | ||
}}<div style="margin-bottom:-28px;font-size:12px;">''This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms | }}<div style="margin-bottom:-28px;font-size:12px;">''This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found [[{{#var:cat}}|here]] for the component: '''{{#if: {{{component|}}} | {{{component|}}} | {{Highlight|unknown component}}}}.'''''</div> | ||
{{{snippet}}} | {{{snippet}}} |
Revision as of 06:56, 15 July 2022
1. Usage
The Snippet template is used to display snippet of code and to provide license/copyrights and component information at the same time.
<category> | component=<component> | snippet=<snippet>}}Usage: {{Snippet | category=
Where:
- <category> is the mandatory category article to that the licenses and copyright associated to the snippet are refering to:
- AI: to refer to the AI licences page
- <component> is the mandatory component name the snippet is refering to.
- <snippet> is the mandatory source code of the snippet.
2. Basic examples
You type | You get |
---|---|
Snippet usage
{{Snippet | category=AI | component=Application | snippet=
<source lang="c" highlight="4-9">
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
</source>
}}
|
This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms which can be found here for the component: Application.
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
|
Snippet error if category or component are not set
{{Snippet | snippet=
<source lang="c" highlight="4-9">
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
</source>
}}
|
This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms which can be found [[unknown category|here]] for the component: unknown component.
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
|
Snippet error if category as a wrong value
{{Snippet | category=Toto | component=Application | snippet=
<source lang="c" highlight="4-9">
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
</source>
}}
|
This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms which can be found [[unknown category|here]] for the component: Application.
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
|
3. More examples
You type | You get |
---|---|
Check that spaces before and after the snippet
BEFORE{{Snippet | category=AI | component=Application | snippet=
<source lang="c" highlight="4-9">
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
</source>
}}AFTER<br>
BEFORE
{{Snippet | category=AI | component=Application | snippet=
<source lang="c" highlight="4-9">
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
</source>
}}
AFTER
|
BEFORE This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms which can be found here for the component: Application.
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
BEFORE This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms which can be found here for the component: Application.
/* USER CODE BEGIN 4 */
/*...*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_11) {
dataRdyIntReceived++;
}
}
/* USER CODE END 4 */
AFTER |
4. Code
This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found [[unknown category|here]] for the component: unknown component.
{{{snippet}}}