Skip to content

Commit 0e09f58

Browse files
authored
Merge pull request #4447 from mysterywolf/gd32
[gd32][drivers] auto formatted
2 parents 6307f3d + 2e99d28 commit 0e09f58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+556
-556
lines changed

bsp/gd32103c-eval/drivers/drv_gpio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2020, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*

bsp/gd32303e-eval/drivers/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void rt_hw_board_init()
7979
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
8080
#endif
8181

82-
#ifdef RT_USING_HEAP
82+
#ifdef RT_USING_HEAP
8383
rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END);
8484
#endif
8585
}

bsp/gd32303e-eval/drivers/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <gd32f30x.h>
2020

2121
// <o> Internal SRAM memory size[Kbytes] <8-64>
22-
// <i>Default: 64
22+
// <i>Default: 64
2323
#ifdef __ICCARM__
2424
// Use *.icf ram symbal, to avoid hardcode.
2525
extern char __ICFEDIT_region_RAM_end__;

bsp/gd32303e-eval/drivers/drv_gpio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void gd32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
261261
/* GPIO Periph clock enable */
262262
rcu_periph_clock_enable(index->clk);
263263
pin_mode = GPIO_MODE_OUT_PP;
264-
264+
265265
switch(mode)
266266
{
267267
case PIN_MODE_OUTPUT:
@@ -442,7 +442,7 @@ rt_err_t gd32_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_
442442
return RT_EINVAL;
443443
}
444444
irqmap = &pin_irq_map[hdr_index];
445-
445+
446446
switch (pin_irq_hdr_tab[hdr_index].mode)
447447
{
448448
case PIN_IRQ_MODE_RISING:
@@ -463,14 +463,14 @@ rt_err_t gd32_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_
463463

464464
/* enable and set interrupt priority */
465465
nvic_irq_enable(irqmap->irqno, 5U, 0U);
466-
466+
467467
/* connect EXTI line to GPIO pin */
468468
gpio_exti_source_select(index->port_src, index->pin_src);
469469

470470
/* configure EXTI line */
471471
exti_init((exti_line_enum)(index->pin), EXTI_INTERRUPT, trigger_mode);
472472
exti_interrupt_flag_clear((exti_line_enum)(index->pin));
473-
473+
474474
rt_hw_interrupt_enable(level);
475475
}
476476
else if (enabled == PIN_IRQ_DISABLE)
@@ -505,7 +505,7 @@ int rt_hw_pin_init(void)
505505
int result;
506506

507507
result = rt_device_pin_register("pin", &_gd32_pin_ops, RT_NULL);
508-
508+
509509
return result;
510510
}
511511
INIT_BOARD_EXPORT(rt_hw_pin_init);
@@ -524,7 +524,7 @@ void GD32_GPIO_EXTI_IRQHandler(rt_int8_t exti_line)
524524
{
525525
pin_irq_hdr(exti_line);
526526
exti_interrupt_flag_clear((exti_line_enum)(1 << exti_line));
527-
}
527+
}
528528
}
529529
void EXTI0_IRQHandler(void)
530530
{

bsp/gd32303e-eval/drivers/drv_i2c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static int gd32_i2c_read(rt_uint32_t i2c_periph, rt_uint16_t slave_address, rt_u
168168
*p_buffer = i2c_data_receive(i2c_periph);
169169

170170
/* point to the next location where the byte read will be saved */
171-
p_buffer++;
171+
p_buffer++;
172172

173173
/* decrement the read bytes counter */
174174
data_byte--;
@@ -277,7 +277,7 @@ static rt_size_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
277277
}
278278
}
279279
}
280-
280+
281281
ret = i;
282282

283283
out:
@@ -287,7 +287,7 @@ static rt_size_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
287287
}
288288

289289
static const struct rt_i2c_bus_device_ops i2c_ops =
290-
{
290+
{
291291
gd32_i2c_xfer,
292292
RT_NULL,
293293
RT_NULL
@@ -324,7 +324,7 @@ int rt_hw_i2c_init(void)
324324

325325
i2c_device.priv = (void *)&_i2c_bit_ops;
326326
rt_i2c_bit_add_bus(&i2c_device, I2C_BUS_NAME);
327-
}
327+
}
328328

