Ejemplo n.º 1
0
int StringData::findNoCase(const StringData& match, int start/*=0*/)
{
	const char* pStrCompare = match.getDataBuf();
	const char* pStr = getDataBuf();
	int iLen = match.length();
	int iMaxLen = length();
	for (int i = 0; i <= iMaxLen - iLen; i++)
	{
		if (!compareNoCase(pStr + i, pStrCompare, iLen))
			return i;
	}
	return -1;
}
Ejemplo n.º 2
0
__interrupt void SPI_IRQHandler(void)
{
    static u8 cnt = 0;
    u8 * data = getDataBuf();
    
    if(SPI_GetITStatus(SPI_IT_RXNE) != RESET){
        spi_cmd = SPI_ReceiveData();
        SPI_ClearITPendingBit(SPI_IT_RXNE); 
    }    
    if(SPI_GetITStatus(SPI_IT_TXE) != RESET){
        if(spi_cmd == 0xff)
            SPI_SendData(cnt);
        else if((spi_cmd & 0xc0) == 0x40)
            SPI_SendData(data[spi_cmd&0x3f]);
        else if((spi_cmd & 0xc0) == 0x80)
        {
            switch(buffer_s)
            {
            case 0:
              SPI_SendData(Rx_Buffer[spi_cmd&0x3f]);
              break;
#if defined(NEED_RESOLVE_INFO)             
            case 1:
              SPI_SendData(RxGGA[spi_cmd&0x3f]);
              break;
#endif // defined(NEED_RESOLVE_INFO)              
            case 2:
              SPI_SendData(DataP[spi_cmd&0x3f]);
              break;
            case 3:
              SPI_SendData(DataQ[spi_cmd&0x3f]);
              break;            
            default:
              SPI_SendData(data[spi_cmd&0x3f]);
              break;
            }
        }
        else if((spi_cmd & 0xf0) == 0x30)
            buffer_s = spi_cmd & 0xf;
        else if((spi_cmd & 0xfc) == 0x14)
        {
            switch(spi_cmd & 0x03)
            {
            case 0:
              BEEP_Cmd(DISABLE);
              SPI_SendData(spi_cmd);
              break;           
            case 1:
              BEEP_DeInit();
              BEEP_Init(BEEP_FREQUENCY_1KHZ);
              BEEP_Cmd(ENABLE);              
              SPI_SendData(spi_cmd);
              break;             
            case 2:
              BEEP_DeInit();
              BEEP_Init(BEEP_FREQUENCY_2KHZ);
              BEEP_Cmd(ENABLE);                  
              SPI_SendData(spi_cmd);
              break;
            case 3:
              BEEP_DeInit();
              BEEP_Init(BEEP_FREQUENCY_4KHZ);
              BEEP_Cmd(ENABLE);                  
              SPI_SendData(spi_cmd);
              break;            
            default:
              BEEP_Cmd(DISABLE);
              SPI_SendData(data[spi_cmd]);
              break;
            }            
        }
        else
            SPI_SendData(0x66);
        cnt ++;
        SPI_ClearITPendingBit(SPI_IT_TXE); 
    }
}