Skip to content

Commit c3c38c9

Browse files
committed
Rename LCD class function parameters
Try to follow the Circle coding style more closely with regards to function parameter names.
1 parent 061ecec commit c3c38c9

File tree

9 files changed

+119
-119
lines changed

9 files changed

+119
-119
lines changed

include/lcd/clcd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CCharacterLCD
2929
virtual ~CCharacterLCD() = default;
3030

3131
virtual bool Initialize() = 0;
32-
virtual void Print(const char* pText, u8 pCursorX = 0, u8 pCursorY = 0, bool pClearLine = false, bool pImmediate = true) = 0;
32+
virtual void Print(const char* pText, u8 nCursorX = 0, u8 nCursorY = 0, bool bClearLine = false, bool bImmediate = true) = 0;
3333
virtual void Clear() = 0;
3434
};
3535

include/lcd/hd44780.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
class CHD44780Base : public CMT32LCD
3333
{
3434
public:
35-
CHD44780Base(u8 pColumns = 20, u8 pRows = 2);
35+
CHD44780Base(u8 nColumns = 20, u8 nRows = 2);
3636
virtual ~CHD44780Base() = default;
3737

3838
// CCharacterLCD
3939
virtual bool Initialize() override;
40-
virtual void Print(const char* pText, u8 pCursorX, u8 pCursorY, bool pClearLine = false, bool pImmediate = true) override;
40+
virtual void Print(const char* pText, u8 nCursorX, u8 nCursorY, bool bClearLine = false, bool bImmediate = true) override;
4141
virtual void Clear() override;
4242

4343
// CMT32LCD
44-
virtual void Update(const CMT32SynthBase& pSynth) override;
44+
virtual void Update(const CMT32SynthBase& Synth) override;
4545

4646
protected:
4747
enum class WriteMode
@@ -50,17 +50,17 @@ class CHD44780Base : public CMT32LCD
5050
Command
5151
};
5252

53-
virtual void WriteNybble(u8 pNybble, WriteMode pMode) = 0;
54-
void WriteByte(u8 pByte, WriteMode pMode);
53+
virtual void WriteNybble(u8 nNybble, WriteMode Mode) = 0;
54+
void WriteByte(u8 nByte, WriteMode Mode);
5555

56-
void WriteCommand(u8 pByte);
57-
void WriteData(u8 pByte);
58-
void WriteData(const u8* pBytes, size_t pSize);
56+
void WriteCommand(u8 nByte);
57+
void WriteData(u8 nByte);
58+
void WriteData(const u8* pBytes, size_t nSize);
5959

60-
void SetCustomChar(u8 pIndex, const u8 pCharData[8]);
60+
void SetCustomChar(u8 nIndex, const u8 nCharData[8]);
6161

62-
void DrawPartLevelsSingle(u8 pRow);
63-
void DrawPartLevelsDouble(u8 pFirstRow);
62+
void DrawPartLevelsSingle(u8 nRow);
63+
void DrawPartLevelsDouble(u8 nFirstRow);
6464

