Import code from old repository from 2018

Old repository: https://github.com/binaryDiv/z80_computer
This commit is contained in:
Lexi / Zoe 2021-04-03 17:21:59 +02:00
parent 536e557eea
commit 8c7b62dc2d
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
19 changed files with 3076 additions and 0 deletions

44
firmware_src/BitIO.h Normal file
View file

@ -0,0 +1,44 @@
/**
* 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_ */