From 46236ce3de8385f27e3f13a9921abee7e1e0fa57 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 15 Nov 2024 05:00:02 +1100 Subject: [docs] Improve halconf/mcuconf code examples (#24597) --- docs/features/backlight.md | 44 ++++++++++++++++++++++++++++++-------------- docs/features/ps2_mouse.md | 12 ++++++++---- 2 files changed, 38 insertions(+), 18 deletions(-) (limited to 'docs/features') diff --git a/docs/features/backlight.md b/docs/features/backlight.md index 94726756fd..20f84ac6b5 100644 --- a/docs/features/backlight.md +++ b/docs/features/backlight.md @@ -161,15 +161,23 @@ Note that the choice of timer may conflict with the [Audio](audio) feature. Depending on the ChibiOS board configuration, you may need to enable PWM at the keyboard level. For STM32, this would look like: -`halconf.h`: -```c -#define HAL_USE_PWM TRUE +::: code-group +```c [halconf.h] +#pragma once + +#define HAL_USE_PWM TRUE // [!code focus] + +#include_next ``` -`mcuconf.h`: -```c -#undef STM32_PWM_USE_TIM4 -#define STM32_PWM_USE_TIM4 TRUE +```c [mcuconf.h] +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM4 // [!code focus] +#define STM32_PWM_USE_TIM4 TRUE // [!code focus] ``` +::: The following `#define`s apply only to the `pwm` driver: @@ -187,15 +195,23 @@ Refer to the ST datasheet for your particular MCU to determine these values. For Depending on the ChibiOS board configuration, you may need to enable general-purpose timers at the keyboard level. For STM32, this would look like: -`halconf.h`: -```c -#define HAL_USE_GPT TRUE +::: code-group +```c [halconf.h] +#pragma once + +#define HAL_USE_GPT TRUE // [!code focus] + +#include_next ``` -`mcuconf.h`: -```c -#undef STM32_GPT_USE_TIM15 -#define STM32_GPT_USE_TIM15 TRUE +```c [mcuconf.h] +#pragma once + +#include_next + +#undef STM32_GPT_USE_TIM15 // [!code focus] +#define STM32_GPT_USE_TIM15 TRUE // [!code focus] ``` +::: The following `#define`s apply only to the `timer` driver: diff --git a/docs/features/ps2_mouse.md b/docs/features/ps2_mouse.md index 90f4cca827..52443c3ce2 100644 --- a/docs/features/ps2_mouse.md +++ b/docs/features/ps2_mouse.md @@ -90,18 +90,22 @@ PS2_ENABLE = yes PS2_DRIVER = interrupt ``` -In your keyboard config.h: +In your keyboard `config.h`: ```c #define PS2_CLOCK_PIN A8 #define PS2_DATA_PIN A9 ``` -And in the chibios specifig halconf.h: +And in the ChibiOS specific `halconf.h`: + ```c -#define PAL_USE_CALLBACKS TRUE -``` +#pragma once +#define PAL_USE_CALLBACKS TRUE // [!code focus] + +#include_next +``` ### USART Version {#usart-version} -- cgit v1.2.3