Skip to content

Commit c02605e

Browse files
committed
Update uncrustify.cfg, format and use ci to check
1 parent 1163887 commit c02605e

189 files changed

Lines changed: 5114 additions & 5665 deletions

File tree

Some content is hidden

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

.github/workflows/uncrustify.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Uncrustify
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
uncrustify:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v6
11+
12+
- name: Install uncrustify
13+
run: |
14+
sudo apt-get update
15+
sudo apt-get install -y uncrustify
16+
17+
- name: Check formatting
18+
run: |
19+
find . \( -name '*.c' -o -name '*.h' \) -print0 | while IFS= read -r -d '' file; do
20+
uncrustify -c uncrustify.cfg --no-backup "$file"
21+
done
22+
23+
if ! git diff --exit-code; then
24+
echo "Formatting check failed. Please run uncrustify locally."
25+
exit 1
26+
fi

include/arch/pico_arm9.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ static inline unsigned long PICO_TIME_MS(void)
3030
static inline void PICO_IDLE(void)
3131
{
3232
unsigned long tick_now = __str9_tick;
33-
while(tick_now == __str9_tick) ;
33+
while (tick_now == __str9_tick);
3434
}
3535

include/arch/pico_atsamd21j18.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static inline void sam_dbg(const char *format, ...)
3434
print_uart(msg);
3535
}
3636

37-
//#define dbg sam_dbg
37+
/*#define dbg sam_dbg */
3838
#define dbg(...) do { } while(0)
3939

4040
extern volatile uint32_t sam_tick;
@@ -56,6 +56,6 @@ static inline unsigned long PICO_TIME_MS(void)
5656
static inline void PICO_IDLE(void)
5757
{
5858
unsigned long tick_now = sam_tick;
59-
while(tick_now == sam_tick) ;
59+
while (tick_now == sam_tick);
6060
}
6161

include/arch/pico_avr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ static inline unsigned long PICO_TIME_MS(void)
3434
static inline void PICO_IDLE(void)
3535
{
3636
unsigned long tick_now = __avr_tick;
37-
while(tick_now == __avr_tick) ;
37+
while (tick_now == __avr_tick);
3838
}
3939

include/arch/pico_esp8266.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
#define dbg printf
2020

2121
/* -------------- MEMORY ------------- */
22-
extern void *pvPortMalloc( size_t xWantedSize );
23-
extern void vPortFree( void *pv );
22+
extern void *pvPortMalloc(size_t xWantedSize);
23+
extern void vPortFree(void *pv);
2424

2525
#define pico_free vPortFree
2626

