|
1 | | -/* |
2 | | -Version 0.8 |
3 | 1 |
|
4 | | -MIT License |
5 | 2 |
|
6 | | -Copyright (c) 2025 Raisul Islam, Iván Sánchez Milara |
7 | 3 |
|
8 | | -Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | | -of this software and associated documentation files (the "Software"), to deal |
10 | | -in the Software without restriction, including without limitation the rights |
11 | | -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | | -copies of the Software, and to permit persons to whom the Software is |
13 | | -furnished to do so, subject to the following conditions: |
14 | | -
|
15 | | -The above copyright notice and this permission notice shall be included in all |
16 | | -copies or substantial portions of the Software. |
17 | | -
|
18 | | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | | -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | | -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | | -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | | -SOFTWARE. |
25 | | -*/ |
| 4 | +/** |
| 5 | + * @file tkjhat/pins.h |
| 6 | + * \author Iván Sánchez Milara |
| 7 | + * @brief Macros including the pins of the HAT. |
| 8 | + * |
| 9 | + * |
| 10 | + * @version 0.83 |
| 11 | + */ |
| 12 | + |
26 | 13 |
|
27 | 14 | /* ========================= |
28 | 15 | * Board / pin macros |
29 | 16 | * ========================= */ |
30 | 17 |
|
31 | | -#define DEFAULT_I2C_SDA_PIN 12 |
32 | | -#define DEFAULT_I2C_SCL_PIN 13 |
| 18 | +/** |
| 19 | + * @defgroup board_pins Board and pin definitions |
| 20 | + * @brief Default GPIO assignments for peripherals on the JTKJ HAT. |
| 21 | + * |
| 22 | + * @details |
| 23 | + * These macros define the GPIO pin numbers for peripherals and interfaces |
| 24 | + * used by the SDK. They can be referenced directly or overridden at compile time |
| 25 | + * if custom wiring is used. |
| 26 | + * |
| 27 | + * **Default pinout:** |
| 28 | + * | Function | Macro | GPIO | Notes | |
| 29 | + * |-----------|--------|------|-------| |
| 30 | + * | I²C SDA | @ref DEFAULT_I2C_SDA_PIN | 12 | Default I²C data | |
| 31 | + * | I²C SCL | @ref DEFAULT_I2C_SCL_PIN | 13 | Default I²C clock | |
| 32 | + * | UART0 | @ref DEFAULT_UART_0 | 0 | Primary UART port | |
| 33 | + * | UART1 | @ref DEFAULT_UART_1 | 1 | Secondary UART port | |
| 34 | + * | SW1 | @ref SW1_PIN / @ref BUTTON1 | 2 | User button 1 | |
| 35 | + * | SW2 | @ref SW2_PIN / @ref BUTTON2 | 22 | User button 2 | |
| 36 | + * | Red LED | @ref RED_LED_PIN / @ref LED1 | 14 | Onboard LED | |
| 37 | + * | RGB LED R | @ref RGB_LED_R | 18 | RGB red channel | |
| 38 | + * | RGB LED G | @ref RGB_LED_G | 19 | RGB green channel | |
| 39 | + * | RGB LED B | @ref RGB_LED_B | 20 | RGB blue channel | |
| 40 | + * | Buzzer | @ref BUZZER_PIN | 17 | Active buzzer | |
| 41 | + * | PDM DATA | @ref PDM_DATA | 16 | Microphone data line | |
| 42 | + * | PDM CLK | @ref PDM_CLK | 15 | Microphone clock line | |
| 43 | + * | VEML6030 Interrupt | @ref VEML6030_INTERRUPT | 9 | Light sensor INT pin | |
| 44 | + * | HDC2021 Interrupt | @ref HDC2021_INTERRUPT | 21 | Temp/humidity INT pin | |
| 45 | + * | ICM42670 Interrupt | @ref ICM42670_INT | 6 | IMU INT1 pin | |
| 46 | + * |
| 47 | + * @note These pin numbers correspond to the Raspberry Pi Pico GPIO numbers. |
| 48 | + * @{ |
| 49 | + */ |
| 50 | + |
| 51 | +/** @name I²C Bus (default) |
| 52 | + * Pins used for the I²C bus connected to sensors and the display. |
| 53 | + * @{ |
| 54 | + */ |
| 55 | +#define DEFAULT_I2C_SDA_PIN 12 /**< I²C data pin (SDA) */ |
| 56 | +#define DEFAULT_I2C_SCL_PIN 13 /**< I²C clock pin (SCL) */ |
| 57 | +/** @} */ |
| 58 | + |
| 59 | +/** @name UART interfaces |
| 60 | + * @{ |
| 61 | + */ |
| 62 | +#define DEFAULT_UART_0 0 /**< UART0 identifier */ |
| 63 | +#define DEFAULT_UART_1 1 /**< UART1 identifier */ |
| 64 | +/** @} */ |
| 65 | + |
| 66 | +/** @name Buttons / Switches |
| 67 | + * @{ |
| 68 | + */ |
| 69 | +#define SW1_PIN 2 /**< SW1 button pin (GPIO 2) */ |
| 70 | +#define SW2_PIN 22 /**< SW2 button pin (GPIO 22) */ |
| 71 | +#define BUTTON1 SW1_PIN /**< Alias for SW1 button */ |
| 72 | +#define BUTTON2 SW2_PIN /**< Alias for SW2 button */ |
| 73 | +/** @} */ |
33 | 74 |
|
34 | | -#define DEFAULT_UART_0 0 |
35 | | -#define DEFAULT_UART_1 1 |
| 75 | +/** @name LEDs |
| 76 | + * @{ |
| 77 | + */ |
| 78 | +#define RED_LED_PIN 14 /**< Onboard red LED pin (GPIO 14) */ |
| 79 | +#define LED1 RED_LED_PIN /**< Alias for red LED */ |
| 80 | +/** @} */ |
36 | 81 |
|
37 | | -#define SW1_PIN 02 |
38 | | -#define SW2_PIN 22 |
39 | | -#define BUTTON1 SW1_PIN |
40 | | -#define BUTTON2 SW2_PIN |
| 82 | +/** @name RGB LED (common-anode) |
| 83 | + * @{ |
| 84 | + */ |
| 85 | +#define RGB_LED_R 18 /**< RGB LED red channel (GPIO 18) */ |
| 86 | +#define RGB_LED_G 19 /**< RGB LED green channel (GPIO 19) */ |
| 87 | +#define RGB_LED_B 20 /**< RGB LED blue channel (GPIO 20) */ |
| 88 | +/** @} */ |
41 | 89 |
|
42 | | -#define RED_LED_PIN 14 |
43 | | -#define LED1 RED_LED_PIN |
| 90 | +/** @name Audio |
| 91 | + * @{ |
| 92 | + */ |
| 93 | +#define BUZZER_PIN 17 /**< Buzzer control pin (GPIO 17) */ |
| 94 | +/** @} */ |
44 | 95 |
|
45 | | -#define RGB_LED_R 18 |
46 | | -#define RGB_LED_G 19 |
47 | | -#define RGB_LED_B 20 |
| 96 | +/** @name PDM Microphone |
| 97 | + * @{ |
| 98 | + */ |
| 99 | +#define PDM_DATA 16 /**< Microphone data input (GPIO 16) */ |
| 100 | +#define PDM_CLK 15 /**< Microphone clock output (GPIO 15) */ |
| 101 | +/** @} */ |
48 | 102 |
|
49 | | -#define BUZZER_PIN 17 |
| 103 | +/** @name Interrupts from Sensors |
| 104 | + * @{ |
| 105 | + */ |
| 106 | +#define VEML6030_INTERRUPT 9 /**< Ambient light sensor interrupt pin */ |
| 107 | +#define HDC2021_INTERRUPT 21 /**< Temperature & humidity sensor interrupt pin */ |
| 108 | +#define ICM42670_INT 6 /**< IMU interrupt pin */ |
| 109 | +/** @} */ |
50 | 110 |
|
51 | | -#define PDM_DATA 16 |
52 | | -#define PDM_CLK 15 |
53 | 111 |
|
54 | | -#define VEML6030_INTERRUPT 9 |
55 | | -#define HDC2021_INTERRUPT 21 |
56 | | -#define ICM42670_INT 6 |
| 112 | +/** @} */ /* end of group board_pins */ |
0 commit comments