Skip to content

Commit d23a241

Browse files
committed
c++17, code style
1 parent 40c8ef5 commit d23a241

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/TJA1020.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
#include <Lin_Interface.hpp>
1414
// #include <Arduino.h>
1515

16+
constexpr auto BAUD_DEFAULT = 19200;
17+
1618
//-----------------------------------------------------------------------------
1719
// constructor
1820

1921
/// Provides HW UART via TJA1020 Chip
20-
Lin_TJA1020::Lin_TJA1020(int uart_nr, uint32_t _baud, int8_t rxPin, int8_t txPin, int8_t nslpPin) : Lin_Interface(uart_nr)
22+
Lin_TJA1020::Lin_TJA1020(int uart_nr, uint32_t _baud, int8_t rxPin, int8_t txPin, int8_t nslpPin) : Lin_Interface(uart_nr),
23+
_tx_pin(txPin),
24+
_nslp_pin(nslpPin)
2125
{
22-
_tx_pin = txPin;
23-
2426
// use default baud rate, if not specified
25-
Lin_Interface::baud = _baud ? _baud : 19200;
27+
Lin_Interface::baud = _baud ? _baud : BAUD_DEFAULT;
2628
Lin_Interface::rxPin = rxPin;
2729
Lin_Interface::txPin = txPin;
28-
29-
_nslp_pin = nslpPin;
3030
}
3131

3232
//-----------------------------------------------------------------------------

src/TJA1020.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
class Lin_TJA1020 : public Lin_Interface
1616
{
1717
public:
18-
enum TJA1020_Mode { Sleep, NormalSlope, LowSlope };
18+
enum TJA1020_Mode {
19+
Sleep,
20+
NormalSlope,
21+
LowSlope
22+
};
1923

2024
/// provides HW-Lin Interface via TJA1020 Chip
2125
/// @param uart_nr Index of HW UART to be used (0..2)

0 commit comments

Comments
 (0)