本文整理汇总了C++中LCD_PrintString函数的典型用法代码示例。如果您正苦于以下问题:C++ LCD_PrintString函数的具体用法?C++ LCD_PrintString怎么用?C++ LCD_PrintString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LCD_PrintString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
* Main function performs following functions:
* 1. Initialises the DMA to move data from ADC_SAR_1 work registers to the
* PrISM pulse density registers.
* 2. Initialises the ISR connected to the DMA nrq terminal(DMA done).
* 3. Initialises the LCD.
* 4. Initialises the PrISM with 1Mhz clock.
* 5. Initialises the two SAR ADCs.
* 6. Displays the results of ADC_SAR_1 when DmaDone ISR rises.
* The results are read from PrISM pulse density register.
* 7. Displays the results of ADC_SAR_2 when internal EOC ISR rises.
*
* Parameters:
* None.
*
* Return:
* None.
*
*******************************************************************************/
int main()
{
char8 resultStr[16u];
float res;
/* Initializes the LCD. */
LCD_Start();
LCD_Position(1u,0u);
LCD_PrintString("ADC2= V");
ADC_SAR_2_Start();
ADC_SAR_2_IRQ_StartEx(ADC_SAR_2_ISR_LOC);
ADC_SAR_2_StartConvert();
CyGlobalIntEnable;
for(;;)
{
/* Show ADC2 result on LCD*/
if(dataReady != 0u)
{
res = ADC_SAR_2_CountsTo_Volts(result);
sprintf((char *)resultStr,"%+1.2f",res);
LCD_Position(1u,5u);
LCD_PrintString(resultStr);
dataReady = 0u;
}
}
}
示例2: DisplayChoices
signed char DisplayChoices(const char *Menu[], char ItemCount, const char *Prompt, char Initial) {
char SelectedItem = 0;
signed char ret = 0;
SelectedItem = Initial;
while (1) {
LCD_ClearDisplay();
LCD_PrintString(Prompt);
LCD_SetPosition(1, 0);
LCD_PrintChar('*');
LCD_PrintString(Menu[SelectedItem]);
ret = GetInput();
if (ret < 0) return ret;
switch (ret) {
case USER_INPUT_CLICK:
return (SelectedItem);
case USER_INPUT_BACK:
return (-1);
case USER_INPUT_CANCEL:
return (-2);
case USER_INPUT_INC:
if (SelectedItem == ItemCount) SelectedItem = ItemCount;
else SelectedItem++;
break;
case USER_INPUT_DEC:
if (SelectedItem == 0) SelectedItem = 0;
else SelectedItem--;
break;
}
}
return (0);
}
示例3: main
int main(void)
{
/* USER CODE BEGIN 1 */
uint8_t damogranlabs_logo[]={
0x0F,
0x13,
0x11,
0x11,
0x0e,
0x00,
0x00
};
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
LCD_Init(2, 20);
LCD_CreateChar(0, damogranlabs_logo);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
LCD_PrintString(2, 1, "n: ");
LCD_PrintNumber(2, 4, -10);
LCD_PrintString(2, 10, "f: ");
LCD_PrintFloat(2, 13, -326.5635, 5);
while (1)
{
LCD_PrintStringWindow(1, 3, 14, 350, "Find us on github and www.damogranlabs.com");
LCD_Clear();
LCD_PrintString(1, 1, "www.damogranlabs.com");
LCD_PutCustom(2, 10, 0);
LCD_ClearArea(1, 5, 12);
HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);
HAL_Delay(2000);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例4: GetYesNo
signed char GetYesNo(const char *prompt, signed char Initial) {
signed char answer;
signed char inp;
LCD_ClearDisplay();
LCD_PrintString(prompt);
answer = Initial;
while (1) {
LCD_SetPosition(1, 0);
if (answer) LCD_PrintString("<YES>\0");
else LCD_PrintString("<NO> \0");
inp = GetInput();
if (inp < 0) return inp;
switch (inp) {
case USER_INPUT_CLICK: //The User Pressed the button to select something...
return (answer);
case USER_INPUT_CANCEL:
return -2;
case USER_INPUT_BACK:
return -1;
case USER_INPUT_INC: //Rot +
case USER_INPUT_DEC: //Rot -
answer = !answer;
break;
default:
break;
}
}
return (0);
}
示例5: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
LCD_Init(2, 20);
LCD_PrintString(0, 0, "Damogran Labs");
Encoder_Init(&encoder1, ENC1_A_GPIO_Port, ENC1_A_Pin, ENC1_B_GPIO_Port, ENC1_B_Pin);
Encoder_Init(&encoder2, ENC2_A_GPIO_Port, ENC2_A_Pin, ENC2_B_GPIO_Port, ENC2_B_Pin);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
LCD_PrintNumber(1, 0, encoder1.abs_rot);
LCD_PrintNumber(1, 6, encoder2.abs_rot);
while (1)
{
if(Encoder_GetState(&encoder1)){
LCD_PrintString(1, 0, " ");
LCD_PrintNumber(1, 0, encoder1.abs_rot);
}
if(Encoder_GetState(&encoder2)){
LCD_PrintString(1, 6, " ");
LCD_PrintNumber(1, 6, encoder2.abs_rot);
}
if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0) == GPIO_PIN_SET){
Encoder_SetAbsToZero(&encoder1);
Encoder_SetAbsToZero(&encoder2);
}
HAL_Delay(100);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
示例6: TestADCCalibration
//main routine for ADC (linear) calibration testing
void TestADCCalibration(void)
{
unsigned int * ADCBuffer;
double * ADCRealValues;
double P, Q;
unsigned int i;
unsigned int NumOfData;
volatile double diffOrig;
volatile double diffCalib;
unsigned char DEBUG_STRING[30];
//set external clock (16MHz XTALL required)
SetCPUClock(0);
//allocate buffer space
if ((ADCBuffer = malloc(ADC_BUFFER_SIZE * sizeof(ADCBuffer[0]))) == NULL)
_asm("trap\n");
if ((ADCRealValues = malloc(ADC_BUFFER_SIZE * sizeof(ADCRealValues[0]))) == NULL)
_asm("trap\n");
//main test
{
//collect data
NumOfData = ADCCollectDataCalib(ADCBuffer, ADCRealValues);
P= GetMultiplierCalib(ADCBuffer, ADCRealValues, NumOfData);
diffOrig = GetErrorCalib(ADCBuffer, ADCRealValues, NumOfData, P, 0);
//calib data
ADCCalibratePQ(ADCBuffer, ADCRealValues, NumOfData, &P, &Q);
diffCalib = GetErrorCalib(ADCBuffer, ADCRealValues, NumOfData, P, Q);
//print errors
sprintf(DEBUG_STRING, "Orig = %f", diffOrig);
LCD_PrintString(LCD_LINE1, ENABLE, DISABLE, DEBUG_STRING);
sprintf(DEBUG_STRING, "Calib= %f", diffCalib);
LCD_PrintString(LCD_LINE2, ENABLE, DISABLE, DEBUG_STRING);
delay(500000l);//to show results
}
//see real values after ADC calibration - for checking calibration
LCD_Clear();
LCD_PrintString(LCD_LINE1, DISABLE, ENABLE, "Real calibrated U");
while(!JOY_SEL)
{
//start single conversion
ADC2_StartConversion();
while (!ADC2_GetFlagStatus());
//clear end of conversion bit
ADC2_ClearFlag();
//collect ADC value and display
LCD_SetCursorPos(LCD_LINE2, 4);//set cursor position
LCD_PrintDec4((P*ADC2_GetConversionValue() + Q)*1000);
}
//unallocate buffer
free(ADCBuffer);
}//TestADCCalibration
示例7: printDebug
void printDebug(STATE state){
LCD_MoveCursor(1,1);
char stringToPrint[16];
sprintf(stringToPrint,"%4d%4d%4d%4d",IRSensor_GetLeftFront(), IRSensor_GetCenterLeft(), IRSensor_GetCenterRight(), IRSensor_GetRightFront());
LCD_PrintString(stringToPrint);
LCD_MoveCursor(1,2);
sprintf(stringToPrint,"OC:%5d:%5d %1d",OC2RS,OC4RS,state);
LCD_PrintString(stringToPrint);
};
示例8: GetFloat
signed char GetFloat(const char *prompt, const char *unit, double* Value, double Min, double Max, double Precision) {
double Output;
char WholePlaces;
char FractionalPlaces;
signed char ret = 0;
if ((Max >= 10000) || (Min <= -10000)) WholePlaces = 5;
else if (Max >= 1000 | Min <= -1000) WholePlaces = 4;
else if (Max >= 100 | Min <= -100) WholePlaces = 3;
else if (Max >= 10 | Min <= -10) WholePlaces = 2;
else WholePlaces = 2;
if (Precision >= 1.0) FractionalPlaces = 0;
else if (Precision >= 0.1) FractionalPlaces = 1;
else if (Precision >= 0.01) FractionalPlaces = 2;
else if (Precision >= 0.001) FractionalPlaces = 3;
else if (Precision >= 0.0001) FractionalPlaces = 4;
Output = *Value;
LCD_ClearDisplay();
LCD_PrintString(prompt);
LCD_SetPosition(1, 0);
LCD_PrintFloat(Output, WholePlaces, FractionalPlaces, 1);
LCD_PrintString(unit);
while (1) {
LCD_SetPosition(1, 0);
LCD_PrintFloat(Output, WholePlaces, FractionalPlaces, 1);
ret = GetInput();
if (ret < 0) return ret;
switch (ret) {
case USER_INPUT_CLICK: //user has pressed the switch to accept.
*Value = Output;
return (0);
case USER_INPUT_CANCEL:
return -2;
case USER_INPUT_BACK:
return -1;
case USER_INPUT_INC: //Rot+
Output += GetRotaryMultiplier() * Precision;
if (Output > Max) Output = Max;
break;
case USER_INPUT_DEC:
Output -= GetRotaryMultiplier() * Precision;
if (Output < Min) Output = Min;
break;
}
}
return (0);
}
示例9: Detect_heartrate
/************************************************
* Method to calculate the heartrate based on
* the start and end values of a counter that
* is driven by interrupts which are driven by
* the heartbeat.
* @return heartrate The last recorded heartrate
************************************************/
float Detect_heartrate(void) {
LCD_Position(0,0);
LCD_PrintString("Heartrate: ");
LCD_PrintString(" ");
LCD_Position(1,0);
/* 600000 because the clock speed of the
heartrate is set to kHz */
heartrate = (600000/(endCounts-startCounts));
LCD_PrintU32Number(heartrate);
LCD_PrintString(" ");
return heartrate;
}
示例10: assert_failed
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
LCD_PrintString(LCD_LINE1, DISABLE, DISABLE, " ERR ");
LCD_PrintString(LCD_LINE2, DISABLE, DISABLE, " ASSERT ");
}
}
示例11: ShowVoltage
signed char ShowVoltage() {
double Batt;
LCD_ClearDisplay();
bLock_BatteryVoltage = 1;
Batt = BatteryVoltage;
bLock_BatteryVoltage = 0;
Batt *= Config.Volts_per_Count;
LCD_PrintString("BATTERY VOLTAGE:\0");
LCD_SetPosition(1, 0);
LCD_PrintFloat(Batt, 2, 2, 0);
LCD_PrintString(" VOLTS\0");
return GetClick();
}
示例12: GetPresetNumber
signed char GetPresetNumber() {
signed char inp;
char pnum;
signed char ptype;
LCD_ClearDisplay();
LCD_PrintString("PRESET SLOT:\0");
LCD_SetPosition(1, 0);
LCD_PrintString("PRESET 01\0");
pnum = 1;
while (1) {
LCD_SetPosition(1, 7);
LCD_PrintLong((int) pnum, 2, 0);
ptype = GetPresetType(pnum);
switch (ptype) {
case 0:
LCD_PrintString("-EMPTY \0");
break;
case 1:
LCD_PrintString("-WAYPOINT \0");
break;
case 2:
LCD_PrintString("-ORBIT \0");
break;
}
inp = GetInput();
if (inp<0) return inp;
switch (inp) {
case USER_INPUT_DEC:
if (pnum > 1) pnum--;
break;
case USER_INPUT_INC:
if (pnum < 5) pnum++;
break;
case USER_INPUT_CLICK:
return (pnum);
case USER_INPUT_BACK:
return (-1);
case USER_INPUT_CANCEL:
return (-2);
}
}
return (-2);
}
示例13: main
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
* main() performs following functions:
* 1: Initializes the LCD
* 2: Starts ADC
* 3: Starts ADC converstion.
* 4: Gets the converted result and displays it in LCD.
*
* Parameters:
* None.
*
* Return:
* None.
*
*******************************************************************************/
int main()
{
int16 output;
/* Start the components */
LCD_Start();
ADC_DelSig_1_Start();
/* Start the ADC conversion */
ADC_DelSig_1_StartConvert();
/* Display the value of ADC output on LCD */
LCD_Position(0u, 0u);
LCD_PrintString("ADC_Output");
for(;;)
{
if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))
{
output = ADC_DelSig_1_GetResult16();
/* Saturate ADC result to positive numbers. */
if(output < 0)
{
output = 0;
}
LCD_Position(1u, 0u);
LCD_PrintInt16(output);
}
}
}
示例14: UserInput
//////////////////////////////////////////////////////
// This function display current input from user
//////////////////////////////////////////////////////
void UserInput(void)
{
//Write_Lcd(0x0D, 0);
char_menu_pw[current_pw_digit] = digit;
char_menu_pw[current_pw_digit+1] = 0;
LCD_PrintString(char_menu_pw, LCD_ROW1, 1);
}
示例15: DisplayLastSkierTime
/*******************************************************************************
* Function name: DisplayPrintLastTimeSkier
********************************************************************************
*
* Summary:
* print time last skier from position row = 1, column = 0
*
*******************************************************************************/
void DisplayLastSkierTime(uint32_t sec, uint16_t milisec)
{
/*printf time in format mm:ss:msmsms*/
sprintf(buff, "Result %02u:%02u:%03u",sec/60,sec%60, milisec);
LCD_Position(0,0);
LCD_PrintString(buff);
}