Restructure files
This commit is contained in:
parent
8c7b62dc2d
commit
b5f86d5972
13 changed files with 29 additions and 20 deletions
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* BitIO.h
|
||||
* @author Andi Dittrich <http://andidittrich.de>
|
||||
* @version 1.0
|
||||
* @license MIT Style X11 License
|
||||
*/
|
||||
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef BITIO_H_
|
||||
#define BITIO_H_
|
||||
|
||||
// set bit
|
||||
static inline void BIT_SET(volatile uint8_t *target, uint8_t bit) __attribute__((always_inline));
|
||||
static inline void BIT_SET(volatile uint8_t *target, uint8_t bit){
|
||||
*target |= (1<<bit);
|
||||
};
|
||||
|
||||
// set clear
|
||||
static inline void BIT_CLEAR(volatile uint8_t *target, uint8_t bit) __attribute__((always_inline));
|
||||
static inline void BIT_CLEAR(volatile uint8_t *target, uint8_t bit){
|
||||
*target &= ~(1<<bit);
|
||||
};
|
||||
|
||||
// bit toogle
|
||||
static inline void BIT_TOGGLE(volatile uint8_t *target, uint8_t bit) __attribute__((always_inline));
|
||||
static inline void BIT_TOGGLE(volatile uint8_t *target, uint8_t bit){
|
||||
*target ^= (1<<bit);
|
||||
};
|
||||
|
||||
// set bit by boolean
|
||||
static inline void BIT_BOOL_SET(volatile uint8_t *target, uint8_t bit, bool enable) __attribute__((always_inline));
|
||||
static inline void BIT_BOOL_SET(volatile uint8_t *target, uint8_t bit, bool enable){
|
||||
if (enable){
|
||||
BIT_SET(target, bit);
|
||||
}else{
|
||||
BIT_CLEAR(target, bit);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* BITIO_H_ */
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue