/**
* @brief  Adds an element to the RxBuffer.
* @param  element to be added.
* @retval None
*/
void RxBuffer_addElement(uint8_t value)
{
  if(!RxBuffer_IsFull()){
    ReceiveBuffer[INDEX_Rx++] = value;
  }
  else {
   DisableRx();
  }
}
Esempio n. 2
0
int TurnOnRF()
{
    unsigned int  irstaut,jk,overtm,baud_o;
    unsigned char comm, cm_o, p_o;
    unsigned char abyte,stua,rfbufsize;
    int  rt;
    char rfexist[28]= {"uPs96Z06P_V2.1 9600 8N1 CH7"};

    GetCommMode(&cm_o, &p_o, &baud_o);
    irstaut = IRPowerCtrl(8);
    comm = 1;
    SetCommMode(3, comm, 9600);
    EnableRx(0);

    __ASM{
        mov ax, 144Ah
        int 10h
    }
    jk = 0;
    overtm = 0;
    rfbufsize = 27;
    while (jk < rfbufsize && overtm < 0x0FFFE)
    {
        if (ExistAuxBGot(&abyte, &stua))
        {
            if  (abyte != 0 && (char)abyte == rfexist[jk])
                jk=jk+1;
            else
            {
                if (abyte != rfexist[jk]) jk = 0;
                overtm++;
            }
        }
        else  overtm++;
    }
    SetCommMode(cm_o, p_o, baud_o);
    DisableRx();
    if  (jk != rfbufsize) return(-1);
    else return(0);
}