329329
#else /* register hardware I2C */
330330

bsp/gd32303e-eval/drivers/drv_spi.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
119119
spi_init_struct.prescale = SPI_PSC_256;
120120
}
121121
} /* baudrate */
122-
122+
123123
switch(configuration->mode & RT_SPI_MODE_3)
124124
{
125125
case RT_SPI_MODE_0:
@@ -135,7 +135,7 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
135135
spi_init_struct.clock_polarity_phase = SPI_CK_PL_HIGH_PH_2EDGE;
136136
break;
137137
}
138-
138+
139139
/* MSB or LSB */
140140
if(configuration->mode & RT_SPI_MSB)
141141
{
@@ -145,7 +145,7 @@ static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configurat
145145
{
146146
spi_init_struct.endian = SPI_ENDIAN_LSB;
147147
}
148-
148+
149149
spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX;
150150
spi_init_struct.device_mode = SPI_MASTER;
151151
spi_init_struct.nss = SPI_NSS_SOFT;
@@ -181,7 +181,7 @@ static rt_uint32_t xfer(struct rt_spi_device* device, struct rt_spi_message* mes
181181
const rt_uint8_t * send_ptr = message->send_buf;
182182
rt_uint8_t * recv_ptr = message->recv_buf;
183183
rt_uint32_t size = message->length;
184-
184+
185185
DEBUG_PRINTF("spi poll transfer start: %d\n", size);
186186

187187
while(size--)
@@ -192,7 +192,7 @@ static rt_uint32_t xfer(struct rt_spi_device* device, struct rt_spi_message* mes
192192
{
193193
data = *send_ptr++;
194194
}
195-
195+
196196
// Todo: replace register read/write by gd32f3 lib
197197
//Wait until the transmit buffer is empty
198198
while(RESET == spi_i2s_flag_get(spi_periph, SPI_FLAG_TBE));
@@ -267,8 +267,8 @@ int gd32_hw_spi_init(void)
267267
rcu_periph_clock_enable(RCU_SPI0);
268268
/* SPI0_SCK(PA5), SPI0_MISO(PA6) and SPI0_MOSI(PA7) GPIO pin configuration */
269269
gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_5 | GPIO_PIN_7);
270-
gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_6);
271-
270+
gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_6);
271+
272272
#endif
273273
#ifdef RT_USING_SPI1
274274
static struct rt_spi_bus spi_bus1;
@@ -287,7 +287,7 @@ int gd32_hw_spi_init(void)
287287
static struct rt_spi_bus spi_bus2;
288288
spi_bus2.parent.user_data = (void *)SPI2;
289289

290-
result = rt_spi_bus_register(&spi_bus2, "spi2", &gd32_spi_ops);
290+
result = rt_spi_bus_register(&spi_bus2, "spi2", &gd32_spi_ops);
291291

292292
rcu_periph_clock_enable(RCU_SPI2);
293293
rcu_periph_clock_enable(RCU_GPIOB);

bsp/gd32303e-eval/drivers/drv_spi_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int rt_hw_gd25q40_init(void)
3030
static rt_base_t gd25q_cs_pin; /* SPI设备CS片选引脚 */
3131

3232
gd25q_cs_pin = GD25Q_SPI_CS_PIN;
33-
33+
3434
rt_pin_mode(GD25Q_SPI_CS_PIN, GPIO_MODE_OUT_PP);
3535

3636
res = rt_spi_bus_attach_device(&spi_dev_gd25q, SPI_DEVICE_NAME, SPI_BUS_NAME, (void*)gd25q_cs_pin);

bsp/gd32303e-eval/drivers/drv_usart.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct gd32_uart
4444
uint32_t tx_port;
4545
uint16_t tx_pin;
4646
uint32_t rx_port;
47-
uint16_t rx_pin;
47+
uint16_t rx_pin;
4848

