Lines Matching +full:t0 +full:- +full:out

4  * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/dt-bindings/led/led.h>
42 const struct ws2812_led_strip_config *config = dev->config; in ws2812_led_strip_sm_init()
44 sys_clock_hw_cycles_per_sec() / (config->cycles_per_bit * config->frequency); in ws2812_led_strip_sm_init()
49 pio = pio_rpi_pico_get_pio(config->piodev); in ws2812_led_strip_sm_init()
53 return -EINVAL; in ws2812_led_strip_sm_init()
57 sm_config_set_sideset_pins(&sm_config, config->gpio_pin); in ws2812_led_strip_sm_init()
58 sm_config_set_out_shift(&sm_config, false, true, (config->num_colors == 4 ? 32 : 24)); in ws2812_led_strip_sm_init()
61 pio_sm_set_consecutive_pindirs(pio, sm, config->gpio_pin, 1, true); in ws2812_led_strip_sm_init()
62 pio_sm_init(pio, sm, -1, &sm_config); in ws2812_led_strip_sm_init()
79 const struct ws2812_led_strip_config *config = dev->config; in ws2812_led_strip_update_rgb()
80 struct ws2812_led_strip_data *data = dev->data; in ws2812_led_strip_update_rgb()
81 PIO pio = pio_rpi_pico_get_pio(config->piodev); in ws2812_led_strip_update_rgb()
86 for (size_t j = 0; j < config->num_colors; j++) { in ws2812_led_strip_update_rgb()
87 switch (config->color_mapping[j]) { in ws2812_led_strip_update_rgb()
93 color |= pixels[i].r << (8 * (2 - j)); in ws2812_led_strip_update_rgb()
96 color |= pixels[i].g << (8 * (2 - j)); in ws2812_led_strip_update_rgb()
99 color |= pixels[i].b << (8 * (2 - j)); in ws2812_led_strip_update_rgb()
104 pio_sm_put_blocking(pio, data->sm, color << (config->num_colors == 4 ? 0 : 8)); in ws2812_led_strip_update_rgb()
107 ws2812_led_strip_reset_delay(config->reset_delay); in ws2812_led_strip_update_rgb()
114 const struct ws2812_led_strip_config *config = dev->config; in ws2812_led_strip_length()
116 return config->length; in ws2812_led_strip_length()
126 * "color-mapping" DT property.
130 const struct ws2812_led_strip_config *config = dev->config; in ws2812_led_strip_init()
131 struct ws2812_led_strip_data *data = dev->data; in ws2812_led_strip_init()
134 if (!device_is_ready(config->piodev)) { in ws2812_led_strip_init()
135 LOG_ERR("%s: PIO device not ready", dev->name); in ws2812_led_strip_init()
136 return -ENODEV; in ws2812_led_strip_init()
139 for (uint32_t i = 0; i < config->num_colors; i++) { in ws2812_led_strip_init()
140 switch (config->color_mapping[i]) { in ws2812_led_strip_init()
148 " Check the color-mapping DT property", in ws2812_led_strip_init()
149 dev->name); in ws2812_led_strip_init()
150 return -EINVAL; in ws2812_led_strip_init()
159 data->sm = sm; in ws2812_led_strip_init()
166 const struct ws2812_rpi_pico_pio_config *config = dev->config; in ws2812_rpi_pico_pio_init()
169 if (!device_is_ready(config->piodev)) { in ws2812_rpi_pico_pio_init()
170 LOG_ERR("%s: PIO device not ready", dev->name); in ws2812_rpi_pico_pio_init()
171 return -ENODEV; in ws2812_rpi_pico_pio_init()
174 pio = pio_rpi_pico_get_pio(config->piodev); in ws2812_rpi_pico_pio_init()
176 pio_add_program(pio, &config->program); in ws2812_rpi_pico_pio_init()
178 return pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); in ws2812_rpi_pico_pio_init()
206 (op | (((DT_INST_PROP_BY_IDX(inst, bit_waveform, i) - 1) & 0xF) << 8))
209 * This pio program runs [T0+T1+T2] cycles per 1 loop.
210 * The first `out` instruction outputs 0 by [T2] times to the sideset pin.
212 * The second `jmp` instruction output 1 by [T0] times to the sideset pin.
220 * In the case of configuration, T0=3, T1=3, T2 =4,
231 SET_DELAY(0x6021, inst, 2), /* 0: out x, 1 side 0 [T2 - 1] */ \
232 SET_DELAY(0x1023, inst, 0), /* 1: jmp !x, 3 side 1 [T0 - 1] */ \
233 SET_DELAY(0x1000, inst, 1), /* 2: jmp 0 side 1 [T1 - 1] */ \
234 SET_DELAY(0x0000, inst, 1), /* 3: jmp 0 side 0 [T1 - 1] */ \
244 .origin = -1, \