当前位置: 首页 > news >正文

网站规划怎么写郑州网站顾问

网站规划怎么写,郑州网站顾问,签订网站建设合同,wordpress匿名评论插件文章目录 说在前面模块详情准备工作开始编译烧录结果 说在前面 esp32版本:s3运行环境:esp-idf(std)开发环境:wsl2LCD模块:ST7789V2 240*280 LCDgithub地址:这里 模块详情 某宙的esp32s3开发板 某雪的1.69inch LCD模块…

文章目录

  • 说在前面
  • 模块详情
  • 准备工作
  • 开始
  • 编译
  • 烧录
  • 结果

说在前面

  • esp32版本:s3
  • 运行环境:esp-idf(std)
  • 开发环境:wsl2
  • LCD模块:ST7789V2 240*280 LCD
  • github地址:这里

模块详情

  • 某宙的esp32s3开发板
    在这里插入图片描述

  • 某雪的1.69inch LCD模块,包含杜邦线
    在这里插入图片描述

准备工作

  • 开发环境(std)搭建,见上篇

  • lcd引脚
    在这里插入图片描述

  • esp32引脚
    在这里插入图片描述

  • 引脚连接
    除了几个固定的,其它可以自行选择,这里我的连接如下

    LCDesp32(括号里为上图的序号)esp32 gpio
    VCC3.3V(18)/
    GNDGND(17)/
    DINSPI_MOSI(20)GPIO17
    CLKSPI_CK(19)GPIO18
    CSSPI_CS(23)GPIO14
    DCGPIO15(22)GPIO15
    RSTGPIO16(21)GPIO16
    BLGPIO13(24)GPIO13

开始

  • 如果从空工程开始的话,可以使用code-generate
    cargo generate esp-rs/esp-idf-template cargo
    
  • 添加依赖
    [features]
    default = ["std", "embassy", "esp-idf-svc/native"]pio = ["esp-idf-svc/pio"]
    std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"]
    alloc = ["esp-idf-svc/alloc"]
    nightly = ["esp-idf-svc/nightly"]
    experimental = ["esp-idf-svc/experimental"]
    embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"][dependencies]
    anyhow = {version = "1", features = ["backtrace"]}
    log = { version = "0.4", default-features = false }
    esp-idf-svc = { version = "0.47.1", default-features = false }
    embedded-graphics = "0.8.1"
    display-interface-spi = "0.4"
    mipidsi = "0.7.1"[build-dependencies]
    embuild = "0.31.3"[package.metadata.esp-idf-sys]
    esp_idf_tools_install_dir = "global"
    
  • 代码(逻辑基本和树莓派一致)
    use display_interface_spi::SPIInterfaceNoCS;
    use embedded_graphics::{mono_font::{MonoTextStyle, ascii::FONT_10X20}, pixelcolor::Rgb565, text::Text, prelude::*, Drawable};
    use esp_idf_svc::hal::{spi, gpio, prelude::*};
    use anyhow::Result;fn main() -> Result<()> {// It is necessary to call this function once. Otherwise some patches to the runtime// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71esp_idf_svc::sys::link_patches();// Bind the log crate to the ESP Logging facilitiesesp_idf_svc::log::EspLogger::initialize_default();let peripherals = Peripherals::take().unwrap();let pins = peripherals.pins;test_lcd(peripherals.spi2,pins.gpio13.into(),pins.gpio15.into(),pins.gpio16.into(),pins.gpio18.into(),pins.gpio17.into(),pins.gpio14.into(),)?;Ok(())
    }fn test_lcd(spi: spi::SPI2,backlight: gpio::AnyOutputPin,dc: gpio::AnyOutputPin,rst: gpio::AnyOutputPin,sclk: gpio::AnyOutputPin,sdo: gpio::AnyOutputPin,cs: gpio::AnyOutputPin,
    ) -> Result<()> {let driver = spi::SpiDeviceDriver::new_single(spi,sclk,sdo,Option::<gpio::AnyIOPin>::None,Some(cs),&spi::SpiDriverConfig::new().dma(spi::Dma::Disabled),&spi::SpiConfig::new().baudrate(20_000_000.into()).data_mode(esp_idf_svc::hal::spi::config::MODE_0),)?;let dc = gpio::PinDriver::output(dc)?;let rst = gpio::PinDriver::output(rst)?;let mut backlight = gpio::PinDriver::output(backlight)?;let di = SPIInterfaceNoCS::new(driver, dc);let mut delay = esp_idf_svc::hal::delay::Ets;let mut display = mipidsi::Builder::st7789(di).with_display_size(240, 280).with_orientation(mipidsi::Orientation::Landscape(true)).init(&mut delay, Some(rst)).unwrap();// Textlet text = "Hello World ^_^;";let text_x = 120;let text_y = 280 / 2;let text_style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE);// Alternating colorlet colors = [Rgb565::RED, Rgb565::GREEN, Rgb565::BLUE];// Clear the display initiallydisplay.clear(colors[0]).unwrap();// Turn on backlightlet _ = backlight.set_high();// Draw textText::new(text, Point::new(text_x, text_y), text_style).draw(&mut display).unwrap();println!("Draw Hello from Rust!");Ok(())
    }
    

编译

  • 编译如果不通过,可以参考环境搭建
    cargo build --target xtensa-esp32s3-espidf
    

烧录

  • wsl访问usb设备见环境搭建
    espflash flash target/xtensa-esp32s3-espidf/debug/rs-esp32s3-st7789-demo
    

结果

在这里插入图片描述

http://www.tj-hxxt.cn/news/79197.html

相关文章:

  • 网站经营与建设谷歌浏览器网页
  • 大连市建设工程信息网官网seo外链推广平台
  • 专业做微视频的网站sem模型
  • 技术支持 广州网站建设网页模版
  • 大美南京网站谷歌排名优化
  • 网站copyright写法nba西部最新排名
  • 新疆建设兵团网站最新新闻热点事件
  • 网站上线后做什么惠州百度推广排名
  • 网站建设客户定位seo快速排名外包
  • 虚拟空间可以做视频网站么网页制作代码html制作一个网页
  • 网站建设活动汕头seo优化培训
  • 手机游戏编程宁波网络优化seo
  • 做网站的收获千锋教育培训多少钱
  • 大气的网站模板信息流优化师工作总结
  • 佛山南海大沥镇最新疫情seo快照推广
  • 品牌网站开发app推广注册接单平台
  • 衡水安徽网站建设营销软文的范文
  • 济南企业制作网站企业网站的推广方式和手段有哪些
  • jsp做的大型网站品牌运营中心
  • 团购网站建设案例产品推广策划方案怎么做
  • 衢州网站建设哪家好市场调研报告包括哪些内容
  • 做网站的把网站写成一行四川网站seo
  • 手机大全网站网站如何优化推广
  • 广告联盟平台自动赚钱seo网站推广seo
  • 个人模板图片湖南seo优化首选
  • 网站建设方案书备案设计图全能优化大师
  • 网站上面做测试题亚马逊关键词优化软件
  • 开发员给我用织梦做的网站站长工具查询入口
  • 做钓鱼网站软件下载网站推广的工作内容
  • 做网站买流量google推广工具