-
Notifications
You must be signed in to change notification settings - Fork 1
/
transistor.h
68 lines (55 loc) · 1.45 KB
/
transistor.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*************************************
* Nom del arxiu: transistor.c
* Autor: Miguel Angel Borrego
* Data: 31/03/2013
* Compilador: WinAvr 20100110
* Descripció: Definicions i prototips
* de funcions
**************************************/
#ifndef _TRANSISTOR_H
#define _TRANSISTOR_H
// definicions de pins i ports
#define TP1_PORT PORTC
#define TP1_DDR (*(&TP1_PORT-1))
#define TP1 1
#define TP2_PORT PORTC
#define TP2_DDR (*(&TP2_PORT-1))
#define TP2 2
#define TP3_PORT PORTC
#define TP3_DDR (*(&TP3_PORT-1))
#define TP3 3
#define RTL1_PORT PORTC
#define RTL1_DDR (*(&RTL1_PORT-1))
#define RTL1 0
#define RTL2_PORT PORTB
#define RTL2_DDR (*(&RTL2_PORT-1))
#define RTL2 4
#define RTL3_PORT PORTB
#define RTL3_DDR (*(&RTL3_PORT-1))
#define RTL3 2
#define RTH1_PORT PORTB
#define RTH1_DDR (*(&RTH1_PORT-1))
#define RTH1 5
#define RTH2_PORT PORTB
#define RTH2_DDR (*(&RTH2_PORT-1))
#define RTH2 3
#define RTH3_PORT PORTB
#define RTH3_DDR (*(&RTH3_PORT-1))
#define RTH3 1
#define PNP 1
#define NPN 0
// definim els components d'un transistor bjt
struct bjt
{
uint8_t base;
uint8_t colector;
uint8_t emisor;
uint16_t beta;
uint8_t tipus; // PNP o NPN
};
// funcions
uint8_t transistor_check(struct bjt* transistor);
uint16_t check (uint8_t high, uint8_t low);
uint8_t calculate_beta (struct bjt* tr);
void tr_init(void);
#endif