Skip to content

Commit 26801ad

Browse files
committed
Output all bus-type API variants in Doxygen and complete native comments
1 parent 58ec848 commit 26801ad

2 files changed

Lines changed: 44 additions & 20 deletions

File tree

src/M5UnitComponent.hpp

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <type_traits>
2929
#include <memory>
3030

31-
#if defined(ARDUINO)
31+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
3232
class TwoWire;
3333
class HardwareSerial;
3434
class SPIClass;
@@ -298,19 +298,30 @@ class Component {
298298

299299
///@name Assign(I2C)
300300
///@{
301-
#if defined(ARDUINO)
301+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
302302
/*!
303303
@brief Assign TwoWire as the communication bus
304304
@param wire TwoWire to be used
305305
@return True if successful
306306
*/
307307
virtual bool assign(TwoWire& wire);
308308
#endif
309-
#if defined(ESP_PLATFORM) && __has_include(<driver/i2c_master.h>)
310-
/*! @brief Assign I2C master bus (ESP-IDF native driver) */
309+
#if defined(DOXYGEN_PROCESS) || (defined(ESP_PLATFORM) && __has_include(<driver/i2c_master.h>))
310+
/*!
311+
@brief Assign I2C master bus (ESP-IDF native driver)
312+
@param bus ESP-IDF I2C master bus handle
313+
@return True if successful
314+
*/
311315
virtual bool assign(i2c_master_bus_handle_t bus);
312-
#elif defined(ESP_PLATFORM)
313-
/*! @brief Assign I2C (ESP-IDF legacy driver, pre-installed port) */
316+
#endif
317+
#if defined(DOXYGEN_PROCESS) || (defined(ESP_PLATFORM) && !__has_include(<driver/i2c_master.h>))
318+
/*!
319+
@brief Assign I2C (ESP-IDF legacy driver, pre-installed port)
320+
@param port I2C port (the driver must be installed beforehand via i2c_param_config / i2c_driver_install)
321+
@param sda SDA GPIO
322+
@param scl SCL GPIO
323+
@return True if successful
324+
*/
314325
virtual bool assign(const i2c_port_t port, const gpio_num_t sda, const gpio_num_t scl);
315326
#endif
316327
/*!
@@ -334,32 +345,44 @@ class Component {
334345

335346
///@name Assign(UART)
336347
///@{
337-
#if defined(ARDUINO)
348+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
338349
/*!
339350
@brief Assign HardwareSerial as the communication bus
340351
@param serial HardwareSerial to be used
341352
@return True if successful
342353
*/
343354
virtual bool assign(HardwareSerial& serial);
344355
#endif
345-
#if defined(ESP_PLATFORM)
346-
/*! @brief Assign UART (ESP-IDF native driver, pre-installed port) */
356+
#if defined(ESP_PLATFORM) || defined(DOXYGEN_PROCESS)
357+
/*!
358+
@brief Assign UART (ESP-IDF native driver, pre-installed port)
359+
@param uart_num UART port number (the driver must be installed beforehand via
360+
uart_driver_install / uart_param_config / uart_set_pin)
361+
@return True if successful
362+
*/
347363
virtual bool assign(const uart_port_t uart_num);
348-
//! @brief Assign SPI device handle (ESP-IDF native, borrowed; cs controlled manually)
349-
virtual bool assign(spi_device_handle_t handle, const gpio_num_t cs);
350364
#endif
351365
///@}
352366

353367
///@name Assign(SPI)
354368
///@{
355-
#if defined(ARDUINO)
369+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
356370
/*!
357371
@brief Assign SPIClass as the communication bus
358372
@param spi SPIClass to be used
359373
@param settings SPI settings to be applied
360374
@return True if successful
361375
*/
362376
virtual bool assign(SPIClass& spi, const SPISettings& settings);
377+
#endif
378+
#if defined(ESP_PLATFORM) || defined(DOXYGEN_PROCESS)
379+
/*!
380+
@brief Assign SPI device handle (ESP-IDF native driver, borrowed)
381+
@param handle ESP-IDF SPI device handle (create with spics_io_num = -1; init bus with SPI_DMA_DISABLED)
382+
@param cs CS GPIO controlled manually by this library
383+
@return True if successful
384+
*/
385+
virtual bool assign(spi_device_handle_t handle, const gpio_num_t cs);
363386
#endif
364387
///@}
365388

src/M5UnitUnified.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <vector>
2626
#include <string>
2727

28-
#if defined(ARDUINO)
28+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
2929
class TwoWire;
3030
class HardwareSerial;
3131
class SPIClass;
@@ -71,7 +71,7 @@ class UnitUnified {
7171

7272
///@name Add unit(I2C)
7373
///@{
74-
#if defined(ARDUINO)
74+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
7575
/*!
7676
@brief Add unit to be managed (I2C via TwoWire)
7777
@param u Unit Component
@@ -80,15 +80,16 @@ class UnitUnified {
8080
*/
8181
bool add(Component& u, TwoWire& wire);
8282
#endif
83-
#if defined(ESP_PLATFORM) && __has_include(<driver/i2c_master.h>)
83+
#if defined(DOXYGEN_PROCESS) || (defined(ESP_PLATFORM) && __has_include(<driver/i2c_master.h>))
8484
/*!
8585
@brief Adding unit to be managed (I2C, ESP-IDF native driver)
8686
@param u Unit Component
8787
@param bus ESP-IDF I2C master bus handle
8888
@return True if successful
8989
*/
9090
bool add(Component& u, i2c_master_bus_handle_t bus);
91-
#elif defined(ESP_PLATFORM)
91+
#endif
92+
#if defined(DOXYGEN_PROCESS) || (defined(ESP_PLATFORM) && !__has_include(<driver/i2c_master.h>))
9293
/*!
9394
@brief Adding unit to be managed (I2C, ESP-IDF legacy driver)
9495
@param u Unit Component
@@ -122,7 +123,7 @@ class UnitUnified {
122123

123124
///@name Add unit(UART)
124125
///@{
125-
#if defined(ARDUINO)
126+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
126127
/*!
127128
@brief Add unit to be managed (UART)
128129
@param u Unit Component
@@ -131,7 +132,7 @@ class UnitUnified {
131132
*/
132133
bool add(Component& u, HardwareSerial& serial);
133134
#endif
134-
#if defined(ESP_PLATFORM)
135+
#if defined(ESP_PLATFORM) || defined(DOXYGEN_PROCESS)
135136
/*!
136137
@brief Adding unit to be managed (UART, ESP-IDF native driver)
137138
@param u Unit Component
@@ -145,7 +146,7 @@ class UnitUnified {
145146

146147
///@name Add unit(SPI)
147148
///@{
148-
#if defined(ARDUINO)
149+
#if defined(ARDUINO) || defined(DOXYGEN_PROCESS)
149150
/*!
150151
@brief Add unit to be managed (SPI)
151152
@param u Unit Component
@@ -155,7 +156,7 @@ class UnitUnified {
155156
*/
156157
bool add(Component& u, SPIClass& spi, const SPISettings& settings);
157158
#endif
158-
#if defined(ESP_PLATFORM)
159+
#if defined(ESP_PLATFORM) || defined(DOXYGEN_PROCESS)
159160
/*!
160161
@brief Adding unit to be managed (SPI, ESP-IDF native driver)
161162
@param u Unit Component

0 commit comments

Comments
 (0)