AlexGyver / GyverCore

Быстрое ядро для Arduino IDE
https://alexgyver.ru/gyvercore/
GNU Lesser General Public License v3.0
127 stars 13 forks source link

Ускорение digitalToggle #15

Closed DimaVE239 closed 4 years ago

DimaVE239 commented 4 years ago

Эту функцию можно ускорить. Из ДШ:

Toggling the pin Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port.

Короче говоря -> запись в PINx (на ATmega48/88/168/328) инвертирует состояние на выходе.

bitToggle(PORTx, pin); меняем на... bitSet(PINx, pin);

AlexGyver commented 4 years ago

Спасибо, в грядущем обновлении переделаем)