This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430FR2355:驱动程序分配不起作用?

Guru**** 2387080 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1118497/msp430fr2355-driver-assignment-not-working

器件型号:MSP430FR2355

您好...

我有以下驱动程序文件。  我正在传递函数的指针...函数是从 main 调用的,指针没有赋值...在函数内部指针得到赋值...赋值的一部分来自在 main 中定义的类型。  如果我在分配之后放置一个断点、我可以看到指针采用大小值(在函数中计算) 但是、在此之前的地址分配不需要执行、但我可以在函数中看到 applicationI2C.pSysCommsB 指向正确的存储器位置0x0540...有人能告诉我如何获得该分配。  我不想在函数中创建指向已在顶层(main)创建的现有数据段的新实例。

谢谢  

    pVal->pSysComms_Handle->pSysCommsB = applicationI2C.pSysCommsB;

uint8_t InitializeDisplay(I2C_txHandle_t *pVal)
{
    /*
     * turn on display, turn
     * on cursor, position
     * cursor line 1 , position 1
     */
    uint8_t InitializeLCD[] = {0x3C, 0x0E, 0x01};

    extern uint8_t *pI2CStream;
    extern SysComms_Handle_t applicationI2C;

    uint8_t err = 0;

    uint8_t k = sizeof(InitializeLCD);
    pI2CStream = malloc(k * 2);
    for (uint8_t t = 0; t < k; t++)
    {
        if (k - t > 1)
            *(pI2CStream + (2 * t)) = 0x80;
        else
            *(pI2CStream + (2 * t)) = 0x00;

        *(pI2CStream + (2 * t + 1)) = InitializeLCD[t];
    }

    pVal->pSysComms_Handle->pSysCommsB = applicationI2C.pSysCommsB;
    pVal->size = k*2;

    if (!(ERR_INIT_LCD == config_I2CSendData(pVal)))
        err = 0;
        //pInit.pSysCommsB->UCBxCTLW[0] |= UCTR | UCTXSTT;
    else
        err = 1;

    return err;
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    解决了…

    缺少指向包含文件的链接...所有编译都很好...仅用于调试和设置断点、我注意到调试器无法找到 h 文件