示例#1
0
static void transmit_downward(data_dispatcher_type_t type, void *data) {
  if (type == MSG_STACK_TO_HC_HCI_CMD) {
    // TODO(zachoverflow): eliminate this call
    transmit_command((BT_HDR *)data, NULL, NULL, NULL);
    LOG_WARN(LOG_TAG, "%s legacy transmit of command. Use transmit_command instead.", __func__);
  } else {
    fixed_queue_enqueue(packet_queue, data);
  }
}
示例#2
0
static void transmit_downward(uint16_t type, void *data)
{
    if (type == MSG_STACK_TO_HC_HCI_CMD) {
        transmit_command((BT_HDR *)data, NULL, NULL, NULL);
        LOG_WARN("%s legacy transmit of command. Use transmit_command instead.\n", __func__);
    } else {
        fixed_queue_enqueue(hci_host_env.packet_queue, data);
    }
    //ke_event_set(KE_EVENT_HCI_HOST_THREAD);
    hci_host_task_post();
}
示例#3
0
文件: hci_layer.c 项目: tve/esp-idf
static void transmit_downward(uint16_t type, void *data)
{
    if (type == MSG_STACK_TO_HC_HCI_CMD) {
        transmit_command((BT_HDR *)data, NULL, NULL, NULL);
        HCI_TRACE_WARNING("%s legacy transmit of command. Use transmit_command instead.\n", __func__);
    } else {
        fixed_queue_enqueue(hci_host_env.packet_queue, data);
    }

    hci_host_task_post(TASK_POST_BLOCKING);
}
示例#4
0
void main()
{
  WDTCTL = WDTPW + WDTHOLD;             //Stop Watchdog Timer
  CSCTL0_H = 0xA5;
    
  
  CSCTL1 |= DCOFSEL0 + DCOFSEL1;                //set max. DCO setting.. 8Mhz
  CSCTL2 = SELA_3 + SELS_3 + SELM_3;            //set ACLK = MCLK = DCO
  CSCTL3 = DIVA_0 + DIVS_0 + DIVM_0;            //set all dividers
  
  P1DIR |= BIT0;
  P1SEL0 |= BIT0;
  
  TA0CCR0 = 207;                                //timer count value 207 for 38 kHz carrier.
  TA0CCR1 = 69;                                 //25% duty cycle for the 38 kHz carrier.
  //TA0CCTL1 = OUTMOD_7;
  TA0CCTL0 = 0x10;
  TA0CTL = TASSEL_1 + MC_1;
  
  
  LEDonboardInit(0);
  
  AccelInit();                          //Setup the accelerometer pins.
  SetupAccel();                         //Setup the ADC and Accel. ADC can only convert one axis at a time.
  CalibrateADC();                       //Find zero points of all 3 axis.

  ADC10CTL0 |= ADC10ENC | ADC10SC; //Start the first sample. If this is not done the ADC10 interupt will not trigger.
  
  __enable_interrupt();
  
  
   while(1)
	{
          TA0CTL |= MC_1;
          ADC10IE &= ~ADC10IE0;
          LED_off_all();
          if (ADCResult_X < CalValue_X - 60 && ADCResult_Y > CalValue_Y - 60 && ADCResult_Y < CalValue_Y + 60)        
          {
          LED_off_all();
          LED_on(8);
          transmit_command(0x04, 0x01);
          }
          else if(ADCResult_X > CalValue_X + 60 && ADCResult_Y > CalValue_Y - 60 && ADCResult_Y < CalValue_Y + 60)
          {LED_off_all();
          LED_on(7);
          transmit_command(0x04, 0x00); 
          }
           else if(ADCResult_Y < CalValue_Y - 60 && ADCResult_X > CalValue_X - 60 && ADCResult_X < CalValue_X + 60)
          {
          LED_off_all();
          LED_on(2);
          transmit_command(0x04, 0x03); 
          }
          else if (ADCResult_Y > CalValue_Y + 60 && ADCResult_X > CalValue_X - 60 && ADCResult_X < CalValue_X + 60)
          {
          LED_off_all();
          LED_on(1);
          transmit_command(0x04, 0x02); 
          }
          TA0CTL = TASSEL_1 + MC_0;           //timer off
          TA0CCTL1 = OUTMOD_0;                //avoid constant high
          //__delay_cycles(500000); 
          ADC10IE |= ADC10IE0;
          //ADC10IE &= ~ADC10IE0;
        }
  
  /*
  while(1)
  {
    transmit_command(0x04, 0x00);
  }
   */
}