first commit
This commit is contained in:
45
si5351_driver.c
Normal file
45
si5351_driver.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* si5351_driver.c
|
||||
*
|
||||
* Created on: 16. aug. 2024
|
||||
* Author: Christian L. V. Madsen (OZ1CM)
|
||||
*/
|
||||
#include "include/si5351_driver.h"
|
||||
|
||||
enum{
|
||||
SI5351_I2C_GET = 0,
|
||||
SI5351_I2C_SET = 1,
|
||||
|
||||
};
|
||||
|
||||
uint8_t cm_si5351_getRevisionNumber(si5351_driver *inst){
|
||||
|
||||
// Read Device Status register:
|
||||
inst->i2c_transfer_evt(inst->i2c_transfer_inst,(uint8_t*) &(inst->device_data.deviceStatus),sizeof(inst->device_data.deviceStatus), SI5351_I2C_GET);
|
||||
|
||||
|
||||
return inst->device_data.deviceStatus.REVID;
|
||||
}
|
||||
|
||||
int cm_si5351_init(si5351_driver *inst, void *i2c_transfer_inst, setGet_I2C_Event_fpt i2c_transfer_evt){
|
||||
|
||||
if(inst == NULL)return -1;
|
||||
if(i2c_transfer_inst == NULL)return -1;
|
||||
if(i2c_transfer_evt == NULL)return -1;
|
||||
|
||||
inst->i2c_transfer_inst = i2c_transfer_inst;
|
||||
inst->i2c_transfer_evt = i2c_transfer_evt;
|
||||
|
||||
int ret = 0;
|
||||
|
||||
// SW Reset device.
|
||||
//ret = cm_ltr390_SWreset(inst);
|
||||
|
||||
// ret = ltr390_readAllReg(inst);
|
||||
|
||||
return ret;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user