4949
struct rt_serial_device * serial;
5050
char *device_name;
@@ -143,7 +143,7 @@ static const struct gd32_uart uarts[] = {
143143
"uart0",
144144
},
145145
#endif
146-
146+
147147
#ifdef RT_USING_USART1
148148
{
149149
USART1, // uart peripheral index
@@ -155,7 +155,7 @@ static const struct gd32_uart uarts[] = {
155155
"uart1",
156156
},
157157
#endif
158-
158+
159159
#ifdef RT_USING_USART2
160160
{
161161
USART2, // uart peripheral index
@@ -167,7 +167,7 @@ static const struct gd32_uart uarts[] = {
167167
"uart2",
168168
},
169169
#endif
170-
170+
171171
#ifdef RT_USING_UART3
172172
{
173173
UART3, // uart peripheral index
@@ -179,7 +179,7 @@ static const struct gd32_uart uarts[] = {
179179
"uart3",
180180
},
181181
#endif
182-
182+
183183
#ifdef RT_USING_UART4
184184
{
185185
UART4, // uart peripheral index
@@ -228,9 +228,9 @@ static rt_err_t gd32_configure(struct rt_serial_device *serial, struct serial_co
228228
RT_ASSERT(cfg != RT_NULL);
229229

230230
uart = (struct gd32_uart *)serial->parent.user_data;
231-
231+
232232
gd32_uart_gpio_init(uart);
233-
233+
234234
usart_baudrate_set(uart->uart_periph, cfg->baud_rate);
235235

236236
switch (cfg->data_bits)
@@ -310,7 +310,7 @@ static int gd32_putc(struct rt_serial_device *serial, char ch)
310310

311311
usart_data_transmit(uart->uart_periph, ch);
312312
while((usart_flag_get(uart->uart_periph, USART_FLAG_TC) == RESET));
313-
313+
314314
return 1;
315315
}
316316

bsp/gd32303e-eval/drivers/gd32f303e_eval.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ static uint32_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN, EVAL_COM2_RX_PIN};
2323
static uint32_t COM_GPIO_PORT[COMn] = {EVAL_COM1_GPIO_PORT, EVAL_COM2_GPIO_PORT};
2424
static rcu_periph_enum COM_GPIO_CLK[COMn] = {EVAL_COM1_GPIO_CLK, EVAL_COM2_GPIO_CLK};
2525

26-
static rcu_periph_enum GPIO_CLK[LEDn] = {LED2_GPIO_CLK, LED3_GPIO_CLK,
26+
static rcu_periph_enum GPIO_CLK[LEDn] = {LED2_GPIO_CLK, LED3_GPIO_CLK,
2727
LED4_GPIO_CLK, LED5_GPIO_CLK};
2828

29-
static uint32_t KEY_PORT[KEYn] = {WAKEUP_KEY_GPIO_PORT,
29+
static uint32_t KEY_PORT[KEYn] = {WAKEUP_KEY_GPIO_PORT,
3030
TAMPER_KEY_GPIO_PORT,
3131
USER_KEY1_GPIO_PORT,
3232
USER_KEY2_GPIO_PORT};
3333
static uint32_t KEY_PIN[KEYn] = {WAKEUP_KEY_PIN, TAMPER_KEY_PIN,USER_KEY1_PIN,USER_KEY2_PIN};
34-
static rcu_periph_enum KEY_CLK[KEYn] = {WAKEUP_KEY_GPIO_CLK,
34+
static rcu_periph_enum KEY_CLK[KEYn] = {WAKEUP_KEY_GPIO_CLK,
3535
TAMPER_KEY_GPIO_CLK,
3636
USER_KEY1_GPIO_CLK,
3737
USER_KEY2_GPIO_CLK};
@@ -47,7 +47,7 @@ static uint8_t KEY_PIN_SOURCE[KEYn] = {WAKEUP_KEY_EXTI_PIN_SOURCE,
4747
TAMPER_KEY_EXTI_PIN_SOURCE,
4848
USER_KEY1_EXTI_PIN_SOURCE,
4949
USER_KEY2_EXTI_PIN_SOURCE};
50-
static uint8_t KEY_IRQn[KEYn] = {WAKEUP_KEY_EXTI_IRQn,
50+
static uint8_t KEY_IRQn[KEYn] = {WAKEUP_KEY_EXTI_IRQn,
5151
TAMPER_KEY_EXTI_IRQn,
5252
USER_KEY1_EXTI_IRQn,
5353
USER_KEY2_EXTI_IRQn};
@@ -66,7 +66,7 @@ void gd_eval_led_init (led_typedef_enum lednum)
6666
{
6767
/* enable the led clock */
6868
rcu_periph_clock_enable(GPIO_CLK[lednum]);
69-
/* configure led GPIO port */
69+
/* configure led GPIO port */
7070
gpio_init(GPIO_PORT[lednum], GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ,GPIO_PIN[lednum]);
7171

7272
GPIO_BC(GPIO_PORT[lednum]) = GPIO_PIN[lednum];
@@ -114,7 +114,7 @@ void gd_eval_led_off(led_typedef_enum lednum)
114114
*/
115115
void gd_eval_led_toggle(led_typedef_enum lednum)
116116
{
117-
gpio_bit_write(GPIO_PORT[lednum], GPIO_PIN[lednum],
117+
gpio_bit_write(GPIO_PORT[lednum], GPIO_PIN[lednum],
118118
(bit_status)(1-gpio_input_bit_get(GPIO_PORT[lednum], GPIO_PIN[lednum])));
119119
}
120120

@@ -184,7 +184,7 @@ void gd_eval_com_init(uint32_t com)
184184
}else if(EVAL_COM2 == com){
185185
com_id = 1U;
186186
}
187-
187+
188188
/* enable GPIO clock */
189189
rcu_periph_clock_enable(COM_GPIO_CLK[com_id]);
190190

bsp/gd32303e-eval/drivers/gd32f303e_eval.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
#endif
1818

1919
#include "gd32f30x.h"
20-
20+
2121
/* exported types */
22-
typedef enum
22+
typedef enum
2323
{
2424
LED2 = 0,
2525
LED3 = 1,
2626
LED4 = 2,
2727
LED5 = 3
2828
} led_typedef_enum;
2929

30-
typedef enum
30+
typedef enum
3131
{
3232
KEY_WAKEUP = 0,
3333
KEY_TAMPER = 1,
3434
KEY_USER1 = 2,
3535
KEY_USER2 = 3
3636
} key_typedef_enum;
3737

38-
typedef enum
38+
typedef enum
3939
{
4040
KEY_MODE_GPIO = 0,
4141
KEY_MODE_EXTI = 1
@@ -47,15 +47,15 @@ typedef enum
4747
#define LED2_PIN GPIO_PIN_0
4848
#define LED2_GPIO_PORT GPIOF
4949
#define LED2_GPIO_CLK RCU_GPIOF
50-
50+
5151
#define LED3_PIN GPIO_PIN_1
5252
#define LED3_GPIO_PORT GPIOF
5353
#define LED3_GPIO_CLK RCU_GPIOF
54-
54+
5555
#define LED4_PIN GPIO_PIN_2
5656
#define LED4_GPIO_PORT GPIOF
5757
#define LED4_GPIO_CLK RCU_GPIOF
58-
58+
5959
#define LED5_PIN GPIO_PIN_3
6060
#define LED5_GPIO_PORT GPIOF
6161
#define LED5_GPIO_CLK RCU_GPIOF
@@ -85,7 +85,7 @@ typedef enum
8585
#define WAKEUP_KEY_EXTI_LINE EXTI_0
8686
#define WAKEUP_KEY_EXTI_PORT_SOURCE GPIO_PORT_SOURCE_GPIOA
8787
#define WAKEUP_KEY_EXTI_PIN_SOURCE GPIO_PIN_SOURCE_0
88-
#define WAKEUP_KEY_EXTI_IRQn EXTI0_IRQn
88+
#define WAKEUP_KEY_EXTI_IRQn EXTI0_IRQn
8989

9090
/* tamper push-button */
9191
#define TAMPER_KEY_PIN GPIO_PIN_13

0 commit comments

Comments
 (0)