Microchip® Advanced Software Framework

ac.c File Reference

Analog comparator (AC) functions.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include "interrupt.h"
#include "compiler.h"
#include "parts.h"
#include "ac.h"
#include "sysclk.h"
#include "sleepmgr.h"
#include "status_codes.h"

Functions

void ac_disable (AC_t *ac, uint8_t channel)
 Disable an analog comparator channel. More...
 
void ac_enable (AC_t *ac, uint8_t channel)
 Enable an analog comparator channel. More...
 
enum ac_status_t ac_get_status (AC_t *ac, uint8_t channel)
 Get analog compare channel status. More...
 
void ac_read_config (AC_t *ac, uint8_t channel, struct ac_config *config)
 Read analog comparator configuration from hardware. More...
 
void ac_set_interrupt_callback (AC_t *ac, ac_callback_t callback)
 Set interrupt callback function. More...
 
void ac_write_config (AC_t *ac, uint8_t channel, struct ac_config *config)
 Write analog comparator configuration to hardware. More...
 
 ISR (ACA_AC0_vect)
 Interrupt handler for analog comparator A channel 0. More...
 
 ISR (ACA_AC1_vect)
 Interrupt handler for analog comparator A channel 1. More...
 
 ISR (ACA_ACW_vect)
 Interrupt handler for analog comparator A in window mode. More...
 
 ISR (ACB_AC0_vect)
 Interrupt handler for analog comparator B channel 0. More...
 
 ISR (ACB_AC1_vect)
 Interrupt handler for analog comparator B channel 1. More...
 
 ISR (ACB_ACW_vect)
 Interrupt handler for analog comparator B in window mode. More...
 

Variables

static ac_callback_t ac_aca_callback
 
static uint8_t ac_aca_opened = 0
 Local variable keeping track of number of users that has opened (configuring, enabled) channels on analog comparator A. More...
 
static ac_callback_t ac_acb_callback
 
static uint8_t ac_acb_opened = 0
 Local variable keeping track of number of users that has opened (configuring, enabled) channels on analog comparator A. More...
 

ISR ( ACA_AC0_vect  )

Interrupt handler for analog comparator A channel 0.

This function will handle interrupt on analog comparator A channel 0 and call the analog comparator channel A callback function.

References ac_aca_callback, AC_STATUS_ABOVE, and AC_STATUS_BELOW.

ISR ( ACA_AC1_vect  )

Interrupt handler for analog comparator A channel 1.

This function will handle interrupt on analog comparator A channel 1 and call the analog comparator channel A callback function.

References ac_aca_callback, AC_STATUS_ABOVE, and AC_STATUS_BELOW.

ISR ( ACA_ACW_vect  )

Interrupt handler for analog comparator A in window mode.

This function will handle interrupt on analog comparator A in window mode and call the analog comparator channel A callback function.

References ac_aca_callback.

ISR ( ACB_AC0_vect  )

Interrupt handler for analog comparator B channel 0.

This function will handle interrupt on analog comparator B channel 0 and call the analog comparator channel B callback function.

References ac_acb_callback, AC_STATUS_ABOVE, and AC_STATUS_BELOW.

ISR ( ACB_AC1_vect  )

Interrupt handler for analog comparator B channel 1.

This function will handle interrupt on analog comparator B channel 1 and call the analog comparator channel B callback function.

References ac_acb_callback, AC_STATUS_ABOVE, and AC_STATUS_BELOW.

ISR ( ACB_ACW_vect  )

Interrupt handler for analog comparator B in window mode.

This function will handle interrupt on analog comparator B in window mode and call the analog comparator channel B callback function.

References ac_acb_callback.

ac_callback_t ac_aca_callback
static

Local storage of analog comparator A interrupt callback function

Referenced by ac_set_interrupt_callback(), and ISR().

uint8_t ac_aca_opened = 0
static

Local variable keeping track of number of users that has opened (configuring, enabled) channels on analog comparator A.

Referenced by ac_disable(), ac_enable(), and ac_write_config().

ac_callback_t ac_acb_callback
static

Local storage of analog comparator B interrupt callback function

Referenced by ac_set_interrupt_callback(), and ISR().

uint8_t ac_acb_opened = 0
static

Local variable keeping track of number of users that has opened (configuring, enabled) channels on analog comparator A.

Referenced by ac_disable(), ac_enable(), and ac_write_config().