
/*****************************************************************************/

#define MEAS_LOOP_CNT 20

/*****************************************************************************/

/* Message byte definitions: */
#define MSG_SOM1 0x3c
#define MSG_SOM2 0x3e
#define MSG_EOM1 0x0d
#define MSG_EOM2 0x0a

#define MSG_TYPE_ANSWER_OK        0x01
#define MSG_TYPE_ANSWER_NOK       0x02
#define MSG_TYPE_MEAS_FREQ_INFO   0x03
#define MSG_TYPE_MEAS_END_INFO    0x04
#define MSG_TYPE_CONFIG           0x05

/*****************************************************************************/

#define CC_STATE_READ_SOM1 20
#define CC_STATE_READ_SOM2 30
#define CC_STATE_READ_CMD  40
#define CC_STATE_READ_DATA 50
#define CC_STATE_READ_EOM1 60
#define CC_STATE_READ_EOM2 70

/*****************************************************************************/

#define CC_CMD_NO_CMD   0

#define MSG_INCOMPLETE 10
#define MSG_COMPLETE   20

/*****************************************************************************/

#define CC_CMD_SET_START_FREQ       0x01
#define CC_CMD_SET_END_FREQ         0x02
#define CC_CMD_SET_INTERVALL        0x03
#define CC_CMD_SET_DRIVE_STRENGTH   0x04
#define CC_CMD_SET_FREQ_STEP        0x05
#define CC_CMD_START_MEASUREMENT    0x06
#define CC_CMD_GET_CONFIG           0x10
#define CC_CMD_EN_CLK               0x20
#define CC_CMD_DIS_CLK              0x21
#define CC_CMD_SAV_DFLT             0x22
#define CC_CMD_SET_CLK_CORR         0x23
#define CC_CMD_GET_CLK_CORR         0x24

/*****************************************************************************/

#define CC_CMD_SET_START_FREQ_FUNC        &cc_setStartFreq
#define CC_CMD_SET_END_FREQ_FUNC          &cc_setEndFreq
#define CC_CMD_SET_INTERVALL_FUNC         &cc_setIntervall
#define CC_CMD_SET_DRIVE_STRENGTH_FUNC    &cc_setDriveStrength
#define CC_CMD_SET_FREQ_STEP_FUNC         &cc_setFreqStep
#define CC_CMD_START_MEASUREMENT_FUNC     &cc_startMeasurement
#define CC_CMD_GET_CONFIG_FUNC            &cc_getConfig
#define CC_CMD_EN_CLK_FUNC                &cc_enableClk
#define CC_CMD_DIS_CLK_FUNC               &cc_disableClk
#define CC_CMD_SAV_DFLT_FUNC              &cc_saveDefaults
#define CC_CMD_SET_CLK_CORR_FUNC          &cc_setClkCorrection
#define CC_CMD_GET_CLK_CORR_FUNC          &cc_getClkCorrection

/*****************************************************************************/

#define CC_CMD_SET_START_FREQ_DATA_TO_READ      4 // up to 32 bit = 4 byte => 2 ** 32 = >500000000Hz
#define CC_CMD_SET_END_FREQ_DATA_TO_READ        4 // up to 32 bit = 4 byte => 2 ** 32 = >500000000Hz
#define CC_CMD_SET_INTERVALL_DATA_TO_READ       2
#define CC_CMD_SET_DRIVE_STRENGTH_DATA_TO_READ  1
#define CC_CMD_SET_FREQ_STEP_DATA_TO_READ       4
#define CC_CMD_START_MEASUREMENT_DATA_TO_READ   0
#define CC_CMD_GET_CONFIG_DATA_TO_READ          0
#define CC_CMD_EN_CLK_DATA_TO_READ              1
#define CC_CMD_DIS_CLK_DATA_TO_READ             1
#define CC_CMD_SAV_DFLT_DATA_TO_READ            0
#define CC_CMD_SET_CLK_CORR_DATA_TO_READ        4
#define CC_CMD_GET_CLK_CORR_DATA_TO_READ        0

/*****************************************************************************/

#define CC_READ_DATA_MAX 64

/*****************************************************************************/

