Skip to content

[bug #37847] Xmega power.h groupings are wrong #545

Open
@avrs-admin

Description

@avrs-admin

Sat 01 Dec 2012 01:34:10 AM CET

In working on a patch to add all xmega devices, I ran across the power.h code.  The problem is that the groupings don't actually match the functionality of the various devices, and even within those groups some of the macros aren't consistent.

I'd propose that rather than defining them based on the individual chip macros, that each of the power_enable() and power_disable() macros be #ifdef'd based on whether the peripheral itself is defined:

#ifdef USARTF1
#define power_usartf1_enable()  (PR_PRPF &= (uint8_t)~(PR_USART1_bm))
#define power_usartf1_disable() (PR_PRPF |= (uint8_t)PR_USART1_bm)
#endif

The _enable_all and _disable_all are a slightly tougher nut to crack, but that could be solved by adding in before the #endif a:

#define __power_usartf1_mask ((uint8_t)PR_USART1_bm)
#else
#define __power_usartf1_mask (0)

Then grouping all these macros together into a single pair of definitions for _all().

file #27005: power.h

This issue was migrated from https://savannah.nongnu.org/bugs/?37847

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions