Exemplo n.º 1
0
//*****************************************************************************
//
// Given a destination buffer and a tStat pointer, this function will produce a
// formatted "request string" that can be used in the Exosite_Write function.
//
//*****************************************************************************
void
StatRequestFormat(tStat *psStat, char *pcRequestBuffer)
{
    if((psStat->eValueType) == STRING)
    {
        //
        // Disable interrupts to avoid changes to the string during the copy
        // operation.
        //
        ROM_IntMasterDisable();

        usprintf(pcRequestBuffer, "%s=%s",
                 psStat->pcCloudAlias,
                 StatStringVal(*psStat));

        ROM_IntMasterEnable();
    }
    else if((psStat->eValueType) == INT)
    {
        usprintf(pcRequestBuffer, "%s=%d",
                 psStat->pcCloudAlias,
                 StatIntVal(*psStat));
    }
    else if((psStat->eValueType) == HEX)
    {
        usprintf(pcRequestBuffer, "%s=0x%x",
                 psStat->pcCloudAlias,
                 StatIntVal(*psStat));
    }
}
Exemplo n.º 2
0
/*
 * send acc. data to uart 3
 */
void sendAcclData(void) {
	readAccel();
	int aMagnitude = abs(Ax) + abs(Ay) + abs(Az);
	short b;
	unsigned char accl[20];
	accl[19] = '\0';
	b = usprintf((char*) accl, "%i,%i,%i\n", Ax, Ay, Az);
#ifndef wlan
	nrf24l01p_send(accl);
#else
	for (int i = 0; i < b; i++) {
		ROM_UARTCharPut(UART3_BASE, accl[i]);
	}
	//ROM_UARTCharPut(UART3_BASE, '\n');

#endif
	b = usprintf((char*) accl, "%i\n", aMagnitude);
#ifndef wlan
	nrf24l01p_send(accl);
#else
	for (int i = 0; i < b; i++) {
		ROM_UARTCharPut(UART3_BASE, accl[i]);
	}
	//ROM_UARTCharPut(UART3_BASE, '\n');

#endif

}
Exemplo n.º 3
0
//*****************************************************************************
//
// Handles notifications from the slider controls.
//
//*****************************************************************************
void
OnSliderChange(tWidget *psWidget, int32_t i32Value)
{
    static char pcCanvasText[5];
    static char pcSliderText[5];

    //
    // Is this the widget whose value we mirror in the canvas widget and the
    // locked slider?
    //
    if(psWidget == (tWidget *)&g_psSliders[SLIDER_CANVAS_VAL_INDEX]) {
        //
        // Yes - update the canvas to show the slider value.
        //
        usprintf(pcCanvasText, "%3d%%", i32Value);
        CanvasTextSet(&g_sSliderValueCanvas, pcCanvasText);
        WidgetPaint((tWidget *)&g_sSliderValueCanvas);

        //
        // Also update the value of the locked slider to reflect this one.
        //
        SliderValueSet(&g_psSliders[SLIDER_LOCKED_INDEX], i32Value);
        WidgetPaint((tWidget *)&g_psSliders[SLIDER_LOCKED_INDEX]);
    }

    if(psWidget == (tWidget *)&g_psSliders[SLIDER_TEXT_VAL_INDEX]) {
        //
        // Yes - update the canvas to show the slider value.
        //
        usprintf(pcSliderText, "%3d%%", i32Value);
        SliderTextSet(&g_psSliders[SLIDER_TEXT_VAL_INDEX], pcSliderText);
        WidgetPaint((tWidget *)&g_psSliders[SLIDER_TEXT_VAL_INDEX]);
    }
}
Exemplo n.º 4
0
static void displayScores(void){
	// Method for displaying high scores
	RIT128x96x4StringDraw("High Scores", 40, 0, 15);
	static char s1[24];
	usprintf(s1, "Classic Mode: %d", classic);
	RIT128x96x4StringDraw(s1, 0, 40, 15);
	static char s2[24];
	usprintf(s2, "Continuous Mode: %d", continuous);
	RIT128x96x4StringDraw(s2, 0, 60, 15);
}
Exemplo n.º 5
0
Arquivo: dbf.c Projeto: hailynch/jnos2
int dbf_fields(int s, char *file, int OF)
{
   FILE *f;
   dbf_header dbfinfo;
   int i,port;
   char *p,Gdir[64];

   output_format = OF;        /* ASCIITEXT or CSOTEXT */

   p = j2strdup(file);
   if (p == NULL)
   {
     tprintf("j2strdup() failed: dbf_fields()\n");
     return 0;
   }

   /* open the file */
   if ((f = fopen(file, "rb")) == NULL)
   {
     tprintf("Cannot open file.\n");
     return(1);
   }

   /* get info from the file header */
   dbf_getheader(f, &dbfinfo);

   /* fill field info structure */
   dbf_getfields(f, &dbfinfo);

   gnamefix(s,p);
   for (i=1; i<=dbfinfo.nflds; i++)
   {
      if (output_format == CSOTEXT)
      {
	 usprintf(s, "-200:%d:%s:max %d Indexed Lookup Public Default",
			  i, fields[i].name, fields[i].length);

	  usputc(s, 10);
	 usprintf(s, "-200:%d:%s:%s.",
			  i, fields[i].name, fields[i].name);
	 usputc(s, 10);
      }
      else
      {
	port = findport(s,Gdir,'g');
	usprintf(s, "7%s\tq%s~%s\t%s\t%u\n",
		 fields[i].name, p, fields[i].name, Hostname,port);
      }
   }
   free(p);
   fclose(f);

   return 0;
}
Exemplo n.º 6
0
//打印时间
void PrintTime( tTime *t )
{
	char buff[12];
	
	print("日期:");
	usprintf(buff,"%04d/%02d/%02d", t->usYear,t->ucMon,t->ucMday);
	PrintWordsAndLineFeed(buff);
	
	print("时间:");
	usprintf(buff,"%02d:%02d:%02d", t->ucHour,t->ucMin,t->ucSec);	
	PrintWordsAndLineFeed(buff);
}
Exemplo n.º 7
0
//*****************************************************************************
//
// Function to format the BD_ADDR as a string.
//
//*****************************************************************************
static void
BD_ADDRToStr(unsigned char *pucBoard_Address, char *pcBoardStr)
{
    unsigned int uIdx;

    usprintf(pcBoardStr, "0x");
    for(uIdx = 0; uIdx < 6; uIdx++)
    {
        pcBoardStr += 2;
        usprintf(pcBoardStr, "%02X", pucBoard_Address[uIdx]);
    }
}
Exemplo n.º 8
0
uint32_t CmdHandler(uint8_t * data, uint32_t size)
{
	uint8_t index;
	uint8_t val;
	index = data[1] - '0';
	switch (data[0]) {
	case 'P':
		desc.ioPin[index].port = data[2] - '0';
		desc.ioPin[index].pin = data[3] - '0';
		desc.ioPin[index].mode = data[4] - '0';
		GPIOPinTypeGPIOOutput(MapPort(desc.ioPin[index].port),
				      MapPin(desc.ioPin[index].pin));
		SaveConfig();
		break;

	case 'I':
		GPIOPinWrite(GPIO_PORTF_BASE, MapPin(desc.ioPin[index].pin),
			     MapPin(desc.ioPin[index].pin));
		break;

	case 'i':
		GPIOPinWrite(GPIO_PORTF_BASE, MapPin(desc.ioPin[index].pin),
			     0x00);
		break;

	case 'T':
		val = ADCTempRead(data[2]);
		usprintf(data, "%d", val);
		return sizeof(data);

	case 'L':
		usprintf(data, "%d%d%d", desc.ioPin[index].port,
			 desc.ioPin[index].pin, desc.ioPin[index].mode);
		return sizeof(data);
	case 'A':
		desc.ioPin[0].port = 0;
		SaveConfig();
		PWMInit();
		return sizeof(data);
	case 'W':
		PWMWidthSet(1);
		return sizeof(data);
	case 'w':
		PWMWidthSet(0);
		return sizeof(data);
	default:
		desc.ioPin[0].pin = data[3] - '0';
	}

	return size;
}
Exemplo n.º 9
0
static void DisplayTimeA(void){
	// Method for displaying the alarm based on the counters
	static char pcTime[10];
	if (aampm==0){
		usprintf(pcTime, "%d%d:%d%d AM", ah2, ah1, am2, am1);
	}
	else {
		usprintf(pcTime, "%d%d:%d%d PM", ah2, ah1, am2, am1);
	}
	RIT128x96x4StringDraw(pcTime, 40, 40, 15);
	if (alarmSet){
		RIT128x96x4StringDraw("Alarm ON", 40, 80, 15);
	}
}
format_message (j_common_ptr cinfo, char * buffer)
{
  struct jpeg_error_mgr * err = cinfo->err;
  int msg_code = err->msg_code;
#ifndef NO_ERROR_STRINGS
  const char * msgtext = NULL;
  const char * msgptr;
  char ch;
  boolean isstring;

  /* Look up message string in proper table */
  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
    msgtext = err->jpeg_message_table[msg_code];
  } else if (err->addon_message_table != NULL &&
         msg_code >= err->first_addon_message &&
         msg_code <= err->last_addon_message) {
    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  }

  /* Defend against bogus message number */
  if (msgtext == NULL) {
    err->msg_parm.i[0] = msg_code;
    msgtext = err->jpeg_message_table[0];
  }

  /* Check for string parameter, as indicated by %s in the message text */
  isstring = FALSE;
  msgptr = msgtext;
  while ((ch = *msgptr++) != '\0') {
    if (ch == '%') {
      if (*msgptr == 's') isstring = TRUE;
      break;
    }
  }

  /* Format the message into the passed buffer */
  if (isstring)
    usprintf(buffer, msgtext, err->msg_parm.s);
  else
    usprintf(buffer, msgtext,
        err->msg_parm.i[0], err->msg_parm.i[1],
        err->msg_parm.i[2], err->msg_parm.i[3],
        err->msg_parm.i[4], err->msg_parm.i[5],
        err->msg_parm.i[6], err->msg_parm.i[7]);
#else
  usprintf(buffer, "JPEG Error %d\n", msg_code);
#endif
}
Exemplo n.º 11
0
static uchar *hlc_resolve_symbol( void *addr, uchar *out, int *outSize ) {
#ifdef _WIN32
	static HANDLE stack_process_handle = NULL;
	DWORD64 index;
	IMAGEHLP_LINEW64 line;
	struct {
		SYMBOL_INFOW sym;
		uchar buffer[256];
	} data;
	data.sym.SizeOfStruct = sizeof(data.sym);
	data.sym.MaxNameLen = 255;
	if( !stack_process_handle ) {
		stack_process_handle = GetCurrentProcess();
		SymSetOptions(SYMOPT_LOAD_LINES);
		SymInitialize(stack_process_handle,NULL,TRUE);
	}
	if( SymFromAddrW(stack_process_handle,(DWORD64)(int_val)addr,&index,&data.sym) ) {
		DWORD offset = 0;
		line.SizeOfStruct = sizeof(line);
		line.FileName = USTR("\\?");
		line.LineNumber = 0;
		SymGetLineFromAddrW64(stack_process_handle, (DWORD64)(int_val)addr, &offset, &line);
		*outSize = usprintf(out,*outSize,USTR("%s(%s:%d)"),data.sym.Name,wcsrchr(line.FileName,'\\')+1,(int)line.LineNumber);
		return out;
	}
#endif
	return NULL;
}
Exemplo n.º 12
0
/**********************************************************************
functionName: FRESULT PcmRecoverWithDate(void)	
description:上位机参数从SD卡恢复,保留加密信息(以文件夹形式)
char 		paseword_system[11];						//系统密码  
**********************************************************************/ 
FRESULT PcmRecoverWithDate( const char *pFile_name )							
{
	FRESULT fresult;
	FIL file_obj;  
	uint32_t br;  
	char pass[11]; 
	char file_name[30];
	uint32_t name_buff = 0;
	
	name_buff = ustrtoul(pFile_name,0,10);
	
	usprintf(file_name,"sys/%08d/pcm.bin",name_buff);
	
	fresult = f_open(&file_obj,file_name,FA_OPEN_EXISTING|FA_READ);
	if (FR_OK != fresult)
	{
		return fresult;
	}	
	
	memcpy(pass,pcm_str->pcm_hmi.paseword_system,11);    	//记录当前密码
	  
	f_read(&file_obj,pcm_ram,PCM_MEM_SIZE,&br);
	f_close(&file_obj); 
	
	memcpy(pcm_str->pcm_hmi.paseword_system,pass,11); 		//恢复当前密码 
	
	return FR_OK;
}
Exemplo n.º 13
0
/**********************************************************************
functionName:FRESULT report_save(char *type,char *file,REPORT_TypeDef *report)
description:保存结果,type:试验类型 file:文件名 report:实验报告
**********************************************************************/ 
FRESULT report_save_usb(uint8_t type,char *file,REPORT_TypeDef *report)
{
	FRESULT fresult;
	FIL file_obj;  
	uint32_t br;  
	char path[PATH_BUF_SIZE];  	
	  
	usprintf(path,"%s/%s.bin",test_path_usb[type].path,file);  
	fresult=f_open(&file_obj,path,FA_CREATE_ALWAYS|FA_WRITE); 
	if(fresult==FR_NO_PATH)
	{	 
		fresult=f_mkdir("1:/test"); 
		fresult=f_mkdir(test_path_usb[type].path); 	  
		fresult=f_open(&file_obj,path,FA_CREATE_NEW|FA_WRITE);  
		if(fresult!=FR_OK)
		return fresult; 
	}
	else if(fresult!=FR_OK)
	return 	fresult;
	
	fresult=f_write(&file_obj,report,sizeof(REPORT_TypeDef),&br);   
	f_close(&file_obj);

	return fresult; 
}
Exemplo n.º 14
0
void output(int n,int (*drawArray)[10]){

	static char pcCanvasText[5];

	int i,j,color;
	for ( i = 0; i < 4; ++i){
		for ( j = 0; j < 4; ++j){
			sRect.i16XMin = 64+i*48 +1;//16
			sRect.i16YMin = 24+j*48 +1;//64
			sRect.i16XMax = 112+i*48 -1;
			sRect.i16YMax = 72+j*48 -1;

			color = drawArray[i][j]%5;
			GrContextForegroundSet(&context, DrawColor[color]);
			GrRectFill(&context, &sRect);

			usprintf(pcCanvasText, "%3d", drawArray[i][j]);

			GrContextForegroundSet(&context, ClrBlack);
		    GrContextFontSet(&context, &g_sFontCm20);
		    GrStringDraw(&context, pcCanvasText, -1, 64+i*48 +1, 24+j*48 +16, 0);


		}

	}
}
/*------------------------------------------------------------
 * Function Name  : GetOnlineParameterDateFromFlash
 * Description    : 获取参数
 * Input          : None
 * Output         : None
 * Return         : None
 *------------------------------------------------------------*/