6565
CScheduler* mScheduler;
6666
u8 mRows;
@@ -73,10 +73,10 @@ class CHD44780Base : public CMT32LCD
7373
class CHD44780FourBit : public CHD44780Base
7474
{
7575
public:
76-
CHD44780FourBit(u8 pColumns = 20, u8 pRows = 2);
76+
CHD44780FourBit(u8 nColumns = 20, u8 nRows = 2);
7777

7878
protected:
79-
virtual void WriteNybble(u8 pNybble, WriteMode pMode) override;
79+
virtual void WriteNybble(u8 nNybble, WriteMode Mode) override;
8080

8181
static constexpr u8 GPIO_PIN_RS = 10;
8282
static constexpr u8 GPIO_PIN_RW = 9;
@@ -98,10 +98,10 @@ class CHD44780FourBit : public CHD44780Base
9898
class CHD44780I2C : public CHD44780Base
9999
{
100100
public:
101-
CHD44780I2C(CI2CMaster* pI2CMaster, u8 pAddress = 0x27, u8 pColumns = 20, u8 pRows = 2);
101+
CHD44780I2C(CI2CMaster* pI2CMaster, u8 nAddress = 0x27, u8 nColumns = 20, u8 nRows = 2);
102102

103103
protected:
104-
virtual void WriteNybble(u8 pNybble, WriteMode pMode) override;
104+
virtual void WriteNybble(u8 nNybble, WriteMode Mode) override;
105105

106106
CI2CMaster* mI2CMaster;
107107
u8 mAddress;

include/lcd/mt32lcd.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ class CMT32LCD : public CCharacterLCD
4242
void OnLCDMessage(const char* pMessage);
4343
void OnProgramChanged(u8 nPartNum, const char* pSoundGroupName, const char* pPatchName);
4444

45-
virtual void Update(const CMT32SynthBase& pSynth) = 0;
45+
virtual void Update(const CMT32SynthBase& Synth) = 0;
4646

4747
protected:
48-
void UpdatePartStateText(const CMT32SynthBase& pSynth);
49-
void UpdatePartLevels(const CMT32SynthBase& pSynth);
48+
void UpdatePartStateText(const CMT32SynthBase& Synth);
49+
void UpdatePartLevels(const CMT32SynthBase& Synth);
5050
void UpdatePeakLevels();
5151

5252
// 20 characters plus null terminator

include/lcd/ssd1306.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@
3030
class CSSD1306 : public CMT32LCD
3131
{
3232
public:
33-
CSSD1306(CI2CMaster* pI2CMaster, u8 pAddress = 0x3c, u8 pHeight = 32);
33+
CSSD1306(CI2CMaster* pI2CMaster, u8 nAddress = 0x3c, u8 nHeight = 32);
3434

3535
// CCharacterLCD
3636
virtual bool Initialize() override;
37-
virtual void Print(const char* pText, u8 pCursorX, u8 pCursorY, bool pClearLine = false, bool pImmediate = false) override;
37+
virtual void Print(const char* pText, u8 nCursorX, u8 nCursorY, bool bClearLine = false, bool bImmediate = false) override;
3838
virtual void Clear() override;
3939

4040
// CMT32LCD
41-
virtual void Update(const CMT32SynthBase& pSynth) override;
41+
virtual void Update(const CMT32SynthBase& Synth) override;
4242

4343
private:
4444
void WriteFramebuffer() const;
45-
void SetPixel(u8 pX, u8 pY);
46-
void ClearPixel(u8 pX, u8 pY);
47-
void DrawChar(char pChar, u8 pCursorX, u8 pCursorY, bool pInverted = false, bool pDoubleWidth = false);
45+
void SetPixel(u8 nX, u8 nY);
46+
void ClearPixel(u8 nX, u8 nY);
47+
void DrawChar(char chChar, u8 nCursorX, u8 nCursorY, bool bInverted = false, bool bDoubleWidth = false);
4848

49-
void DrawPartLevels(bool pDrawPeaks = true);
49+
void DrawPartLevels(bool bDrawPeaks = true);
5050

5151
CI2CMaster* mI2CMaster;
5252
u8 mAddress;

src/lcd/hd44780.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -104,45 +104,45 @@ const u8 CHD44780Base::CustomCharData[7][8] =
104104
// Use ASCII space for empty bar, custom chars for 1-7 rows, 0xFF for full bar
105105
const char CHD44780Base::BarChars[] = { ' ', '\x1', '\x2', '\x3', '\x4', '\x5', '\x6', '\x7', '\xff' };
106106

107-
CHD44780Base::CHD44780Base(u8 pColumns, u8 pRows)
107+
CHD44780Base::CHD44780Base(u8 nColumns, u8 nRows)
108108
: CMT32LCD(),
109109
mScheduler(CScheduler::Get()),
110-
mRows(pRows),
111-
mColumns(pColumns)
110+
mRows(nRows),
111+
mColumns(nColumns)
112112
{
113113
}
114114

115-
void CHD44780Base::WriteByte(u8 pByte, WriteMode pMode)
115+
void CHD44780Base::WriteByte(u8 nByte, WriteMode Mode)
116116
{
117-
WriteNybble(pByte >> 4, pMode);
118-
WriteNybble(pByte, pMode);
117+
WriteNybble(nByte >> 4, Mode);
118+
WriteNybble(nByte, Mode);
119119
}
120120

121-
void CHD44780Base::WriteCommand(u8 pByte)
121+
void CHD44780Base::WriteCommand(u8 nByte)
122122
{
123123
// RS = LOW for command mode
124-
WriteByte(pByte, WriteMode::Command);
124+
WriteByte(nByte, WriteMode::Command);
125125
}
126126

127-
void CHD44780Base::WriteData(u8 pByte)
127+
void CHD44780Base::WriteData(u8 nByte)
128128
{
129129
// RS = HIGH for data mode
130-
WriteByte(pByte, WriteMode::Data);
130+
WriteByte(nByte, WriteMode::Data);
131131
}
132132

133-
void CHD44780Base::WriteData(const u8* pBytes, size_t pSize)
133+
void CHD44780Base::WriteData(const u8* pBytes, size_t nSize)
134134
{
135-
for (size_t i = 0; i < pSize; ++i)
135+
for (size_t i = 0; i < nSize; ++i)
136136
WriteData(pBytes[i]);
137137
}
138138

139-
void CHD44780Base::SetCustomChar(u8 pIndex, const u8 pCharData[8])
139+
void CHD44780Base::SetCustomChar(u8 nIndex, const u8 nCharData[8])
140140
{
141-
assert(pIndex < 8);
142-
WriteCommand(0x40 | (pIndex << 3));
141+
assert(nIndex < 8);
142+
WriteCommand(0x40 | (nIndex << 3));
143143

144144
for (u8 i = 0; i < 8; ++i)
145-
WriteData(pCharData[i]);
145+
WriteData(nCharData[i]);
146146
}
147147

148148
bool CHD44780Base::Initialize()
@@ -196,18 +196,18 @@ bool CHD44780Base::Initialize()
196196
return true;
197197
}
198198

199-
void CHD44780Base::Print(const char* pText, u8 pCursorX, u8 pCursorY, bool pClearLine, bool pImmediate)
199+
void CHD44780Base::Print(const char* pText, u8 nCursorX, u8 nCursorY, bool bClearLine, bool bImmediate)
200200
{
201201
static u8 rowOffset[] = { 0, u8(0x40), mColumns, u8(0x40 + mColumns) };
202-
WriteCommand(0x80 | rowOffset[pCursorY] + pCursorX);
202+
WriteCommand(0x80 | rowOffset[nCursorY] + nCursorX);
203203

204204
const char* p = pText;
205205
while (*p)
206206
WriteData(*p++);
207207

208-
if (pClearLine)
208+
if (bClearLine)
209209
{
210-
while ((p++ - pText) < (mColumns - pCursorX))
210+
while ((p++ - pText) < (mColumns - nCursorX))
211211
WriteData(' ');
212212
}
213213
}
@@ -218,7 +218,7 @@ void CHD44780Base::Clear()
218218
mScheduler->MsSleep(50);
219219
}
220220

221-
void CHD44780Base::DrawPartLevelsSingle(u8 pRow)
221+
void CHD44780Base::DrawPartLevelsSingle(u8 nRow)
222222
{
223223
char lineBuf[18 + 1];
224224

@@ -230,10 +230,10 @@ void CHD44780Base::DrawPartLevelsSingle(u8 pRow)
230230

231231
lineBuf[18] = '\0';
232232

233-
Print(lineBuf, 0, pRow, true);
233+
Print(lineBuf, 0, nRow, true);
234234
}
235235

236-
void CHD44780Base::DrawPartLevelsDouble(u8 pFirstRow)
236+
void CHD44780Base::DrawPartLevelsDouble(u8 nFirstRow)
237237
{
238238
char line1Buf[18 + 1];
239239
char line2Buf[18 + 1];
@@ -256,15 +256,15 @@ void CHD44780Base::DrawPartLevelsDouble(u8 pFirstRow)
256256

257257
line1Buf[18] = line2Buf[18] = '\0';
258258

259-
Print(line1Buf, 0, pFirstRow, true);
260-
Print(line2Buf, 0, pFirstRow + 1, true);
259+
Print(line1Buf, 0, nFirstRow, true);
260+
Print(line2Buf, 0, nFirstRow + 1, true);
261261
}
262262

263-
void CHD44780Base::Update(const CMT32SynthBase& pSynth)
263+
void CHD44780Base::Update(const CMT32SynthBase& Synth)
264264
{
265-
CMT32LCD::Update(pSynth);
265+
CMT32LCD::Update(Synth);
266266

267-
UpdatePartLevels(pSynth);
267+
UpdatePartLevels(Synth);
268268

269269
Print(mTextBuffer, 0, 0, true);
270270
if (mRows == 2)

src/lcd/hd44780fourbit.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#include "lcd/hd44780.h"
2727

28-
CHD44780FourBit::CHD44780FourBit(u8 pColumns, u8 pRows)
29-
: CHD44780Base(pColumns, pRows),
28+
CHD44780FourBit::CHD44780FourBit(u8 nColumns, u8 nRows)
29+
: CHD44780Base(nColumns, nRows),
3030

3131
mRS(GPIO_PIN_RS, GPIOModeOutput),
3232
mRW(GPIO_PIN_RW, GPIOModeOutput),
@@ -46,15 +46,15 @@ CHD44780FourBit::CHD44780FourBit(u8 pColumns, u8 pRows)
4646
mD7.Write(LOW);
4747
}
4848

49-
void CHD44780FourBit::WriteNybble(u8 pNybble, WriteMode pMode)
49+
void CHD44780FourBit::WriteNybble(u8 nNybble, WriteMode Mode)
5050
{
5151
// RS = LOW for command mode, HIGH for data mode
52-
mRS.Write(pMode == WriteMode::Command ? LOW : HIGH);
52+
mRS.Write(Mode == WriteMode::Command ? LOW : HIGH);
5353

54-
mD4.Write((pNybble >> 0) & 1);
55-
mD5.Write((pNybble >> 1) & 1);
56-
mD6.Write((pNybble >> 2) & 1);
57-
mD7.Write((pNybble >> 3) & 1);
54+
mD4.Write((nNybble >> 0) & 1);
55+
mD5.Write((nNybble >> 1) & 1);
56+
mD6.Write((nNybble >> 2) & 1);
57+
mD7.Write((nNybble >> 3) & 1);
5858

5959
// Toggle enable
6060
mEN.Write(HIGH);

src/lcd/hd44780i2c.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
#define LCD_ENABLE (1 << 2)
2828
#define LCD_BACKLIGHT (1 << 3)
2929

30-
CHD44780I2C::CHD44780I2C(CI2CMaster* pI2CMaster, u8 pAddress, u8 pColumns, u8 pRows)
31-
: CHD44780Base(pColumns, pRows),
30+
CHD44780I2C::CHD44780I2C(CI2CMaster* pI2CMaster, u8 nAddress, u8 nColumns, u8 nRows)
31+
: CHD44780Base(nColumns, nRows),
3232
mI2CMaster(pI2CMaster),
33-
mAddress(pAddress)
33+
mAddress(nAddress)
3434
{
3535
}
3636

37-
void CHD44780I2C::WriteNybble(u8 pNybble, WriteMode pMode)
37+
void CHD44780I2C::WriteNybble(u8 nNybble, WriteMode Mode)
3838
{
3939
// Write bits with ENABLE pulsed high momentarily
40-
u8 bits = ((pNybble << 4) & 0xF0) | LCD_BACKLIGHT | LCD_ENABLE;
40+
u8 bits = ((nNybble << 4) & 0xF0) | LCD_BACKLIGHT | LCD_ENABLE;
4141

42-
if (pMode == WriteMode::Data)
42+
if (Mode == WriteMode::Data)
4343
bits |= 1;
4444

4545
mI2CMaster->Write(mAddress, &bits, 1);

src/lcd/mt32lcd.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ void CMT32LCD::OnLCDMessage(const char* pMessage)
4545
mLCDStateTime = ticks;
4646
}
4747

48-
void CMT32LCD::OnProgramChanged(u8 pPartNum, const char* pSoundGroupName, const char* pPatchName)
48+
void CMT32LCD::OnProgramChanged(u8 nPartNum, const char* pSoundGroupName, const char* pPatchName)
4949
{
5050
unsigned ticks = CTimer::Get()->GetTicks();
5151

5252
// Bail out if displaying a message and it hasn't been on-screen long enough
5353
if (mState == State::DisplayingMessage && (ticks - mLCDStateTime) <= MSEC2HZ(MessageDisplayTimeMillis))
5454
return;
5555

56-
snprintf(mTextBuffer, sizeof(mTextBuffer), "%d|%s%s", pPartNum + 1, pSoundGroupName, pPatchName);
56+
snprintf(mTextBuffer, sizeof(mTextBuffer), "%d|%s%s", nPartNum + 1, pSoundGroupName, pPatchName);
5757

5858
mState = State::DisplayingTimbreName;
5959
mLCDStateTime = ticks;
@@ -83,12 +83,12 @@ void CMT32LCD::Update(const CMT32SynthBase& Synth)
8383
}
8484

8585
if (mState == State::DisplayingPartStates)
86-
UpdatePartStateText(pSynth);
86+
UpdatePartStateText(Synth);
8787
}
8888

89-
void CMT32LCD::UpdatePartStateText(const CMT32SynthBase& pSynth)
89+
void CMT32LCD::UpdatePartStateText(const CMT32SynthBase& Synth)
9090
{
91-
u32 partStates = pSynth.GetPartStates();
91+
u32 partStates = Synth.GetPartStates();
9292

9393
// First 5 parts
9494
for (u8 i = 0; i < 5; ++i)
@@ -103,16 +103,16 @@ void CMT32LCD::UpdatePartStateText(const CMT32SynthBase& pSynth)
103103
mTextBuffer[11] = ' ';
104104

105105
// Volume
106-
sprintf(mTextBuffer + 12, "|vol:%3d", pSynth.GetMasterVolume());
106+
sprintf(mTextBuffer + 12, "|vol:%3d", Synth.GetMasterVolume());
107107
}
108108

109-
void CMT32LCD::UpdatePartLevels(const CMT32SynthBase& pSynth)
109+
void CMT32LCD::UpdatePartLevels(const CMT32SynthBase& Synth)
110110
{
111-
u32 partStates = pSynth.GetPartStates();
111+
u32 partStates = Synth.GetPartStates();
112112
for (u8 i = 0; i < 9; ++i)
113113
{
114114
if ((partStates >> i) & 1)
115-
mPartLevels[i] = floor(VelocityScale * pSynth.GetVelocityForPart(i)) + 0.5f;
115+
mPartLevels[i] = floor(VelocityScale * Synth.GetVelocityForPart(i)) + 0.5f;
116116
else if (mPartLevels[i] > 0)
117117
--mPartLevels[i];
118118
}

0 commit comments

Comments
 (0)