Skip to content

Commit

Permalink
fixup! cpu/efm32: implement periph_timer_periodic for series 0/1
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Jan 18, 2024
1 parent bf43287 commit 35b1a6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
14 changes: 5 additions & 9 deletions tests/periph/uart_locate_pins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ INCLUDES += -I$(abspath $(CURDIR))/include
include ../Makefile.periph_common

USEMODULE += soft_uart
USEMODULE += fmt
# we do not need stdio
USEMODULE += stdio_null

include $(RIOTBASE)/Makefile.include
# We do not need multi-threading for this app
DISBALE_MODULE += core_thread

ifneq ($(MCU),esp32)
# We only need 1 thread (+ the Idle thread on some platforms) and we really
# want this app working on all boards.
CFLAGS += -DMAXTHREADS=2
else
# ESP32x SoCs uses an extra thread for esp_timer
CFLAGS += -DMAXTHREADS=3
endif
include $(RIOTBASE)/Makefile.include
25 changes: 18 additions & 7 deletions tests/periph/uart_locate_pins/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
*
* @}
*/
#include <stdio.h>
#include <stdint.h>

#include "container.h"
#include "fmt.h"
#include "macros/units.h"
#include "periph/gpio.h"
#include "periph/timer.h"
Expand All @@ -34,8 +35,8 @@
* pins, e.g. pins connected to crystals, etc. may not react friendly to be
* used as output */
static const struct {
unsigned port_num;
unsigned pin_num;
uint8_t port_num;
uint8_t pin_num;
} pins[] = {
{
.port_num = 0,
Expand All @@ -60,10 +61,20 @@ int main(void)
soft_uart_config[0].tx_pin = pin;
soft_uart_init(0, UART_SYMBOL_RATE, NULL, NULL);
static char buf[32];
size_t len = snprintf(buf, sizeof(buf), "P%u.%u / P%c%u\n",
pins[i].port_num, pins[i].pin_num,
(int)'A' + (int)pins[i].port_num, pins[i].pin_num);
soft_uart_write(0, (void *)buf, len);
char *pos = buf;
*pos++ = 'P';
pos += fmt_u16_dec(pos, pins[i].port_num);
*pos++ = '.';
pos += fmt_u16_dec(pos, pins[i].pin_num);
*pos++ = ' ';
*pos++ = '/';
*pos++ = ' ';
*pos++ = 'P';
*pos++ = (char)((int)'A' + (int)pins[i].port_num);
pos += fmt_u16_dec(pos, pins[i].pin_num);
*pos++ = '\n';

soft_uart_write(0, (void *)buf, (size_t)pos - (size_t)buf);
soft_uart_poweroff(0);
}
}
Expand Down

0 comments on commit 35b1a6c

Please sign in to comment.