class pah8011 for mbed

pah8011/pah_util.h

Committer:
bell_huang
Date:
2019-01-23
Revision:
6:d196b612b14a

File content as of revision 6:d196b612b14a:

/**
 * @file pah_util.h
 *
 * Copyright (c) 2016-2017 PixArt Imaging Inc.
 * All Rights Reserved.
 * Confidential and Proprietary - PixArt Imaging Inc.
 **/
#ifndef __pah_util_h__
#define __pah_util_h__


#include <stdint.h>


#define PAH_ARRAY_SIZE(arr)         (sizeof(arr) / sizeof(arr[0]))

#define PAH_SET_BIT(var,pos)        do { ((var) |= (1 << (pos))); } while(0)
#define PAH_CLEAR_BIT(var,pos)      do { ((var) &= ~(1 << (pos))); } while(0)
#define PAH_CHECK_BIT(var,pos)      (((var) >> (pos)) & 1)

#define PAH_UINT64_HIGH(var)  ((uint32_t)(var >> 32))
#define PAH_UINT64_LOW(var)   ((uint32_t)(var & UINT32_MAX))


#endif  // header guard