22 lines
505 B
C
22 lines
505 B
C
#include <avr/io.h>
|
|
|
|
void Taster_init(void){
|
|
DDRD &= ~(7<<5); // Set bit 5-7 of Data Direction Register D as input
|
|
DDRC &= ~(1<<2); // Set bit 2 of Data Direction Register B as input
|
|
|
|
PORTD &= ~(7<<5); // Initialize bit 5-7 of PORTD as low
|
|
PORTC &= ~(1<<2); // Initialize bit 2 of PORTC as low
|
|
}
|
|
|
|
uint8_t Taster1_get(void){
|
|
return PORTD&(1<<7);
|
|
}
|
|
uint8_t Taster2_get(void){
|
|
return PORTD&(1<<6);
|
|
}
|
|
uint8_t Taster3_get(void){
|
|
return PORTD&(1<<5);
|
|
}
|
|
uint8_t Taster4_get(void){
|
|
return PORTC&(1<<2);
|
|
} |