summaryrefslogtreecommitdiffstats
path: root/hal/pin.tpp
blob: 4f6bd4aca27f66822ea1c9f883559b6c7430bbce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* 
 * File:   pin.cpp
 * Author: naopross
 * 
 * Created on May 3, 2018, 8:02 PM
 */

#include "pin.hpp"

template<typename reg, unsigned bit>
pin<reg, bit>::pin(reg *r)
{
	_register = r;
}


template<typename reg, unsigned bit>
pin<reg, bit>::~pin()
{
    
}

template<typename reg, unsigned bit>
void pin<reg, bit>::set(bool v)
{
	if (v) 
		*reinterpret_cast<volatile uint8_t *>(_register) |= 1<<bit;
	else
		*reinterpret_cast<volatile uint8_t *>(_register) &= ~(1<<bit);
}