Example #1
0
// ------------------------------------
// Fonction permettant d'éteindre la led verte
// ------------------------------------
void led_green_off(void)
{
  P1OUT &= ~LEDG;                // Mise à 0 du bit 6 du port 1
                                //    xxxx xxxx
                                // TODO
                                //
  led_green_toggle();
}
Example #2
0
// ------------------------------------
// Fonction permettant d'allumer la led verte
// ------------------------------------
void led_green_on(void)
{
  P1OUT |= LEDG;                // Mise à 1 du bit 6 du port 1
                                //    xxxx xxxx
                                // OR  1
                                //     1
  led_green_toggle();
}
Example #3
0
File: plat_avr.c Project: nesl/splt
void test_receiver( void )
{
  static uint32_t buf;
  TASK_BEGIN();
  while( 1 ) {
    cc1k_radio_recv(&buf, sizeof(buf));
    led_green_toggle();
  }
  TASK_END();
}
Example #4
0
// --------------------------
// Fonction    : bllth_run
// Description : ...
// Param(s)    : ...
// Output      : ...
// --------------------------
uint8_t bltth_parse(void)
{
  uint8_t ret = 1;
  char buffer[TRAME_MAX_SIZE];/* = "-v:+100,-100;"; test*/
  while(1)
  {
  if(uart_gets_startWithAndUntil(buffer, TRAME_CAR_START, TRAME_CAR_END, TRAME_MAX_SIZE) > 0)    // Si on a reçu des caracteres
  {
    switch(buffer[TRAME_CMD_INDEX])
    {
      case TRAME_CAR_VITESSE: // Type trame recue 2 vitesse des roues   
        {
          unsigned vitesseA=0, vitesseB=0;
          
          
          /* On peut réecrire la fonction atoi pour prendre que 3 caractere si tu veux, sinon comme sa c'est plus rapide que mettre en temp */
          vitesseA = (buffer[TRAME_SENSA_INDEX+1]-48)*100 +(buffer[TRAME_SENSA_INDEX+2]-48)*10 + (buffer[TRAME_SENSA_INDEX+3]-48);
          vitesseB = (buffer[TRAME_SENSB_INDEX+1]-48)*100 +(buffer[TRAME_SENSB_INDEX+2]-48)*10 + (buffer[TRAME_SENSB_INDEX+3]-48);
          
          motor_setDir(buffer[TRAME_SENSA_INDEX],buffer[TRAME_SENSB_INDEX]);     
          motor_setSpd(vitesseA,vitesseB);
          
        }      
        break;
   
      case TRAME_CAR_AU:
        TA1CCR1 = 0;
        TA1CCR2 = 0;
        break;
                  
      case TRAME_CAR_LED:
        if(buffer[TRAME_LEDG_INDEX] == '1')
          led_green_toggle();
        /*else
          led_green_off();
        */
        if(buffer[TRAME_LEDD_INDEX]== '1')
           led_red_toggle();
        /*else
          led_red_off();*/
        break;
                    
      default:
        break;
      
    } 
  }
  }
  /* Inutile, la lecture est une tache bloquante (attente d'un caractere), on ne peut donc pas revenir sur une trame recue.
  // Clear rx buffer
  memset(rx_buff, ' ', sizeof(rx_buff) );
  rx_buff[sizeof(rx_buff)-1] = '\0';
  */
  return ret;
}
Example #5
0
File: plat_avr.c Project: nesl/splt
void test_radio( void )
{
  static uint32_t cnt;
  TASK_BEGIN();
  cnt = 0;
  while( 1 ) {
    cc1k_radio_send(&cnt, sizeof(cnt));
    cnt++;
    led_green_toggle();
  }
  TASK_END();
}
Example #6
0
void keyboard_task()
{
 uint16_t input;

while(1)
{
	input = read_inputs_image();

	if(input&BUTT_0_MASK) led_green_toggle();
	if(input&BUTT_1_MASK) led_red_toggle();
	if(input&BUTT_2_MASK) {led_green_toggle();led_red_toggle();}
	if(input&BUTT_3_MASK) {led_green_set();led_red_set();}
	if(input&BUTT_4_MASK) {led_green_reset();led_red_reset();}
	if(input&BUTT_5_MASK) {led_green_set();}
	if(input&BUTT_6_MASK) {led_red_set();}
	if(input&BUTT_7_MASK) {led_green_reset();}
	if(input&BUTT_8_MASK) {led_red_reset();}
	if(input&BUTT_9_MASK) {}
	if(input&BUTT_F_MASK) {}
	if(input&BUTT_N_MASK) {}
}

}
Example #7
0
int main(void)
{
  clock_init();
  time_init();
  pwm_init(0);
  led_green_init();

  while (1) {
    time_delay_ms(500);
    led_green_toggle();
  }

  return 0;
}
Example #8
0
File: led.c Project: nesl/sos-2x
int8_t ker_led(uint8_t action)
{
  switch (action){
  case LED_RED_ON:        led_red_on();        break;
  case LED_GREEN_ON:      led_green_on();      break;
  case LED_YELLOW_ON:     led_yellow_on();     break;
  case LED_RED_OFF:       led_red_off();       break;
  case LED_GREEN_OFF:     led_green_off();     break;
  case LED_YELLOW_OFF:    led_yellow_off();    break;
  case LED_RED_TOGGLE:    led_red_toggle();    break;
  case LED_GREEN_TOGGLE:  led_green_toggle();  break;
  case LED_YELLOW_TOGGLE: led_yellow_toggle(); break;
  }
  return 0;
}
Example #9
0
File: plat_avr.c Project: nesl/splt
void fft_task( void )
{
  static fixed    imag[NFFT];
  static uint16_t i = 0;
  TASK_BEGIN();
	
  while(1) {
    TASK_SEM_WAIT(&data_ready);
    led_red_toggle();
    for(i = 0; i < NFFT; i++) {
      imag[i] = 0;
    }
    // compute FFT from 512 samples, the routines takes 200 ms
    fix_fft(processing_buf, imag, M, 0);
    processing_buf = NULL;
    led_green_toggle();
  }
  TASK_END();
}
/**
 * SPI task
 */
void spi_task(void *pvParameters) {
     
    while (1) {
		
		if(TEST_BIT_HIGH(SSI0_SR_R, 3))
		{
			// Receive full
			led_red_toggle();
		}
		
		if(TEST_BIT_LOW(SSI0_SR_R, 1))
		{
			// Send full
			led_green_toggle();
		}
		
        spi_send_task();
        spi_receive_task();
         
        vTaskDelay(10);
    }
}