You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
603 B
C

#include <avr/io.h>
void Taster_init(void){
DDRD &= ~(0b111<<5); // Set bit 5-7 of Data Direction Register D as input
DDRC &= ~(1<<2); // Set bit 2 of Data Direction Register C as input
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
}
uint8_t Taster1_get(void){
return ((PIND & (1<<PIND7)) == 0);
}
uint8_t Taster2_get(void){
return ((PIND & (1<<PIND6)) == 0);
}
uint8_t Taster3_get(void){
return ((PIND & (1<<PIND5)) == 0);
}
uint8_t Taster4_get(void){
return ((PINC & (1<<PINC2)) == 0);
}