Skip to content

Commit 8a85ff4

Browse files
committed
[bsp/bluetrum] formatting code
1 parent 26310fe commit 8a85ff4

File tree

6 files changed

+31
-17
lines changed

6 files changed

+31
-17
lines changed

bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ static int blehr_sample(void)
6464
15,
6565
1);
6666

67-
if (tid != RT_NULL) {
67+
if (tid != RT_NULL)
68+
{
6869
rt_thread_startup(tid);
6970
}
7071
}

bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void sd_mount(void *parameter)
2626
while (1)
2727
{
2828
rt_thread_mdelay(500);
29-
if(rt_device_find("sd0") != RT_NULL)
29+
if (rt_device_find("sd0") != RT_NULL)
3030
{
3131
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
3232
{

bsp/bluetrum/ab32vg1-ab-prougen/board/board.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void rt_hw_systick_init(void)
182182

183183
timer0_init();
184184
hal_set_tick_hook(timer0_cfg);
185-
hal_set_ticks(get_sysclk_nhz()/RT_TICK_PER_SECOND);
185+
hal_set_ticks(get_sysclk_nhz() / RT_TICK_PER_SECOND);
186186

187187
PICCON |= 0x10002;
188188
}
@@ -224,31 +224,35 @@ void cache_init(void)
224224
RT_SECTION(".irq.cache")
225225
void os_spiflash_lock(void)
226226
{
227-
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) {
227+
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0))
228+
{
228229
rt_mutex_take(&mutex_spiflash, RT_WAITING_FOREVER);
229230
}
230231
}
231232

232233
RT_SECTION(".irq.cache")
233234
void os_spiflash_unlock(void)
234235
{
235-
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) {
236+
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0))
237+
{
236238
rt_mutex_release(&mutex_spiflash);
237239
}
238240
}
239241

240242
RT_SECTION(".irq.cache")
241243
void os_cache_lock(void)
242244
{
243-
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) {
245+
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0))
246+
{
244247
rt_mutex_take(&mutex_cache, RT_WAITING_FOREVER);
245248
}
246249
}
247250

248251
RT_SECTION(".irq.cache")
249252
void os_cache_unlock(void)
250253
{
251-
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) {
254+
if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0))
255+
{
252256
rt_mutex_release(&mutex_cache);
253257
}
254258
}
@@ -280,5 +284,5 @@ void exception_isr(void)
280284
rt_kprintf(stack_info, rt_thread_self()->sp, rt_thread_self()->name);
281285
#endif
282286

283-
while(1);
287+
while (1);
284288
}

bsp/bluetrum/libraries/hal_drivers/drv_flash.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size);
3131
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size);
3232
static int fal_flash_erase(long offset, size_t size);
3333

34-
const struct fal_flash_dev ab32_onchip_flash = {
34+
const struct fal_flash_dev ab32_onchip_flash =
35+
{
3536
"onchip_flash",
3637
AB32_FLASH_START_ADDRESS,
3738
AB32_FLASH_SIZE,
3839
AB32_FLASH_PAGE_SIZE,
3940
{NULL, fal_flash_read, fal_flash_write, fal_flash_erase},
40-
256*8
41+
256 * 8
4142
};
4243

4344
static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size)
@@ -47,7 +48,8 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size)
4748

4849
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size)
4950
{
50-
if (size % 256) {
51+
if (size % 256)
52+
{
5153
rt_kprintf("Flash write requires 256 byte alignment\n");
5254
return -1;
5355
}
@@ -57,11 +59,13 @@ static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size)
5759

5860
static int fal_flash_erase(long offset, size_t size)
5961
{
60-
if (size % 4096) {
62+
if (size % 4096)
63+
{
6164
rt_kprintf("Flash erase requires 4096 byte alignment\n");
6265
return -1;
6366
}
64-
while (size > 0) {
67+
while (size > 0)
68+
{
6569
os_spiflash_erase(offset);
6670
offset += 4096;
6771
size -= 4096;
@@ -78,7 +82,8 @@ int fal_ops_test(void)
7882
int size = 256;
7983
int addr = 0;
8084

81-
for (int i = 0; i < 256; i++) {
85+
for (int i = 0; i < 256; i++)
86+
{
8287
data[i] = i;
8388
}
8489

@@ -108,9 +113,11 @@ int fal_ops_test(void)
108113
}
109114

110115
result = fal_partition_erase(part_dev, 0, 4096);
111-
if (result >= 0) {
116+
if (result >= 0)
117+
{
112118
rt_kprintf("Erase data success.\n");
113119
}
120+
114121
rt_memset(data, 0, 256);
115122
result = fal_partition_read(part_dev, 0, data, 256);
116123
if (result >= 0)
-36.7 KB
Binary file not shown.

bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ void hal_set_tick_hook(void (*hook)(uint32_t ticks))
1111

1212
void hal_set_ticks(uint32_t ticks)
1313
{
14-
if (ticks != hw_ticks) {
14+
if (ticks != hw_ticks)
15+
{
1516
hw_ticks = ticks;
1617
}
17-
if (tick_cfg_hook != HAL_NULL) {
18+
if (tick_cfg_hook != HAL_NULL)
19+
{
1820
tick_cfg_hook(hw_ticks);
1921
}
2022
}

0 commit comments

Comments
 (0)