Skip to content

Commit d7bdb97

Browse files
committed
func(const T)
1 parent d23a241 commit d7bdb97

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/TJA1020.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ constexpr auto BAUD_DEFAULT = 19200;
1919
// constructor
2020

2121
/// Provides HW UART via TJA1020 Chip
22-
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(const int uart_nr, const uint32_t _baud, const int8_t rxPin, const int8_t txPin, const int8_t nslpPin) : Lin_Interface(uart_nr),
2323
_tx_pin(txPin),
2424
_nslp_pin(nslpPin)
2525
{
@@ -33,21 +33,21 @@ Lin_TJA1020::Lin_TJA1020(int uart_nr, uint32_t _baud, int8_t rxPin, int8_t txPin
3333
// write / read on bus
3434

3535
/// Requests a Lin 2.0 Frame
36-
bool Lin_TJA1020::readFrame(uint8_t FrameID)
36+
bool Lin_TJA1020::readFrame(const uint8_t FrameID)
3737
{
3838
setMode(_writingSlope);
3939
return Lin_Interface::readFrame(FrameID);
4040
}
4141

4242
/// Sends a Lin 2.0 Frame
43-
void Lin_TJA1020::writeFrame(uint8_t FrameID, size_t size)
43+
void Lin_TJA1020::writeFrame(const uint8_t FrameID, const size_t size)
4444
{
4545
setMode(_writingSlope);
4646
return Lin_Interface::writeFrame(FrameID, size);
4747
}
4848

4949
/// Sends a Lin 1.3 Frame (Legacy Checksum)
50-
void Lin_TJA1020::writeFrameClassic(uint8_t FrameID, size_t size)
50+
void Lin_TJA1020::writeFrameClassic(const uint8_t FrameID, const size_t size)
5151
{
5252
setMode(_writingSlope);
5353
Lin_Interface::writeFrameClassic(FrameID, size);
@@ -57,7 +57,7 @@ void Lin_TJA1020::writeFrameClassic(uint8_t FrameID, size_t size)
5757
/// NormalSlope, LowSlope for writing operation;
5858
/// Sleep will release INH and may disables Power-Supply
5959
/// @param mode TJA1020 Mode to be the next
60-
void Lin_TJA1020::setMode(TJA1020_Mode mode)
60+
void Lin_TJA1020::setMode(const TJA1020_Mode mode)
6161
{
6262
// we don't need to act, if we're allready there
6363
// see "setMode(sleep)" in the switch below
@@ -149,9 +149,10 @@ void Lin_TJA1020::setMode(TJA1020_Mode mode)
149149
} // void Lin_TJA1020::setMode(TJA1020_Mode newMode)
150150

151151
/// Defines standard slope, to be used, when writing to the bus
152-
void Lin_TJA1020::setSlope(TJA1020_Mode slope) {
152+
void Lin_TJA1020::setSlope(const TJA1020_Mode slope) {
153153
_writingSlope = slope;
154-
if (_writingSlope == Sleep) {
154+
if (_writingSlope == Sleep)
155+
{
155156
_writingSlope = NormalSlope;
156157
}
157158
}

src/TJA1020.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ class Lin_TJA1020 : public Lin_Interface
2525
/// @param uart_nr Index of HW UART to be used (0..2)
2626
/// @param baud Baud rate for RX/TX (0 = default 19200 baud)
2727
/// @param nslpPin /SLP Pin to control TJA1020
28-
Lin_TJA1020(int uart_nr, uint32_t _baud, int8_t rxPin, int8_t txPin, int8_t nslpPin);
28+
Lin_TJA1020(const int uart_nr, const uint32_t _baud, const int8_t rxPin, const int8_t txPin, const int8_t nslpPin);
2929

30-
bool readFrame(uint8_t FrameID);
31-
void writeFrame(uint8_t FrameID, size_t size);
32-
void writeFrameClassic(uint8_t FrameID, size_t size);
30+
bool readFrame(const uint8_t FrameID);
31+
void writeFrame(const uint8_t FrameID, const size_t size);
32+
void writeFrameClassic(const uint8_t FrameID, const size_t size);
3333

3434
/// switches the operational mode of TJA1020 chip
3535
/// @param mode target mode
36-
void setMode(TJA1020_Mode mode);
36+
void setMode(const TJA1020_Mode mode);
3737
/// Defines standard slope rate, when using to the bus
3838
/// @param slope "NormalSlope" or "LowSlope" is only valid
39-
void setSlope(TJA1020_Mode slope);
39+
void setSlope(const TJA1020_Mode slope);
4040

4141
private:
4242
TJA1020_Mode _writingSlope = NormalSlope;

0 commit comments

Comments
 (0)