Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ad5422_arduino.h
00001 #ifndef _AD5422_ARDUINO_H /* Guard against multiple inclusion */ 00002 #define _AD5422_ARDUINO_H 00003 #include <stdint.h> 00004 /* Provide C++ Compatibility */ 00005 #ifdef __cplusplus 00006 extern "C" { 00007 #endif 00008 00009 #define AD5422_ADR 0 00010 ////////////////////////////////////////////// 00011 // ************ Commands AD5422 *********** // 00012 ////////////////////////////////////////////// 00013 00014 #define AD5422_NOP 0x00 00015 #define AD5422_REG_DATA 0x01 00016 #define AD5422_READBACK 0x02 00017 #define AD5422_REG_CONTROL 0x55 00018 #define AD5422_REG_RESET 0x56 00019 00020 ////////////////////////////////////////////// 00021 // *********** READ Registers ****************** // 00022 ////////////////////////////////////////////// 00023 00024 #define AD5422_STATUS_REGISTER 0x00 00025 #define AD5422_DATA_REGISTER 0x01 00026 #define AD5422_CONTROL_REGISTER 0x10 00027 00028 typedef union{ 00029 struct{ 00030 uint16_t 00031 R0:1, 00032 R1:1, 00033 R2:1, 00034 DCEN:1, 00035 SREN:1, 00036 SRSTEP:3, 00037 SRCLOCK:4, 00038 OUTEN:1, 00039 REXT:1, 00040 OVRRNG:1, 00041 CLRSEL:1; 00042 }; 00043 struct{ 00044 uint16_t 00045 L:8, 00046 H:8; 00047 }; 00048 }AD5422_CONTROL_t; 00049 extern AD5422_CONTROL_t AD5422_CONTROL; 00050 00051 typedef union{ 00052 struct{ 00053 uint16_t 00054 OverTemp:1, 00055 SlewActive:1, 00056 IoutFault:1, 00057 :13; 00058 }; 00059 uint16_t w:16; 00060 00061 }AD5422_STATUS_t; 00062 extern AD5422_STATUS_t AD5422_STATUS; 00063 00064 void ad5422_init ( void ); 00065 void ad5422_resetDevice ( unsigned char adr ); 00066 void ad5422_powerDownDevice ( unsigned char adr ); 00067 void ad5422_powerUpDevice ( unsigned char adr ); 00068 char ad5422_readyDevice ( unsigned char ch ); 00069 char ad5422_sendCommandDevice ( unsigned char reg, unsigned char high_byte, unsigned char low_byte, unsigned char adr ); 00070 uint32_t ad5422_readReg ( unsigned char reg, unsigned char adr ); 00071 unsigned int ad5422_setRegisters ( void ); 00072 unsigned int ad5422_setRegistersChannal ( char channal ); 00073 unsigned char ad5422_setVoltageChannal ( float voltage, char channal ); 00074 00075 /* Provide C++ Compatibility */ 00076 #ifdef __cplusplus 00077 } 00078 #endif 00079 00080 #endif /* _EXAMPLE_FILE_NAME_H */ 00081 00082 /* ***************************************************************************** 00083 End of File 00084 */
Generated on Fri Jul 15 2022 07:00:34 by
1.7.2