minimal: Allow to compile without defining MICROPY_HAL_H.

pull/1120/head
Damien George 2015-02-13 15:26:53 +00:00
rodzic ccf45a4283
commit 601c814603
6 zmienionych plików z 15 dodań i 9 usunięć

Wyświetl plik

@ -30,7 +30,9 @@
#include "py/mpstate.h"
#include "readline.h"
#ifdef MICROPY_HAL_H
#include MICROPY_HAL_H
#endif
#if 0 // print debugging info
#define DEBUG_PRINT (1)

Wyświetl plik

@ -9,7 +9,6 @@
#include "py/pfenv.h"
#include "py/gc.h"
#include "pyexec.h"
#include "pybstdio.h"
void do_str(const char *src) {
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);

Wyświetl plik

@ -65,6 +65,10 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
#include <alloca.h>
#define HAL_GetTick() 0
int mp_hal_stdin_rx_chr(void);
void mp_hal_stdout_tx_str(const char *str);
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len);
void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len);
static inline void mp_hal_set_interrupt_char(char c) {}

Wyświetl plik

@ -6,7 +6,7 @@
*/
// Receive single character
int stdin_rx_chr(void) {
int mp_hal_stdin_rx_chr(void) {
unsigned char c = 0;
#if MICROPY_MIN_USE_STDOUT
int r = read(0, &c, 1);
@ -16,7 +16,7 @@ int stdin_rx_chr(void) {
}
// Send string of given length
void stdout_tx_strn(const char *str, mp_uint_t len) {
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
#if MICROPY_MIN_USE_STDOUT
int r = write(1, str, len);
(void)r;

Wyświetl plik

@ -1,7 +1,6 @@
#include <string.h>
#include <unistd.h>
#include "py/mpconfig.h"
#include "pybstdio.h"
/*
* Extra UART functions
@ -11,16 +10,16 @@
// Send "cooked" string of length, where every occurance of
// LF character is replaced with CR LF.
void stdout_tx_strn_cooked(const char *str, mp_uint_t len) {
void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) {
while (len--) {
if (*str == '\n') {
stdout_tx_strn("\r", 1);
mp_hal_stdout_tx_strn("\r", 1);
}
stdout_tx_strn(str++, 1);
mp_hal_stdout_tx_strn(str++, 1);
}
}
// Send zero-terminated string
void stdout_tx_str(const char *str) {
stdout_tx_strn(str, strlen(str));
void mp_hal_stdout_tx_str(const char *str) {
mp_hal_stdout_tx_strn(str, strlen(str));
}

Wyświetl plik

@ -30,7 +30,9 @@
#include "py/obj.h"
#include "py/pfenv.h"
#ifdef MICROPY_HAL_H
#include MICROPY_HAL_H
#endif
#if MICROPY_PY_BUILTINS_FLOAT
#include "py/formatfloat.h"