3.3 CCL Configuration
The CCL is a programmable logic peripheral which can be connected to the device pins, to events, or to other internal peripherals. The CCL can serve as “glue logic” between the device peripherals and external devices.
The CCL can be configured to form Combinatorial Logic Functions realizing a logic expression, which is a function of up to three inputs. This configuration is done in look-up tables. On ATtiny1617 there are two look-up tables available with three inputs where each can be configured separately.
On the ATtiny1617 nightlight, the Ambient Light Sensor and PIR sensor are attached to the LUT0 inputs. Addressable RGB LEDs are connected to the LUT1 output.
The idea is that the RGB LEDs should not turn ON before it is dark AND there is a movement in front of the PIR. This means that both sensors need to “trigger” before the CPU take action and turn ON the LEDs. To avoid the CPU polling the sensors to check if both sensors have triggered, the CCL does this while the CPU sleeps. When LUT0 wakes the CPU, LUT1 together with the SPI and TCA work to turn the LEDs ON or OFF.