2021-10-21 19:55:33 +02:00
|
|
|
#include <avr/io.h>
|
|
|
|
|
|
|
|
void Taster_init(void){
|
2021-10-28 16:11:18 +02:00
|
|
|
DDRD &= ~(0b111<<5); // Set bit 5-7 of Data Direction Register D as input
|
2021-10-28 16:36:38 +02:00
|
|
|
DDRC &= ~(1<<2); // Set bit 2 of Data Direction Register C as input
|
2021-10-21 19:55:33 +02:00
|
|
|
|
2021-10-28 16:36:38 +02:00
|
|
|
PORTD |= (0b111<<5); // Initialize bit 5-7 of PORTD as for pull up resistor
|
|
|
|
PORTC |= (1<<2); // Initialize bit 2 of PORTC as for pull up resistor
|
2021-10-21 19:55:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t Taster1_get(void){
|
2021-10-28 16:11:18 +02:00
|
|
|
return PIND&(1<<7);
|
2021-10-21 19:55:33 +02:00
|
|
|
}
|
|
|
|
uint8_t Taster2_get(void){
|
2021-10-28 16:11:18 +02:00
|
|
|
return PIND&(1<<6);
|
2021-10-21 19:55:33 +02:00
|
|
|
}
|
|
|
|
uint8_t Taster3_get(void){
|
2021-10-28 16:11:18 +02:00
|
|
|
return PIND&(1<<5);
|
2021-10-21 19:55:33 +02:00
|
|
|
}
|
|
|
|
uint8_t Taster4_get(void){
|
2021-10-28 16:11:18 +02:00
|
|
|
return PINC&(1<<2);
|
2021-10-21 19:55:33 +02:00
|
|
|
}
|