Exemplo n.º 1
0
uint8_t DS1302_read(int address)
{
  uint8_t data;
  bitSet(address, DS1302_READBIT);
  _DS1302_start();
  _DS1302_togglewrite(address, true);
  data = _DS1302_toggleread();
  _DS1302_stop();
  return (data);
}
Exemplo n.º 2
0
void DS1302_clock_burst_read(uint8_t *p)
{
  int i;
  _DS1302_start();
  _DS1302_togglewrite(DS1302_CLOCK_BURST_READ, true);
  for (i = 0; i<8; i++)
  {
    *p++ = _DS1302_toggleread();
  }
  _DS1302_stop();
}
Exemplo n.º 3
0
// --------------------------------------------------------
// DS1302_read
//
// This function reads a byte from the DS1302 
// (clock or ram).
//
// The address could be like "0x80" or "0x81", 
// the lowest bit is set anyway.
//
// This function may be called as the first function, 
// also the pinMode is set.
//
uint8_t DS1302_read(int address)
{
  uint8_t data;

  // set lowest bit (read bit) in address
  bitSet( address, DS1302_READBIT);  

  _DS1302_start();
  // the I/O-line is released for the data
  _DS1302_togglewrite( address, true);  
  data = _DS1302_toggleread();
  _DS1302_stop();

  return (data);
}
Exemplo n.º 4
0
// --------------------------------------------------------
// DS1302_clock_burst_read
//
// This function reads 8 bytes clock data in burst mode
// from the DS1302.
//
// This function may be called as the first function, 
// also the pinMode is set.
//
void DS1302_clock_burst_read( uint8_t *p)
{
  int i;

  _DS1302_start();

  // Instead of the address, 
  // the CLOCK_BURST_READ command is issued
  // the I/O-line is released for the data
  _DS1302_togglewrite( DS1302_CLOCK_BURST_READ, true);  

  for( i=0; i<8; i++)
  {
    *p++ = _DS1302_toggleread();
  }
  _DS1302_stop();
}