In this use case, the PINMUX module is configured for:
- One pin in input mode, with pull-up enabled, connected to the GPIO module
- Sampling mode of the pin changed to sample on demand
This use case sets up the PINMUX to configure a physical I/O pin set as an input with pull-up and changes the sampling mode of the pin to reduce power by only sampling the physical pin state when the user application attempts to read it.
Setup
Prerequisites
There are no special setup requirements for this use-case.
Code
Copy-paste the following setup code to your application:
Workflow
- Create a PINMUX module pin configuration struct, which can be filled out to adjust the configuration of a single port pin.
- Initialize the pin configuration struct with the module's default values.
- Note
- This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
- Adjust the configuration struct to request an input pin with pull-up connected to the GPIO peripheral.
- Configure GPIO10 with the initialized pin configuration struct, to enable the input sampler on the pin.
Use Case
Code
Copy-paste the following code to your user application:
Workflow
- Adjust the configuration of the pin to enable on-demand sampling mode.