Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I know this is more then one question but they are as a group... Problem set 1. (5 points) We are interested in knowing if
I know this is more then one question but they are as a group...
Problem set 1. (5 points) We are interested in knowing if the joystick's up button in our discovery kit was pressed. This button is connected to pin 3 of GPIO port A. Every time we need to read some input, we will need to use a bitwise operation to check the corresponding bit, inside an if-statement. Complete the code below in order to verify if bit 3 in GPIOA->IDR is equal to 1. In other words if the statement below is true, the up button was pressed! Hint: You only need to write an hexadecimal mask inside the parentheses. Remember, bits and pins start counting from 0. if (GPIOA-IDR & ) != 0x00) ; 2. (5 points) Complete the code below to configure pin 10 of GPIO port B as push-pull. Hint: You only need to write an hexadecimal mask inside the parentheses. GP10B->OTYPER &= -( - 3. (5 points) Write a single line of C code that would enable the clocks of GPIOs port A, B and E. Hint: You should set the correct bits from the correct register 4. (10 points) Write a complete C program to set up and turn ON both the green and red LEDs (PB.2 and PE.8) at the same time in our discovery kit Hint: Your C progran should include the correct #include library, main function, and dead loop. Use the code from Lecture 1, Slide 32 as your template, and the code from Lecture 2, Slide 39 to help you. Note: Write all masks in hexadecimal formatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started