2.5 CLC Driver

Overview

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. This provides greater flexibility and potential in embedded designs, since the CLC module can operate outside the limitations of software execution, and supports a vast amount of output designs.

Features

  • The driver provides a CLC GUI whose gates can be configured depending on the application needs.
  • The mode of the CLC can be configured using the Logic Cell Mode component in the software settings tab.
Logic Cell Modes Supported
  • AND-OR,
  • OR-XOR,
  • 4-input AND,
  • SR latch,
  • 1-input D flip-flop with S and R,
  • 2-input D flip-flop with R,
  • JK flip-flop with R,
  • 1-input transparent latch with S and R

2.5.1 Module Documentation

2.5.1.1 CLC Driver

Configurable Logic Cell driver 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 using dsPIC MCUs.

2.5.1.1.1 Module description

Configurable Logic Cell driver 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 using dsPIC MCUs.

Data structures
  • struct CLC_INTERFACE

    Structure containing the function pointers of CLC driver.

Functions
  • void CLC1_Initialize (void)

    Initializes the CLC1 module.

  • void CLC1_Deinitialize (void)

    Deinitializes the CLC1 to POR values.

  • bool CLC1_OutputStatusGet (void)

    Returns output pin status of the CLC1 module.

  • static void CLC1_Enable (void)

    This inline function enables the CLC1 module.

  • static void CLC1_Disable (void)

    This inline function disables the CLC1 module.

  • void CLC1_PositiveEdgeCallbackRegister (void(*handler)(void))

    This function can be used to override default callback and to define custom callback for CLC1 PositiveEdge event.

  • void CLC1_PositiveEdgeCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_PositiveEdgeCallbackRegister.

  • void CLC1_NegativeEdgeCallbackRegister (void(*handler)(void))

    This function can be used to override default callback and to define custom callback for CLC1 NegativeEdge event.

  • void CLC1_NegativeEdgeCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_NegativeEdgeCallbackRegister.

  • void CLC1_Tasks (void)

    Implements the tasks for polled implementations where the hardware supports dedicated event for Positive edge, Negative edge or both. Note: If both Positive Edge and Negative Edge uses polling mode then Callback function of positive edge takes the priority if both event occurred.

Variables

2.5.1.1.2 Function Documentation

CLC1_Deinitialize()

void CLC1_Deinitialize (void )

Deinitializes the CLC1 to POR values.

Parameters:
none
Returns:

none

CLC1_Disable()

inline static void CLC1_Disable (void )

This inline function disables the CLC1 module.

Precondition:

CLC1_Initialize function should be called before calling this function.

Parameters:
none
Returns:

none

CLC1_Enable()

inline static void CLC1_Enable (void )

This inline function enables the CLC1 module.

Precondition:

CLC1_Initialize function should be called before calling this function.

Parameters:
none
Returns:

none

CLC1_Initialize()

void CLC1_Initialize (void )

Initializes the CLC1 module.

Parameters:
none
Returns:

none

CLC1_NegativeEdgeCallback()

void CLC1_NegativeEdgeCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_NegativeEdgeCallbackRegister.

Parameters:
none
Returns:

none

CLC1_NegativeEdgeCallbackRegister()

void CLC1_NegativeEdgeCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CLC1 NegativeEdge event.

Parameters:
in handler

- Address of the callback function.

Returns:

none

CLC1_OutputStatusGet()

bool CLC1_OutputStatusGet (void )

Returns output pin status of the CLC1 module.

Precondition:

CLC1_Initialize function should be called before calling this function.

Parameters:
none
Returns:

Output pin status

CLC1_PositiveEdgeCallback()

void CLC1_PositiveEdgeCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_PositiveEdgeCallbackRegister.

Parameters:
none
Returns:

none

CLC1_PositiveEdgeCallbackRegister()

void CLC1_PositiveEdgeCallbackRegister (void(*)(void) handler)

This function can be used to override default callback and to define custom callback for CLC1 PositiveEdge event.

Parameters:
in handler

- Address of the callback function.

Returns:

none

CLC1_Tasks()

void CLC1_Tasks (void )

