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};
70inline bool addFacesUART(UnitUnified& units, UnitFacesFinger&
unit,
const uint32_t baud = 19200,
71 const uint32_t config = SERIAL_8N1)
73 const auto fp = getFacesPins();
74 if (fp.rx < 0 || fp.tx < 0) {
75 M5_LIB_LOGE(
"wiring: addFacesUART unsupported board=0x%02x",
static_cast<int>(M5.getBoard()));
78 M5_LIB_LOGI(
"wiring: addFacesUART board=0x%02x rx=%d tx=%d pwr=%d tch=%d baud=%lu",
static_cast<int>(M5.getBoard()),
79 fp.rx, fp.tx, fp.panel_power, fp.touch_power, (
unsigned long)baud);
81 auto cfg =
unit.config();
82 cfg.panel_power_pin = fp.panel_power;
83 cfg.touch_power_pin = fp.touch_power;
86 HardwareSerial& serial = m5::unit::wiring::defaultUartSerial();
88 serial.begin(baud, config, fp.rx, fp.tx);
89 return units.add(
unit, serial);
104inline bool addFacesUART(UnitUnified& units, UnitFacesFinger& unit, const uint32_t baud = 19200,
105 const m5::unit::wiring::UartConfig config = m5::unit::wiring::UartConfig::Default)
107 const auto fp = getFacesPins();
108 if (fp.rx < 0 || fp.tx < 0) {
109 M5_LIB_LOGE(
"wiring: addFacesUART unsupported board=0x%02x",
static_cast<int>(M5.getBoard()));
112 M5_LIB_LOGI(
"wiring(ESP-IDF): addFacesUART board=0x%02x rx=%d tx=%d pwr=%d tch=%d baud=%u",
113 static_cast<int>(M5.getBoard()), fp.rx, fp.tx, fp.panel_power, fp.touch_power, (
unsigned)baud);
115 auto cfg =
unit.config();
116 cfg.panel_power_pin = fp.panel_power;
117 cfg.touch_power_pin = fp.touch_power;
120 auto port = m5::unit::wiring::uartPortHandle(m5::unit::wiring::defaultUartPort(),
static_cast<gpio_num_t
>(fp.rx),
121 static_cast<gpio_num_t
>(fp.tx), baud, config);
122 if (port == UART_NUM_MAX) {
125 return units.add(
unit, port);
Top level namespace of M5Stack.
Faces Finger Module (FPC1020A via M-Bus) for M5UnitUnified.