Skip to content

Commit eca8e44

Browse files
committed
Rename console Putc to PutChar and minor fixes
Rename the console output API from Putc to PutChar across implementations and headers (i2c, null, uart0) and update call sites accordingly for naming consistency. Remove an unused <cstdint> include in uart0 implementation. Bump copyright ranges to include 2026 in several files and tidy a few header comment/endif formatting details.
1 parent 9ed8e3f commit eca8e44

6 files changed

Lines changed: 16 additions & 17 deletions

File tree

lib-hal/console/i2c/console.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void __attribute__((cold)) Init()
212212
WriteRegister(SC16IS7X0_FCR, FCR_ENABLE_FIFO);
213213
}
214214

215-
void Putc(int c)
215+
void PutChar(int c)
216216
{
217217
if (!s_is_connected)
218218
{

lib-hal/console/null/console.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file console.cpp
33
*
44
*/
5-
/* Copyright (C) 2023-2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2023-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -32,5 +32,5 @@ void Puts([[maybe_unused]] const char* p) {}
3232
void Write([[maybe_unused]] const char* p, [[maybe_unused]] unsigned int i) {}
3333
void Status([[maybe_unused]] uint32_t i, [[maybe_unused]] const char* p) {}
3434
void Error([[maybe_unused]] const char* p) {}
35-
void Putc([[maybe_unused]] int i) {}
35+
void PutChar([[maybe_unused]] int i) {}
3636
} // namespace console

lib-hal/console/uart0/console.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file console.cpp
33
*
44
*/
5-
/* Copyright (C) 2018-2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2018-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -23,25 +23,24 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#include <cstdint>
2726
#include <cstring>
2827

2928
#include "console.h"
3029

3130
namespace uart0
3231
{
3332
void Init();
34-
void Putc(int);
33+
void PutChar(int);
3534
void Puts(const char*);
3635
} // namespace uart0
3736

3837
namespace console
3938
{
4039
void SetFgColour(Colours fg);
4140

42-
void Putc(int c)
41+
void PutChar(int c)
4342
{
44-
uart0::Putc(c);
43+
uart0::PutChar(c);
4544
}
4645

4746
void Puts(const char* s)
@@ -100,7 +99,7 @@ void Write(const char* s, unsigned int n)
10099

101100
while (((c = *s++) != 0) && (n-- != 0))
102101
{
103-
Putc(static_cast<int>(c));
102+
PutChar(static_cast<int>(c));
104103
}
105104
}
106105

lib-hal/include/console/console_i2c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file console_i2c.h
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -30,4 +30,4 @@
3030
#error File should not be included
3131
#endif
3232

33-
#endif // CONSOLE_CONSOLE_I2C_H_
33+
#endif // CONSOLE_CONSOLE_I2C_H_

lib-hal/include/console/console_null.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file console_null.h
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -46,11 +46,11 @@ enum class Colours
4646
};
4747

4848
inline void Init() {}
49-
inline void Putc([[maybe_unused]] int i) {}
49+
inline void PutChar([[maybe_unused]] int i) {}
5050
inline void Puts([[maybe_unused]] const char* p) {}
5151
inline void Write([[maybe_unused]] const char* p, [[maybe_unused]] unsigned int i) {}
5252
inline void Status([[maybe_unused]] Colours c, [[maybe_unused]] const char* p) {}
5353
inline void Error([[maybe_unused]] const char* p) {}
5454
} // namespace console
5555

56-
#endif // CONSOLE_CONSOLE_NULL_H_
56+
#endif // CONSOLE_CONSOLE_NULL_H_

lib-hal/include/console/console_uart0.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file console_uart0.h
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -72,7 +72,7 @@ enum class Colours
7272
};
7373

7474
void Init();
75-
void Putc(int);
75+
void PutChar(int);
7676
void Puts(const char*);
7777
void Write(const char*, unsigned int);
7878
void Status(Colours, const char*);
@@ -82,4 +82,4 @@ void Error(const char*);
8282

8383
} // namespace console
8484

85-
#endif // CONSOLE_CONSOLE_UART0_H_
85+
#endif // CONSOLE_CONSOLE_UART0_H_

0 commit comments

Comments
 (0)