90 oct_double = log10((
double)((frequency*1000000)/1039));
98 oct = (uint8_t)oct_double;
101 float_dac = 2048-(2078*pow(2, (10+ oct)))/(frequency*1000000);
102 float_dac = (float_dac > (floor(float_dac) + 0.5)) ? ceil(float_dac) : floor(float_dac);
110 dac = (uint16_t)float_dac;
112 return((uint16_t)((oct<<12)| (dac<<2) | clk));
LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator.
Header File for Linduino Libraries and Demo Code.
uint16_t LTC6904_frequency_to_code(float frequency, uint8_t clk)
Calculates the code necessary to create the clock frequency.
int8_t i2c_write_byte_data(uint8_t address, uint8_t command, uint8_t value)
Write a byte of data to register specified by "command".
uint8_t LTC6904_write(uint8_t address, uint16_t code)
Writes 2 bytes.
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.