Exemple #1
0
// Duration is 15ms, more than one tick!
static void
rf_router_ping(void)
{
  set_ccon();           // 1.7ms
  ccTX();               // 4.8ms

  // Sync               // 8.5ms
  for(uint8_t i = 0; i < 6; i++) {
    sethigh(RF_ROUTER_ZERO_HIGH);
    setlow(RF_ROUTER_ZERO_LOW);
  }
  sethigh(RF_ROUTER_ONE_HIGH);
  setlow(RF_ROUTER_ONE_LOW);
  sethigh(RF_ROUTER_ONE_LOW);
  CC1100_CLEAR_OUT;
}
Exemple #2
0
void
set_txrestore()
{
#ifdef HAS_MBUS	
  if(mbus_mode != WMBUS_NONE) {
    // rf_mbus.c handles cc1101 configuration on its own.
    // if mbus is activated the configuration must not be
    // changed here, that leads to a crash!
    return;
  }
#endif
  if(tx_report) {
    set_ccon();
    ccRX();

  } else {
    set_ccoff();

  }
}
Exemple #3
0
void
send_belfox(char *msg)
{

  uint8_t repeat=BELFOX_REPEAT;
  uint8_t len=strnlen(msg,BELFOX_LEN+2)-1;
  
  // assert if length incorrect
  if (len != BELFOX_LEN) return;
  
  LED_ON();

#if defined (HAS_IRRX) || defined (HAS_IRTX) // Block IR_Reception
  cli();
#endif

#ifdef USE_RF_MODE
  change_RF_mode(RF_mode_slow);
#else

#ifdef HAS_MORITZ
  uint8_t restore_moritz = 0;
  if(moritz_on) {
    restore_moritz = 1;
    moritz_on = 0;
    set_txreport("21");
  }
#endif

  if(!cc_on)
    set_ccon();
#endif
  ccTX();                                       // Enable TX 
  do {
    send_sync();                                // sync

    for(int i = 1; i <= BELFOX_LEN; i++)        // loop input, for example 'L111001100110'
      send_bit(msg[i] == '1');

    CC1100_OUT_PORT &= ~_BV(CC1100_OUT_PIN);    // final low to complete last bit
        
    my_delay_ms(BELFOX_PAUSE);                  // pause

  } while(--repeat > 0);

  if(TX_REPORT) {                               // Enable RX
    ccRX();
  } else {
    ccStrobe(CC1100_SIDLE);
  }

#if defined (HAS_IRRX) || defined (HAS_IRTX) // Activate IR_Reception
  sei(); 
#endif

#ifdef USE_RF_MODE
  restore_RF_mode();
#else
#ifdef HAS_MORITZ
  if(restore_moritz)
    rf_moritz_init();
#endif
#endif
  LED_OFF();
}