查看: 1532|回复: 0

[原创] 【MCX-N947分享】+驱动TFT屏

[复制链接]
  • TA的每日心情
    开心
    昨天 14:34
  • 签到天数: 1100 天

    连续签到: 18 天

    [LV.10]以坛为家III

    28

    主题

    4267

    帖子

    0

    金牌会员

    Rank: 6Rank: 6

    积分
    5778
    最后登录
    2025-7-26
    发表于 2024-3-23 12:14:48 | 显示全部楼层 |阅读模式
    【MCX-N947分享】+驱动TFT屏
    折腾了好长时间,终于调通SPI接口的TFT显示屏的显示处理了。发现实现MCX-N97的GPIO输入输出处理,和之前用过的ARM系列的开发板还真是不一样啊。除了要设置GPIO的标准设置外,
    // 打开总线时钟
        CLOCK_EnableClock(kCLOCK_Gpio3);
    CLOCK_EnableClock(kCLOCK_Gpio0);

    // 初始化端口
        const port_pin_config_t port0_2_pin16_config = {/* Internal pull-up/down resistor is disabled */
                                                         kPORT_PullDisable,
                                                         /* Low internal pull resistor value is selected. */
                                                         kPORT_LowPullResistor,
                                                         /* Fast slew rate is configured */
                                                         kPORT_FastSlewRate,
                                                         /* Passive input filter is disabled */
                                                         kPORT_PassiveFilterDisable,
                                                         /* Open drain output is disabled */
                                                         kPORT_OpenDrainDisable,
                                                         /* Low drive strength is configured */
                                                         kPORT_LowDriveStrength,
                                                         /* Pin is configured as PIO3_4 */
                                                         kPORT_MuxAlt0,
                                                         /* Digital input enabled */
                                                         kPORT_InputBufferEnable,
                                                         /* Digital input is not inverted */
                                                         kPORT_InputNormal,
                                                         /* Pin Control Register fields [15:0] are not locked */
                                                         kPORT_UnlockRegister};
        PORT_SetPinConfig(PORT0, 16U, &port0_2_pin16_config);
        PORT_SetPinConfig(PORT0, 17U, &port0_2_pin16_config);
        PORT_SetPinConfig(PORT0, 20U, &port0_2_pin16_config);




        const port_pin_config_t port3_4_pinF14_config = {/* Internal pull-up/down resistor is disabled */
                                                         kPORT_PullDisable,
                                                         /* Low internal pull resistor value is selected. */
                                                         kPORT_LowPullResistor,
                                                         /* Fast slew rate is configured */
                                                         kPORT_FastSlewRate,
                                                         /* Passive input filter is disabled */
                                                         kPORT_PassiveFilterDisable,
                                                         /* Open drain output is disabled */
                                                         kPORT_OpenDrainDisable,
                                                         /* Low drive strength is configured */
                                                         kPORT_LowDriveStrength,
                                                         /* Pin is configured as PIO3_4 */
                                                         kPORT_MuxAlt0,
                                                         /* Digital input enabled */
                                                         kPORT_InputBufferEnable,
                                                         /* Digital input is not inverted */
                                                         kPORT_InputNormal,
                                                         /* Pin Control Register fields [15:0] are not locked */
                                                         kPORT_UnlockRegister};
        /* PORT3_4 (pin F14) is configured as PIO3_4 */
        PORT_SetPinConfig(PORT3, 4U, &port3_4_pinF14_config);
        PORT_SetPinConfig(PORT3, 1U, &port3_4_pinF14_config);
        PORT_SetPinConfig(PORT3, 2U, &port3_4_pinF14_config);
    PORT_SetPinConfig(PORT3, 3U, &port3_4_pinF14_config);

    还要执行以下代码:
        GPIO0->PDDR |= (1U << 16);
        GPIO0->PDDR |= (1U << 17);
        GPIO0->PDDR |= (1U << 20);
        GPIO3->PDDR |= (1U << 1);
        GPIO3->PDDR |= (1U << 2);
        GPIO3->PDDR |= (1U << 3);
        GPIO3->PDDR |= (1U << 4);
    否则GPIO口不会被正常使用,输出高、低电平。
    我的TFT屏是ST7735驱动的,在示例程序的基础上,进行必要的修改,以适应MCX-N947的开发环境。最终驱动效果如下:
    图片1.png

    哎...今天够累的,签到来了~
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-7-27 03:47 , Processed in 0.079609 second(s), 20 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

    快速回复 返回顶部 返回列表