3.4 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 features a versatile CLC GUI for customizable gate configuration based on application needs.
- The CLC mode can be set using the Logic Cell Mode component in the software's settings tab
- 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
3.4.1 Module Documentation
3.4.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.
3.4.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
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.
3.4.1.1.2 Function Documentation
CLC1_Deinitialize()
void CLC1_Deinitialize (void )
Deinitializes the CLC1 to POR values.
none |
none |
CLC1_Disable()
inline static void CLC1_Disable (void )
This inline function disables the CLC1 module.
CLC1_Initialize function should be called before calling this function. |
none |
none |
CLC1_Enable()
inline static void CLC1_Enable (void )
This inline function enables the CLC1 module.
CLC1_Initialize function should be called before calling this function. |
none |
none |
CLC1_Initialize()
void CLC1_Initialize (void )
Initializes the CLC1 module.
none |
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.
none |
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.
in | handler |
- Address of the callback function. |
none |
CLC1_OutputStatusGet()
bool CLC1_OutputStatusGet (void )
Returns output pin status of the CLC1 module.
CLC1_Initialize function should be called before calling this function. |
none |
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.
none |
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.
in | handler |
- Address of the callback function. |
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.
CLC1_Initialize function should be called before calling this function. |
none |
none |
3.4.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.
3.4.2 Data Structure Documentation
3.4.2.1 CLC_INTERFACE Struct Reference
Structure containing the function pointers of CLC driver.
3.4.2.1.1 Detailed Description
Structure containing the function pointers of CLC driver.
#include <clc_interface.h>
Data Fields
void(* Initialize )(void)
Pointer to CLCx_Initialize e.g. CLC1_Initialize.
void(* Deinitialize )(void)
Pointer to CLCx_Deinitialize e.g. CLC1_Deinitialize.
void(* Enable )(void)
Pointer to CLCx_Enable e.g. CLC1_Enable.
void(* Disable )(void)
Pointer to CLCx_Disable e.g. CLC1_Disable.
bool(* OutputStatusGet )(void)
Pointer to CLCx_OutputStatusGet e.g. CLC1_OutputStatusGet.
void(* EdgeCallbackRegister )(void(*CallbackHandler)(void))
Pointer to CLCx_EdgeCallbackRegister e.g. CLC1_EdgeCallbackRegister.
void(* PositiveEdgeCallbackRegister )(void(*CallbackHandler)(void))
Pointer to CLCx_PositiveEdgeCallbackRegister e.g. CLC1_PositiveEdgeCallbackRegister.
void(* NegativeEdgeCallbackRegister )(void(*CallbackHandler)(void))
Pointer to CLCx_NegativeEdgeCallbackRegister e.g. CLC1_NegativeEdgeCallbackRegister.
void(* Tasks )(void)
Pointer to CLCx_Tasks e.g. CLC1_Tasks (Supported only in polling mode)
3.4.2.1.2 Field Documentation
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)
3.4.3 File Documentation
3.4.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"
3.4.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.
3.4.3.1.2 Variables
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.
3.4.3.1.3 Detailed Description
This is the generated driver header file for the CLC1 driver.
CLC1 Generated Driver Header File
3.4.3.2 source/clc_interface.h File Reference
3.4.3.2.1 Data structures
struct CLC_INTERFACE
Structure containing the function pointers of CLC driver.
3.4.3.2.2 Detailed Description
CLC Generated Driver Interface Header File