Exemplo n.º 1
0
Arquivo: main.c Projeto: Shmuma/radio
void main (void)
{
    int cnt = 0;

    InitDevice ();
    Delay10KTCYx (250);
    InitializeUSB ();
    InitLCD ();

    /* UCONbits.USBEN = 0; */
    /* UCFGbits.UTRDIS = 0; */
    /* UCFGbits.UPUEN = 1; */
    /* UCFGbits.FSEN = 1; */
    USBDeviceAttach ();

    while (1) {
        WriteLCDChar (UCONbits.USBEN ? '0' : '1');
        WriteLCDChar (UCFGbits.FSEN  ? '0' : '1');
        WriteLCDChar (UCFGbits.UTRDIS ? '0' : '1');
        WriteLCDChar (UCFGbits.UPUEN ? '0' : '1');
        WriteLCDChar ('0' + UCFGbits.PPB);
        WriteLCDChar ('-');
        WriteLCDChar ('0' + USTATbits.ENDP);
        WriteLCDChar ('0' + USTATbits.DIR);
        WriteLCDChar ('0' + USTATbits.PPBI);
        WriteLCDChar ('-');
        putNumber (USBDeviceState);
        WriteLCDChar ('-');
        putNumber (cnt++);
//        if (USBDeviceState == DETACHED_STATE)
//            USBDeviceAttach ();
        Delay10KTCYx (1000);
        LCDHome ();
        Delay10KTCYx (10);
    }
//        if (USBDeviceState < CONFIGURED_STATE)
//            continue;

//        bitset (PORTB, E_PORT);
//        Delay10TCYx (10);
//        ClearLCD ();
//        bitclr (PORTB, E_PORT);
//        Delay10TCYx (10);
//    }
}
Exemplo n.º 2
0
  void
instantiateFunction(void)
{
	int	index;

	index = evaluateNumber();
	pc -= sizeof(functionType *);
	putNumber(&(currentFunctionTable[index]));
}
Exemplo n.º 3
0
  void
instantiateSymbol(void)
{
	int	index;

	index = evaluateNumber();
	pc -= sizeof(symbolType *);
	putNumber(currentSymbolTable[index]);
}
Exemplo n.º 4
0
void produce(int *memoryAddr, int semID)
{
    while(1) {
        getSemaphore(semID);
        if(memoryAddr[FILLINDEX] < ARRAYSIZE) {
            putNumber(memoryAddr);
        }
        releaseSemaphore(semID);
        sleep(1);
    }
}
unsigned char SeeedOLED::putFloat(float floatNumber)
{
  unsigned char decimal=2;
  unsigned int temp=0;
  float decy=0.0;
  float rounding = 0.5;
  unsigned char f=0;
  if(floatNumber<0.0)
  {
    putString("-");
    floatNumber = -floatNumber;
    f +=1;
  }
  for (unsigned char i=0; i<decimal; ++i)
  {
    rounding /= 10.0;
  }
    floatNumber += rounding;

  temp = floatNumber;
  f += putNumber(temp);
  if(decimal>0)
  {
    putChar('.');
    f +=1;
 }
  decy = floatNumber-temp;//decimal part,
  for(unsigned char i=0;i<decimal;i++)//4
  {
    decy *=10;// for the next decimal
    temp = decy;//get the decimal
    putNumber(temp);
    decy -= temp;
  }
  f +=decimal;
  return f;
}
Exemplo n.º 6
0
static int
putKeyName (ListGenerationData *lgd, const KeyValue *value) {
  const KeyNameEntry *kne = findKeyNameEntry(lgd, value);
  if (kne) return putUtf8String(lgd, kne->name);

  if (value->key != KTB_KEY_ANY) {
    const KeyValue anyKey = {
      .set = value->set,
      .key = KTB_KEY_ANY
    };

    if ((kne = findKeyNameEntry(lgd, &anyKey))) {
      if (!putUtf8String(lgd, kne->name)) return 0;
      if (!putCharacter(lgd, WC_C('.'))) return 0;
      if (!putNumber(lgd, value->key+1)) return 0;
      return 1;
    }
  }

  return putUtf8String(lgd, "?");
}

static int
putKeyCombination (ListGenerationData *lgd, const KeyCombination *combination) {
  wchar_t delimiter = 0;

  {
    unsigned char index;
    for (index=0; index<combination->modifierCount; index+=1) {
      if (!delimiter) {
        delimiter = WC_C('+');
      } else if (!putCharacter(lgd, delimiter)) {
        return 0;
      }

      if (!putKeyName(lgd, &combination->modifierKeys[combination->modifierPositions[index]])) return 0;
    }
  }

  if (combination->flags & KCF_IMMEDIATE_KEY) {
    if (delimiter)
      if (!putCharacter(lgd, delimiter))
        return 0;

    if (!putKeyName(lgd, &combination->immediateKey)) return 0;
  }

  return 1;
}
Exemplo n.º 7
0
int judgement_4lua(lua_State *L)
{	
	extern int answer;
	
	judgement((char *)getStr(L));
	
//	printf("answer %d", answer);
	while (!answer) {
		SDL_Delay(50);
	}
	
	putNumber(L, answer);
	answer = 0;
	
	return 1;
}
Exemplo n.º 8
0
int DBF::putNumber ( const char *name, double val )
{
	int	nth = field(name) ;
	return nth < 0 ? -1 : putNumber(nth,val) ;
}
Exemplo n.º 9
0
void JsonObject::putInteger(const QString& key, int value) {
    putNumber(key, value);
}