Implements the tasks for polled implementations where the hardware supports dedicated event for Positive edge, Negative edge or both. Note: If both Positive Edge and Negative Edge uses polling mode then Callback function of positive edge takes the priority if both event occurred.

Precondition:

CLC1_Initialize function should be called before calling this function.

Parameters:
none
Returns:

none

2.5.1.1.3 Variable Documentation

CLC1

const struct CLC_INTERFACE CLC1

Structure object of type CLC_INTERFACE with the custom name given by the user in the Melody Driver User interface.

The default name e.g. CLC1 can be changed by the user in the CLC user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.5.2 Class Documentation

2.5.2.1 CLC_INTERFACE Struct Reference

Structure containing the function pointers of CLC driver.

2.5.2.1.1 Detailed Description

Structure containing the function pointers of CLC driver.

#include <clc_interface.h>

Public Attributes

2.5.2.1.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

clc_interface.h

Deinitialize

void(* Deinitialize) (void)

Pointer to CLCx_Deinitialize e.g. CLC1_Deinitialize.

Disable

void(* Disable) (void)

Pointer to CLCx_Disable e.g. CLC1_Disable.

EdgeCallbackRegister

void(* EdgeCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CLCx_EdgeCallbackRegister e.g. CLC1_EdgeCallbackRegister.

Enable

void(* Enable) (void)

Pointer to CLCx_Enable e.g. CLC1_Enable.

Initialize

void(* Initialize) (void)

Pointer to CLCx_Initialize e.g. CLC1_Initialize.

NegativeEdgeCallbackRegister

void(* NegativeEdgeCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CLCx_NegativeEdgeCallbackRegister e.g. CLC1_NegativeEdgeCallbackRegister.

OutputStatusGet

bool(* OutputStatusGet) (void)

Pointer to CLCx_OutputStatusGet e.g. CLC1_OutputStatusGet.

PositiveEdgeCallbackRegister

void(* PositiveEdgeCallbackRegister) (void(*CallbackHandler)(void))

Pointer to CLCx_PositiveEdgeCallbackRegister e.g. CLC1_PositiveEdgeCallbackRegister.

Tasks

void(* Tasks) (void)

Pointer to CLCx_Tasks e.g. CLC1_Tasks (Supported only in polling mode)

2.5.3 File Documentation

2.5.3.1 source/clc1.h File Reference

This is the generated driver header file for the CLC1 driver.

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>
#include "clc_interface.h"

2.5.3.1.1 Functions

  • void CLC1_Initialize (void)

    Initializes the CLC1 module.

  • void CLC1_Deinitialize (void)

    Deinitializes the CLC1 to POR values.

  • bool CLC1_OutputStatusGet (void)

    Returns output pin status of the CLC1 module.

  • static void CLC1_Enable (void)

    This inline function enables the CLC1 module.

  • static void CLC1_Disable (void)

    This inline function disables the CLC1 module.

  • void CLC1_PositiveEdgeCallbackRegister (void(*handler)(void))

    This function can be used to override default callback and to define custom callback for CLC1 PositiveEdge event.

  • void CLC1_PositiveEdgeCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_PositiveEdgeCallbackRegister.

  • void CLC1_NegativeEdgeCallbackRegister (void(*handler)(void))

    This function can be used to override default callback and to define custom callback for CLC1 NegativeEdge event.

  • void CLC1_NegativeEdgeCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using CLC1_NegativeEdgeCallbackRegister.

  • void CLC1_Tasks (void)

    Implements the tasks for polled implementations where the hardware supports dedicated event for Positive edge, Negative edge or both. Note: If both Positive Edge and Negative Edge uses polling mode then Callback function of positive edge takes the priority if both event occurred.

2.5.3.1.2 Variables

2.5.3.1.3 Detailed Description

This is the generated driver header file for the CLC1 driver.

CLC1 Generated Driver Header File

2.5.3.2 source/clc_interface.h File Reference

2.5.3.2.1 Data structures

  • struct CLC_INTERFACE

    Structure containing the function pointers of CLC driver.

2.5.3.2.2 Detailed Description

CLC Generated Driver Interface Header File