[docs] Improve halconf/mcuconf code examples (#24597)
This commit is contained in:
		
							parent
							
								
									a8a47c4011
								
							
						
					
					
						commit
						46236ce3de
					
				
					 8 changed files with 222 additions and 136 deletions
				
			
		| 
						 | 
				
			
			@ -160,15 +160,23 @@ To configure the DI pin for open drain configuration, add the following to your
 | 
			
		|||
 | 
			
		||||
Depending on the ChibiOS board configuration, you may need to enable SPI at the keyboard level. For STM32, this would look like:
 | 
			
		||||
 | 
			
		||||
`halconf.h`:
 | 
			
		||||
```c
 | 
			
		||||
#define HAL_USE_SPI TRUE
 | 
			
		||||
::: code-group
 | 
			
		||||
```c [halconf.h]
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define HAL_USE_SPI TRUE // [!code focus]
 | 
			
		||||
 | 
			
		||||
#include_next <halconf.h>
 | 
			
		||||
```
 | 
			
		||||
`mcuconf.h`:
 | 
			
		||||
```c
 | 
			
		||||
#undef STM32_SPI_USE_SPI1
 | 
			
		||||
#define STM32_SPI_USE_SPI1 TRUE
 | 
			
		||||
```c [mcuconf.h]
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include_next <mcuconf.h>
 | 
			
		||||
 | 
			
		||||
#undef STM32_SPI_USE_SPI1 // [!code focus]
 | 
			
		||||
#define STM32_SPI_USE_SPI1 TRUE // [!code focus]
 | 
			
		||||
```
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
The following `define`s apply only to the `spi` driver:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -213,15 +221,23 @@ The following `#define`s apply only to the PIO driver:
 | 
			
		|||
 | 
			
		||||
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 <halconf.h>
 | 
			
		||||
```
 | 
			
		||||
`mcuconf.h`:
 | 
			
		||||
```c
 | 
			
		||||
#undef STM32_PWM_USE_TIM2
 | 
			
		||||
#define STM32_PWM_USE_TIM2 TRUE
 | 
			
		||||
```c [mcuconf.h]
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include_next <mcuconf.h>
 | 
			
		||||
 | 
			
		||||
#undef STM32_PWM_USE_TIM2 // [!code focus]
 | 
			
		||||
#define STM32_PWM_USE_TIM2 TRUE // [!code focus]
 | 
			
		||||
```
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
The following `#define`s apply only to the `pwm` driver:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue