add REPL via bleuart
This commit is contained in:
parent
fda065ea89
commit
5e6f113779
|
@ -25,7 +25,7 @@ MEMORY
|
|||
FLASH_ISR (rx) : ORIGIN = 0x0001c000, LENGTH = 0x001000 /* sector 0, 4 KiB */
|
||||
FLASH_TEXT (rx) : ORIGIN = 0x0001d000, LENGTH = 0x03C000 /* APP - ISR, 240 KiB */
|
||||
FLASH_FATFS (r) : ORIGIN = 0x00059000, LENGTH = 0x019000 /* File system 100KB KB */
|
||||
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
|
||||
RAM (xrw) : ORIGIN = 0x20003000, LENGTH = 0x0D000 /* 52 KiB, give 8KiB headroom for softdevice */
|
||||
}
|
||||
|
||||
/* produce a link error if there is not this amount of RAM for these sections */
|
||||
|
|
|
@ -105,6 +105,10 @@ int mp_hal_stdin_rx_chr(void) {
|
|||
return (int)byte;
|
||||
}
|
||||
|
||||
bool mp_hal_stdin_any(void) {
|
||||
return !isBufferEmpty(mp_rx_ring_buffer);
|
||||
}
|
||||
|
||||
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
|
||||
uint8_t *buf = (uint8_t *)str;
|
||||
size_t send_len;
|
||||
|
|
|
@ -32,15 +32,18 @@
|
|||
#include "pins.h"
|
||||
#include "hal_uart.h"
|
||||
|
||||
void serial_init(void) {
|
||||
// uart_init0();
|
||||
//
|
||||
// mp_obj_t args[2] = {
|
||||
// MP_OBJ_NEW_SMALL_INT(0),
|
||||
// MP_OBJ_NEW_SMALL_INT(115200),
|
||||
// };
|
||||
// MP_STATE_PORT(pyb_stdio_uart) = machine_hard_uart_type.make_new((mp_obj_t)&machine_hard_uart_type, MP_ARRAY_SIZE(args), 0, args);
|
||||
#if (MICROPY_PY_BLE_NUS)
|
||||
#include "ble_uart.h"
|
||||
#endif
|
||||
|
||||
void serial_init(void) {
|
||||
|
||||
#if MICROPY_PY_BLE_NUS
|
||||
ble_uart_init0();
|
||||
while (!ble_uart_enabled()) {
|
||||
;
|
||||
}
|
||||
#else
|
||||
hal_uart_init_t param =
|
||||
{
|
||||
.id = 0,
|
||||
|
@ -56,6 +59,7 @@ void serial_init(void) {
|
|||
};
|
||||
|
||||
hal_uart_init( UART_BASE(0), ¶m);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue