MicroPython 1.4.5 发布,此版本包括大量组件和改进,支持 STM32F2 和 F7 MCUs。 更新内容如下: py core:- use wrapper to check self argument of builtin methods, to prevent segfaults- catch case when relative import happens without active package- fix running package submodule with -m- add TimeoutError exception subclassed from OSError- prevent many extra vstr allocations by preallocating room for nullbyte- modbuiltins: Implement round() to precision- implement memoryview slice assignment, eg m1[0:3] = m2[2:5]- viper: allow functions to take up to 4 arguments- viper: issue an error when compiling functions with more than 4 args- raise SyntaxError when str hex escape sequence is malformed- fix handling of parsing empty input so it raises an exception- viper: compile errors now have traceback with function and filename- make list += accept all arguments and add testextmod:- ubinascii: add a2b_base64 and b2a_base64 functions- machine: implement physical memory access using /dev/mem (Linux, etc)lib:- readline: add emacs control chars for cursor movement (disabled bydefault)tools:- update upip to 0.5.4: recognize and handle "package not found" errorunix port:- add O_WRONLY | O_CREAT to open call when opening file for append ("a")- socket.getaddrinfo: accept family & socktype arguments- socket.getaddrinfo: port is unsigned value- modsocket: implement sendto(), recvfrom(), inet_pton()- set MICROPY_PY_SYS_PLATFORM to "darwin" if compiled on OSX 详细改进请看:https://github.com/micropython/micropython/releases/tag/v1.4.5。 下载: Arudino虽然在开源硬件领域非常流行,但是对于不懂C/C++编程语言的玩家来说,还是需要一段学习时间。 早些时候,我们在Kickstarter上看到一款相对特殊的开发板Espruino,他能让用户通过JavaScrpit轻松实现对单片机的控制,让更多的计算机初学者来动手做硬件。 从现在开始,Python玩家也可以做类似的事情。 Damien George是一名计算机工程师,他每天都要使用Python语言工作,同时也在做一些机器人项目。有一天,他突然冒出了一个想法:能否用Python语言来控制单片机,进行实现对机器人的操控呢? 要知道,Python是一款比较容易上手的脚本语言,而且有强大的社区支持,一些非计算机专业领域的人都选它作为入门语言。遗憾的是,它不能实现一些非常底层的操控,所以在硬件领域并不起眼。 Damien为了突破这种限制,他花费了六个月的时间来打造Micro Python。它基于ANSI C,语法跟Pyton 3基本一致,拥有自家的解析器、编译器、虚拟机和类库等。目前他支持基于32-bit的ARM处理器,比如说STM32F405。 借助Micro Python,用户完全可以通过Python脚本语言实现硬件底层的访问和控制,比如说控制LED灯泡、LCD显示器、读取电压、控制电机、访问SD卡等。 与此同时,Damien还给大家带来了一款专门为Micro Python而打造的开发板,它基于STM32F405单片机,通过USB接口进行数据传输。该开发板内置4个LED灯、一个加速传感器、时钟模块,可在 3V-10V之间的电压正常工作。值得一提的是,它遵守MIT协议开源,被授权人拥有复制、修改、发行和再授权的权利。 这款板子的面积为33mm×40mm,重6克。对它感兴趣的朋友可以上Kickstarter支持一下,最低售价为20英镑 |