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.

CC2530: API for GPIO management in TIMAC

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK, TIMAC

I am looking for an API to manage GPIO in TIMAC-based application running on CC2530. I have skimmed through the documentation, but didn't found much on this topic. Everything what I found in the code itself is HAL driver API for managing LCD, LEDs and ADC, but not GPIO as it is.

In particular, I need to manage state of the pin P1.7. I found that by default it is defained as HAL_LCD_MISO_PIN. However, I have no intention to use SPI and want to use it as a digital output pin.

Any ideas how to do this?

  • Try to refer to the following macro in Z-Stack

    #define HAL_IO_SET(port, pin, val) HAL_IO_SET_PREP(port, pin, val)
    #define HAL_IO_SET_PREP(port, pin, val) st( P##port##_##pin## = val; )
    #define HAL_CONFIG_IO_OUTPUT(port, pin, val) HAL_CONFIG_IO_OUTPUT_PREP(port, pin, val)
    #define HAL_CONFIG_IO_OUTPUT_PREP(port, pin, val) st( P##port##SEL &= ~BV(pin); \
    P##port##_##pin## = val; \
    P##port##DIR |= BV(pin); )
    #define HAL_CONFIG_IO_PERIPHERAL(port, pin) HAL_CONFIG_IO_PERIPHERAL_PREP(port, pin)
    #define HAL_CONFIG_IO_PERIPHERAL_PREP(port, pin) st( P##port##SEL |= BV(pin); )
  • Yes, those macroses do the job. They are the same in TIMAC in LCD driver (hal_lcd.c).
    Actually, HAL_CONFIG_IO_OUTPUT(port, pin, val) was enough for my case.
    Thanks.