Content originally posted in LPCWare by amlwwalker on Mon Dec 16 12:42:52 MST 2013 Hi I am trying to get my ADC's for my touchscreen working on an interrupt. They worked when I was polling the channels, but I dont get anything on an interrupt.
My setup code for the two channels is:
void prepareTouchScreen() {
ADC_Init(LPC_ADC, 400000);
/* Configure X1: */LPC_IOCON ->P0_24 = PIN_GPIO; /* X1 is a GPIO pin */
LPC_GPIO0 ->DIR |= (1 << 24); /* it's output */
LPC_GPIO0 ->SET = (1 << 24); /* and is set high */
/* Configure Y1: */LPC_IOCON ->P0_23 = PIN_GPIO; /* Y1 is a GPIO pin */
LPC_GPIO0 ->DIR |= (1 << 23); /* it's output */
LPC_GPIO0 ->SET = (1 << 23); /* and is set high */
/* Configure X2: */LPC_IOCON ->P0_22 = PIN_OD; /* simulated open drain (high impedance) mode */
LPC_GPIO0 ->DIR |= (1 << 22); /* this pin is always output */
LPC_GPIO0 ->SET = (1 << 22); /* and is set high (not sinking current) */
/* Configure Y2: */LPC_IOCON ->P0_21 = PIN_OD; /* simulated open drain (high impedance) mode */
LPC_GPIO0 ->DIR |= (1 << 21); /* this pin is always output */
LPC_GPIO0 ->SET = (1 << 21); /* and is set high (not sinking current) */
LOG("Touch Screen Prepared");
}
prepareTouchScreen();
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(ADC_IRQn, ((0x01<<3)|0x01));
LPC_ADC->INTEN = 0; /* disable ADC interrupts */
NVIC_ClearPendingIRQ(ADC_IRQn); /* clear ADC_IRQ pending bit in the NVIC */
NVIC_EnableIRQ(ADC_IRQn); /* enable ADC_IRQ in the NVIC */
startTouchscreenADC(0);
while(1){
}
Finally my ADC handler is:
void ADC_IRQHandler(void)
{
static uint8_t valid = 0;
static uint16_t valueX = 0x8000;
static uint16_t valueY = 0x8000;
uint16_t value;
NVIC_ClearPendingIRQ(ADC_IRQn);
// the static local variables above are for temporary values, until we have both values as a complete set.
// read ADC values and store into appropriate variables:
// get ADC channel status for channel 0, if it's ready
LOG("Handler accessed");
if(value & ADC_DR_DONE_FLAG) // this might happen right now, it might not
{
valueX = ADC_DR_RESULT(value); // store value temporarily
valid |= X_VALID; // X position is now valid
startTouchscreenADC(1); // start conversion for channel 1.
}
// get ADC channel status for channel 1, if it's ready
value = LPC_ADC->DR[1];
if(value & ADC_DR_DONE_FLAG) // this might happen right now, it might not
{
valueY = ADC_DR_RESULT(value); // store value temporarily
valid |= Y_VALID; // Y position is now valid
startTouchscreenADC(0); // start conversion for channel 0.
}
if(BOTH_VALID == valid)
{
valid = 0;
if(valueX >= TOUCH_X_MIN && valueX < TOUCH_X_MAX && valueY >= TOUCH_Y_MIN && valueY < TOUCH_Y_MAX)
{
touchPos = (valueX << 16) | (valueY & 0xffff);
touchState = 1;
}
else
{
touchState = 0; // not touched.
touchPos = 0x80008000; // coordinates somewhere far away. :)
}
}
}
I am expecting to see:
LOG("Handler accessed");
If I touch the touchscreen and the Handler is called. What I do see is on my terminal is:
Quote:
Touch Screen Prepared
startTouchscreenADC
direction = 0
direction changed
finished conversion
Can anyone see why Im not getting anything back when I touch the touchscreen? Im not sure why its not going into the handler. Im trying to setup JTAG debugging now to see if I can get anything but any help would be greatly appreciated.
Content originally posted in LPCWare by amlwwalker on Tue Dec 17 14:15:45 MST 2013 no one can help me? I thought this kind of thing would be straight forward, but its turning out not to be...there is very little on this and the example is correct.
0
Kudos
Reply
'
var data = div.getElementsByClassName("video-js");
var script = document.createElement('script');
script.src = "https://players.brightcove.net/" + data_account + "/" + data_palyer + "_default/index.min.js";
for(var i=0;i< data.length;i++){
videodata.push(data[i]);
}
}
}
for(var i=0;i< videodata.length;i++){
document.getElementsByClassName('lia-vid-container')[i].innerHTML = videodata[i].outerHTML;
document.body.appendChild(script);
}
}
catch(e){
}
/* Re compile html */
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
}
if (code_l.toLowerCase() != newBody.getAttribute("slang").toLowerCase()) {
/* Adding Translation flag */
var tr_obj = $filter('filter')($scope.sourceLangList, function (obj_l) {
return obj_l.code.toLowerCase() === newBody.getAttribute("slang").toLowerCase()
});
if (tr_obj.length > 0) {
tr_text = "This content was translated from lilicon-trans-text using AI-assisted tools.".replace(/lilicon-trans-text/g, tr_obj[0].title);
tr_text +='View original';
try {
if ($scope.wootMessages[$rootScope.profLang] != undefined) {
tr_text = $scope.wootMessages[$rootScope.profLang].replace(/lilicon-trans-text/g, tr_obj[0].title);
tr_text +='View original';
}
} catch (e) {
}
} else {
//tr_text = "This message was translated for your convenience!";
tr_text = "lilicon-trans.your.convenience";
}
try {
if (!document.getElementById("tr-msz-" + value)) {
var tr_para = document.createElement("P");
tr_para.setAttribute("id", "tr-msz-" + value);
tr_para.setAttribute("class", "tr-msz");
tr_para.style.textAlign = 'justify';
var tr_fTag = document.createElement("IMG");
tr_fTag.setAttribute("class", "tFlag");
tr_fTag.setAttribute("alt", "Translate icon");
// tr_fTag.setAttribute("title", "Disclaimer for Translate icon");
tr_fTag.setAttribute("src", "/html/assets/translate-icon.svg");
tr_para.appendChild(tr_fTag);
var container = document.createElement('span');
container.innerHTML = tr_text;
//var tr_textNode = document.createTextNode(container);
tr_para.appendChild(container);
/* Woot message only for multi source */
if(rootElement.querySelector(".lia-message-body-content").previousElementSibling != null && rootElement.querySelector(".lia-message-body-content").previousElementSibling.getAttributeNames().includes("data-generation-timestamp")){
rootElement.querySelector(".lia-message-body-content").previousElementSibling.remove()
}
if(rootElement.querySelector(".lia-quilt-forum-message")){
rootElement.querySelector(".lia-quilt-forum-message .lia-message-body").insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-message-view-blog-topic-message")) {
rootElement.querySelector(".lia-message-view-blog-topic-message .lia-message-body").insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-quilt-blog-reply-message")){
rootElement.querySelector(".lia-quilt-blog-reply-message .lia-message-body").insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-quilt-tkb-message")){
rootElement.querySelectorAll(".lia-quilt-tkb-message .lia-message-body")[0].insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-quilt-tkb-reply-message")){
rootElement.querySelectorAll(".lia-quilt-tkb-reply-message .lia-message-body")[0].insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-quilt-idea-message")){
rootElement.querySelector(".lia-quilt-idea-message .lia-message-body").insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector(".lia-quilt-idea-reply-message")){
rootElement.querySelector(".lia-quilt-idea-reply-message .lia-message-body").insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
} else if(rootElement.querySelector('.lia-quilt-occasion-message')){
rootElement.querySelector('.lia-quilt-occasion-message .lia-message-body').insertBefore(tr_para,rootElement.querySelector(".lia-message-body-content"));
}
else {
if (rootElement.querySelectorAll('div.lia-quilt-row-footer').length > 0) {
rootElement.querySelectorAll('div.lia-quilt-row-footer')[0].appendChild(tr_para);
} else {
rootElement.querySelectorAll('div.lia-quilt-column-message-footer')[0].appendChild(tr_para);
}
}
}
} catch (e) {
}
}
} else {
/* Do not display button for same language */
// syncList.remove(value);
var index = $scope.syncList.indexOf(value);
if (index > -1) {
$scope.syncList.splice(index, 1);
}
}
}
}
}
}
/*if(mszList_l.length <= 0){
setTimeout(()=>{
var mszListl = [];
angular.forEach(document.querySelectorAll("[class*='lia-js-data-messageUid']"), function(element) {
var mszId = element.getAttribute("data-lia-message-uid");
if (mszId != null) {
mszListl.push(mszId);
}
});
var mszListid = mszListl;
console.log("mszListl:",mszListl);
},2000)
}else{
var mszListid = mszList_l;
}*/
console.log("mszList_l:",mszList_l.length);
angular.forEach(mszList_l, function (value) {
if (document.querySelectorAll('div.lia-js-data-messageUid-' + value).length > 0) {
var rootElements = document.querySelectorAll('div.lia-js-data-messageUid-' + value);
}else if(document.querySelectorAll('.lia-occasion-message-view .lia-component-occasion-message-view').length >0){
var rootElements = document.querySelectorAll('.lia-occasion-message-view .lia-component-occasion-message-view')[0].querySelectorAll('.lia-occasion-description')[0];
}else {
var rootElements = document.querySelectorAll('div.message-uid-' + value);
}
angular.forEach(rootElements, function (rootElement) {
if (value == '521599' && "ForumTopicPage" == "TkbArticlePage") {
rootElement = document.querySelector('.lia-thread-topic');
}
/* V1.1 Remove from UI */
if (document.getElementById("tr-msz-" + value)) {
document.getElementById("tr-msz-" + value).remove();
}
if (document.getElementById("tr-sync-" + value)) {
document.getElementById("tr-sync-" + value).remove();
}
/* XPath expression for subject and Body */
var lingoRBExp = "//lingo-body[@id = "+"'lingo-body-"+value+"'"+"]";
lingoRSExp = "//lingo-sub[@id = "+"'lingo-sub-"+value+"'"+"]";
/* Get translated subject of the message */
lingoRSXML = doc.evaluate(lingoRSExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i=0;i 0){
angular.forEach(document.querySelectorAll(".PageTitle"), function(subEle) {
subEle.textContent = sub_L;
});
}
}
}
// Label translation
try{
var labelEle = document.querySelector("#labelsForMessage");
if(!labelEle){
labelEle = document.querySelector(".LabelsList");
}
if(labelEle) {
var listContains = labelEle.querySelector('.label');
if (listContains) {
/* Commenting this code as bussiness want to point search with source language label */
// var tagHLink = labelEle.querySelectorAll(".label")[0].querySelector(".label-link").href.split("label-name")[0];
var lingoLabelExp = "//lingo-label/text()";
trLabels = [];
trLabelsHtml = "";
/* Get translated labels of the message */
lingoLXML = doc.evaluate(lingoLabelExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var labelsLength = document.querySelector(".LabelsList").querySelectorAll(".label").length;
var labelSnapshotLength = lingoLXML.snapshotLength;
if (labelsLength == labelSnapshotLength){
for (var k = 0; k < lingoLXML.snapshotLength; k++) {
//trLabels.push(lingoLXML.snapshotItem(i).textContent);
if (k != 0) {
//trLabelsHtml = trLabelsHtml + '