コード例 #1
0
ファイル: mp9ex01.c プロジェクト: kekke-gk/TNCT
#include <3048fone.h>
#include "h8_3048fone.h"

volatile int count1=-1;/*LED0用カウンタ -1の時は休止中*/
volatile int count2=-1;/*LED1用カウンタ -1の時は休止中*/
main()
{
	initLed();
	initPushSW();/*PushSWの初期化*/
	initTimer1Int(10000); /*時間割り込み10000μsec=10msec ch1使用*/
	E_INT();        /*CPU割り込み許可*/
	startTimer1();  /*時間割り込みタイマスタートch1*/
	while(1) {
		if ((count1==-1 || 50<count1) && checkPushSW(0)==1) {
			count1=0;
			turnOnLed(0);
		} else if (100<count1 && count1<200) {
			turnOffLed(0);
		} else if (200<count1 && count1<300) { /*200カウントで2秒経過*/
			turnOnLed(0);
		} else if (300<count1) {
			count1=-1;
			turnOffLed(0);
		}
		
		if ((count2==-1 || 50<count2) && checkPushSW(1)==1) {
			count2=0;
			turnOnLed(1);
		} else if (100<count2 && count2<200) {
			turnOffLed(1);
		} else if (200<count2 && count2<300) { /*200カウントで2秒経過*/
			turnOnLed(1);
		} else if (200<count2) { /*200カウントで2秒経過*/
			count2=-1;
			turnOffLed(1);
		}
	}
}
コード例 #2
0
ファイル: mp3ex05.c プロジェクト: kekke-gk/TNCT
main()
{
	initLed();
	while(1) {
		turnOnLed(0); 
		turnOffLed(1); 
		waitmsec(1000);
		turnOffLed(0); 
		turnOnLed(1); 
		waitmsec(1000);
	}
}
コード例 #3
0
void DigitalLed::switchLedPinState() {
  if (m_ledPinState == HIGH) {
    turnOffLed();
  } else {
    turnOnLed(); 
  }
}
コード例 #4
0
ファイル: leds.c プロジェクト: Rekamux/Boot-Loader
int main(int argc, char **argv)
{
  long i = 0;                    //Waiting counter
  long led = 0;                  //Bits to lit

  for (i=0; i<=3; i++)
    turnOffLed(i);

  init1sTimer0();

  while (serial_getc_nb() > 255)
  {
    turnOffLed(led);

    led++;

    if (led == 4)
      led = 0;

    turnOnLed(led);

    launchAndWaitTimer0();
  }

  return 0;
}
コード例 #5
0
ファイル: mp3ex08.c プロジェクト: kekke-gk/TNCT
main()
{
	int i;
	initLed(); /*LEDの初期化*/
	while(1) {
		turnOnLed(1); /*LED1のON*/
		waitmsec(11);
		turnOffLed(1); /*LED1のOFF*/
		waitmsec(11);
	}
}
コード例 #6
0
void DigitalLed::showBlinkingLed(unsigned long deltaMillis,
                          unsigned long blinkInterval) {

  activateLed(deltaMillis);

  // Blink the LED.
  if (!m_isBlinking) {
    m_isBlinking = true;
    turnOnLed();
  } else {    
    m_blinkTimer += deltaMillis;
    if (m_blinkTimer >= blinkInterval) {
        switchLedPinState();
        m_blinkTimer = 0L;
    }
  }
}
コード例 #7
0
ファイル: prog3000.c プロジェクト: Rekamux/Boot-Loader
int main(int argc, char **argv)
{
  serial_init();
  serial_puts("\r\nPortal - Still alive\r\n");
  long *address = (long *)(&partition_begin);
  long allTime = 0;
  initPE6();
  long time = *address;
  address ++;
  long duration = *address;
  address ++;
  long waveLenght = *address; 
  short c = 256;
  short previousLed = time%4;
  short currentLed = previousLed;
  while ((time != 0xFFFFFFFF || duration != 0xFFFFFFFF || waveLenght != 0xFFFFFFFF) && c > 255)
  {
    currentLed = time%4 == previousLed ? (time+1) % 4 : time % 4;
    turnOnLed(currentLed);
    allTime = time+duration;
    c = serial_getc_nb();
    initMsTimer0(duration);
    playWaveLenghtMm(waveLenght);
    launchAndWaitTimer0();
    shutUp();
    address ++;
    turnOffLed(currentLed);
    previousLed = currentLed;
    time = *address;
    address ++;
    duration = *address;
    address ++;
    waveLenght = *address; 
  }
  unsigned int a = 0;
  asm volatile("bx %0"::"r"(a));
  return 0;
}
コード例 #8
0
ファイル: testSPI.c プロジェクト: kramar5r/BLM3SYS
int main(int argc,char *argv[]){

	float VINT;
	float VOUT;

	if( argc > 2 ) {
     VINT = atof(argv[1]);  // input voltage
     VOUT = atof(argv[2]);  // voltage output
    }
    else{
    	printf("\n Something goes wrong... \n");
    	printf("\n Usage: testSPI Vin Vout \n");
    	printf("\n Where Vin and Vout are float values \n");
    	return EXIT_FAILURE;
    }

	if (rp_Init() != RP_OK) {
        fprintf(stderr, "Red Pitaya API init failed!\n");
        return EXIT_FAILURE;
    }

	
    turnOnLed(0);
    sleep(1);

	// All pin startup definition
    OutputPinDefinition(); 
	UpdatePinStructures();
    WriteAllBus();

    setVoltageClamp();

    int *tab;
	int i =0;
	tab = malloc(4*sizeof(int));

	turnOnLed(1);
	sleep(1);

    printf("\n Test of function FindResistors: \n");
    tab = FindResistors(VINT,VOUT);
	
	for(i=0;i<4;i++) printf("%d\n",tab[i]);    // Tale vrstica naredi izpis za izračunane komponente
        
	turnOffLed(1);
	turnOnLed(2);
	sleep(1);
    setVCResistorsValue(VINT, VOUT);
	turnOffLed(2);

	sleep(1);
/*	printf("\n TESTING SPI-WRITE COMMAND  \n");
	turnOnLed(3);
	sleep(1);

	//char *data[3]={0x254, 0x33, 0};
	char *data="AaBbCc";
	//char *data[8] ={0x01, 0x05, 0x00, 0x20, 0xFF, 0x00, 0x00, 0x00};

	if (write_spi(data, strlen(data))<0){
		printf("Write to SPI FAILED");
	}

	turnOffLed(3);
	sleep(1);*/
	turnOffLed(0);

    rp_Release();

	return EXIT_SUCCESS;
}
コード例 #9
0
void DigitalLed::showSteadyLed(unsigned long deltaMillis) {
  stopBlinkingLed();
  activateLed(deltaMillis);
  turnOnLed();
}