Defines | Functions

# Power management drivers

## Defines
#define | Setup_idle_mode() (SMCR=0,SMCR |= (1<<SE))
#define | Setup_power_down_mode() (SMCR=0,SMCR |= (1<<SE)+(1<<SM1))
#define | Setup_adc_noise_reduction_mode() (SMCR=0,SMCR |= (1<<SE)+(1<<SM0))
#define | Setup_power_save_mode() (SMCR=0,SMCR |= (1<<SE)+(1<<SM1)+(1<<SM0))
#define | Setup_standby_mode() (SMCR=0,SMCR |= (1<<SE)+(1<<SM2)+(1<<SM1))
#define | Setup_ext_standby_mode() (SMCR=0,SMCR |= (1<<SE)+(1<<SM2)+(1<<SM1)+(1<<SM0))
#define | Clear_prescaler() Set_cpu_prescaler(0)
| This function reset the internal CPU core clock prescaler.
#define | Sleep_instruction() {asm("SLEEP");}
#define | Set_power_down_mode() set_power_down_mode()
#define | Set_idle_mode() set_idle_mode()
#define | Enter_idle_mode() (set_idle_mode())
| This function makes the AVR core enter idle mode.
#define | Enter_power_down_mode() (set_power_down_mode())
| This function makes the AVR core enter power down mode.
#define | Enter_adc_noise_reduction_mode() (set_adc_noise_reduction_mode())
| This function makes the AVR core enter adc noise reduction mode.
#define | Enter_power_save_mode() (set_power_save_mode())
| This function makes the AVR core enter power save mode.
#define | Enter_standby_mode() (set_standby_mode())
| This function makes the AVR core enter standby mode.
#define | Enter_ext_standby_mode() (set_ext_standby_mode())
| This function makes the AVR core enter extended standby mode.
## Functions
void | Set_cpu_prescaler (U8 x)
| This function configure the internal CPU core clock prescaler value.
void | set_idle_mode (void)
| This function makes the AVR core enter idle mode.
void | set_power_down_mode (void)
| This function makes the AVR core enter power down mode.
void | set_adc_noise_reduction_mode (void)
| This function makes the AVR core enter adc noise reduction mode.
void | set_power_save_mode (void)
| This function makes the AVR core enter power save mode.
void | set_standby_mode (void)
| This function makes the AVR core enter standby mode.
void | set_ext_standby_mode (void)
| This function makes the AVR core enter extended standby mode.

## Define Documentation

#define Setup_idle_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE))

Definition at line 96 of file power_drv.h.

Referenced by set_idle_mode().

#define Setup_power_down_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE)+(1<<SM1))

Definition at line 97 of file power_drv.h.

Referenced by set_power_down_mode().

#define Setup_adc_noise_reduction_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE)+(1<<SM0))

Definition at line 98 of file power_drv.h.

Referenced by set_adc_noise_reduction_mode().

#define Setup_power_save_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE)+(1<<SM1)+(1<<SM0))

Definition at line 99 of file power_drv.h.

Referenced by set_power_save_mode().

#define Setup_standby_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE)+(1<<SM2)+(1<<SM1))

Definition at line 100 of file power_drv.h.

Referenced by set_standby_mode().

#define Setup_ext_standby_mode | ( | ) | (SMCR=0,SMCR |= (1<<SE)+(1<<SM2)+(1<<SM1)+(1<<SM0))

Definition at line 101 of file power_drv.h.

Referenced by set_ext_standby_mode().

#define Clear_prescaler | ( | ) | Set_cpu_prescaler(0)

This function reset the internal CPU core clock prescaler.

Definition at line 108 of file power_drv.h.

Referenced by __low_level_init(), and main().

#define Sleep_instruction | ( | ) | {asm("SLEEP");}

Definition at line 122 of file power_drv.h.

Referenced by set_adc_noise_reduction_mode(), set_ext_standby_mode(), set_idle_mode(), set_power_down_mode(), set_power_save_mode(), and set_standby_mode().

#define Set_power_down_mode | ( | ) | set_power_down_mode()

Definition at line 125 of file power_drv.h.

#define Set_idle_mode | ( | ) | set_idle_mode()

Definition at line 126 of file power_drv.h.

#define Enter_idle_mode | ( | ) | (set_idle_mode())

This function makes the AVR core enter idle mode.

Definition at line 139 of file power_drv.h.

#define Enter_power_down_mode | ( | ) | (set_power_down_mode())

This function makes the AVR core enter power down mode.

Definition at line 143 of file power_drv.h.

Referenced by suspend_action().

#define Enter_adc_noise_reduction_mode | ( | ) | (set_adc_noise_reduction_mode())

This function makes the AVR core enter adc noise reduction mode.

Definition at line 147 of file power_drv.h.

#define Enter_power_save_mode | ( | ) | (set_power_save_mode())

This function makes the AVR core enter power save mode.

Definition at line 151 of file power_drv.h.

#define Enter_standby_mode | ( | ) | (set_standby_mode())

This function makes the AVR core enter standby mode.

Definition at line 156 of file power_drv.h.

#define Enter_ext_standby_mode | ( | ) | (set_ext_standby_mode())

This function makes the AVR core enter extended standby mode.

Definition at line 160 of file power_drv.h.

## Function Documentation

void Set_cpu_prescaler | ( | U8 | x ) |

This function configure the internal CPU core clock prescaler value.

Parameters:

  x,: | prescaler new value

This function configure the internal CPU core clock prescaler value.

Parameters:

  U8 | the precaler value to be written

Definition at line 60 of file power_drv.c.

    {
       U8 save_int=Get_interrupt_state();
       Disable_interrupt();
       CLKPR=(1<<CLKPCE);
       CLKPR=x;
       if(save_int) { Enable_interrupt(); }
    }

void set_idle_mode | ( | void | ) |

This function makes the AVR core enter idle mode.

Definition at line 82 of file power_drv.c.

References Setup_idle_mode, and Sleep_instruction.

    {
       Setup_idle_mode();
       Sleep_instruction();
    }

void set_power_down_mode | ( | void | ) |

This function makes the AVR core enter power down mode.

Definition at line 73 of file power_drv.c.

References Setup_power_down_mode, and Sleep_instruction.

    {
       Setup_power_down_mode();
       Sleep_instruction();
    }

void set_adc_noise_reduction_mode | ( | void | ) |

This function makes the AVR core enter adc noise reduction mode.

Definition at line 91 of file power_drv.c.

References Setup_adc_noise_reduction_mode, and Sleep_instruction.

    {
       Setup_adc_noise_reduction_mode();
       Sleep_instruction();
    }

void set_power_save_mode | ( | void | ) |

This function makes the AVR core enter power save mode.

Definition at line 100 of file power_drv.c.

References Setup_power_save_mode, and Sleep_instruction.

    {
       Setup_power_save_mode();
       Sleep_instruction();
    }

void set_standby_mode | ( | void | ) |

This function makes the AVR core enter standby mode.

Definition at line 109 of file power_drv.c.

References Setup_standby_mode, and Sleep_instruction.

    {
       Setup_standby_mode();
       Sleep_instruction();
    }

void set_ext_standby_mode | ( | void | ) |

This function makes the AVR core enter extended standby mode.

Definition at line 118 of file power_drv.c.

References Setup_ext_standby_mode, and Sleep_instruction.

    {
       Setup_ext_standby_mode();
       Sleep_instruction();
    }