示例#1
0
文件: CC1101.cpp 项目: epatel/Cosa
bool
CC1101::begin(const void* config)
{
  // Reset the device
  m_cs.pulse(30);
  DELAY(30);
  strobe(SRES);
  DELAY(300);

  // Upload the configuration. Check for default configuration
  spi.begin(this);
  loop_until_bit_is_clear(PIN, Board::MISO);
  write_P(IOCFG2, 
	  config ? (const uint8_t*) config : CC1101::config, 
	  CONFIG_MAX);
  spi.end();

  // Adjust configuration with instance specific state
  uint16_t sync = hton(m_addr.network);
  spi.begin(this);
  loop_until_bit_is_clear(PIN, Board::MISO);
  write(PATABLE, 0x60);
  write(CHANNR, m_channel);
  write(ADDR, m_addr.device);
  write(SYNC1, &sync, sizeof(sync));
  spi.end();

  // Initiate device driver state and enable interrupt handler
  m_avail = false;
  spi.attach(this);
  m_irq.enable();
  return (true);
}
示例#2
0
void writeChar(char letter, int pos)
{
  selectDisplayChar(pos);
  switch(letter)
  {
   case ' ':
     write_blank();
     break;
     
   case 'A':
     write_A();
     break;
     
   case 'B':
     write_B();
     break;
     
   case 'C':
     write_C();
     break;
     
   case 'D':
     write_D();
     break;
     
   case 'E':
     write_E();
     break;
     
   case 'F':
     write_F();
     break;
     
   case 'G':
     write_G();
     break;
     
   case 'H':
     write_H();
     break;
     
   case 'I':
     write_I();
     break;
     
   case 'J':
     write_J();
     break;
     
   case 'K':
     write_K();
     break;
     
   case 'L':
     write_L();
     break;
     
   case 'M':
     write_M();
     break;
     
   case 'N':
     write_N();
     break;
     
   case 'O':
     write_O();
     break;
     
   case 'P':
     write_P();
     break;
     
   case 'Q':
     write_Q();
     break;
     
   case 'R':
     write_R();
     break;
     
   case 'S':
     write_S();
     break;
     
   case 'T':
     write_T();
     break;

   case 'U':
     write_U();
     break;
     
   case 'V':
     write_V();
     break;

   case 'W':
     write_W();
     break;
     
   case 'X':
     write_X();
     break;
     
   case 'Y':
     write_Y();
     break;
     
   case 'Z':
     write_Z();
     break;
     
   case ':':
     write_colon();
     break;
     
  default:
    write_checker();
    break;
  } 
}
示例#3
0
/** Write a PROGMEM string followed by CR/LF to a file.
 * \param[in] str Pointer to the PROGMEM string.
 * Use writeError to check for errors.
 */
void SdFile::writeln_P(PGM_P str) {
  write_P(str);
  write_P(PSTR("\r\n"));
}