Hanna
Sourcecode Batteriemanagementsystem
taster.c
gehe zur Dokumentation dieser Datei
1 
15 #include <avr/io.h>
16 #include <avr/interrupt.h>
17 #include <stdio.h>
18 #include <util/delay.h>
19 
20 #include "taster.h"
21 #include "board_init.h"
22 
23 uint8_t taster_nr = 0;
24 
29 ISR ( PORTD_INT0_vect )
30 {
31 // PORTD.INT0MASK = 0;
32 
33  uint8_t i = 0;
34  i = (PORTD.IN & TASTER_ALLE) ^ TASTER_ALLE;
35 
36  if ( i == TASTER_1_bm )
37  taster_nr = 1;
38  else if ( i == TASTER_2_bm )
39  taster_nr = 2;
40  else if ( i == TASTER_3_bm )
41  taster_nr = 3;
42  else if ( i == TASTER_4_bm )
43  taster_nr = 4;
44  else
45  taster_nr = 99;
46 
47 // printf ( "Taster \x1B[31m%i\x1B[0m.\n\n\r", taster_nr );
48 
49 // _delay_ms(5);
50 // PORTD.INT0MASK = TASTER_ALLE;
51 }
52 
Standard board header file. Diese Datei enthält die Standardparameter und Pinbelegungen für das BMS B...
uint8_t taster_nr
Globale Definition. Die Variable wird aus der ISR gesetzt und gibt an, welcher der vier Taster am Dis...
Definition: taster.c:23
ISR(PORTD_INT0_vect)
Die ISR PORTD_INT0_vect ermittelt, welcher Taster am Display gedrückt wurde und speichert das Ergebni...
Definition: taster.c:29
Standardheader.