Provide correct active level and pull on all signals. Use
init-to-active when configuring antenna switch.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Convert the GPIO based driver to the new GPIO API. (Only the
gpio_configure() call is affected).
Move configuration to DT where appropriate for both SPI and GPIO
drivers, only leaving the SPI vs. GPIO decision in Kconfig (in
addition to the basic enable for the driver.) Move some files around
to clean up as a result of this change.
led_ws2812 sample changes:
- make the pattern easier to look at by emitting less light
- use led_strip alias from DT to get strip device, allocate
appropriate struct led_rgb buffer, etc.
- move the pins around and remove 96b_carbon support (I have no board
to test with)
GPIO driver specific changes:
- str is required to write OUTSET/OUTCLR, not strb. The registers
are word-sized.
- the str[b] registers must all be in r0-r7, so "l" is the correct GCC
inline assembly constraint for both "base" and "pin"
SPI driver specific changes:
- match the GPIO driver in not supporting the update_channels API
method, which never made sense for this type of strip
- return -ENOMEM when the user tries to send more pixel data
than we have buffer space for instead of -EINVAL
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Extend the physical level GPIO_OUTPUT_{HIGH,LOW} configuration with
GPIO_OUTPUT_{ACTIVE,INACTIVE} for logic level initialization.
This enables use of device-tree configuration flags in calls to
gpio_pin_configure() to set the logic level without having to
determine the corresponding physical level.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Switched from deprecated gpio_pin_write to gpio_pin_set and also add the
LED GPIO flags to the gpio configuration.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
Mark the INT signal to be active low and use the new functions to get
gpio state and configure the gpio interrupt flanks.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
This factors the common bits of device declaration into macros
so it would be easier to add new instances.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Remove support for GPIO_ACCESS_BY_PORT in the config function
as configuration by port is going away.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Since the GPIO expander is a I2C device, any read/write to
the registers has high latency. Therefore, semaphore is
introduced to prevent multiple threads to manipulate
the GPIOs at the same time.
Also make sure that we are not doing I2C transactions
within ISRs.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Only update the internal register cache after successful write,
or else it would get out of sync with hardware.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The register pair for each port in the GPIO expander are
port 0 first then port 1. This would not work for big
endian systems with the u16_t port value. So need to
swap the byte ordering on such system.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The structures defined in the header file are only used by
the driver source file, and should not be used by others.
So roll the header file into the source file so it won't
get #include.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Use I2C burst write to write 2 bytes to each pair of registers
instead of 2 separate transactions of writing 1 byte.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
PCA95XX is a series of compatible I2C-based GPIO expanders,
with common registers on input/output, polarity and configuration.
This renames the original PCAL9535A driver to PCA95XX to indicate
that it can support this series. Additional features on variants
are guarded by kconfigs.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Update driver code and board files to use new GPIO configuration flags
such as GPIO_ACTIVE_LOW. Also add implementation of new port_* driver
API as well as gpio_pin_interrupt_configure function.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The interrupt functionality of this driver is incomplete,
but for the sake of not slowing down the GPIO API refactor,
I'm just returning -ENOTSUP until we can track down the issue.
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
The 1pin test fails to pass because it expects to be able to
manipulate more than 16 pins. Since the intent is to filter invalid
pins at the wrapper level remove the validation performed within the
driver.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Some drivers masked the set of signaled pins based on enabled
interrupts, some did not. For those that did not the 2-pin test could
fail. The documentation does not imply that pins unrelated to the
callback participate in the notification process, so do the filtering
in the generic callback loop.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Previously the check would fail if a higher pin was present in the
callback set. Callbacks should only be told about pins that are
relevant to the callback, so reject unless exactly the expected pin
was provided.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Update the code configuring pins that control the routing of certain
lines on the board, to take advantage of the introduced possibility
of configuring a pin as output with specified initial state.
Additionally, use `gpio_pin_get_raw` instead of `gpio_pin_get` for
checking the reset pin state, to save a few bytes in flash.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Convert the sample to use the new GPIO API and additionally:
- add some error messages for unsuccessful GPIO API calls
- correct the index of `def_val` element used in the `right_button`
callback, to match the one used when the callback is installed
- use flags defined in devicetree for the pin that drives the LED
(for consistency, as this does not make much difference for a pin
that is only toggled)
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
In order to reliably detect interrupts the interrupt must be
acknowledged before the callback is invoked.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
In the fine print of the manual it's stated that attempts to enable a
pull in one direction while the pull in the other direction is enabled
are ignored. This has been confirmed. Change logic to disable both
pulls, then enable the one that's configured, if any.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
In order to reliably detect interrupts the interrupt must be
acknowledged before the callback is invoked.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Correct DRDY active level to default active-high, switch to new
interrupt configuration.
Also fix a common bug where an already-active DRDY signal is not
properly handled.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Update driver code and board files to use new GPIO configuration flags
such as GPIO_ACTIVE_LOW. Also add implementation of new port_* driver
API as well as gpio_pin_interrupt_configure function.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Exclude the mps2_an385/mps2_an521 as we try to run on qemu and that
doesnt support the GPIO/LED so the tests will fail. For now exclude
the platform completely until we can just do a sim run exclusion.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
gpio_pin_interrupt_configure() is invoked from within
gpio_pin_configure() to support legacy code that combines pin and
interrupt configuration. Expressing a disabled interrupt by a zero
value for interrupt flags causes this invocation to disable interrupts
when the intent is to change only a pin configuration, such as pull
direction.
Support a distinction between explicitly disabling interrupts and
leaving the interrupt configuration unchanged.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
gpio_pin_interrupt_configure() verified that the pin was within range,
while gpio_pin_configure() did not. Make them consistent since they
take the same set of flags.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
- Updates gpio driver and device tree files to the new GPIO Config flags
- Implements the new port_* APIs
- Update I2C and PWM Drivers to use new GPIO config
- Add esp32.overlay to gpio_basic_api test
- refactor convert_int_type, regs struct
- remove config_polarity
- add kConfig notes
Tests:
- samples/basic/blinky
- samples/basic/button
- tests/drivers/gpio/gpio_basic_api
- tests/drivers/gpio/gpio_api_1pin
Board:
- esp32 DevKitC V4
Note about interrupts:
The ESP32 requires specifying a CPU interrupt to be used for GPIO
interrupt signals. CPU interrupts can be either level or edge (or
special) triggered, but not both.
Please check gpio/Kconfig.esp32 for more info.
Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
As the mmio32 is more of a library than a proper driver, just implement
the new port functions and have pin_interrupt_configure marked pretty
much as not supported.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Enables the 2-pin gpio test on the rv32m1_vega_ri5cy board by adding a
dts overlay and configuring pinmuxes on the arduino header.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Updates the rv32m1 gpio driver and all associated boards to use new
device tree compatible gpio configuration flags. Implements new port
get/set/clear/toggle and pin_interrupt_configure functions recently
added to the gpio api.
Assumes the gpio api layer handles translating logical flags to physical
flags.
Stops quietly reconfiguring pinmuxes to gpio mode. The pinmux must now
be configured explicitly in the board's pinmux.c or in the application.
Tested with:
- samples/basic/blinky
- samples/basic/button
- tests/drivers/gpio/gpio_api_1pin
On boards:
- rv32m1_vega_ri5cy
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Remove redundant interrupt code from gpio_mcux_configure, move the rest
to gpio_mcux_pin_interrupt_configure.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
When checking the behavior of pull configurations delay long enough
for the signal to stabilize. Checking without a sufficient delay may
indicate a false failure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use standard spelling for pull and active flags. Correct LED active
level (based on SAM-D21-Xplained-Pro).
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Update driver code and board files to use new GPIO configuration flags
such as GPIO_ACTIVE_LOW. Also add implementation of new port_* driver
API as well as gpio_pin_interrupt_configure function.
We treat GPIO_INT_MODE_LEVEL as not supported as the hardware doesn't
seem to handle level interrupts as one would expect. Looking into this
further to determine if its a HW bug or some misconfiguration in the
software.
We don't support dynamic setting of PULL_UP/PULL_DOWN config as this is
handled by pinctrl for the current boards we support the CMSDK AHB
driver on.
Tested on musca-a board.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Define the mask in terms of the individual non-zero fields to isolate
from future changes to the bit position.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The debounce flag is to be provided to the pin configuration, not the
pin interrupt configuration.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The asserts verify that:
- Output needs to be enabled for 'Open Drain', 'Open Source' mode to be
supported.
- GPIO_LINE_OPEN_DRAIN flag can be enabled only if GPIO_SINGLE_ENDED is
enabled.
- Only one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 can be enabled for a level
interrupt.
- GPIO_INT_DEBOUNCE is not passed to gpio_pin_interrupt_configure
function.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>