71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
/*
|
|
* si5351_driver.h
|
|
*
|
|
* Created on: 16. aug. 2024
|
|
* Author: Christian L. V. Madsen (OZ1CM)
|
|
*/
|
|
|
|
#ifndef SI5351_DRIVER_INCLUDE_SI5351_DRIVER_H_
|
|
#define SI5351_DRIVER_INCLUDE_SI5351_DRIVER_H_
|
|
|
|
#include "stdio.h"
|
|
#include "stdint.h"
|
|
|
|
typedef int (*setGet_I2C_Event_fpt)(void *inst, uint8_t *data, uint32_t len, uint8_t set_get);
|
|
|
|
typedef struct{
|
|
|
|
uint8_t SYS_INIT : 1; // System Initialization Status
|
|
uint8_t LOL_A : 1; // PLLB Loss Of Lock Status.
|
|
uint8_t LOL_B : 1; // PLL A Loss Of Lock Status.
|
|
uint8_t LOS_CLKIN : 1; // CLKIN Loss Of Signal (Si5351C Only).
|
|
uint8_t LOS_XTAL : 1; // Crystal Loss of Signal
|
|
uint8_t RESERVED : 1;
|
|
uint8_t REVID : 2; // Revision number of the device.
|
|
|
|
|
|
}__attribute__((packed)) si5351_deviceStat;
|
|
|
|
typedef struct{
|
|
|
|
uint8_t SYS_INIT_STKY : 1; // System Calibration Status Sticky Bit
|
|
uint8_t LOL_A_STKY : 1; // PLLB Loss Of Lock Status Sticky Bit
|
|
uint8_t LOL_B_STKY : 1; // PLL A Loss Of Lock Status Sticky Bit.
|
|
uint8_t LOS_CLKIN_STKY : 1; // CLKIN Loss Of Signal (Si5351C Only) Sticky Bit.
|
|
uint8_t LOS_XTAL_STKY : 1; // Crystal Loss of Signal Sticky Bit.
|
|
uint8_t RESERVED : 3;
|
|
|
|
|
|
}__attribute__((packed)) si5351_interruptStatusSticky;
|
|
|
|
typedef struct{
|
|
|
|
|
|
|
|
|
|
}__attribute__((packed)) si5351_outputEnableControl;
|
|
|
|
typedef struct{
|
|
|
|
si5351_deviceStat deviceStatus;
|
|
si5351_interruptStatusSticky ISR_StatusSticky;
|
|
|
|
|
|
}__attribute__((packed)) si5351_data;
|
|
|
|
typedef struct{
|
|
|
|
void *i2c_transfer_inst;
|
|
setGet_I2C_Event_fpt i2c_transfer_evt;
|
|
|
|
si5351_data device_data;
|
|
|
|
|
|
}__attribute__((packed)) si5351_driver;
|
|
|
|
int cm_si5351_init(si5351_driver *inst, void *i2c_transfer_inst, setGet_I2C_Event_fpt i2c_transfer_evt);
|
|
uint8_t cm_si5351_getRevisionNumber(si5351_driver *inst);
|
|
|
|
|
|
#endif /* SI5351_DRIVER_INCLUDE_SI5351_DRIVER_H_ */
|