Exemplo n.º 1
0
void ms5611_polling(){
  
  static __xdata u8 * __xdata next_buf = pressure_data;
  
  if(ms5611_capture){
    ms5611_capture = FALSE;
    
    send_command(0x00);
    i2c0_read_write(I2C_READ(I2C_ADDRESS_RW), next_buf, 3);
    next_buf += 3;
    
    switch(capture_cycle++){
      case 0:
      case 2:
        send_command(0x52); // Read ADC2 (temperature) with OSR=512
        break;
      case 3: // Rotate
        capture_cycle = 0;
        data_hub_assign_page(make_packet);
        next_buf = pressure_data;
      case 1:
        send_command(0x42); // Read ADC1 (pressure) with OSR=512
        break; 
    }
  }
}
Exemplo n.º 2
0
void telemeter_polling(){
  u8 buf_size = uart1_rx_size();
  for(; buf_size >= (SYLPHIDE_PAGESIZE - 1); buf_size -= (SYLPHIDE_PAGESIZE - 1)){
    if(!data_hub_assign_page(make_packet)){break;}
  }
}