Switching PORTC and PORTD to PINC and PIND in Taster.c
This commit is contained in:
parent
d48aedf507
commit
48ea8062c0
@ -41,6 +41,18 @@
|
||||
</ToolNumber>
|
||||
<ToolName xmlns="">Simulator</ToolName>
|
||||
</com_atmel_avrdbg_tool_simulator>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
|
@ -1,22 +1,22 @@
|
||||
#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
|
||||
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 &= ~(7<<5); // Initialize bit 5-7 of PORTD as low
|
||||
PORTC &= ~(1<<2); // Initialize bit 2 of PORTC as low
|
||||
PIND &= ~(0b111<<5); // Initialize bit 5-7 of PORTD as low
|
||||
PINC &= ~(1<<2); // Initialize bit 2 of PORTC as low
|
||||
}
|
||||
|
||||
uint8_t Taster1_get(void){
|
||||
return PORTD&(1<<7);
|
||||
return PIND&(1<<7);
|
||||
}
|
||||
uint8_t Taster2_get(void){
|
||||
return PORTD&(1<<6);
|
||||
return PIND&(1<<6);
|
||||
}
|
||||
uint8_t Taster3_get(void){
|
||||
return PORTD&(1<<5);
|
||||
return PIND&(1<<5);
|
||||
}
|
||||
uint8_t Taster4_get(void){
|
||||
return PORTC&(1<<2);
|
||||
return PINC&(1<<2);
|
||||
}
|
Loading…
Reference in New Issue
Block a user