diff options
Diffstat (limited to 'testhal/STM32')
61 files changed, 142 insertions, 168 deletions
diff --git a/testhal/STM32/STM32F0xx/ADC/main.c b/testhal/STM32/STM32F0xx/ADC/main.c index 8b36522c5..00471e038 100644 --- a/testhal/STM32/STM32F0xx/ADC/main.c +++ b/testhal/STM32/STM32F0xx/ADC/main.c @@ -84,11 +84,11 @@ static const ADCConversionGroup adcgrpcfg2 = { * Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED4);
@@ -142,7 +142,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32SetCCR(0);
diff --git a/testhal/STM32/STM32F0xx/EXT/main.c b/testhal/STM32/STM32F0xx/EXT/main.c index 51844bbda..171983f00 100644 --- a/testhal/STM32/STM32F0xx/EXT/main.c +++ b/testhal/STM32/STM32F0xx/EXT/main.c @@ -89,7 +89,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F0xx/IRQ_STORM/main.c b/testhal/STM32/STM32F0xx/IRQ_STORM/main.c index 9127ac762..ef5e498a9 100644 --- a/testhal/STM32/STM32F0xx/IRQ_STORM/main.c +++ b/testhal/STM32/STM32F0xx/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -325,7 +325,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/PWM-ICU/main.c b/testhal/STM32/STM32F0xx/PWM-ICU/main.c index 084929b17..bf700e4f1 100644 --- a/testhal/STM32/STM32F0xx/PWM-ICU/main.c +++ b/testhal/STM32/STM32F0xx/PWM-ICU/main.c @@ -141,7 +141,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/SPI/main.c b/testhal/STM32/STM32F0xx/SPI/main.c index b0e4c1c3b..8e5fa0458 100644 --- a/testhal/STM32/STM32F0xx/SPI/main.c +++ b/testhal/STM32/STM32F0xx/SPI/main.c @@ -49,11 +49,11 @@ static uint8_t rxbuf[512]; * SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOC, GPIOC_LED4); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -63,18 +63,17 @@ static msg_t spi_thread_1(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOC, GPIOC_LED4); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,18 +83,17 @@ static msg_t spi_thread_2(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(blinker_wa, 128);
-static msg_t blinker(void *arg) {
+static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED3);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED3);
@@ -155,7 +153,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F0xx/UART/main.c b/testhal/STM32/STM32F0xx/UART/main.c index 2c7f79b34..363607890 100644 --- a/testhal/STM32/STM32F0xx/UART/main.c +++ b/testhal/STM32/STM32F0xx/UART/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F0xx/USB_CDC/main.c b/testhal/STM32/STM32F0xx/USB_CDC/main.c index 43ac2c294..2866b85ce 100644 --- a/testhal/STM32/STM32F0xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F0xx/USB_CDC/main.c @@ -438,11 +438,11 @@ static const ShellConfig shell_cfg1 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOC, GPIOC_LED_RED);
chThdSleepMilliseconds(time);
@@ -497,7 +497,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F1xx/ADC/main.c b/testhal/STM32/STM32F1xx/ADC/main.c index 6000aba83..ae54da840 100644 --- a/testhal/STM32/STM32F1xx/ADC/main.c +++ b/testhal/STM32/STM32F1xx/ADC/main.c @@ -95,13 +95,12 @@ static THD_FUNCTION(Thread1, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(500);
palSetPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -149,7 +148,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
adcStopConversion(&ADCD1);
chThdSleepMilliseconds(500);
diff --git a/testhal/STM32/STM32F1xx/CAN/main.c b/testhal/STM32/STM32F1xx/CAN/main.c index c24a74297..5fb0d6abb 100644 --- a/testhal/STM32/STM32F1xx/CAN/main.c +++ b/testhal/STM32/STM32F1xx/CAN/main.c @@ -48,7 +48,6 @@ static THD_FUNCTION(can_rx, p) { }
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
@@ -71,7 +70,6 @@ static THD_FUNCTION(can_tx, p) { canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -104,7 +102,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/EXT/main.c b/testhal/STM32/STM32F1xx/EXT/main.c index 6b6749a3d..2a6fa80a5 100644 --- a/testhal/STM32/STM32F1xx/EXT/main.c +++ b/testhal/STM32/STM32F1xx/EXT/main.c @@ -89,7 +89,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F1xx/I2C/main.c b/testhal/STM32/STM32F1xx/I2C/main.c index 67a5c0aab..36fb15ac5 100644 --- a/testhal/STM32/STM32F1xx/I2C/main.c +++ b/testhal/STM32/STM32F1xx/I2C/main.c @@ -42,14 +42,14 @@ static float acc[3]; */
static THD_WORKING_AREA(PollAccelThreadWA, 256);
static THD_FUNCTION(PollAccelThread, arg) {
- chRegSetThreadName("PollAccel");
+
(void)arg;
- while (TRUE) {
+ chRegSetThreadName("PollAccel");
+ while (true) {
osalThreadSleepMilliseconds(32);
lis3GetAcc(acc);
}
- return 0;
}
/*
@@ -57,14 +57,14 @@ static THD_FUNCTION(PollAccelThread, arg) { */
static THD_WORKING_AREA(PollFakeThreadWA, 256);
static THD_FUNCTION(PollFakeThread, arg) {
- chRegSetThreadName("PollFake");
+
(void)arg;
- while (TRUE) {
+ chRegSetThreadName("PollFake");
+ while (true) {
osalThreadSleepMilliseconds(16);
request_fake();
}
- return 0;
}
/*
@@ -103,7 +103,7 @@ int main(void) { NULL);
/* main loop handles LED */
- while (TRUE) {
+ while (true) {
if (sqrtf(acc[0]*acc[0] + acc[1]*acc[1]) > 0.5)
palClearPad(IOPORT3, GPIOC_LED); /* on */
else
diff --git a/testhal/STM32/STM32F1xx/IRQ_STORM/main.c b/testhal/STM32/STM32F1xx/IRQ_STORM/main.c index d4f06cf8b..1cc385d86 100644 --- a/testhal/STM32/STM32F1xx/IRQ_STORM/main.c +++ b/testhal/STM32/STM32F1xx/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -327,7 +327,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F1xx/PWM-ICU/main.c b/testhal/STM32/STM32F1xx/PWM-ICU/main.c index 52d66c850..d19819da0 100644 --- a/testhal/STM32/STM32F1xx/PWM-ICU/main.c +++ b/testhal/STM32/STM32F1xx/PWM-ICU/main.c @@ -137,7 +137,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/RTC/main.c b/testhal/STM32/STM32F1xx/RTC/main.c index b43362453..573a31569 100644 --- a/testhal/STM32/STM32F1xx/RTC/main.c +++ b/testhal/STM32/STM32F1xx/RTC/main.c @@ -30,7 +30,7 @@ RTCAlarm alarmspec; static THD_WORKING_AREA(blinkWA, 128); static THD_FUNCTION(blink_thd, arg) { (void)arg; - while (TRUE) { + while (true) { chThdSleepMilliseconds(100); palTogglePad(GPIOC, GPIOC_LED); } @@ -57,7 +57,7 @@ int main(void) { alarmspec.tv_sec = tv_sec + 20; rtcSetAlarm(&RTCD1, 0, &alarmspec); - while (TRUE){ + while (true){ chThdSleepSeconds(10); /* going to anabiosis*/ @@ -138,7 +138,7 @@ int main(void) { rtcSetCallback(&RTCD1, my_cb); - while (TRUE){ + while (true){ /* Wait until alarm callback signaled semaphore.*/ status = chBSemWaitTimeout(&alarm_sem, S2ST(RTC_ALARMPERIOD + 5)); diff --git a/testhal/STM32/STM32F1xx/SPI/main.c b/testhal/STM32/STM32F1xx/SPI/main.c index 5c55ccd45..ff8ea72fa 100644 --- a/testhal/STM32/STM32F1xx/SPI/main.c +++ b/testhal/STM32/STM32F1xx/SPI/main.c @@ -52,7 +52,7 @@ static THD_FUNCTION(spi_thread_1, p) { (void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palClearPad(IOPORT3, GPIOC_LED); /* LED ON. */
spiStart(&SPID1, &hs_spicfg); /* Setup transfer parameters. */
@@ -62,7 +62,6 @@ static THD_FUNCTION(spi_thread_1, p) { spiUnselect(&SPID1); /* Slave Select de-assertion. */
spiReleaseBus(&SPID1); /* Ownership release. */
}
- return 0;
}
/*
@@ -74,7 +73,7 @@ static THD_FUNCTION(spi_thread_2, p) { (void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palSetPad(IOPORT3, GPIOC_LED); /* LED OFF. */
spiStart(&SPID1, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,7 +83,6 @@ static THD_FUNCTION(spi_thread_2, p) { spiUnselect(&SPID1); /* Slave Select de-assertion. */
spiReleaseBus(&SPID1); /* Ownership release. */
}
- return 0;
}
/*
@@ -129,7 +127,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/UART/main.c b/testhal/STM32/STM32F1xx/UART/main.c index 36b26d385..b77c09df9 100644 --- a/testhal/STM32/STM32F1xx/UART/main.c +++ b/testhal/STM32/STM32F1xx/UART/main.c @@ -138,7 +138,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F1xx/USB_CDC/main.c b/testhal/STM32/STM32F1xx/USB_CDC/main.c index da03352bd..eae64e0b5 100644 --- a/testhal/STM32/STM32F1xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F1xx/USB_CDC/main.c @@ -441,8 +441,9 @@ static THD_WORKING_AREA(waThread1, 128); static THD_FUNCTION(Thread1, arg) {
(void)arg;
+
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(IOPORT3, GPIOC_LED);
chThdSleepMilliseconds(time);
@@ -497,7 +498,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c b/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c index 0e4602b2c..3394dbe1b 100644 --- a/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c +++ b/testhal/STM32/STM32F1xx/USB_CDC_F107/main.c @@ -442,7 +442,7 @@ static msg_t Thread1(void *arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(IOPORT3, GPIOC_LED_STATUS1);
chThdSleepMilliseconds(time);
@@ -497,7 +497,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminated(shelltp)) {
diff --git a/testhal/STM32/STM32F30x/ADC/main.c b/testhal/STM32/STM32F30x/ADC/main.c index 046757687..0686becb7 100644 --- a/testhal/STM32/STM32F30x/ADC/main.c +++ b/testhal/STM32/STM32F30x/ADC/main.c @@ -105,17 +105,16 @@ static const ADCConversionGroup adcgrpcfg2 = { * Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -163,7 +162,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F30x/ADC_DUAL/main.c b/testhal/STM32/STM32F30x/ADC_DUAL/main.c index 98fc6dd72..b77e267b2 100644 --- a/testhal/STM32/STM32F30x/ADC_DUAL/main.c +++ b/testhal/STM32/STM32F30x/ADC_DUAL/main.c @@ -129,17 +129,16 @@ static const ADCConversionGroup adcgrpcfg2 = { * Red LEDs blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED10_RED);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -187,7 +186,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F30x/CAN/main.c b/testhal/STM32/STM32F30x/CAN/main.c index a1f281cf9..e9511c17b 100644 --- a/testhal/STM32/STM32F30x/CAN/main.c +++ b/testhal/STM32/STM32F30x/CAN/main.c @@ -31,7 +31,7 @@ static const CANConfig cancfg = { * Receiver thread.
*/
static THD_WORKING_AREA(can_rx_wa, 256);
-static msg_t can_rx(void *p) {
+static THD_FUNCTION(can_rx, p) {
event_listener_t el;
CANRxFrame rxmsg;
@@ -47,14 +47,13 @@ static msg_t can_rx(void *p) { }
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
* Transmitter thread.
*/
static THD_WORKING_AREA(can_tx_wa, 256);
-static msg_t can_tx(void * p) {
+static THD_FUNCTION(can_tx, p) {
CANTxFrame txmsg;
(void)p;
@@ -70,7 +69,6 @@ static msg_t can_tx(void * p) { canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -102,7 +100,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/EXT/main.c b/testhal/STM32/STM32F30x/EXT/main.c index a8800a141..c905da39f 100644 --- a/testhal/STM32/STM32F30x/EXT/main.c +++ b/testhal/STM32/STM32F30x/EXT/main.c @@ -93,7 +93,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F30x/IRQ_STORM/main.c b/testhal/STM32/STM32F30x/IRQ_STORM/main.c index 2472d0a75..09d922afe 100644 --- a/testhal/STM32/STM32F30x/IRQ_STORM/main.c +++ b/testhal/STM32/STM32F30x/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -329,7 +329,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F30x/PWM-ICU/main.c b/testhal/STM32/STM32F30x/PWM-ICU/main.c index d1bc47e5f..ee9f8a8d2 100644 --- a/testhal/STM32/STM32F30x/PWM-ICU/main.c +++ b/testhal/STM32/STM32F30x/PWM-ICU/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/SPI/main.c b/testhal/STM32/STM32F30x/SPI/main.c index b7e6398b2..62610dfa5 100644 --- a/testhal/STM32/STM32F30x/SPI/main.c +++ b/testhal/STM32/STM32F30x/SPI/main.c @@ -49,11 +49,11 @@ static uint8_t rxbuf[512]; * SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOE, GPIOE_LED10_RED); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -63,18 +63,17 @@ static msg_t spi_thread_1(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOE, GPIOE_LED10_RED);/* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,18 +83,17 @@ static msg_t spi_thread_2(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(blinker_wa, 128);
-static msg_t blinker(void *arg) {
+static THD_FUNCTION(blinker, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(500);
palClearPad(GPIOE, GPIOE_LED3_RED);
@@ -155,7 +153,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F30x/UART/main.c b/testhal/STM32/STM32F30x/UART/main.c index 68a9e31c6..35d48f70b 100644 --- a/testhal/STM32/STM32F30x/UART/main.c +++ b/testhal/STM32/STM32F30x/UART/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F30x/USB_CDC/main.c b/testhal/STM32/STM32F30x/USB_CDC/main.c index 834a9c2c6..c40a82cb1 100644 --- a/testhal/STM32/STM32F30x/USB_CDC/main.c +++ b/testhal/STM32/STM32F30x/USB_CDC/main.c @@ -445,11 +445,11 @@ static const ShellConfig shell_cfg1 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(time);
@@ -504,7 +504,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c b/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c index b3d664317..bada16558 100644 --- a/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c +++ b/testhal/STM32/STM32F30x/USB_CDC_IAD/main.c @@ -154,11 +154,11 @@ static const ShellConfig shell_cfg2 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg1.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOE, GPIOE_LED3_RED);
chThdSleepMilliseconds(time);
@@ -216,7 +216,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp1 && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp1)) {
diff --git a/testhal/STM32/STM32F37x/ADC/main.c b/testhal/STM32/STM32F37x/ADC/main.c index fb6f5c8f4..063683a3d 100644 --- a/testhal/STM32/STM32F37x/ADC/main.c +++ b/testhal/STM32/STM32F37x/ADC/main.c @@ -111,13 +111,12 @@ static THD_FUNCTION(Thread1, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -163,7 +162,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON)) {
adcStopConversion(&ADCD1);
}
diff --git a/testhal/STM32/STM32F37x/CAN/main.c b/testhal/STM32/STM32F37x/CAN/main.c index 21da0b697..5b50a102e 100644 --- a/testhal/STM32/STM32F37x/CAN/main.c +++ b/testhal/STM32/STM32F37x/CAN/main.c @@ -47,7 +47,6 @@ static THD_FUNCTION(can_rx, p) { }
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
@@ -70,7 +69,6 @@ static THD_FUNCTION(can_tx, p) { canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -102,7 +100,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/EXT/main.c b/testhal/STM32/STM32F37x/EXT/main.c index 296478d84..3ce6a34f3 100644 --- a/testhal/STM32/STM32F37x/EXT/main.c +++ b/testhal/STM32/STM32F37x/EXT/main.c @@ -91,7 +91,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F37x/I2C/main.c b/testhal/STM32/STM32F37x/I2C/main.c index 92a7c0ab9..5eb3dcbaa 100644 --- a/testhal/STM32/STM32F37x/I2C/main.c +++ b/testhal/STM32/STM32F37x/I2C/main.c @@ -50,13 +50,12 @@ static THD_FUNCTION(blinker, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -88,7 +87,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
unsigned i;
msg_t msg;
static const uint8_t cmd[] = {0, 0};
diff --git a/testhal/STM32/STM32F37x/IRQ_STORM/main.c b/testhal/STM32/STM32F37x/IRQ_STORM/main.c index 34ae66902..f7a2fd642 100644 --- a/testhal/STM32/STM32F37x/IRQ_STORM/main.c +++ b/testhal/STM32/STM32F37x/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -328,7 +328,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F37x/PWM-ICU/main.c b/testhal/STM32/STM32F37x/PWM-ICU/main.c index 5188ad9b3..bb23765d2 100644 --- a/testhal/STM32/STM32F37x/PWM-ICU/main.c +++ b/testhal/STM32/STM32F37x/PWM-ICU/main.c @@ -134,7 +134,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/SDADC/main.c b/testhal/STM32/STM32F37x/SDADC/main.c index 2abf339b3..1285a5793 100644 --- a/testhal/STM32/STM32F37x/SDADC/main.c +++ b/testhal/STM32/STM32F37x/SDADC/main.c @@ -108,13 +108,12 @@ static THD_FUNCTION(Thread1, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -156,7 +155,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON)) {
adcStopConversion(&SDADCD1);
}
diff --git a/testhal/STM32/STM32F37x/SPI/main.c b/testhal/STM32/STM32F37x/SPI/main.c index f15de5a1f..a2de89200 100644 --- a/testhal/STM32/STM32F37x/SPI/main.c +++ b/testhal/STM32/STM32F37x/SPI/main.c @@ -54,7 +54,7 @@ static THD_FUNCTION(spi_thread_1, p) { (void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOC, GPIOC_LED2); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -64,7 +64,6 @@ static THD_FUNCTION(spi_thread_1, p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -76,7 +75,7 @@ static THD_FUNCTION(spi_thread_2, p) { (void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOC, GPIOC_LED2); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -86,7 +85,6 @@ static THD_FUNCTION(spi_thread_2, p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -99,7 +97,7 @@ static THD_FUNCTION(blinker, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED1);
@@ -154,7 +152,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F37x/UART/main.c b/testhal/STM32/STM32F37x/UART/main.c index dc1a80b58..5ce33d16d 100644 --- a/testhal/STM32/STM32F37x/UART/main.c +++ b/testhal/STM32/STM32F37x/UART/main.c @@ -134,7 +134,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F37x/USB_CDC/main.c b/testhal/STM32/STM32F37x/USB_CDC/main.c index 516181b64..9eea7d19c 100644 --- a/testhal/STM32/STM32F37x/USB_CDC/main.c +++ b/testhal/STM32/STM32F37x/USB_CDC/main.c @@ -449,7 +449,7 @@ static THD_FUNCTION(Thread1, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(time);
@@ -504,7 +504,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/ADC/main.c b/testhal/STM32/STM32F4xx/ADC/main.c index 6b2c9846d..7a1cd59a7 100644 --- a/testhal/STM32/STM32F4xx/ADC/main.c +++ b/testhal/STM32/STM32F4xx/ADC/main.c @@ -92,11 +92,11 @@ static const ADCConversionGroup adcgrpcfg2 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED5);
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED5);
@@ -150,7 +150,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32DisableTSVREFE();
diff --git a/testhal/STM32/STM32F4xx/CAN/main.c b/testhal/STM32/STM32F4xx/CAN/main.c index ebdaf2fab..b7ae9dc79 100644 --- a/testhal/STM32/STM32F4xx/CAN/main.c +++ b/testhal/STM32/STM32F4xx/CAN/main.c @@ -41,7 +41,7 @@ static const CANConfig cancfg = { */
static THD_WORKING_AREA(can_rx1_wa, 256);
static THD_WORKING_AREA(can_rx2_wa, 256);
-static msg_t can_rx(void *p) {
+static THD_FUNCTION(can_rx, p) {
struct can_instance *cip = p;
event_listener_t el;
CANRxFrame rxmsg;
@@ -59,14 +59,13 @@ static msg_t can_rx(void *p) { }
}
chEvtUnregister(&CAND1.rxfull_event, &el);
- return 0;
}
/*
* Transmitter thread.
*/
static THD_WORKING_AREA(can_tx_wa, 256);
-static msg_t can_tx(void * p) {
+static THD_FUNCTION(can_tx, p) {
CANTxFrame txmsg;
(void)p;
@@ -83,7 +82,6 @@ static msg_t can_tx(void * p) { canTransmit(&CAND2, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
- return 0;
}
/*
@@ -120,7 +118,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/DAC/main.c b/testhal/STM32/STM32F4xx/DAC/main.c index 62f9a2c6f..8049ce958 100644 --- a/testhal/STM32/STM32F4xx/DAC/main.c +++ b/testhal/STM32/STM32F4xx/DAC/main.c @@ -36,7 +36,7 @@ int main(void) { * Normal main() thread activity, if the button is pressed then the I2s
* transfer is stopped.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/DMA_STORM/main.c b/testhal/STM32/STM32F4xx/DMA_STORM/main.c index 05265aa38..d119613f9 100644 --- a/testhal/STM32/STM32F4xx/DMA_STORM/main.c +++ b/testhal/STM32/STM32F4xx/DMA_STORM/main.c @@ -82,7 +82,7 @@ static void tmo(void *p) { static THD_WORKING_AREA(waSPI1, 1024);
static THD_WORKING_AREA(waSPI2, 1024);
static THD_WORKING_AREA(waSPI3, 1024);
-static msg_t spi_thread(void *p) {
+static THD_FUNCTION(spi_thread, p) {
unsigned i;
SPIDriver *spip = (SPIDriver *)p;
virtual_timer_t vt;
@@ -96,7 +96,7 @@ static msg_t spi_thread(void *p) { txbuf[i] = (uint8_t)i;
/* Continuous transmission.*/
- while (TRUE) {
+ while (true) {
/* Starts a VT working as watchdog to catch a malfunction in the SPI
driver.*/
chVTSet(&vt, MS2ST(10), tmo, NULL);
@@ -113,11 +113,11 @@ static msg_t spi_thread(void *p) { * a LED.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED3); /* Orange. */
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED3); /* Orange. */
@@ -173,7 +173,7 @@ int main(void) { /* Normal main() thread activity, it does continues memory copy operations
using 2 DMA streams at the lowest priority.*/
- while (TRUE) {
+ while (true) {
virtual_timer_t vt;
chVTObjectInit(&vt);
diff --git a/testhal/STM32/STM32F4xx/EXT/main.c b/testhal/STM32/STM32F4xx/EXT/main.c index 66e41c3a9..e85774cc6 100644 --- a/testhal/STM32/STM32F4xx/EXT/main.c +++ b/testhal/STM32/STM32F4xx/EXT/main.c @@ -91,7 +91,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F4xx/GPT/main.c b/testhal/STM32/STM32F4xx/GPT/main.c index a1d6fd007..e58f7e0a1 100644 --- a/testhal/STM32/STM32F4xx/GPT/main.c +++ b/testhal/STM32/STM32F4xx/GPT/main.c @@ -85,7 +85,7 @@ int main(void) { * Normal main() thread activity, it changes the GPT1 period every
* five seconds.
*/
- while (TRUE) {
+ while (true) {
palSetPad(GPIOD, GPIOD_LED4);
gptStartContinuous(&GPTD4, 5000);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32F4xx/I2C/main.c b/testhal/STM32/STM32F4xx/I2C/main.c index e7ccffb57..8b3369e75 100644 --- a/testhal/STM32/STM32F4xx/I2C/main.c +++ b/testhal/STM32/STM32F4xx/I2C/main.c @@ -150,7 +150,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
palTogglePad(GPIOB, GPIOB_LED_B);
chThdSleepMilliseconds(100);
diff --git a/testhal/STM32/STM32F4xx/I2S/main.c b/testhal/STM32/STM32F4xx/I2S/main.c index b27861411..21895f7d3 100644 --- a/testhal/STM32/STM32F4xx/I2S/main.c +++ b/testhal/STM32/STM32F4xx/I2S/main.c @@ -70,7 +70,7 @@ int main(void) { * Normal main() thread activity, if the button is pressed then the I2s
* transfer is stopped.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON))
i2sStopExchange(&I2SD2);
chThdSleepMilliseconds(500);
diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM/main.c b/testhal/STM32/STM32F4xx/IRQ_STORM/main.c index 0b5ae9c00..e863910c3 100644 --- a/testhal/STM32/STM32F4xx/IRQ_STORM/main.c +++ b/testhal/STM32/STM32F4xx/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -328,7 +328,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c index d3cce8724..4f8d5e8bb 100644 --- a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c +++ b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c @@ -45,7 +45,7 @@ static bool saturated; * Test worker thread.
*/
static THD_WORKING_AREA(waWorkerThread, 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
(void)arg;
@@ -67,7 +67,7 @@ static msg_t WorkerThread(void *arg) { * Test periodic thread.
*/
static THD_WORKING_AREA(waPeriodicThread, 128);
-static msg_t PeriodicThread(void *arg) {
+static THD_FUNCTION(PeriodicThread, arg) {
(void)arg;
@@ -307,7 +307,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32F4xx/PWM-ICU/main.c b/testhal/STM32/STM32F4xx/PWM-ICU/main.c index adadbcc57..3f288fce3 100644 --- a/testhal/STM32/STM32F4xx/PWM-ICU/main.c +++ b/testhal/STM32/STM32F4xx/PWM-ICU/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/RTC/main.c b/testhal/STM32/STM32F4xx/RTC/main.c index 1c2b60082..5a5a85f19 100644 --- a/testhal/STM32/STM32F4xx/RTC/main.c +++ b/testhal/STM32/STM32F4xx/RTC/main.c @@ -52,11 +52,10 @@ static time_t unix_time; static THD_WORKING_AREA(blinkWA, 128);
static THD_FUNCTION(blink_thd, arg){
(void)arg;
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(100);
palTogglePad(GPIOB, GPIOB_LED_R);
}
- return 0;
}
/*
@@ -282,7 +281,7 @@ int main(void){ shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
/* wait until user do not want to test wakeup */
- while (TRUE){
+ while (true){
osalThreadSleepMilliseconds(200);
}
#endif /* WAKEUP_TEST */
diff --git a/testhal/STM32/STM32F4xx/SDC/main.c b/testhal/STM32/STM32F4xx/SDC/main.c index 8d6bb9767..ac7be48ee 100644 --- a/testhal/STM32/STM32F4xx/SDC/main.c +++ b/testhal/STM32/STM32F4xx/SDC/main.c @@ -39,11 +39,11 @@ static const SDCConfig sdccfg = { * LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOC, GPIOC_LED);
chThdSleepMilliseconds(500);
palClearPad(GPIOC, GPIOC_LED);
@@ -295,7 +295,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp)
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/SPI/main.c b/testhal/STM32/STM32F4xx/SPI/main.c index fd18555ae..59464a0fd 100644 --- a/testhal/STM32/STM32F4xx/SPI/main.c +++ b/testhal/STM32/STM32F4xx/SPI/main.c @@ -47,11 +47,11 @@ static uint8_t rxbuf[512]; * SPI bus contender 1.
*/
static THD_WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOD, GPIOD_LED5); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -61,18 +61,17 @@ static msg_t spi_thread_1(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
* SPI bus contender 2.
*/
static THD_WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOD, GPIOD_LED5); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -82,7 +81,6 @@ static msg_t spi_thread_2(void *p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -131,7 +129,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32F4xx/UART/main.c b/testhal/STM32/STM32F4xx/UART/main.c index 44ba350ce..aea045c89 100644 --- a/testhal/STM32/STM32F4xx/UART/main.c +++ b/testhal/STM32/STM32F4xx/UART/main.c @@ -144,7 +144,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
/*
* Starts both a transmission and a receive operations, both will be
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/main.c b/testhal/STM32/STM32F4xx/USB_CDC/main.c index 938ffaa8a..fcd346160 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/main.c @@ -438,7 +438,7 @@ static const ShellConfig shell_cfg1 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
@@ -510,7 +510,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp && (SDU2.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp)) {
diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c index b8a75106a..7827acf47 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c +++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c @@ -147,7 +147,7 @@ static const ShellConfig shell_cfg2 = { * Red LED blinker thread, times are in milliseconds.
*/
static THD_WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
@@ -211,7 +211,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
- while (TRUE) {
+ while (true) {
if (!shelltp1 && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
else if (chThdTerminatedX(shelltp1)) {
diff --git a/testhal/STM32/STM32L1xx/ADC/main.c b/testhal/STM32/STM32L1xx/ADC/main.c index d00652432..9ca096a51 100644 --- a/testhal/STM32/STM32L1xx/ADC/main.c +++ b/testhal/STM32/STM32L1xx/ADC/main.c @@ -100,7 +100,7 @@ static THD_FUNCTION(Thread1, arg) { (void)arg;
chRegSetThreadName("blinker");
- while (TRUE) {
+ while (true) {
palSetPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOB, GPIOB_LED4);
@@ -154,7 +154,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32DisableTSVREFE();
diff --git a/testhal/STM32/STM32L1xx/EXT/main.c b/testhal/STM32/STM32L1xx/EXT/main.c index cae04dfb7..26ea0359c 100644 --- a/testhal/STM32/STM32L1xx/EXT/main.c +++ b/testhal/STM32/STM32L1xx/EXT/main.c @@ -89,7 +89,7 @@ int main(void) { * Normal main() thread activity, in this demo it enables and disables the
* button EXT channel using 5 seconds intervals.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
extChannelDisable(&EXTD1, 0);
chThdSleepMilliseconds(5000);
diff --git a/testhal/STM32/STM32L1xx/IRQ_STORM/main.c b/testhal/STM32/STM32L1xx/IRQ_STORM/main.c index 675e94699..3d3ea3a1f 100644 --- a/testhal/STM32/STM32L1xx/IRQ_STORM/main.c +++ b/testhal/STM32/STM32L1xx/IRQ_STORM/main.c @@ -58,7 +58,7 @@ static msg_t b[NUM_THREADS][MAILBOX_SIZE]; * Test worker threads.
*/
static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
-static msg_t WorkerThread(void *arg) {
+static THD_FUNCTION(WorkerThread, arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
unsigned me = (unsigned)arg;
@@ -69,7 +69,7 @@ static msg_t WorkerThread(void *arg) { chRegSetThreadName("worker");
/* Work loop.*/
- while (TRUE) {
+ while (true) {
/* Waiting for a message.*/
chMBFetch(&mb[me], &msg, TIME_INFINITE);
@@ -329,7 +329,7 @@ int main(void) { /*
* Normal main() thread activity, nothing in this test.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(5000);
}
}
diff --git a/testhal/STM32/STM32L1xx/PWM-ICU/main.c b/testhal/STM32/STM32L1xx/PWM-ICU/main.c index b70b06435..610b90912 100644 --- a/testhal/STM32/STM32L1xx/PWM-ICU/main.c +++ b/testhal/STM32/STM32L1xx/PWM-ICU/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32L1xx/SPI/main.c b/testhal/STM32/STM32L1xx/SPI/main.c index 3ba87936a..287597da6 100644 --- a/testhal/STM32/STM32L1xx/SPI/main.c +++ b/testhal/STM32/STM32L1xx/SPI/main.c @@ -52,7 +52,7 @@ static THD_FUNCTION(spi_thread_1, p) { (void)p;
chRegSetThreadName("SPI thread 1");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palSetPad(GPIOB, GPIOB_LED4); /* LED ON. */
spiStart(&SPID2, &hs_spicfg); /* Setup transfer parameters. */
@@ -62,7 +62,6 @@ static THD_FUNCTION(spi_thread_1, p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -74,7 +73,7 @@ static THD_FUNCTION(spi_thread_2, p) { (void)p;
chRegSetThreadName("SPI thread 2");
- while (TRUE) {
+ while (true) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
palClearPad(GPIOB, GPIOB_LED4); /* LED OFF. */
spiStart(&SPID2, &ls_spicfg); /* Setup transfer parameters. */
@@ -84,7 +83,6 @@ static THD_FUNCTION(spi_thread_2, p) { spiUnselect(&SPID2); /* Slave Select de-assertion. */
spiReleaseBus(&SPID2); /* Ownership release. */
}
- return 0;
}
/*
@@ -132,7 +130,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
return 0;
diff --git a/testhal/STM32/STM32L1xx/UART/main.c b/testhal/STM32/STM32L1xx/UART/main.c index 106f246d5..04b40d752 100644 --- a/testhal/STM32/STM32L1xx/UART/main.c +++ b/testhal/STM32/STM32L1xx/UART/main.c @@ -136,7 +136,7 @@ int main(void) { /*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
|