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.

请教cc2640程序的意思

Other Parts Discussed in Thread: CC2640

const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UARTCOUNT] = {
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
.intNum = INT_UART0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.txPin = CC2640R2_LAUNCHXL_UART_TX,
.rxPin = CC2640R2_LAUNCHXL_UART_RX,
.ctsPin = PIN_UNASSIGNED,
.rtsPin = PIN_UNASSIGNED,
.ringBufPtr = uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0],
.ringBufSize = sizeof(uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0]),
.txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
.rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
.errorFxn = NULL
}
};

这是UART的配置吗,怎么知道程序上其他串口的配置呢???

  • 這是關於串口硬體得設置,沒有其他串口了,CC2640只有支持一路串口
  • 什么意思呢,才刚刚开始接触,看不懂例程上的程序,不知道怎么看配置
  • 可以參考UARTCC26XX.h對UARTCC26XX_HWAttrsV2 這個資料結構的說明

    typedef struct UARTCC26XX_HWAttrsV2 {
    uint32_t baseAddr; /*!< UART Peripheral's base address */
    uint32_t powerMngrId; /*!< UART Peripheral's power manager ID */
    int intNum; /*!< UART Peripheral's interrupt vector */
    /*! @brief UART Peripheral's interrupt priority.

    The CC26xx uses three of the priority bits, meaning ~0 has the same effect as (7 << 5).

    (7 << 5) will apply the lowest priority.

    (1 << 5) will apply the highest priority.

    Setting the priority to 0 is not supported by this driver.

    HWI's with priority 0 ignore the HWI dispatcher to support zero-latency interrupts, thus invalidating the critical sections in this driver.
    */
    uint8_t intPriority;
    /*! @brief SPI SWI priority.
    The higher the number, the higher the priority.
    The minimum is 0 and the maximum is 15 by default.
    The maximum can be reduced to save RAM by adding or modifying Swi.numPriorities in the kernel configuration file.
    */
    uint32_t swiPriority;
    uint8_t txPin; /*!< UART TX pin */
    uint8_t rxPin; /*!< UART RX pin */
    uint8_t ctsPin; /*!< UART CTS pin */
    uint8_t rtsPin; /*!< UART RTS pin */
    unsigned char *ringBufPtr; /*!< Pointer to an application ring buffer */
    size_t ringBufSize; /*!< Size of ringBufPtr */
    UARTCC26XX_FifoThreshold txIntFifoThr; /*!< UART TX interrupt FIFO threshold select */
    UARTCC26XX_FifoThreshold rxIntFifoThr; /*!< UART RX interrupt FIFO threshold select */
    /*! Application error function to be called on receive errors */
    UARTCC26XX_ErrorCallback errorFxn;
    } UARTCC26XX_HWAttrsV2;
  • 好的哦,const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2640R2_LAUNCHXL_I2CCOUNT] = {
    {
    .baseAddr = I2C0_BASE,
    .powerMngrId = PowerCC26XX_PERIPH_I2C0,
    .intNum = INT_I2C_IRQ,
    .intPriority = ~0,
    .swiPriority = 0,
    .sdaPin = CC2640R2_LAUNCHXL_I2C0_SDA0,
    .sclPin = CC2640R2_LAUNCHXL_I2C0_SCL0,
    }
    };
    那这个是不是也是串口硬体的设置呢,怎么才能判断程序是不是串口的设置呢
  • 好的哦const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2640R2_LAUNCHXL_I2CCOUNT] = {
    {
    .baseAddr = I2C0_BASE,
    .powerMngrId = PowerCC26XX_PERIPH_I2C0,
    .intNum = INT_I2C_IRQ,
    .intPriority = ~0,
    .swiPriority = 0,
    .sdaPin = CC2640R2_LAUNCHXL_I2C0_SDA0,
    .sclPin = CC2640R2_LAUNCHXL_I2C0_SCL0,
    }
    };
    那这个是不是也是串口硬体的设置呢,怎么才能判断串口的设置呢const ???CCC26XX_HWAttrsV1 ???CC26xxHWAttrs[CC2640R2_LAUNCHXL_I2CCOUNT] = {
    {
    这种形式的就是吗
  • I2CCC26XX_HWAttrsV1 這個是I2C界面,串口就是UART開頭的
  • const UART_Config UART_config[CC2640R2_LAUNCHXL_UARTCOUNT] = {
    {
    .fxnTablePtr = &UARTCC26XX_fxnTable,
    .object = &uartCC26XXObjects[CC2640R2_LAUNCHXL_UART0],
    .hwAttrs = &uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UART0]
    },
    };那这个又是UART的什么呢
  • 在UART.h有說明

    /*!
    * @brief UART Global configuration
    *
    * The UART_Config structure contains a set of pointers used to characterize
    * the UART driver implementation.
    *
    * This structure needs to be defined before calling UART_init() and it must
    * not be changed thereafter.
    *
    * @sa UART_init()
    */
    typedef struct UART_Config_ {
    /*! Pointer to a table of driver-specific implementations of UART APIs */
    UART_FxnTable const *fxnTablePtr;

    /*! Pointer to a driver specific data object */
    void *object;

    /*! Pointer to a driver specific hardware attributes structure */
    void const *hwAttrs;
    } UART_Config;
  • 好的哦虽然不是很清楚但还是 感谢你的回答