2727
static inline void *pico_zalloc(size_t size)
2828
{
2929
void *ptr = (void *)pvPortMalloc(size);
3030

31-
if(ptr)
31+
if (ptr)
3232
memset(ptr, 0u, size);
3333

3434
return ptr;

include/arch/pico_generic_gcc.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ extern volatile unsigned int pico_ms_tick;
2929
extern void *pico_mutex_init(void);
3030
extern void pico_mutex_lock(void*);
3131
extern void pico_mutex_unlock(void*);
32-
extern void *pvPortMalloc( size_t xSize );
33-
extern void vPortFree( void *pv );
32+
extern void *pvPortMalloc(size_t xSize);
33+
extern void vPortFree(void *pv);
3434

3535
#define pico_free(x) vPortFree(x)
3636
#define free(x) vPortFree(x)
@@ -39,7 +39,7 @@ static inline void *pico_zalloc(size_t size)
3939
{
4040
void *ptr = pvPortMalloc(size);
4141

42-
if(ptr)
42+
if (ptr)
4343
memset(ptr, 0u, size);
4444

4545
return ptr;
@@ -53,25 +53,25 @@ extern int32_t prescale_time;
5353
static inline pico_time PICO_TIME_MS()
5454
{
5555
#ifdef TIME_PRESCALE
56-
return pico_ms_tick << prescale_time;
56+
return pico_ms_tick << prescale_time;
5757
#else
58-
return pico_ms_tick;
58+
return pico_ms_tick;
5959
#endif
6060
}
6161

6262
static inline pico_time PICO_TIME()
6363
{
6464
#ifdef TIME_PRESCALE
65-
return (pico_ms_tick / 1000) << prescale_time;
65+
return (pico_ms_tick / 1000) << prescale_time;
6666
#else
67-
return (pico_ms_tick / 1000);
67+
return (pico_ms_tick / 1000);
6868
#endif
6969
}
7070

7171
static inline void PICO_IDLE(void)
7272
{
7373
pico_time now = PICO_TIME_MS();
74-
while(now == PICO_TIME_MS()) ;
74+
while (now == PICO_TIME_MS());
7575
}
7676

7777
#else /* NO RTOS SUPPORT */
@@ -88,7 +88,7 @@ extern void memmeas_free(void *);
8888
static inline void *pico_zalloc(size_t size)
8989
{
9090
void *ptr = malloc(size);
91-
if(ptr)
91+
if (ptr)
9292
memset(ptr, 0u, size);
9393

9494
return ptr;
@@ -108,7 +108,7 @@ static inline pico_time PICO_TIME(void)
108108
static inline void PICO_IDLE(void)
109109
{
110110
unsigned int now = pico_ms_tick;
111-
while(now == pico_ms_tick) ;
111+
while (now == pico_ms_tick);
112112
}
113113

114114
#endif /* IFNDEF RTOS */

include/arch/pico_mbed.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define dbg(...)
2727

2828
/*
29-
#define MEMORY_MEASURE
30-
#define JENKINS_DEBUG
29+
#define MEMORY_MEASURE
30+
#define JENKINS_DEBUG
3131
*/
3232

3333
/* Intended for Mr. Jenkins endurance test loggings */
@@ -80,7 +80,7 @@ static inline void *pico_zalloc(int x)
8080
#ifdef JENKINS_DEBUG
8181
if (!stats) {
8282
jenkins_dbg(">> OUT OF MEM\n");
83-
while(1) ;
83+
while (1);
8484
;
8585
}
8686

@@ -106,7 +106,7 @@ static inline void pico_free(void *x)
106106
#ifdef MEMORY_MEASURE_ADV
107107
if ((stats->signature != 0xdeadbeef) || (x != stats->mem)) {
108108
jenkins_dbg(">> FREE ERROR: caller is %p\n", __builtin_return_address(0));
109-
while(1) ;
109+
while (1);
110110
;
111111
}
112112

include/arch/pico_msp430.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static inline void *pico_zalloc(size_t size)
2727
{
2828
void *ptr = malloc(size);
2929

30-
if(ptr)
30+
if (ptr)
3131
memset(ptr, 0u, size);
3232

3333
return ptr;

include/arch/pico_pic24.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#endif
2121

2222
/*
23-
#ifndef __PIC24FJ256GA106__
24-
#define __PIC24FJ256GA106__
25-
#endif
23+
#ifndef __PIC24FJ256GA106__
24+
#define __PIC24FJ256GA106__
25+
#endif
2626
*/
2727

2828
#ifndef PICO_MAX_SOCKET_FRAMES
@@ -59,7 +59,7 @@ static inline void pico_free(void *tgt)
5959
# define pico_free(x) free(x)
6060
#endif
6161

62-
extern void *pvPortMalloc( size_t xWantedSize );
62+
extern void *pvPortMalloc(size_t xWantedSize);
6363
extern volatile pico_time __pic24_tick;
6464

6565
static inline unsigned long PICO_TIME(void)
@@ -94,7 +94,7 @@ static inline void PICO_IDLE(void)
9494
TIMBASE_INT_E = 1;
9595
/* Doesn't matter that this call isn't interrupt safe, */
9696
/* we just check for the value to change */
97-
while(tick_now == __pic24_tick) ;
97+
while (tick_now == __pic24_tick);
9898
}
9999

100100
#endif

include/arch/pico_pic32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern volatile unsigned int pico_ms_tick;
2828
static inline void *pico_zalloc(size_t size)
2929
{
3030
void *ptr = malloc(size);
31-
if(ptr)
31+
if (ptr)
3232
memset(ptr, 0u, size);
3333

3434
return ptr;
@@ -47,7 +47,7 @@ static inline pico_time PICO_TIME(void)
4747
static inline void PICO_IDLE(void)
4848
{
4949
unsigned int now = pico_ms_tick;
50-
while(now == pico_ms_tick) ;
50+
while (now == pico_ms_tick);
5151
}
5252

5353
#endif /* PICO_PIC32 */

0 commit comments

Comments
 (0)