[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] Restructure conditions for power management APIs (power.h
From: |
Sivanupandi, Pitchumani |
Subject: |
[avr-libc-dev] Restructure conditions for power management APIs (power.h) |
Date: |
Mon, 29 Sep 2014 13:55:55 +0000 |
Hi All,
Power management APIs in power.h are depends on device macro. Most of the
devices
share same APIs. Irrespective of those common APIs, device name needs to be
added
to power.h to enable for that device.
If these APIs are enabled based on some condition from device header then these
APIs
shall be enabled automatically for new devices.
For example:
Add conditions in power.h like:
#if defined __AVR_HAVE_PRTIM0_PRR0
#define power_timer0_enable() PRR0 &= (uint8_t)~(1 << PRTIM0)
#define power_timer0_disable() PRR0 |= (uint8_t)(1 << PRTIM0)
#endif
#if defined __AVR_HAVE_PRTIM3_PRR1
#define power_timer3_enable() PRR1 &= (uint8_t)~(1 << PRTIM3)
#define power_timer3_disable() PRR1 |= (uint8_t)(1 << PRTIM3)
#endif
Add conditions to device header as follows:
iodevice.h:
#define __AVR_HAVE_PRTIM0_PRR0
#define __AVR_HAVE_PRTIM3_PRR1
However, power.h may need update if the new device has a different/ new power
reduction
register or bitfields.
Will it be useful? Please give your suggestions.
Regards,
Pitchumani
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] Restructure conditions for power management APIs (power.h),
Sivanupandi, Pitchumani <=