Skip to content

Commit 730cff7

Browse files
committed
Applying Google C++ Style Guide
1 parent 033c33a commit 730cff7

13 files changed

Lines changed: 65 additions & 83 deletions

File tree

lib-clib/src/asctime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file time.c
2+
* @file asctime.c
33
*
44
*/
55
/* Copyright (C) 2019 by Arjan van Vught mailto:info@orangepi-dmx.nl

lib-configstore/.settings/language.settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
66
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
77
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
8-
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1681685281287766334" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
8+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1681605964914070334" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
99
<language-scope id="org.eclipse.cdt.core.gcc"/>
1010
<language-scope id="org.eclipse.cdt.core.g++"/>
1111
</provider>

lib-configstore/device/gd32/ram/storedevice.cpp

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,56 +35,60 @@
3535
static constexpr uint32_t kFlashSectorSize = 4096U;
3636
static constexpr uint32_t kBsramSize = 4096U;
3737

38-
StoreDevice::StoreDevice() {
39-
DEBUG_ENTRY
38+
StoreDevice::StoreDevice()
39+
{
40+
DEBUG_ENTRY
4041

41-
detected_ = true;
42+
detected_ = true;
4243

43-
printf("StoreDevice: BSRAM with total %d bytes [%d kB]\n", GetSize(), GetSize() / 1024U);
44-
DEBUG_EXIT
44+
printf("StoreDevice: BSRAM with total %d bytes [%d kB]\n", GetSize(), GetSize() / 1024U);
45+
DEBUG_EXIT
4546
}
4647

47-
StoreDevice::~StoreDevice() {
48-
DEBUG_ENTRY
48+
StoreDevice::~StoreDevice(){DEBUG_ENTRY
4949

50-
DEBUG_EXIT
51-
}
50+
DEBUG_EXIT}
5251

53-
uint32_t StoreDevice::GetSize() const {
54-
return kBsramSize;
52+
uint32_t StoreDevice::GetSize() const
53+
{
54+
return kBsramSize;
5555
}
5656

57-
uint32_t StoreDevice::GetSectorSize() const {
58-
return kFlashSectorSize;
57+
uint32_t StoreDevice::GetSectorSize() const
58+
{
59+
return kFlashSectorSize;
5960
}
6061

61-
bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) uint8_t *buffer, storedevice::Result& result) {
62-
DEBUG_ENTRY
63-
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
64-
assert((offset + length) <= BSRAM_SIZE);
62+
bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) uint8_t* buffer, storedevice::Result& result)
63+
{
64+
DEBUG_ENTRY
65+
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
66+
assert((offset + length) <= BSRAM_SIZE);
6567

66-
result = storedevice::Result::OK;
68+
result = storedevice::Result::kOk;
6769

68-
DEBUG_EXIT
69-
return true;
70+
DEBUG_EXIT
71+
return true;
7072
}
7173

72-
bool StoreDevice::Erase(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, storedevice::Result& result) {
73-
DEBUG_ENTRY
74+
bool StoreDevice::Erase(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, storedevice::Result& result)
75+
{
76+
DEBUG_ENTRY
7477

75-
result = storedevice::Result::OK;
78+
result = storedevice::Result::kOk;
7679

77-
DEBUG_EXIT
78-
return true;
80+
DEBUG_EXIT
81+
return true;
7982
}
8083

81-
bool StoreDevice::Write(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) const uint8_t *buffer, storedevice::Result& result) {
82-
DEBUG_ENTRY
83-
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
84-
assert((offset + length) <= BSRAM_SIZE);
84+
bool StoreDevice::Write(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) const uint8_t* buffer, storedevice::Result& result)
85+
{
86+
DEBUG_ENTRY
87+
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
88+
assert((offset + length) <= BSRAM_SIZE);
8589

86-
result = storedevice::Result::OK;
90+
result = storedevice::Result::kOk;
8791

88-
DEBUG_EXIT
89-
return true;
92+
DEBUG_EXIT
93+
return true;
9094
}

lib-display/include/spi/display.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ using LcdDriver = ST7735S;
5555
#include "spi/st7789.h"
5656
using LcdDriver = ST7789;
5757
#endif
58-
5958
#include "spi/lcd_font.h"
6059
#include "spi/spilcd.h"
61-
6260
#include "console.h"
63-
6461
#if defined(DISPLAYTIMEOUT_GPIO)
6562
#include "hal_gpio.h"
6663
#endif
@@ -240,16 +237,16 @@ class Display : public LcdDriver
240237
Write(rows_, pText);
241238
}
242239

243-
void TextStatus(const char* pText, uint32_t nConsoleColor)
240+
void TextStatus(const char* text, console::Colours colour)
244241
{
245-
TextStatus(pText);
242+
TextStatus(text);
246243

247-
if (nConsoleColor == UINT32_MAX)
244+
if (static_cast<uint32_t>(colour) == UINT32_MAX)
248245
{
249246
return;
250247
}
251248

252-
ConsoleStatus(nConsoleColor, pText);
249+
console::Status(colour, text);
253250
}
254251

255252
void Progress()

lib-display/include/spi/st7789.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#include "spi/st77xx.h"
3232
#include "debug.h"
3333

34-
namespace st7789::cmd
34+
namespace st7789
35+
{
36+
namespace cmd
3537
{
3638
inline constexpr uint8_t kGctrl = 0xB7; ///< Gate Control
3739
inline constexpr uint8_t kVcoms = 0xBB; ///< VCOM Setting
@@ -41,7 +43,7 @@ inline constexpr uint8_t kVrhs = 0xC3; ///< VRH Set
4143
inline constexpr uint8_t kVdvs = 0xC4; ///< VDV Set
4244
inline constexpr uint8_t kFrctrL2 = 0xC6; ///< Frame Rate Control in Normal Mode
4345
inline constexpr uint8_t kPwctrL1 = 0xD0; ///< Power Control 1
44-
} // namespace st7789::cmd
46+
} // namespace cmd
4547
#if defined(SPI_LCD_240X240)
4648
inline constexpr uint32_t kRotation0ShiftX = 0;
4749
inline constexpr uint32_t kRotation0ShiftY = 80;
@@ -61,7 +63,7 @@ inline constexpr uint32_t kRotation2ShiftY = 0;
6163
inline constexpr uint32_t kRotation3ShiftX = 0;
6264
inline constexpr uint32_t kRotation3ShiftY = 0;
6365
#endif
64-
66+
} // namespace st7789
6567

6668
class ST7789 : public ST77XX
6769
{

lib-gd32/include/gd32_uart.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ inline constexpr uint32_t kUartStop2Bits = 2;
4747

4848
void Gd32UartBegin(uint32_t usart_periph, uint32_t baudrate, uint32_t bits, uint32_t parity, uint32_t stop_bits);
4949
void Gd32UartSetBaudrate(uint32_t usart_periph, uint32_t baudrate);
50-
void Gd32UartTransmit(uint32_t usart_periph, const uint8_t* data, uint32_t length);
51-
void Gd32UartTransmitString(uint32_t usart_periph, const char* data);
5250

5351
inline uint32_t Gd32UartGetRxFifoLevel(__attribute__((unused)) uint32_t usart_periph)
5452
{

lib-gd32/include/mcu/gd32f30x_mcu.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#include <stdint.h>
3434

35+
#define BITBAND_SRAM_BASE (uint32_t)0x22000000
36+
3537
#define MCU_CLOCK_FREQ (uint32_t)(120000000)
3638
#define AHB_CLOCK_FREQ (uint32_t)(120000000)
3739
#define APB1_CLOCK_FREQ (uint32_t)(60000000)
@@ -264,6 +266,13 @@
264266
#define SPI2_DMAx DMA1
265267
#define SPI2_TX_DMA_CHx DMA_CH1
266268

269+
#define TIMER4_RCU_DMAx RCU_DMA1
270+
#define TIMER4_DMAx DMA1
271+
#define TIMER4_CH0_DMA_CHx DMA_CH4
272+
#define TIMER4_CH1_DMA_CHx DMA_CH3
273+
#define TIMER4_CH2_DMA_CHx DMA_CH1
274+
#define TIMER4_CH3_DMA_CHx DMA_CH0
275+
267276
#define TIMER7_RCU_DMAx RCU_DMA1
268277
#define TIMER7_DMAx DMA1
269278
#define TIMER7_CH0_DMA_CHx DMA_CH2

lib-gd32/src/f/gd32_i2c.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#endif
3434

3535
#include <cstdint>
36+
#include <cassert>
3637

3738
#include "gd32.h"
3839
#include "gd32_i2c.h"

lib-gd32/src/gd32_uart.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -309,33 +309,3 @@ void Gd32UartSetBaudrate(uint32_t usart_periph, uint32_t baudrate)
309309

310310
USART_CTL0(usart_periph) |= USART_CTL0_UEN;
311311
}
312-
313-
void Gd32UartTransmit(uint32_t usart_periph, const uint8_t* data, uint32_t length)
314-
{
315-
assert(data != nullptr);
316-
317-
while (length-- != 0)
318-
{
319-
while (RESET == usart_flag_get(usart_periph, USART_FLAG_TBE));
320-
#if defined(GD32H7XX)
321-
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
322-
#else
323-
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
324-
#endif
325-
}
326-
}
327-
328-
void Gd32UartTransmitString(uint32_t usart_periph, const char* data)
329-
{
330-
assert(data != nullptr);
331-
332-
while (*data != '\0')
333-
{
334-
while (RESET == usart_flag_get(USART0, USART_FLAG_TBE));
335-
#if defined(GD32H7XX)
336-
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
337-
#else
338-
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
339-
#endif
340-
}
341-
}

lib-gd32/src/softuart0/uart0.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ void Init()
241241
NVIC_SetPriority(TIMERx_IRQn, 2);
242242
NVIC_EnableIRQ(TIMERx_IRQn);
243243
}
244-
245-
244+
246245
void Putc(int c)
247246
{
248247
if (c == '\n')
@@ -270,6 +269,8 @@ void Puts(const char* s)
270269
PutcTimer(*s++);
271270
}
272271

272+
Putc('\n');
273+
273274
do
274275
{
275276
__DMB();

0 commit comments

Comments
 (0)