Skip to content

Commit 8214dcf

Browse files
committed
Merge branch 'develop'
2 parents 9d213f2 + ddf0ce6 commit 8214dcf

2 files changed

Lines changed: 5 additions & 46 deletions

File tree

src/m5_unit_component/adapter.cpp

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
/*!
77
@file adapter.cpp
88
@brief Adapters to treat M5HAL and TwoWire in the same way
9-
@note Currently handles TwoWire directly, but will handle via M5HAL in the
10-
future
9+
@note Currently handles TwoWire directly, but will handle via M5HAL in the future
1110
*/
1211
#include "adapter.hpp"
1312
#include <cassert>
@@ -56,10 +55,10 @@ class WireImpl : public Adapter::Impl {
5655
public:
5756
WireImpl(TwoWire& wire, const uint8_t addr) : Adapter::Impl(addr), _wire(&wire)
5857
{
59-
uint32_t w = (&wire == &Wire1);
58+
uint32_t w = (&wire != &Wire);
6059
_sda = search_pin_number(idx_table[w][0]);
6160
_scl = search_pin_number(idx_table[w][1]);
62-
M5_LIB_LOGI("I2C SDA: %d, SCL: %d", _sda, _scl);
61+
M5_LIB_LOGI("I2C SDA:%d, SCL:%d", _sda, _scl);
6362
}
6463

6564
virtual int16_t scl() const override
@@ -96,8 +95,6 @@ class WireImpl : public Adapter::Impl {
9695
virtual m5::hal::error::error_t readWithTransaction(uint8_t* data, const size_t len) override
9796
{
9897
assert(_addr);
99-
//_wire->setClock(_clock); DON'T CALL
100-
10198
if (data && _wire->requestFrom(_addr, len)) {
10299
auto count = std::min(len, (size_t)_wire->available());
103100
for (size_t i = 0; i < count; ++i) {
@@ -170,7 +167,7 @@ class WireImpl : public Adapter::Impl {
170167
m5::hal::error::error_t write_with_transaction(const uint8_t addr, const uint8_t* data, const size_t len,
171168
const bool stop)
172169
{
173-
_wire->setClock(_clock); //
170+
_wire->setClock(_clock);
174171
_wire->beginTransmission(addr);
175172
if (data) {
176173
_wire->write(data, len);
@@ -420,40 +417,3 @@ bool Adapter::popPin()
420417

421418
} // namespace unit
422419
} // namespace m5
423-
424-
#if 0
425-
//CoreS3SE
426-
18:02:03.752 > [ 3554][W][pin.cpp:65] restore(): restore pin:1
427-
18:02:03.758 > [ 3554][W][pin.cpp:67] restore(): restore IO_MUX_GPIO0_REG :00001a00 -> 00001b00
428-
18:02:03.766 > [ 3560][W][pin.cpp:69] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
429-
18:02:03.774 > [ 3568][W][pin.cpp:71] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000100 -> 00000059
430-
18:02:03.780 > [ 3576][W][pin.cpp:85] restore(): restore GPIO_ENABLE_REG:00001818
431-
18:02:03.784 > [ 3582][W][pin.cpp:65] restore(): restore pin:2
432-
18:02:03.792 > [ 3586][W][pin.cpp:67] restore(): restore IO_MUX_GPIO0_REG :00001a00 -> 00001b00
433-
18:02:03.800 > [ 3594][W][pin.cpp:69] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
434-
18:02:03.809 > [ 3602][W][pin.cpp:71] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000100 -> 0000005a
435-
18:02:03.815 > [ 3611][W][pin.cpp:85] restore(): restore GPIO_ENABLE_REG:0000181a
436-
18:02:03.822 > [ 3616][W][unit_MLX90614.cpp:311] start_periodic_measurement(): IIR:4 FIR:7 IT:140
437-
//NanoC6
438-
18:03:55.995 > [ 2432][W][pin.cpp:65] restore(): restore pin:1
439-
18:03:56.001 > [ 2432][W][pin.cpp:66] restore(): restore IO_MUX_GPIO0_REG :00001a02 -> 00001b02
440-
18:03:56.009 > [ 2439][W][pin.cpp:68] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
441-
18:03:56.017 > [ 2447][W][pin.cpp:70] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000080 -> 0000002d
442-
18:03:56.023 > [ 2455][W][pin.cpp:85] restore(): restore GPIO_ENABLE_REG:00000000
443-
18:03:56.027 > [ 2461][W][pin.cpp:65] restore(): restore pin:2
444-
18:03:56.035 > [ 2465][W][pin.cpp:66] restore(): restore IO_MUX_GPIO0_REG :00001a02 -> 00001b02
445-
18:03:56.044 > [ 2473][W][pin.cpp:68] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
446-
18:03:56.051 > [ 2481][W][pin.cpp:70] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000080 -> 0000002e
447-
18:03:56.058 > [ 2489][W][pin.cpp:85] restore(): restore GPIO_ENABLE_REG:00000002
448-
//Core
449-
18:24:54.954 > [ 2690][W][pin.cpp:64] restore(): restore pin:22
450-
18:24:54.959 > [ 2690][W][pin.cpp:66] restore(): restore IO_MUX_GPIO0_REG :00002a08 -> 00002b08
451-
18:24:54.970 > [ 2697][W][pin.cpp:68] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
452-
18:24:54.975 > [ 2705][W][pin.cpp:70] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000100 -> 0000001d
453-
18:24:54.987 > [ 2713][W][pin.cpp:84] restore(): restore GPIO_ENABLE_REG:0a84cf90
454-
18:24:54.992 > [ 2719][W][pin.cpp:64] restore(): restore pin:21
455-
18:24:54.998 > [ 2723][W][pin.cpp:66] restore(): restore IO_MUX_GPIO0_REG :00002a08 -> 00002b08
456-
18:24:55.003 > [ 2731][W][pin.cpp:68] restore(): restore GPIO_PIN0_REG :00000000 -> 00000004
457-
18:24:55.009 > [ 2739][W][pin.cpp:70] restore(): restore GPIO_FUNC0_OUT_SEL_CFG_REG:00000100 -> 0000001e
458-
18:24:55.020 > [ 2747][W][pin.cpp:84] restore(): restore GPIO_ENABLE_REG:0ac4cf90
459-
#endif

src/m5_unit_component/adapter.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
/*!
77
@file adapter.hpp
88
@brief Adapters to treat M5HAL and TwoWire in the same way
9-
@note Currently handles TwoWire directly, but will handle via M5HAL in the
10-
future
9+
@note Currently handles TwoWire directly, but will handle via M5HAL in the future
1110
*/
1211
#ifndef M5_UNIT_COMPONENT_ADAPTER_HPP
1312
#define M5_UNIT_COMPONENT_ADAPTER_HPP

0 commit comments

Comments
 (0)