Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
adc_pm_irq.c
Go to the documentation of this file.
1#include "adc_pm.h"
2#include <LPC17xx.h>
3#include <stdlib.h>
4
7
10
11// PUBLIC FUNCTIONS
12
17
19{
20 done_action = NULL;
21}
22
23// INTERRUPT HANDLER
24
25extern void ADC_IRQHandler(void)
26{
27 // The interrupt reads info from the ADGDR register.
28 const u16 new_value = (LPC_ADC->ADGDR >> 4) & 0xFFF;
29
30 if (done_action)
31 done_action(prv_value, new_value);
32
33 if (new_value != prv_value)
34 prv_value = new_value;
35}
void ADC_IRQHandler(void)
Definition adc_pm_irq.c:25
_PRIVATE ADC_PMInterruptHandler done_action
Holds the handler that is executed when the conversion is done.
Definition adc_pm_irq.c:6
void ADC_PMUnsetSampleReadyAction(void)
Definition adc_pm_irq.c:18
_PRIVATE u16 prv_value
Used to store the previous value of the conversion.
Definition adc_pm_irq.c:9
void ADC_PMSetSampleReadyAction(ADC_PMInterruptHandler action)
Sets the action to be executed when the conversion is done.
Definition adc_pm_irq.c:13
void(* ADC_PMInterruptHandler)(u16 prv_value, u16 new_value)
The type of the function that will be executed when a conversion is done.
#define _PRIVATE
Definition types.h:37
uint16_t u16
Definition types.h:7