asd

Committer:
vitlog
Date:
Mon Jun 22 09:52:01 2020 +0000
Revision:
0:9a5218876095
Tozhe ne pomnyu

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vitlog 0:9a5218876095 1 #ifndef _AD5422_ARDUINO_H /* Guard against multiple inclusion */
vitlog 0:9a5218876095 2 #define _AD5422_ARDUINO_H
vitlog 0:9a5218876095 3 #include <stdint.h>
vitlog 0:9a5218876095 4 /* Provide C++ Compatibility */
vitlog 0:9a5218876095 5 #ifdef __cplusplus
vitlog 0:9a5218876095 6 extern "C" {
vitlog 0:9a5218876095 7 #endif
vitlog 0:9a5218876095 8
vitlog 0:9a5218876095 9 #define AD5422_ADR 0
vitlog 0:9a5218876095 10 //////////////////////////////////////////////
vitlog 0:9a5218876095 11 // ************ Commands AD5422 *********** //
vitlog 0:9a5218876095 12 //////////////////////////////////////////////
vitlog 0:9a5218876095 13
vitlog 0:9a5218876095 14 #define AD5422_NOP 0x00
vitlog 0:9a5218876095 15 #define AD5422_REG_DATA 0x01
vitlog 0:9a5218876095 16 #define AD5422_READBACK 0x02
vitlog 0:9a5218876095 17 #define AD5422_REG_CONTROL 0x55
vitlog 0:9a5218876095 18 #define AD5422_REG_RESET 0x56
vitlog 0:9a5218876095 19
vitlog 0:9a5218876095 20 //////////////////////////////////////////////
vitlog 0:9a5218876095 21 // *********** READ Registers ****************** //
vitlog 0:9a5218876095 22 //////////////////////////////////////////////
vitlog 0:9a5218876095 23
vitlog 0:9a5218876095 24 #define AD5422_STATUS_REGISTER 0x00
vitlog 0:9a5218876095 25 #define AD5422_DATA_REGISTER 0x01
vitlog 0:9a5218876095 26 #define AD5422_CONTROL_REGISTER 0x10
vitlog 0:9a5218876095 27
vitlog 0:9a5218876095 28 typedef union{
vitlog 0:9a5218876095 29 struct{
vitlog 0:9a5218876095 30 uint16_t
vitlog 0:9a5218876095 31 R0:1,
vitlog 0:9a5218876095 32 R1:1,
vitlog 0:9a5218876095 33 R2:1,
vitlog 0:9a5218876095 34 DCEN:1,
vitlog 0:9a5218876095 35 SREN:1,
vitlog 0:9a5218876095 36 SRSTEP:3,
vitlog 0:9a5218876095 37 SRCLOCK:4,
vitlog 0:9a5218876095 38 OUTEN:1,
vitlog 0:9a5218876095 39 REXT:1,
vitlog 0:9a5218876095 40 OVRRNG:1,
vitlog 0:9a5218876095 41 CLRSEL:1;
vitlog 0:9a5218876095 42 };
vitlog 0:9a5218876095 43 struct{
vitlog 0:9a5218876095 44 uint16_t
vitlog 0:9a5218876095 45 L:8,
vitlog 0:9a5218876095 46 H:8;
vitlog 0:9a5218876095 47 };
vitlog 0:9a5218876095 48 }AD5422_CONTROL_t;
vitlog 0:9a5218876095 49 extern AD5422_CONTROL_t AD5422_CONTROL;
vitlog 0:9a5218876095 50
vitlog 0:9a5218876095 51 typedef union{
vitlog 0:9a5218876095 52 struct{
vitlog 0:9a5218876095 53 uint16_t
vitlog 0:9a5218876095 54 OverTemp:1,
vitlog 0:9a5218876095 55 SlewActive:1,
vitlog 0:9a5218876095 56 IoutFault:1,
vitlog 0:9a5218876095 57 :13;
vitlog 0:9a5218876095 58 };
vitlog 0:9a5218876095 59 uint16_t w:16;
vitlog 0:9a5218876095 60
vitlog 0:9a5218876095 61 }AD5422_STATUS_t;
vitlog 0:9a5218876095 62 extern AD5422_STATUS_t AD5422_STATUS;
vitlog 0:9a5218876095 63
vitlog 0:9a5218876095 64 void ad5422_init ( void );
vitlog 0:9a5218876095 65 void ad5422_resetDevice ( unsigned char adr );
vitlog 0:9a5218876095 66 void ad5422_powerDownDevice ( unsigned char adr );
vitlog 0:9a5218876095 67 void ad5422_powerUpDevice ( unsigned char adr );
vitlog 0:9a5218876095 68 char ad5422_readyDevice ( unsigned char ch );
vitlog 0:9a5218876095 69 char ad5422_sendCommandDevice ( unsigned char reg, unsigned char high_byte, unsigned char low_byte, unsigned char adr );
vitlog 0:9a5218876095 70 uint32_t ad5422_readReg ( unsigned char reg, unsigned char adr );
vitlog 0:9a5218876095 71 unsigned int ad5422_setRegisters ( void );
vitlog 0:9a5218876095 72 unsigned int ad5422_setRegistersChannal ( char channal );
vitlog 0:9a5218876095 73 unsigned char ad5422_setVoltageChannal ( float voltage, char channal );
vitlog 0:9a5218876095 74
vitlog 0:9a5218876095 75 /* Provide C++ Compatibility */
vitlog 0:9a5218876095 76 #ifdef __cplusplus
vitlog 0:9a5218876095 77 }
vitlog 0:9a5218876095 78 #endif
vitlog 0:9a5218876095 79
vitlog 0:9a5218876095 80 #endif /* _EXAMPLE_FILE_NAME_H */
vitlog 0:9a5218876095 81
vitlog 0:9a5218876095 82 /* *****************************************************************************
vitlog 0:9a5218876095 83 End of File
vitlog 0:9a5218876095 84 */