STM32 Blue Pill Drivers
Drivers that could be used to interface and interact with STM32F103C8T6 Microcontroller
Loading...
Searching...
No Matches
Bit Manipulation Math Macros

This module contains the bit math manipulation macro-functions. More...

+ Collaboration diagram for Bit Manipulation Math Macros:

Macros

#define SET_BIT(REG, BITNUM)   (REG) |= (1 << (BITNUM))
 Set a certain bit's value. More...
 
#define CLEAR_BIT(REG, BITNUM)   (REG) &= ~(1 << (BITNUM))
 Clear a certain bit's value to. More...
 
#define TOGGLE_BIT(REG, BITNUM)   (REG) ^= (1 << (BITNUM))
 Toggle a bit to 0 if it's 1, 1 otherwise. More...
 
#define GET_BIT(REG, BITNUM)   (((REG) >> (BITNUM)) & 1)
 Return the value of the bit whether it's 1 or 0 More...
 

Detailed Description

This module contains the bit math manipulation macro-functions.

Macro Definition Documentation

◆ SET_BIT

#define SET_BIT (   REG,
  BITNUM 
)    (REG) |= (1 << (BITNUM))

#include <LIB/LSTD_BITMATH.h>

Set a certain bit's value.

Parameters
[in]REGThe register to set its bit
[in]BITNUMThe bit number to set

◆ CLEAR_BIT

#define CLEAR_BIT (   REG,
  BITNUM 
)    (REG) &= ~(1 << (BITNUM))

#include <LIB/LSTD_BITMATH.h>

Clear a certain bit's value to.

Parameters
[in]REGThe register to clear its bit
[in]BITNUMThe bit number to clear

◆ TOGGLE_BIT

#define TOGGLE_BIT (   REG,
  BITNUM 
)    (REG) ^= (1 << (BITNUM))

#include <LIB/LSTD_BITMATH.h>

Toggle a bit to 0 if it's 1, 1 otherwise.

Parameters
[in]REGThe register to toggle its bit
[in]BITNUMThe bit number to toggle

◆ GET_BIT

#define GET_BIT (   REG,
  BITNUM 
)    (((REG) >> (BITNUM)) & 1)

#include <LIB/LSTD_BITMATH.h>

Return the value of the bit whether it's 1 or 0

Parameters
[in]REGThe register to get its bit
[in]BITNUMThe bit number to get