Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
handle.hpp
Go to the documentation of this file.
1/**
2 * @file handle.hpp
3 * @brief I2C handle type for hardware abstraction
4 * @ingroup hal
5 *
6 * Canonical definition of I2cHandle - the primary way to reference
7 * I2C peripherals in SBL. Used by drivers, generated hardware configs,
8 * and user code.
9 */
10
11#ifndef SBL_HAL_I2C_HANDLE_HPP_
12#define SBL_HAL_I2C_HANDLE_HPP_
13
14#include <cstdint>
15
16namespace sbl {
17
18/**
19 * @brief I2C peripheral handle
20 *
21 * Represents an I2C configuration as resolved from hardware manifests.
22 * Includes peripheral number, pin mappings, and bus speed.
23 *
24 * Examples:
25 * - STM32H7 I2C1 on PB8/PB9: I2cHandle{1, 1, 8, 4, 1, 9, 4, 100000}
26 * - STM32H7 I2C2 on PB10/PB11: I2cHandle{2, 1, 10, 4, 1, 11, 4, 400000}
27 */
28struct I2cHandle {
29 uint32_t peripheral; ///< I2C peripheral number (e.g., 1 for I2C1)
30 uint32_t scl_port; ///< SCL GPIO port number
31 uint32_t scl_pin; ///< SCL GPIO pin number
32 uint32_t scl_af; ///< SCL alternate function (STM32)
33 uint32_t sda_port; ///< SDA GPIO port number
34 uint32_t sda_pin; ///< SDA GPIO pin number
35 uint32_t sda_af; ///< SDA alternate function (STM32)
36 uint32_t speed_hz; ///< Bus speed in Hz (100000, 400000, 1000000)
37};
38
39} // namespace sbl
40
41#endif // SBL_HAL_I2C_HANDLE_HPP_
Root namespace for all Sound Byte Libs functionality.
Definition aliases.hpp:24
I2C peripheral handle.
Definition handle.hpp:28
uint32_t sda_pin
SDA GPIO pin number.
Definition handle.hpp:34
uint32_t peripheral
I2C peripheral number (e.g., 1 for I2C1)
Definition handle.hpp:29
uint32_t sda_af
SDA alternate function (STM32)
Definition handle.hpp:35
uint32_t scl_port
SCL GPIO port number.
Definition handle.hpp:30
uint32_t speed_hz
Bus speed in Hz (100000, 400000, 1000000)
Definition handle.hpp:36
uint32_t scl_af
SCL alternate function (STM32)
Definition handle.hpp:32
uint32_t sda_port
SDA GPIO port number.
Definition handle.hpp:33
uint32_t scl_pin
SCL GPIO pin number.
Definition handle.hpp:31