Skip to content

Commit

Permalink
platform/ev3: Use common printf.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Jun 10, 2024
1 parent ca16393 commit d16a98f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bricks/ev3/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void debug(pb_hal_uart_t *uart, const char *s) {

void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
debug(&UART0, str);
MICROPY_EVENT_POLL_HOOK
// MICROPY_EVENT_POLL_HOOK
}

void mp_hal_stdout_tx_flush(void) {
Expand Down
22 changes: 3 additions & 19 deletions lib/pbio/platform/ev3/platform.c
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2024 The Pybricks Authors


#include <stdint.h>

typedef struct {
volatile uint8_t *thr;
volatile uint8_t *lsr;
} debug_uart_t;

// Sensor port 1
static debug_uart_t UART0 = { .thr = (volatile uint8_t *)0x01D0C000, .lsr = (volatile uint8_t *)0x01D0C014 };

static void debug(debug_uart_t *uart, const char *s) {
while (*s) {
while ((*uart->lsr & (1 << 5)) == 0) {
}
*uart->thr = *s++;
}
}
#include <stdio.h>

// Called from assembly code in startup.s. After this, the "main" function in
// lib/pbio/sys/main.c is called. That contains all calls to the driver
// initialization (low level in pbdrv, high level in pbio), and system level
// functions for running user code (currently a hardcoded MicroPython script).
void SystemInit(void) {
debug(&UART0, "System init in platform.c called from startup.s\n\n");
printf("System init in platform.c called from startup.s\n\n");

// TODO: TIAM1808 system init
}

0 comments on commit d16a98f

Please sign in to comment.