Teensy 4.0 开发板

最新产品介绍、展示
回复
头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

Teensy 4.0 开发板

#1

帖子 shaoziyang »

新的Teensy 4.0开发板已经发布了。

图片

4.0版使用了NXP的i.MX.RT1060微控制器,在保持了小巧体积基础上,性能有了极大提升.

图片主要技术参数 
  • ARM Cortex-M7的频率为600 MHz
  • 1024K RAM
  • 2048K闪存(64K保留用于恢复和EEPROM仿真)
  • 2个USB全速端口
  • 3个CAN总线(1个带CAN FD)
  • 2个I2S数字音频
  • 1个S / PDIF数字音频
  • 1个SDIO(4位)原生SD
  • 3个SPI,全部带16字FIFO
  • 3个I2C,全部带4字节FIFO
  • 7个串口,全部带4字节FIFO
  • 32个通用DMA通道
  • 31个PWM引脚
  • 40个数字引脚,都具有中断功能
  • 14个模拟引脚,芯片上有2个ADC
  • 加密加速器
  • 随机数发生器
  • RTC
  • 可编程的FlexIO
  • 像素处理管道
  • 外围交叉触发
  • 电源管理
 已经有网友在考虑移植 micropython 了
引脚图

图片图片

https://www.pjrc.com/store/teensy40.html

头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

Re: Teensy 4.0 开发板

#2

帖子 shaoziyang »

https://blog.adafruit.com/2020/01/10/te ... toffregen/ CircuitPython 已经移植到 Teensy 4.0 

代码: 全选

import time
import board
import busio
from digitalio import DigitalInOut
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi
import adafruit_requests as requests
import adafruit_ssd1306
print("ESP32 SPI webclient test")
JSON_URL = "https://www.adafruit.com/api/quotes.php"
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x3c)
# If you have an externally connected ESP32:
esp32_cs = DigitalInOut(board.D5)
esp32_reset = DigitalInOut(board.D6)
esp32_ready = DigitalInOut(board.D9)
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
requests.set_socket(socket, esp)
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
    print("ESP32 found and in idle mode")
print("Firmware vers.", esp.firmware_version)
print("MAC addr:", [hex(i) for i in esp.MAC_address])
display.fill(0)
display.text("Found ESP32", 0, 0, 1)
display.show()
for ap in esp.scan_networks():
    print("\t%s\t\tRSSI: %d" % (str(ap['ssid'], 'utf-8'), ap['rssi']))
print("Connecting to AP...")
display.text("Connecting to AP", 0, 8, 1)
display.show()
while not esp.is_connected:
    try:
        esp.connect_AP(b'adafruit', b'ffffffff')
    except RuntimeError as e:
        print("could not connect to AP, retrying: ",e)
        continue
print("Connected to", str(esp.ssid, 'utf-8'), "\tRSSI:", esp.rssi)
print("My IP address is", esp.pretty_ip(esp.ip_address))
print("IP lookup adafruit.com: %s" % esp.pretty_ip(esp.get_host_by_name("adafruit.com")))
print("Ping google.com: %d ms" % esp.ping("google.com"))
display.text("Connected: "+str(esp.ssid, 'utf-8'), 0, 16, 1)
display.text("IP: "+esp.pretty_ip(esp.ip_address), 0, 24, 1)
display.show()
def wrap_nicely(string, max_chars):
        """A helper that will return a list of lines with word-break wrapping.
        :param str string: The text to be wrapped.
        :param int max_chars: The maximum number of characters on a line before wrapping.
        """
        string = string.replace('\n', '').replace('\r', '') # strip confusing newlines
        words = string.split(' ')
        the_lines = []
        the_line = ""
        for w in words:
            if len(the_line+' '+w) <= max_chars:
                the_line += ' '+w
            else:
                the_lines.append(the_line)
                the_line = ''+w
        if the_line:      # last line remaining
            the_lines.append(the_line)
        # remove first space from first line:
        the_lines[0] = the_lines[0][1:]
        return the_lines
while True:
    print()
    print("Fetching json from", JSON_URL)
    r = requests.get(JSON_URL)
    j = r.json()
    print('-'*40)
    print(j)
    print('-'*40)
    quote = j[0]['text']
    author = j[0]['author']
    r.close()
    display.fill(0)
    lines = wrap_nicely(quote, 21)
    lines.append(" ")
    lines.append(author)
    print(lines)
    for i, line in enumerate(lines[:-2]):
        display.fill(0)
        display.text(line, 0, 0, 1)
        if len(lines) > i+1:
            display.text(lines[i+1], 0, 8, 1)
        if len(lines) > i+2:
            display.text(lines[i+2], 0, 16, 1)
        if len(lines) > i+3:
            display.text(lines[i+3], 0, 24, 1)
        display.show()
        time.sleep(0.5)
    time.sleep(3)
print("Done!")

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章