aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F0xx/SPI/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F0xx/SPI/main.c')
-rw-r--r--testhal/STM32/STM32F0xx/SPI/main.c16
1 files changed, 7 insertions, 9 deletions
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;