2 * Copyright © 2019 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
23 port_c->outtgl = (1 << pin_c); \
25 ao_gpio_set(port_d, pin_d, v); \
27 port_c->outtgl = (1 << pin_c); \
31 #define byte(v) do { \
32 uint8_t _bit_ = 0x80; \
34 bit(!!((v) & _bit_)); \
39 #define repeat(v,c) do { \
41 for (_i_ = 0; _i_ < (c); _i_++) \
46 ao_snek_apa102_write(void *gpio_d, uint8_t pin_d,
47 void *gpio_c, uint8_t pin_c,
49 struct snek_neopixel *pixels)
51 struct samd21_port *port_d = gpio_d;
52 struct samd21_port *port_c = gpio_c;
54 ao_gpio_set(port_c, pin_c, 1);
56 for (i = 0; i < 32; i++)