mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-02 07:42:28 +00:00
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>
21 lines
454 B
C
21 lines
454 B
C
/*
|
|
* Copyright (c) 2019, Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_SAMPLES_DRIVERS_LED_WS2812_H_
|
|
#define ZEPHYR_SAMPLES_DRIVERS_LED_WS2812_H_
|
|
|
|
/*
|
|
* At 4 MHz, 1 bit is 250 ns, so 3 bits is 750 ns.
|
|
*
|
|
* That's cutting it a bit close to the edge of the timing parameters,
|
|
* but it seems to work on AdaFruit LED rings.
|
|
*/
|
|
#define SPI_FREQ 4000000
|
|
#define ZERO_FRAME 0x40
|
|
#define ONE_FRAME 0x70
|
|
|
|
#endif
|