Untitled
unknown
plain_text
3 years ago
2.3 kB
11
Indexable
/*
* File: TAD_GESTIONLCD.c
* Author: Christian Hasko
*
* Created on 22 de abril de 2023, 14:17
*/
#include <xc.h>
#include "TAD_GESTIONLCD.h"
#include "TAD_TIMER.H"
#include "LcTLCD.h"
static unsigned char TimerVirtual;
static unsigned char StartPos = 2;
__bit Enable = 0;
const char menuList[5][23] = {
"1.Start Recording", // StartPos = 0
"2.Play Recordings", // StartPos = 1
"3.Modify Current Time", // StartPos = 2
"4.Show Current Time", // StartPos = 3
"5.End Communication" // StartPos = 4
};
void GLCD_Init(void) {
TI_NewTimer(&TimerVirtual);
}
void GCLD_Motor(void) {
static unsigned char Estado = 0;
static unsigned char longitud1 = 0;
static unsigned char longitud2 = 0;
static unsigned char start1 = 0;
static unsigned char start2 = 0;
static unsigned char i = 0;
static unsigned char countPantalla = 0;
switch(Estado) {
case 0:
if(Enable) {
Estado++;
LcGotoXY(0,0);
}
break;
case 1:
//(menuList[StartPos][longitud1] != '\0') ? (LcPutChar(menuList[StartPos][longitud1++])) : (Estado++, StartPos++);
//Obtenemos la longitud de los textos!
if(menuList[StartPos][longitud1] != '\0') {
longitud1++;
}else {
Estado++;
}
break;
case 2:
LcPutChar(menuList[StartPos][start1 + i++]);
Estado++;
countPantalla++;
break;
case 3:
if(menuList[StartPos][i+start1] == '\0') {
//
LcPutChar(' ');
i = 0;
start1 = 0;
Estado++;
}else if(countPantalla >= 15) {
LcGotoXY(0,0);
i = 0;
start1++;
Estado++;
countPantalla = 0;
}else {
Estado = 2;
}
break;
case 4:
if(TI_GetTics(TimerVirtual) >= 4000) {
Estado = 2;
TI_ResetTics(TimerVirtual);
}
break;
}
}
void GLCD_EnableMenu(void) {
Enable = 1;
}
void GLCD_DisableMenu(void) {
Enable = 0;
}
Editor is loading...