aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F1xx
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F1xx')
-rw-r--r--testhal/STM32/STM32F1xx/ADC/main.c5
-rw-r--r--testhal/STM32/STM32F1xx/CAN/main.c4
-rw-r--r--testhal/STM32/STM32F1xx/EXT/main.c2
-rw-r--r--testhal/STM32/STM32F1xx/I2C/main.c14
-rw-r--r--testhal/STM32/STM32F1xx/IRQ_STORM/main.c6
-rw-r--r--testhal/STM32/STM32F1xx/PWM-ICU/main.c2
-rw-r--r--testhal/STM32/STM32F1xx/RTC/main.c6
-rw-r--r--testhal/STM32/STM32F1xx/SPI/main.c8
-rw-r--r--testhal/STM32/STM32F1xx/UART/main.c2
-rw-r--r--testhal/STM32/STM32F1xx/USB_CDC/main.c5
-rw-r--r--testhal/STM32/STM32F1xx/USB_CDC_F107/main.c4
11 files changed, 27 insertions, 31 deletions
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)) {