| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- /**
- * @file AD5933_ATY.h
- *
- * @param Project DEVICE_GENERAL_ATY_LIB
- *
- * @author ATY
- *
- * @copyright
- * - Copyright 2017 - 2023 MZ-ATY
- * - This code follows:
- * - MZ-ATY Various Contents Joint Statement -
- * <a href="https://mengze.top/MZ-ATY_VCJS">
- * https://mengze.top/MZ-ATY_VCJS</a>
- * - CC 4.0 BY-NC-SA -
- * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
- * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
- * - Your use will be deemed to have accepted the terms of this statement.
- *
- * @brief Familiar functions of AD5933 for all embedded device
- *
- * @version
- * - 1_01_24015 > ATY
- * -# Preliminary version, first Release
- ********************************************************************************
- */
- #ifndef __AD5933_ATY_H
- #define __AD5933_ATY_H
- #include "INCLUDE_ATY.h"
- /******************************* For user *************************************/
- // 0 0 0 1 1 0 1 R/W
- #define AD5933_ADDRESS (0x0D)
- /******************************************************************************/
- struct AD5933_ATY_Dev
- {
- uint8_t addr;
- uint8_t(*i2cProcess)(uint8_t addr, uint8_t* data_t, uint8_t len, uint8_t rw);
- uint8_t lock;
- uint8_t debugEnable;
- int (*LOG)();
- };
- void AD5933_Init(struct AD5933_ATY_Dev* dev);
- void AD5933_Measure(struct AD5933_ATY_Dev* dev);
- // Device address and address pointer
- #define AD5933_ADDR (0x0D)
- #define ADDR_PTR (0xB0)
- // Control Register
- #define CTRL_REG1 (0x80)
- #define CTRL_REG2 (0x81)
- // Start Frequency Register
- #define START_FREQ_1 (0x82)
- #define START_FREQ_2 (0x83)
- #define START_FREQ_3 (0x84)
- // Frequency increment register
- #define INC_FREQ_1 (0x85)
- #define INC_FREQ_2 (0x86)
- #define INC_FREQ_3 (0x87)
- // Number of increments register
- #define NUM_INC_1 (0x88)
- #define NUM_INC_2 (0x89)
- // Number of settling time cycles register
- #define NUM_SCYCLES_1 (0x8A)
- #define NUM_SCYCLES_2 (0x8B)
- // Status register
- #define STATUS_REG (0x8F)
- // Temperature data register
- #define TEMP_DATA_1 (0x92)
- #define TEMP_DATA_2 (0x93)
- // Real data register
- #define REAL_DATA_1 (0x94)
- #define REAL_DATA_2 (0x95)
- // Imaginary data register
- #define IMAG_DATA_1 (0x96)
- #define IMAG_DATA_2 (0x97)
- /**
- * Constants
- * Constants for use with the AD5933 library class.
- */
- // Temperature measuring
- #define TEMP_MEASURE (CTRL_TEMP_MEASURE)
- #define TEMP_NO_MEASURE (CTRL_NO_OPERATION)
- // Clock sources
- #define CLOCK_INTERNAL (CTRL_CLOCK_INTERNAL)
- #define CLOCK_EXTERNAL (CTRL_CLOCK_EXTERNAL)
- // PGA gain options
- #define PGA_GAIN_X1 (CTRL_PGA_GAIN_X1)
- #define PGA_GAIN_X5 (CTRL_PGA_GAIN_X5)
- // Power modes
- #define POWER_STANDBY (CTRL_STANDBY_MODE)
- #define POWER_DOWN (CTRL_POWER_DOWN_MODE)
- #define POWER_ON (CTRL_NO_OPERATION)
- // I2C result success/fail
- #define I2C_RESULT_SUCCESS (0)
- #define I2C_RESULT_DATA_TOO_LONG (1)
- #define I2C_RESULT_ADDR_NAK (2)
- #define I2C_RESULT_DATA_NAK (3)
- #define I2C_RESULT_OTHER_FAIL (4)
- // Control output voltage range options
- #define CTRL_OUTPUT_RANGE_1 (0b00000000)
- #define CTRL_OUTPUT_RANGE_2 (0b00000110)
- #define CTRL_OUTPUT_RANGE_3 (0b00000100)
- #define CTRL_OUTPUT_RANGE_4 (0b00000010)
- // Control register options
- #define CTRL_NO_OPERATION (0b00000000)
- #define CTRL_INIT_START_FREQ (0b00010000)
- #define CTRL_START_FREQ_SWEEP (0b00100000)
- #define CTRL_INCREMENT_FREQ (0b00110000)
- #define CTRL_REPEAT_FREQ (0b01000000)
- #define CTRL_TEMP_MEASURE (0b10010000)
- #define CTRL_POWER_DOWN_MODE (0b10100000)
- #define CTRL_STANDBY_MODE (0b10110000)
- #define CTRL_RESET (0b00010000)
- #define CTRL_CLOCK_EXTERNAL (0b00001000)
- #define CTRL_CLOCK_INTERNAL (0b00000000)
- #define CTRL_PGA_GAIN_X1 (0b00000001)
- #define CTRL_PGA_GAIN_X5 (0b00000000)
- // Status register options
- #define STATUS_TEMP_VALID (0x01)
- #define STATUS_DATA_VALID (0x02)
- #define STATUS_SWEEP_DONE (0x04)
- #define STATUS_ERROR (0xFF)
- // Frequency sweep parameters
- #define SWEEP_DELAY (1)
- #endif /* __AD5933_ATY_H */
- /******************************** End Of File *********************************/
|