Проверка в analogWrite(), добавление экземпляров для Wire, SPI, Serial

В функции analogWrite() добавлена проверка, включен ли уже канал - если включен, применяется новое значение только если оно отличается от текущего.
В модулях Wire, SPI, Serial теперь по два экземпляра в соответствии с периферией МК. Для каждой платы задается свой экземпляр, используемый по умолчанию
Co-authored-by: KLASSENTS <klassen@elron.tech>
Co-committed-by: KLASSENTS <klassen@elron.tech>
This commit was merged in pull request #21.
This commit is contained in:
klassents authored and klassents committed 2025-05-27 12:35:36 +03:00
1 parent f1e091bf77
commit 778608b576
29 files changed
+186 -130

No files matched your search

+7 -5
View File
@@ -287,15 +287,17 @@ void TwoWire::onRequest( void (*function)(void) )
extern "C" void __attribute__((optimize("O3"))) wire_interrupt_handler(uint8_t num)
{
if (num == 1)
twi_interruptHandler(Wire.getHandler());
twi_interruptHandler(Wire1.getHandler());
#if I2C_COMMON_QTY>1
else if (num == 0)
twi_interruptHandler(Wire1.getHandler());
twi_interruptHandler(Wire0.getHandler());
#endif
}
// ----------------------------- Preinstantiate Objects ----------------------------- //
TwoWire Wire = TwoWire(1);
#if I2C_COMMON_QTY>1
TwoWire Wire1 = TwoWire(0);
TwoWire Wire1 = TwoWire(1); // I2C1 is always available
#if I2C_COMMON_QTY > 1
TwoWire Wire0 = TwoWire(0); // I2C0 is available on some boards
#endif
// default interface
TwoWire& Wire = DEFAULT_WIRE;
+4 -2
View File
@@ -90,9 +90,11 @@ class TwoWire : public Stream
void onRequest( void (*)(void) );
};
extern TwoWire Wire;
#if I2C_COMMON_QTY>1
extern TwoWire Wire1;
#if I2C_COMMON_QTY>1
extern TwoWire Wire0;
#endif
// default interface
extern TwoWire& Wire;
#endif