- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# 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))
| Clear_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())
| Enter_idle_mode.
#define | Enter_power_down_mode() (set_power_down_mode())
| Enter_power_down_mode.
#define | Enter_adc_noise_reduction_mode() (set_adc_noise_reduction_mode())
| Enter_adc_noise_reduction_mode.
#define | Enter_power_save_mode() (set_power_save_mode())
| Enter_power_save_mode.
#define | Enter_standby_mode() (set_standby_mode())
| Enter_standby_mode.
#define | Enter_ext_standby_mode() (set_ext_standby_mode())
| Enter_ext_standby_mode.
## Functions
void | Set_cpu_prescaler (U8 x)
| Set_prescaler.
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 57 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 58 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 59 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 60 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 61 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 62 of file power_drv.h.

Referenced by set_ext_standby_mode().

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

Clear_prescaler.

This function reset the internal CPU core clock prescaler

Parameters:

  | none |

Returns:
  none.

Definition at line 76 of file power_drv.h.

Referenced by __low_level_init(), and main().

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

Definition at line 95 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 98 of file power_drv.h.

#define Set_idle_mode | ( |  | ) | set_idle_mode()

Definition at line 99 of file power_drv.h.

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

Enter_idle_mode.

This function makes the AVR core enter idle mode.

Parameters:

  | none |

Returns:
  none.

Definition at line 118 of file power_drv.h.

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

Enter_power_down_mode.

This function makes the AVR core enter power down mode.

Parameters:

  | none |

Returns:
  none.

Definition at line 128 of file power_drv.h.

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

Enter_adc_noise_reduction_mode.

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

Parameters:

  | none |

Returns:
  none.

Definition at line 138 of file power_drv.h.

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

Enter_power_save_mode.

This function makes the AVR core enter power save mode.

Parameters:

  | none |

Returns:
  none.

Definition at line 148 of file power_drv.h.

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

Enter_standby_mode.

This function makes the AVR core enter standby mode.

Parameters:

  | none |

Returns:
  none.

Definition at line 158 of file power_drv.h.

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

Enter_ext_standby_mode.

This function makes the AVR core enter extended standby mode.

Parameters:

  | none |

Returns:
  none.

Definition at line 168 of file power_drv.h.

## Function Documentation

void Set_cpu_prescaler | ( | U8 | x | ) |

Set_prescaler.

This function configure the internal CPU core clock prescaler value

Parameters:

  | x,: | prescaler new value

Returns:
  none.

Set_prescaler.

Parameters:

  | U8 | the precaler value to be written

Definition at line 57 of file power_drv.c.

    00058 {
    00059    U8 save_int=Get_interrupt_state();
    00060    Disable_interrupt();
    00061    CLKPR=(1<<CLKPCE);
    00062    CLKPR=x;
    00063    if(save_int) { Enable_interrupt(); }
    00064 }

void set_idle_mode | ( | void |  | ) |

This function makes the AVR core enter idle mode.

Definition at line 79 of file power_drv.c.

References Setup_idle_mode, and Sleep_instruction.

    00080 {
    00081    Setup_idle_mode();
    00082    Sleep_instruction();
    00083 }

void set_power_down_mode | ( | void |  | ) |

This function makes the AVR core enter power down mode.

Definition at line 70 of file power_drv.c.

References Setup_power_down_mode, and Sleep_instruction.

    00071 {
    00072    Setup_power_down_mode();
    00073    Sleep_instruction();
    00074 }

void set_adc_noise_reduction_mode | ( | void |  | ) |

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

Definition at line 88 of file power_drv.c.

References Setup_adc_noise_reduction_mode, and Sleep_instruction.

    00089 {
    00090    Setup_adc_noise_reduction_mode();
    00091    Sleep_instruction();
    00092 }

void set_power_save_mode | ( | void |  | ) |

This function makes the AVR core enter power save mode.

Definition at line 97 of file power_drv.c.

References Setup_power_save_mode, and Sleep_instruction.

    00098 {
    00099    Setup_power_save_mode();
    00100    Sleep_instruction();
    00101 }

void set_standby_mode | ( | void |  | ) |

This function makes the AVR core enter standby mode.

Definition at line 106 of file power_drv.c.

References Setup_standby_mode, and Sleep_instruction.

    00107 {
    00108    Setup_standby_mode();
    00109    Sleep_instruction();
    00110 }

void set_ext_standby_mode | ( | void |  | ) |

This function makes the AVR core enter extended standby mode.

Definition at line 115 of file power_drv.c.

References Setup_ext_standby_mode, and Sleep_instruction.

    00116 {
    00117    Setup_ext_standby_mode();
    00118    Sleep_instruction();
    00119 }