inital version

This commit is contained in:
2020-05-27 20:38:58 +02:00
commit 7b936642ad
21 changed files with 1850 additions and 0 deletions

26
writepin.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef WRITEPIN_H
#define WRITEPIN_H
#include <avr/io.h>
inline void writePin(volatile unsigned char *port, const unsigned char pin, const bool state) //waste 2 cycles
{
*port &= ~(1 << pin);
if(state) *port |= (1 << pin);
}
inline void setBit( volatile unsigned char *reg, const unsigned char bit, bool value )
{
writePin(reg, bit, value);
}
inline void setDirection( volatile unsigned char *portDirReg, const unsigned char pin, bool makeOutput )
{
writePin(portDirReg, pin, makeOutput);
}
inline bool readPin( volatile unsigned char *inPort, const unsigned char pin){ return (bool) (*inPort & (1 << pin));}
#endif