From 48ea8062c0d54822b55a1a727549a938932d0f1a Mon Sep 17 00:00:00 2001 From: _N0x Date: Thu, 28 Oct 2021 16:11:18 +0200 Subject: [PATCH] Switching PORTC and PORTD to PINC and PIND in Taster.c --- EmbeddedSystemsTHM/EmbeddedSystemsTHM.cproj | 152 +++++++++++--------- EmbeddedSystemsTHM/Taster.c | 16 +-- 2 files changed, 90 insertions(+), 78 deletions(-) diff --git a/EmbeddedSystemsTHM/EmbeddedSystemsTHM.cproj b/EmbeddedSystemsTHM/EmbeddedSystemsTHM.cproj index 315c59b..bccc70a 100644 --- a/EmbeddedSystemsTHM/EmbeddedSystemsTHM.cproj +++ b/EmbeddedSystemsTHM/EmbeddedSystemsTHM.cproj @@ -41,85 +41,97 @@ Simulator + + + + + + + + + + + + - -mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega1284p" - True - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Optimize for size (-Os) - True - True - True - - - libm - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - + -mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega1284p" + True + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + - -mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega1284p" - True - True - True - True - True - False - True - True - - - DEBUG - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Optimize debugging experience (-Og) - True - True - Default (-g2) - True - - - libm - - - - - %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ - - - Default (-Wa,-g) - + -mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega1284p" + True + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Optimize debugging experience (-Og) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\ + + + Default (-Wa,-g) + diff --git a/EmbeddedSystemsTHM/Taster.c b/EmbeddedSystemsTHM/Taster.c index 3216454..83b4594 100644 --- a/EmbeddedSystemsTHM/Taster.c +++ b/EmbeddedSystemsTHM/Taster.c @@ -1,22 +1,22 @@ #include 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); } \ No newline at end of file