1. Register GPIOx PDDR is used for configuring the direction of GPIO ports (logic 0 sets the port pin as input). Write embedded C code to configure the direction of ports in Figure 1 to read the push button switch and display its status on the LED Vee.
PTD10
PTA7 FRDMKL257
2200
Figure 1
2. Write embedded C code to turn ON the LED in Figure 1 using GPIOx PSOR or GPIOx PCOR.
3. A 4x4-matrix keypad is interfaced with the microcontroller as shown in Figure 2.
a. Write embedded C code to set the direction of Ports using the GPIOxPDDR register to scan the keys.
e2 D2
ea DJ
C4
roRn
D1
D4
Figure 2
b. If GPIOA PDIR=0xFD while GPIOB_PDOR=0x7F, the key pressed is.