The code was developed for FRDM KL128Z microcontroller running ARM's cortex M0+ processor. Further more, a shield was developed for the FRDM board which communicates to a LCD touch diplay using the GPIO port and a high brightness LED to which the power is delivered by a switch mode power supply. The LED is made to blink by providing the switch mode power supply an fluctuating DC. This is delivered by the onboard PMW module. A feedback is also given back to the microcontroller through thr ADC. Using this converted value the processor adjusts the period of the PWM wave.
The display is a resistive touch panel that has 4 leads, a pair on the top and the bottom and a pair on either side. Two resistive layers are seperated by a very small distance, when a force is applied the two layers are made to come in contact with each other. When we set one of the sides to Vcc and ground we can get a reading from the other two sides with which we can estimate the location of the press. The analog voltage value obtained is fed to an ADC and this converts the value into a digital value which the processor can interpret. We poll the touch screen periodically using OsDelay and see if there was a press. When there is a press, we send the signal received to the ADC for it to convert it into a digital value.
The ADC is shared with two peripherals namely, the HB LED and the touch screen. The base code that was given stops converting the feedback from the ADC as soon as it gets a value to be converted from the touch screen. The modification made, tries to share the ADC between the two peripheral and prioritise the conversion of the feedback from the HBLED over the conversion of the touch values.
A message queue is created and when the touch screen wants to pass the data to the ADC module, it passes it through the queue. The conversion takes place only when we have a HB LED conversion to be performed. We see if there is a enough time to make another ADC conversion, if so we go ahead and convert the value present in the queue, else we don't and let the touch screen stall at the point in the code till it gets a reply from the ADC.
It is advised to use OpenSDA as the debugger.