GPIOs for ADC ADS114S08 #55541
-
I'm currently working on a driver for the ADC ADS114S08 in #54911. On top of that, I have already prepared a PR as draft for the current sources in this ADC: #55537. The question now is, how I should implement the GPIOs of this ADC. Yes, this ADC has GPIOs. For my project I actually need them only as outputs. Hence for me it would be sufficient to implement them similarly to the current sources in #55537 as voltage sources. But this would of course not scale at all to the use case when somebody needs them to act as inputs. My second idea would be to implement a separate device which acts like a normal GPIO controller/expander. But this has the issue, that it would be possible to use the same pin for instance as GPIO and as ADC input. Which won't work, of course. Therefore, I would have to share data between the ADC driver and the GPIO driver. I could use the same data and config structs for both of them and instantiate them in the same source file, but this also feels a little bit hacky. In short: Does somebody have good idea how to implement this, so that it is acceptable as a PR? I suppose it would be great if @anangl could give me his point of view on this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Take a look at how it's done for the LMP90XXX: See drivers/gpio/gpio_stm32.c?#L47 for how it's done on the STM32. For the ADS114s0x in the pin_configure() function if the flag GPIO_INPUT or GPIO_OUTPUT is set then set the appropriate bit in the GPIOCON register otherwise clear it for analog input. |
Beta Was this translation helpful? Give feedback.
Take a look at how it's done for the LMP90XXX:
ADC driver drivers/adc/adc_lmp90xxx.c
GPIO driver drivers/gpio/gpio_lmp90xxx.c
See drivers/gpio/gpio_stm32.c?#L47 for how it's done on the STM32. For the ADS114s0x in the pin_configure() function if the flag GPIO_INPUT or GPIO_OUTPUT is set then set the appropriate bit in the GPIOCON register otherwise clear it for analog input.