Enumerations | Functions

Power-fail comparator (hal_pof)
[nRF24LE1 HAL]


The Power-fail comparator provides the MCU with an early warning of impending power failure. A flag wil be raised when the system supply voltage is below a configurable threshold voltage.

Enumerations

enum  hal_pof_threshold_t { HAL_POF_THRESHOLD_2_1V = 0x00, HAL_POF_THRESHOLD_2_3V = 0x20, HAL_POF_THRESHOLD_2_5V = 0x40, HAL_POF_THRESHOLD_2_7V = 0x60 }

Functions

void hal_pof_enable (_Bool enable)
void hal_pof_set_threshold (hal_pof_threshold_t threshold)
_Bool hal_pof_warning (void)

Enumeration Type Documentation

An enum used for different POF thresholds.

Enumerator:
HAL_POF_THRESHOLD_2_1V 
HAL_POF_THRESHOLD_2_3V 
HAL_POF_THRESHOLD_2_5V 
HAL_POF_THRESHOLD_2_7V 

Definition at line 34 of file hal_pof.h.


Function Documentation

void hal_pof_enable ( _Bool  enable )

Function to enable or disable the Power-fail comparator

Parameters:
enableBoolean value. True = enable, false = disable.

Definition at line 21 of file hal_pof.c.

{
    if(enable)
        POFCON |= 0x80;
    else
        POFCON &= ~0x80;
}
void hal_pof_set_threshold ( hal_pof_threshold_t  threshold )

Function setting the threshold voltage for the Power-fail comparator

Parameters:
thresholdselects the threshold for the Power-fail comparator

  • HAL_POF_THRESHOLD_2_1V
  • HAL_POF_THRESHOLD_2_3V
  • HAL_POF_THRESHOLD_2_5V
  • HAL_POF_THRESHOLD_2_7V

Definition at line 29 of file hal_pof.c.

{
    POFCON &= ~0x60;
    POFCON |= ((uint8_t)threshold & 0x60);
}
_Bool hal_pof_warning ( void   )

Checks for low voltage warning from the Power-fail comparator

Definition at line 35 of file hal_pof.c.

{
    if(POFCON & 0x10)
        return true;
    else
        return false;
}