15#ifndef M5_UNIT_FINGER_WIRING_HPP
16#define M5_UNIT_FINGER_WIRING_HPP
19#include <M5UnitUnified.hpp>
20#include <wiring/m5_unit_unified_wiring.hpp>
23#include <HardwareSerial.h>
32#if defined(__M5UNIFIED_HPP__)
48inline FacesPins getFacesPins()
50 switch (M5.getBoard()) {
51 case m5::board_t::board_M5Stack:
52 return {16, 17, 26, 5};
54 return {-1, -1, -1, -1};
71inline bool addFacesUART(UnitUnified& units, UnitFacesFinger&
unit,
const uint32_t baud = 19200,
72 const uint32_t config = SERIAL_8N1)
74 const auto fp = getFacesPins();
75 if (fp.rx < 0 || fp.tx < 0) {
76 M5_LIB_LOGE(
"wiring: addFacesUART unsupported board=0x%02x",
static_cast<int>(M5.getBoard()));
79 M5_LIB_LOGI(
"wiring: addFacesUART board=0x%02x rx=%d tx=%d pwr=%d tch=%d baud=%lu",
static_cast<int>(M5.getBoard()),
80 fp.rx, fp.tx, fp.panel_power, fp.touch_power, (
unsigned long)baud);
82 auto cfg =
unit.config();
83 cfg.panel_power_pin = fp.panel_power;
84 cfg.touch_power_pin = fp.touch_power;
87 HardwareSerial& serial = m5::unit::wiring::defaultUartSerial();
89 serial.begin(baud, config, fp.rx, fp.tx);
90 return units.add(
unit, serial);
106inline bool addFacesUART(UnitUnified& units, UnitFacesFinger& unit, const uint32_t baud = 19200,
107 const m5::unit::wiring::UartConfig config = m5::unit::wiring::UartConfig::Default)
109 const auto fp = getFacesPins();
110 if (fp.rx < 0 || fp.tx < 0) {
111 M5_LIB_LOGE(
"wiring: addFacesUART unsupported board=0x%02x",
static_cast<int>(M5.getBoard()));
114 M5_LIB_LOGI(
"wiring(ESP-IDF): addFacesUART board=0x%02x rx=%d tx=%d pwr=%d tch=%d baud=%u",
115 static_cast<int>(M5.getBoard()), fp.rx, fp.tx, fp.panel_power, fp.touch_power, (
unsigned)baud);
117 auto cfg =
unit.config();
118 cfg.panel_power_pin = fp.panel_power;
119 cfg.touch_power_pin = fp.touch_power;
122 auto port = m5::unit::wiring::uartPortHandle(m5::unit::wiring::defaultUartPort(),
static_cast<gpio_num_t
>(fp.rx),
123 static_cast<gpio_num_t
>(fp.tx), baud, config);
124 if (port == UART_NUM_MAX) {
127 return units.add(
unit, port);
Top level namespace of M5Stack.
Faces Finger Module (FPC1020A via M-Bus) for M5UnitUnified.