void GetOnlineParameterDateFromFlash( STATUS_RW_FLASH_TypeDef rw )
{
	uint32_t IP = 0;
	uint8_t i = 0;
	
	switch ( rw )
	{
		case READ_FLASH:
			IP = devc_ip_get();
			
			for (i=0; i<4; ++i)
			{				
				usprintf(OnlineParameter.data[3-i],"%03d",(uint8_t)IP);

				IP >>= 8;
			}		
			break;
		
		case WRITE_FLASH:
			for (i=0; i<4; ++i)
			{				
				IP <<= 8;
				
				IP |= (uint8_t)ustrtoul(OnlineParameter.data[i],0,10); 		
			}

			devc_ip_set(IP);
			break;
	}
}
Exemplo n.º 16
0
Arquivo: main.c Projeto: mybays/lm3s
void ADC0IntHandler()
{

    unsigned long adc0Value;   // Holds the ADC result
    char adc0String[5];        // Holds the string-converted ADC result

    // 清ADC0中断标志.
    // ADCIntClear (unsigned long ulBase, unsigned long ulSequenceNum) 
    ADCIntClear(ADC0_BASE, 0);
    
    //从SSO读出转换结果 (FIFO0),本例中只有一个采样.如果要使用多个转换源,需要使用数组做为参数传递给API函数,保存FIFO转换结果.
    // long ADCSequenceDataGet (unsigned long ulBase,unsigned long ulSequenceNum,unsigned long *pulBuffer) 
    ADCSequenceDataGet(ADC0_BASE, 0, &adc0Value);
    adc0Value= ((59960 - (adc0Value * 100)) / 356);
    
    
    // 在OLED上显示当前温度
    usprintf(adc0String, "%d", adc0Value);    
    IntMasterDisable();
    RIT128x96x4StringDraw("Current temp :         ", 6, 48, 15);
    RIT128x96x4StringDraw(adc0String, 94, 48, 15);
    IntMasterEnable();  

    // ADC模块空闲,可以进行下一次转换
    adc_busy=0;    
 
}
Exemplo n.º 17
0
int TiledMap::loadMap(const char* mapName)
{
	char tempstr[256] = "";
	usprintf(tempstr, "%s", mapName);

	PACKFILE *file = pack_fopen(tempstr, F_READ_PACKED);
	this->loadFrom(file, tileRepository);
	pack_fclose(file);
	return 0;
}
Exemplo n.º 18
0
/**********************************************************************
functionName:FRESULT report_exist(uint8_t type,char *file)
description:查询指定试验种类指定文件名的文件是否存在
**********************************************************************/  
FRESULT report_exist(uint8_t type,char *file)
{
	FRESULT fresult=FR_OK;
	FIL file_obj;  
	char path[PATH_BUF_SIZE];   
	usprintf(path,"%s/%s.bin",test_path[type].path,file); 
	fresult=f_open(&file_obj,path,FA_OPEN_EXISTING|FA_READ); 
	f_close(&file_obj);	 
	return fresult;
}  
Exemplo n.º 19
0
/**********************************************************************
functionName:FRESULT report_save_usb_set_time (uint8_t type, char *file)
description:设置导出报告的文件时间
**********************************************************************/ 
FRESULT report_save_usb_set_time (uint8_t type, char *file)
{
	char path_sd[PATH_BUF_SIZE]; 
	char path_usb[PATH_BUF_SIZE]; 
	FILINFO file_info;
	FRESULT result;
	
	usprintf(path_sd,"%s/%s.bin",test_path[type].path,file);	
	result = f_stat(path_sd,&file_info);
	if (result != FR_OK)
	{
		return result;
	}
	
	usprintf(path_usb,"%s/%s.bin",test_path_usb[type].path,file);	
	result = f_utime(path_usb,&file_info);
	
	return result;
}
Exemplo n.º 20
0
void Timer13OnExecute(tWidget *pWidget)
{
      if(flag==true)
      {
         static char str[16];
         count++;
         usprintf(str, " %d sec", count);
         LabelTextSet(&Label8, str);
      }
}
Exemplo n.º 21
0
Arquivo: dbf.c Projeto: hailynch/jnos2
int dbf_search(int s, char *file, char *field, char *pattern)
{
   FILE *f;
   dbf_header dbfinfo;
   int i;

   if (strlen(pattern) <3)
   {
	 if (output_format == CSOTEXT)
	  usprintf(s, "-515:search string must be at least 3 characters.\n500:did not understand PH query.\n200:Ok.\n");
       else
	  usprintf(s, "\nSearch string must be at least 3 characters\nTry a longer search string\n");
	return 0;
   }
   else
   if ((dbfmatch(pattern)) == 1)
   {
	if (output_format == CSOTEXT)
	usprintf(s, "-515:search string was matched too often.\n500:choose an alternative search string.\n200:Ok.\n");
      else
	usprintf(s, "\nSearch string was matched too often\nTry an alternative search string\n");
      return 0;
   }
   else
   /* open the file */
   if ((f = fopen(file, "rb")) == NULL)
   {
     tprintf("Cannot open file: %s\n", file);
     return(1);
   }

   /* get info from the file header */
   dbf_getheader(f, &dbfinfo);

   /* fill field info structure */
   dbf_getfields(f, &dbfinfo);

   /* read records */
   dbf_getrecords(s, f, &dbfinfo, pattern, get_fieldno(field));

   fclose(f);
   return 0;
}
Exemplo n.º 22
0
/* dialog callback for retrieving information about the keymap list */
char *keymap_list_getter(int index, int *list_size)
{
   static char buf[256];
   int val;

   if (index < 0) {
      if (list_size)
	 *list_size = KEY_MAX;
      return NULL;
   }

   val = editor_table[index];

   if (val >= ' ')
      usprintf(buf, "%-16s ->  U+%04X - '%c'", scancode_to_name(index), val, val);
   else
      usprintf(buf, "%-16s ->  U+%04X - %s", scancode_to_name(index), val, ascii_name[val]);

   return buf;
}
Exemplo n.º 23
0
static void startContinuous(void){
	// Method for continuing the Continuous mode
	resetContinuous();
	drawGallow();
	int i;
	for (i=0; i<try; i++){
		if (i==0){
			drawHead();
		}
		else if (i==1){
			drawBody();
		}
		else if (i==2){
			drawRightArm();
		}
		else if (i==3){
			drawLeftArm();
		}
		else if (i==4){
			drawRightLeg();
		}
	}
	static char puc_score[10];
	usprintf(puc_score, "Score: %d", score);
    RIT128x96x4StringDraw(puc_score, 69, 0, 15);
	displayAlphabet();
	drawUnderscore(0, 83);
	drawHiddenWord();
}

