Instructions from the AVR power library for ATmega328P

The library <avr/power.h> makes it easy to shut down all unneeded hardware of an ATmega controller.

The documentation of this library shows all available instructions and also on which controllers they are working. As I didn’t find this very readable I copied the table and deleted everything that doesn’t apply to the ATmega328P.

Here is the list of instructions from the power library for the ATmega328P, the chip of the arduino Uno board:

Power Macro Description
power_adc_enable() Enable the Analog to Digital Converter module.
power_adc_disable() Disable the Analog to Digital Converter module.
power_spi_enable() Enable the Serial Peripheral Interface module.
power_spi_disable() Disable the Serial Peripheral Interface module.
power_timer0_enable() Enable the Timer 0 module.
power_timer0_disable() Disable the Timer 0 module.
power_timer1_enable() Enable the Timer 1 module.
power_timer1_disable() Disable the Timer 1 module.
power_timer2_enable() Enable the Timer 2 module.
power_timer2_disable() Disable the Timer 2 module.
power_twi_enable() Enable the Two Wire Interface module.
power_twi_disable() Disable the Two Wire Interface module.
power_usart0_enable() Enable the USART 0 module.
power_usart0_disable() Disable the USART 0 module.
power_all_enable() Enable all modules.
power_all_disable() Disable all modules.

Hope this helps

heliosoph

4 thoughts on “Instructions from the AVR power library for ATmega328P

  1. Pingback: Arduino - Sleep etc | Pearltrees

  2. Matti Pirttimaa

    Hi,
    I’m interested in a noise traffic light project: https://www.instructables.com/id/Noise-Traffic-Light-DIY-3D-Printed/

    In that project, the code includes Avr/Power.h library … I tried to google where to download this library, but I have some problems: the library is (if I understand right) available here: https://github.com/Synapseware/avr

    If I download the zip file and unzip it, I ll get the folder called avr-master… inside this folder there is three subfolders called bin, include and lib. The library looks like different that I have used to see… Is that avr-master folder the right one to move to arduino libraries folder, needed in the arduino traffic light project? That is the way I have used to do, when I need to add some libraries to use with arduino projects.

    Reply
    1. heliosoph Post author

      Hi Matti,

      leave the zip file as it is. In the Arduino IDE go to Sketch -> Include Library -> Add ZIP Library…

      This is the standard way to include a zipped library.

      heliosoph

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

− 2 = 8