Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
adc_pm_irq.c File Reference
#include "adc_pm.h"
#include <LPC17xx.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void ADC_PMSetSampleReadyAction (ADC_PMInterruptHandler action)
 Sets the action to be executed when the conversion is done.
 
void ADC_PMUnsetSampleReadyAction (void)
 
void ADC_IRQHandler (void)
 

Variables

_PRIVATE ADC_PMInterruptHandler done_action = NULL
 Holds the handler that is executed when the conversion is done.
 
_PRIVATE u16 prv_value = 0x0
 Used to store the previous value of the conversion.
 

Function Documentation

◆ ADC_IRQHandler()

void ADC_IRQHandler ( void  )
extern

Definition at line 25 of file adc_pm_irq.c.

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}
_PRIVATE ADC_PMInterruptHandler done_action
Holds the handler that is executed when the conversion is done.
Definition adc_pm_irq.c:6
_PRIVATE u16 prv_value
Used to store the previous value of the conversion.
Definition adc_pm_irq.c:9
uint16_t u16
Definition types.h:7

◆ ADC_PMSetSampleReadyAction()

void ADC_PMSetSampleReadyAction ( ADC_PMInterruptHandler  action)

Sets the action to be executed when the conversion is done.

Todo:
This function is not implemented void ADC_PMDisableSampling();
Parameters
actionThe action to be executed when the conversion is done.

Definition at line 13 of file adc_pm_irq.c.

14{
15 done_action = action;
16}

◆ ADC_PMUnsetSampleReadyAction()

void ADC_PMUnsetSampleReadyAction ( void  )

Definition at line 18 of file adc_pm_irq.c.

19{
20 done_action = NULL;
21}

Variable Documentation

◆ done_action

_PRIVATE ADC_PMInterruptHandler done_action = NULL

Holds the handler that is executed when the conversion is done.

Definition at line 6 of file adc_pm_irq.c.

◆ prv_value

_PRIVATE u16 prv_value = 0x0

Used to store the previous value of the conversion.

Definition at line 9 of file adc_pm_irq.c.