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.

TI_RTOS for msp 43x 如何使用库函数实现GPIO并口写入



在GPIO.h文件中只有如下写操作,只能实现位写入,是否有其他写函数可是实现并口写入。

/*!
* @brief Writes the value to a GPIO pin
*
* @param index GPIO index
* @param value must be either 0 or 1
*/
extern void GPIO_write(unsigned int index, unsigned int value);

期待您的回复,谢谢.

  • 楼主可以看看这个中文教程

    http://bbs.21ic.com/icview-900756-1-2.html

  • 已经成功找到需要的库函数,可以实现,io口并口配置,我在接下来使用rtos 驱动spi时遇到如下问题,运行SPI_transfer()函数后,无法运行接下来的程序,仿真发现运行SPI_transfer()函数前,spi 的io口已配置成功,运行SPI_transfer()函数后,spi的RXBUF中已经有数据,就是无法运行后面的函数。主要的taskFxn函数如下:

    void pm25ld020taskFxn(UArg arg0, UArg arg1) {


    GPIO_write(ZKS_GASSENSOR_X2_SPI_PM25LD020_CE,
    ZKS_GASSENSOR_X2_PM25LD020_ENABLE);

    SPI_Handle spi_handle_pm25ld020;
    Bool transferOK;
    SPI_Params spiParams_pm25ld020;
    SPI_Params_init(&spiParams_pm25ld020);
    spiParams_pm25ld020.transferMode = SPI_MODE_BLOCKING;
    spiParams_pm25ld020.transferCallbackFxn = NULL;
    spiParams_pm25ld020.bitRate = 8000000;
    spi_handle_pm25ld020 = SPI_open(Board_SPI_PM25LD020, &spiParams_pm25ld020);

    SPI_Transaction spi_transaction_pm25ld020;
    UChar transmitBuffer[1] = { 0x9f };
    UChar receiveBuffer[4] = { 0x04 };
    spi_transaction_pm25ld020.count = 4;
    spi_transaction_pm25ld020.txBuf = (Ptr) transmitBuffer;
    spi_transaction_pm25ld020.rxBuf = (Ptr) receiveBuffer;
    transferOK = SPI_transfer(spi_handle_pm25ld020, &spi_transaction_pm25ld020);
    __no_operation();
    GPIO_write(ZKS_GASSENSOR_X2_SPI_PM25LD020_CE,
    ZKS_GASSENSOR_X2_PM25LD020_DISABLE);
    if (!transferOK) {
    /* Error in SPI transfer or transfer is already in progress */
    }

    }

    希望能得到您的帮助,谢谢。