Jump to main content

##

# 3.15.4 Configurable Logic Cell (CLC)

The Configurable Logic Cell (CLC) module allows the user to specify combinations of signals as inputs to a logic function and to use the logic output to control other peripherals or I/O pins. CLC module can also be configured to generate and interrupt when the logic cell output changes.

## Using The Library

CLC peripheral runs independent of the processor core. CLC peripheral is initialized using CLC_Initialize() API. This will be done by the auto-generated code as part of the system initialization (that is, if CLC peripheral is added to the project graph).

At any point during program execution, logic cell can be turned On or Off using CLC_Enable API. Invoking CLC_Enable() with argument value of "true" will enable the logic cell and an argument value of "false" will disable it.

If CLC is configured to generate a processor Interrupt, a callback must be registered using the CLC_CallbackRegister() API. See code example below.

    /* Context is provided as part of callback */
    void CLC_EventHandler(uintptr_t context)
    {
        /* CLC interrupt occurred, do something */
    }

    int main(void)
    {
        /* Register Callback */
        CLC1_CallbackRegister(CLC_EventHandler, (uintptr_t) NULL);

        /* Enable CLC */
        CLC1_Enable(true);
    }

## Library Interface

Peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
CLCx_Initialize | Initializes CLC peripheral
CLCx_Enable | Enable/Disable CLC module
CLCx_CallbackRegister | Registers the function to be called from interrupt

Data types and constants

Name | Type | Description
--- | --- | ---
CLC_CALLBACK | Typedef | Defines the data type and function signature for the CLC peripheral callback function