[Nut-upsdev] [PATCH 21/36] Use (1 << N) to define a bit flag at bit N.

Arnaud Quette aquette.dev at gmail.com
Mon May 14 14:52:45 UTC 2012


2012/3/9 Greg A. Woods <woods at planix.com>:
> From: "Greg A. Woods" <woods at planix.com>
>
> ---
>  drivers/apcsmart.h |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/apcsmart.h b/drivers/apcsmart.h
> index e10c5fe..d85c3b9 100644
> --- a/drivers/apcsmart.h
> +++ b/drivers/apcsmart.h
> @@ -115,14 +115,14 @@
>
>  /* status bits */
>
> -#define APC_STAT_CAL   0x01    /* calibration */
> -#define APC_STAT_TRIM  0x02    /* SmartTrim */
> -#define APC_STAT_BOOST 0x04    /* SmartBoost */
> -#define APC_STAT_OL    0x08    /* on line */
> -#define APC_STAT_OB    0x10    /* on battery */
> -#define APC_STAT_OVER  0x20    /* overload */
> -#define APC_STAT_LB    0x40    /* low battery */
> -#define APC_STAT_RB    0x80    /* replace battery */
> +#define APC_STAT_CAL   (1 << 0)        /* calibration */
> +#define APC_STAT_TRIM  (1 << 1)        /* SmartTrim */
> +#define APC_STAT_BOOST (1 << 2)        /* SmartBoost */
> +#define APC_STAT_OL    (1 << 3)        /* on line */
> +#define APC_STAT_OB    (1 << 4)        /* on battery */
> +#define APC_STAT_OVER  (1 << 5)        /* overload */
> +#define APC_STAT_LB    (1 << 6)        /* low battery */
> +#define APC_STAT_RB    (1 << 7)        /* replace battery */
>
>  /*
>  * serial protocol: special commands - initialization and such

applied to trunk, r3586, with another driver version bump.
thanks.

Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsdev mailing list