static void startClassic(void){
	// Method for starting the Classic mode
	resetClassic();
	drawGallow();
	static char puc_score[10];
	usprintf(puc_score, "Score: %d", score);
    RIT128x96x4StringDraw(puc_score, 69, 0, 15);
	displayAlphabet();
    drawUnderscore(0, 83);
	drawHiddenWord();
}
Exemplo n.º 24
0
/*------------------------------------------------------------
 * Function Name  : SD_EraseFlashOperation
 * Description    : 擦除flash操作
 * Input          : None
 * Output         : None
 * Return         : None
 *------------------------------------------------------------*/
ErrorStatus SD_EraseFlashOperation( uint16_t x, uint16_t y )
{	
	ErrorStatus Err = SUCCESS;
	uint32_t addr = 0;
	const uint8_t ERASE_FLASH_NUM = 3;
	const uint32_t erase_addr[ERASE_FLASH_NUM] = {ADDR_FLASH_SECTOR_5,ADDR_FLASH_SECTOR_6,ADDR_FLASH_SECTOR_7};
	uint8_t i = 0;
	char buff[10];
	uint8_t process = 0;

	lcd_font24(x,y,COLOR_POINT,COLOR_BACK,"> 正在擦除flash...",UPDATE_FONT);
	x += 216;
		
	/* Enable the flash control register access */
	FLASH_Unlock();

	/* Erase the user Flash area ************************************************/
	/* area defined by FLASH_USER_START_ADDR and FLASH_USER_END_ADDR */

	/* Clear pending flags (if any) */  
	FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | 
				  FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); 
	
	for (i=0; i<ERASE_FLASH_NUM; ++i)
	{
		/* Get the number of the start and end sectors */
		addr = GetSector(erase_addr[i]);

		/* Device voltage range supposed to be [2.7V to 3.6V], the operation will
		   be done by word */ 
		if (FLASH_EraseSector(addr, VoltageRange_3) != FLASH_COMPLETE)
		{ 
		  /* Error occurred while sector erase. 
			 User can add here some code to deal with this error  */
			Err = ERROR;
			break;
		}
		
		process += 30;
		usprintf(buff,"%3d%%",process);
		lcd_font24(x,y,COLOR_POINT,COLOR_BACK,buff,UPDATE_FONT);
	}
	
	bsp_DelayMS(DELAY_TIME);
	lcd_font24(x,y,COLOR_POINT,COLOR_BACK,"100%",UPDATE_FONT);
	
	FLASH_Lock(); 
	
	return Err;
}
Exemplo n.º 25
0
/*
 * send calculated heading to uart3
 */
