aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F4xx')
-rw-r--r--testhal/STM32/STM32F4xx/ADC/main.c6
-rw-r--r--testhal/STM32/STM32F4xx/CAN/main.c8
-rw-r--r--testhal/STM32/STM32F4xx/DAC/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/DMA_STORM/main.c10
-rw-r--r--testhal/STM32/STM32F4xx/EXT/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/GPT/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/I2C/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/I2S/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/IRQ_STORM/main.c6
-rw-r--r--testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c6
-rw-r--r--testhal/STM32/STM32F4xx/PWM-ICU/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/RTC/main.c5
-rw-r--r--testhal/STM32/STM32F4xx/SDC/main.c6
-rw-r--r--testhal/STM32/STM32F4xx/SPI/main.c12
-rw-r--r--testhal/STM32/STM32F4xx/UART/main.c2
-rw-r--r--testhal/STM32/STM32F4xx/USB_CDC/main.c4
-rw-r--r--testhal/STM32/STM32F4xx/USB_CDC_IAD/main.c4
17 files changed, 38 insertions, 43 deletions
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)) {