Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions samples/drivers/led_apa102c_bitbang/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ void send_rgb(struct device *gpio_dev, u32_t rgb)

for (i = 0; i < 32; i++) {
/* MSB goes in first */
gpio_pin_write(gpio_dev, GPIO_DATA_PIN, !!(rgb & 0x80000000));
gpio_pin_set_raw(gpio_dev, GPIO_DATA_PIN, (rgb & BIT(31)) != 0);

/* Latch data into LED */
gpio_pin_write(gpio_dev, GPIO_CLK_PIN, 1);
gpio_pin_write(gpio_dev, GPIO_CLK_PIN, 0);
gpio_pin_set_raw(gpio_dev, GPIO_CLK_PIN, 1);
gpio_pin_set_raw(gpio_dev, GPIO_CLK_PIN, 0);

rgb <<= 1;
}
Expand All @@ -79,12 +79,12 @@ void main(void)
}

/* Setup GPIO output */
ret = gpio_pin_configure(gpio_dev, GPIO_DATA_PIN, (GPIO_DIR_OUT));
ret = gpio_pin_configure(gpio_dev, GPIO_DATA_PIN, GPIO_OUTPUT);
if (ret) {
printk("Error configuring " GPIO_NAME "%d!\n", GPIO_DATA_PIN);
}

ret = gpio_pin_configure(gpio_dev, GPIO_CLK_PIN, (GPIO_DIR_OUT));
ret = gpio_pin_configure(gpio_dev, GPIO_CLK_PIN, GPIO_OUTPUT);
if (ret) {
printk("Error configuring " GPIO_NAME "%d!\n", GPIO_CLK_PIN);
}
Expand Down