void sendHeading(void) {
	short b;
	char accl[20];
	accl[19] = '\0';
	b = usprintf(accl, "$HEAD,%i*\n", (int) getHeading()); //$HEAD,value*
#ifndef wlan
	nrf24l01p_send(accl);
#else
	for (int i = 0; i < b && accl[i] != '\0'; i++) {
		ROM_UARTCharPut(UART3_BASE, accl[i]);
	}

#endif
}
Exemplo n.º 26
0
// Prints a menu of items to buy to the LCD display
// User can toggle through menu options by pressing UP or DOWN and can add items
// to their order by pressing SELECT. Adding items increments the total 
// according to each item's price.
//
// upDownIndex: index to handle which item is being displayed (1 - Burger, 2- Fries,
// 3 - Shake).
// currDollars: current number of dollars in the total.
// currCents: current amount of cents in the total.
void print_menu(int upDownIndex, int currDollars, int currCents)
{  
      clear_display();
      delay(1000);
          
      char totalDollars[3];
      char totalCents[3];
      
      display_string(menu[upDownIndex]); //display current menu item
      usprintf(totalDollars, "%d", currDollars); //convert int to char
      usprintf(totalCents, "%d", currCents);
      display_string("                         "); //space out the display to next line
      display_string("Total: $"); //print the total
      display_string(totalDollars);
      display_string(".");
      display_string(totalCents);
      //fix to append the extra 0 in cents
      if (currCents == 0) {
        display_string("0");
      }
      //reset addr of display back to the start
      set_ddram(0x0);
}
Exemplo n.º 27
0
Arquivo: dbf.c Projeto: hailynch/jnos2
void CSO_printrec(int s, char *recbuf, int nflds, int index)
/*
   Display a record in CSO nameserver format.
   Uses information in the 'fields' global array.
*/
{
   char *p, *q;
   int i;
   
   p = recbuf;         /* point to the buffer containing the record */
   p++;                /* skip deletion marker */

   for (i=1; i<=nflds; i++)
   {
      if ( (fields[i].type != 'M') )      /* ignore memo fields */
      {
	  usprintf(s, "-200:%d:%20s: ", index, fields[i].name);    /* field name */
	  if (fields[i].type == 'D')              /* date fields */
	  {
	     q = p;                               /* point to the field */
	     q+=2;                                /* skip 'century' */
	     j2send(s, q, 2, 0);   /* year */
	     usputc(s, '/');
	     q+=2;
	     j2send(s, q, 2, 0);   /* month */
	     q+=2;
	     usputc(s, '/');
	     j2send(s, q, 2, 0);   /* day */
	  }
	  else                                   /* others */
	     j2send(s, p, fields[i].length, 0);    /* field data */
	  usputc(s, 10);
      }
      p = p + fields[i].length;          /* move to next field in buffer */
   }
 usprintf(s, "-200:%d:%20s ", index," ");
}
Exemplo n.º 28
0
/*
 * send mag. values to uart 3
 */
