Driver API for PAC (plib_pac.h)
More...
Driver API for PAC (plib_pac.h)
Usage Example
The following example demonstrates typical usage of the PAC peripheral:
#include <pic32c.h>
#include <stdint.h>
void MyPACCallback(void)
{
}
int32_t configure_PAC(void)
{
{
}
else
{
}
return 0;
}
void PAC_WriteProtectControl(PAC_PERIPHERAL peripheral, PAC_PROTECTION operation)
Controls protection for a peripheral.
void PAC_SetCallbackHandler(PAC_CALLBACK_HANDLER callback)
Registers a PAC callback function.
void PAC_Initialize(void)
Initializes the PAC module.
void PAC_EnableInterrupt(void)
Enables PAC interrupts.
void PAC_EnableEvent(void)
Enables PAC event output.
bool PAC_PeripheralIsProtected(PAC_PERIPHERAL peripheral)
Checks if a peripheral is protected.
@ PAC_PROTECTION_SET
Definition plib_pac.h:59
Peripheral Access Controller (PAC) PLIB APIs.
◆ PAC_CALLBACK_HANDLER
| typedef void(* PAC_CALLBACK_HANDLER) (void) |
PAC callback function type.
- Parameters
-
◆ PAC_PERIPHERAL
Peripheral identifiers for PAC operations.
Important portability rule: The numeric values MUST match the device's PERID encoding used by PAC.WrCtrl.PERID (as defined by the device header/SVD). Do not rely on enum auto-numbering or on a "common" instance list, because peripheral instances vary by device.
◆ PAC_PROTECTION
PAC protection modes for a peripheral.
| Enumerator |
|---|
| PAC_PROTECTION_CLEAR | |
| PAC_PROTECTION_SET | |
| PAC_PROTECTION_SET_AND_LOCK | |
◆ PAC_ClearAHBErrorFlags()
| void PAC_ClearAHBErrorFlags |
( |
uint32_t | mask | ) |
|
Clears specific AHB error flags.
- Parameters
-
| mask | Mask of error flags to clear. |
- Returns
- void
◆ PAC_ClearInterruptFlag()
| void PAC_ClearInterruptFlag |
( |
void | | ) |
|
Clears PAC interrupt flag.
- Returns
- void
◆ PAC_ClearPeripheralError()
Clears error status of a peripheral.
- Parameters
-
| peripheral | The target peripheral. |
- Returns
- void
◆ PAC_DisableEvent()
| void PAC_DisableEvent |
( |
void | | ) |
|
Disables PAC event output.
- Returns
- void
◆ PAC_DisableInterrupt()
| void PAC_DisableInterrupt |
( |
void | | ) |
|
Disables PAC interrupts.
- Returns
- void
◆ PAC_EnableEvent()
| void PAC_EnableEvent |
( |
void | | ) |
|
Enables PAC event output.
- Returns
- void
◆ PAC_EnableInterrupt()
| void PAC_EnableInterrupt |
( |
void | | ) |
|
Enables PAC interrupts.
- Returns
- void
◆ PAC_GetAHBErrorFlags()
| uint32_t PAC_GetAHBErrorFlags |
( |
void | | ) |
|
Gets AHB error flags.
- Returns
- Bitmask of AHB error flags.
◆ PAC_Initialize()
| void PAC_Initialize |
( |
void | | ) |
|
Initializes the PAC module.
This function sets up the PAC for use.
- Returns
- void
◆ PAC_InterruptIsEnabled()
| bool PAC_InterruptIsEnabled |
( |
void | | ) |
|
Checks if PAC interrupt is enabled.
- Returns
- true if enabled, false otherwise.
◆ PAC_PeripheralHasError()
Checks if a peripheral has an error.
- Parameters
-
| peripheral | The target peripheral. |
- Returns
- true if an error is detected, false otherwise.
◆ PAC_PeripheralIsProtected()
Checks if a peripheral is protected.
- Parameters
-
| peripheral | The target peripheral. |
- Returns
- true if the peripheral is protected, false otherwise.
◆ PAC_SetCallbackHandler()
Registers a PAC callback function.
- Parameters
-
| callback | User-defined callback function. |
| context | User data passed to callback. |
- Returns
- void
◆ PAC_WriteProtectControl()
Controls protection for a peripheral.
- Parameters
-
| peripheral | The target peripheral. |
| operation | The protection operation to perform. |
- Returns
- void