|
|
@@ -71,14 +71,22 @@ void NbusCommunicator::_receiveFromSlave()
|
|
|
void NbusCommunicator::setLedOn()
|
|
|
{
|
|
|
#if NBUS_USE_LED
|
|
|
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
|
|
|
+ #if NBUS_LED_POLARITY_REVERSED
|
|
|
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
|
|
|
+ #else
|
|
|
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
|
|
|
+ #endif // POLARITY
|
|
|
#endif // NBUS_USE_LED
|
|
|
}
|
|
|
|
|
|
void NbusCommunicator::setLedOff()
|
|
|
{
|
|
|
#if NBUS_USE_LED
|
|
|
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
|
|
|
+ #if NBUS_LED_POLARITY_REVERSED
|
|
|
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
|
|
|
+ #else
|
|
|
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
|
|
|
+ #endif // POLARITY
|
|
|
#endif // NBUS_USE_LED
|
|
|
}
|
|
|
|
|
|
@@ -149,7 +157,6 @@ void NbusCommunicator::_receiveFromSlave()
|
|
|
_uart_nbus->readBytes(_data_packet_comm + received_size, in_bytes);
|
|
|
received_size += in_bytes;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
_packet_rx.Init();
|
|
|
@@ -167,21 +174,29 @@ void NbusCommunicator::_receiveFromSlave()
|
|
|
void NbusCommunicator::setLedOn()
|
|
|
{
|
|
|
#if NBUS_USE_LED
|
|
|
- digitalWrite(NBUS_LED_PIN, HIGH);
|
|
|
+ #if NBUS_LED_POLARITY_REVERSED
|
|
|
+ digitalWrite(NBUS_LED_PIN, LOW);
|
|
|
+ #else
|
|
|
+ digitalWrite(NBUS_LED_PIN, HIGH);
|
|
|
+ #endif // POLARITY
|
|
|
#endif // NBUS_USE_LED
|
|
|
}
|
|
|
|
|
|
void NbusCommunicator::setLedOff()
|
|
|
{
|
|
|
#if NBUS_USE_LED
|
|
|
- digitalWrite(NBUS_LED_PIN, LOW);
|
|
|
+ #if NBUS_LED_POLARITY_REVERSED
|
|
|
+ digitalWrite(NBUS_LED_PIN, HIGH);
|
|
|
+ #else
|
|
|
+ digitalWrite(NBUS_LED_PIN, LOW);
|
|
|
+ #endif // POLARITY
|
|
|
#endif // NBUS_USE_LED
|
|
|
}
|
|
|
|
|
|
void NbusCommunicator::toggleLed()
|
|
|
{
|
|
|
#if NBUS_USE_LED
|
|
|
- digitalWrite(NBUS_LED_PIN, ~digitalRead(NBUS_LED_PIN));
|
|
|
+ digitalWrite(NBUS_LED_PIN, !digitalRead(NBUS_LED_PIN));
|
|
|
#endif // NBUS_USE_LED
|
|
|
}
|
|
|
|