瀏覽代碼

【修复】: micropython 串口缺少类型的问题

SummerGift 7 年之前
父節點
當前提交
21f685f0c4
共有 2 個文件被更改,包括 10 次插入8 次删除
  1. 7 0
      port/machine_uart.c
  2. 3 8
      port/machine_uart.h

+ 7 - 0
port/machine_uart.c

@@ -36,6 +36,13 @@
 #include <stdarg.h>
 #include "machine_uart.h"
 
+STATIC const mp_obj_type_t machine_uart_type;
+
+typedef struct _machine_uart_obj_t {
+    mp_obj_base_t base;
+    struct rt_serial_device *uart_device;
+}machine_uart_obj_t;
+
 STATIC void machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
     machine_uart_obj_t *self = (machine_uart_obj_t*) self_in;
     mp_printf(print, "uart( device port : %s,baud_rate = %d, data_bits = %d, parity = %d, stop_bits = %d )",

+ 3 - 8
port/machine_uart.h

@@ -24,18 +24,13 @@
  * THE SOFTWARE.
  */
 
-#ifndef _MACHINE_UART_H
-#define _MACHINE_UART_H
+#ifndef MICROPY_INCLUDED_MACHINE_UART_H
+#define MICROPY_INCLUDED_MACHINE_UART_H
 
 #include "py/obj.h"
 #include <rtthread.h>
 
-typedef struct _machine_uart_obj_t {
-    mp_obj_base_t base;
-    struct rt_serial_device *uart_device;
-};
-
 extern const mp_obj_type_t machine_uart_type;
-typedef struct _machine_uart_obj_t machine_uart_obj_t;
+extern const mp_obj_dict_t machine_uart_locals_dict;
 
 #endif // _MACHINE_UART_H