Skip to content

Commit

Permalink
boards: arm: twr_ke18f: add ADC support
Browse files Browse the repository at this point in the history
Add support for reading the onboard potentiometer (ADC0 channel
12) and thermistor (ADC0 channels 0 and 1).

Signed-off-by: Henrik Brix Andersen <[email protected]>
  • Loading branch information
henrikbrixandersen authored and MaureenHelm committed Jun 7, 2019
1 parent ca38f0a commit ac42942
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions boards/arm/twr_ke18f/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@ config GPIO_MCUX_PORTE

endif # GPIO_MCUX

if ADC

config ADC_0
default y

endif # ADC

endif # BOARD_TWR_KE18F
2 changes: 2 additions & 0 deletions boards/arm/twr_ke18f/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ features:
+-----------+------------+-------------------------------------+
| SPI(M) | on-chip | spi |
+-----------+------------+-------------------------------------+
| ADC | on-chip | adc |
+-----------+------------+-------------------------------------+

The default configuration can be found in the defconfig file:
``boards/arm/twr_ke18f/twr_ke18f_defconfig``.
Expand Down
8 changes: 8 additions & 0 deletions boards/arm/twr_ke18f/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ static int twr_ke18f_pinmux_init(struct device *dev)
#endif
pinmux_pin_set(portc, 15, PORT_PCR_MUX(kPORT_MuxAsGpio));

#ifdef CONFIG_ADC_0
/* Thermistor A, B */
pinmux_pin_set(porta, 0, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
pinmux_pin_set(porta, 1, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
/* Potentiometer */
pinmux_pin_set(portc, 14, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
#endif

return 0;
}

Expand Down
5 changes: 5 additions & 0 deletions boards/arm/twr_ke18f/twr_ke18f.dts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@
status = "ok";
};

&adc0 {
status = "ok";
sample-time = <12>;
};

&flash0 {
/*
* For more information, see:
Expand Down
1 change: 1 addition & 0 deletions boards/arm/twr_ke18f/twr_ke18f.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ supported:
- i2c
- hwinfo
- spi
- adc

0 comments on commit ac42942

Please sign in to comment.