I guess we need some help with definitions. Basically, we'd like to read data from an I2C line. Should be as simple as "set to input" and "read the pin". However...
In the documentation, the nrf_gpio_cfg call has several parameters. Some are obvious; others appear to lack definitions.
__STATIC_INLINE void nrf_gpio_cfg ( uint32_t pin_number, nrf_gpio_pin_dir_t dir, nrf_gpio_pin_input_t input, nrf_gpio_pin_pull_t pull, nrf_gpio_pin_drive_t drive, nrf_gpio_pin_sense_t sense )
I’m looking at what the settings should be for reading an I2C line while enabling the internal pullup.
- Presumably “pin direction” should be NRF_GPIO_PIN_DIR_INPUT. This seems clear enough.
- Input buffer: what is this? Do I need NRF_GPIO_PIN_INPUT_CONNECT to be able to read a pin? Or is input buffering an additional optional feature?
- For pullup we presumably set NRF_GPIO_PIN_PULLUP
- For drive, we set NRF_GPIO_PIN_SOD1 to correspond to I2C standards
- Sense mode: what is this? What does “sense” mean? Does this correspond to generating an interrupt on an edge? For a binary value, what’s the difference between sensing high and sensing low or not sensing at all? How does this affect the ability to just read the value of the pin using the nrf_gpio_pin_read() call?
Thanks!