void sendMagnetoData(void) {
	readMagneto();
	short b;
	unsigned char mag[20];
	mag[19] = '\0';
	b = usprintf((char*) mag, "%i,%i,%i\n", Mx, My, Mz);
#ifndef wlan
	nrf24l01p_send(mag);
#else
	for (int i = 0; i < b; i++) {
		ROM_UARTCharPut(UART3_BASE, mag[i]);
	}

#endif
}
Exemplo n.º 29
0
 /**********************************************************************
functionName: FRESULT CheckBackUpFileExist( const char *pFile_name )
description: 搜索备份文件是否存在  YES:存在, NO:不存在  
**********************************************************************/ 
BoolStatus CheckBackUpFileExist( const char *pFile_name )
{
	char file_name[30];
	DIR dir_object;
	uint32_t name_buff = 0;
	
	name_buff = ustrtoul(pFile_name,0,10);
	
	usprintf(file_name,"sys/%08d",name_buff);
	
	if (FR_OK == f_opendir(&dir_object,file_name))
	{
		return YES;
	}
	
	return NO;
}
Exemplo n.º 30
0
//*****************************************************************************
//
// Display a uIP type IP Address.
//
//*****************************************************************************
static void
DisplayIPAddress(void *ipaddr, unsigned long ulCol, unsigned long ulRow)
{
    char pucBuf[16];
    unsigned char *pucTemp = (unsigned char *)ipaddr;

    //
    // Convert the IP Address into a string.
    //
    usprintf(pucBuf, "%d.%d.%d.%d", pucTemp[0], pucTemp[1], pucTemp[2],
             pucTemp[3]);

    //
    // Display the string.
    //
    RIT128x96x4StringDraw(pucBuf, ulCol, ulRow, 15);
}