| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LT_PMBusDeviceLTC2975.h
Go to the documentation of this file.
1 /*!
2 LTC PSM Device
3
4 @verbatim
5
6 Representation of a device and its capabilities.
7
8 @endverbatim
9
10
11 Copyright 2018(c) Analog Devices, Inc.
12
13 All rights reserved.
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17 - Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 - Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
22 distribution.
23 - Neither the name of Analog Devices, Inc. nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without specific prior written permission.
26 - The use of this software may or may not infringe the patent rights
27 of one or more patent holders. This license does not release you
28 from the requirement that you obtain separate licenses from these
29 patent holders to use this software.
30 - Use of the software either in source or binary form, must be run
31 on or directly connected to an Analog Devices Inc. component.
32
33 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
34 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
35 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
37 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
39 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
40 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 /*! @file
46 @ingroup LT_PMBusDevice
47 Library Header File for LT_PMBusDeviceLTC2975
48 */
49
50 #ifndef LT_PMBusDeviceLTC2975_H_
51 #define LT_PMBusDeviceLTC2975_H_
52
53 #include "LT_PMBusDeviceManager.h"
54
55 class LT_PMBusDeviceLTC2975 : public LT_PMBusDeviceManager
56 {
57 public:
58
59 static uint32_t cap_;
60
61 LT_PMBusDeviceLTC2975(LT_PMBus *pmbus, uint8_t address) : LT_PMBusDeviceManager(pmbus, address, 8)
62 {
63 }
64
65 uint32_t getCapabilities (
66 )
67 {
68 return cap_;
69 }
70
71 //! Is/are these capability(s) supported?
72 //! @return true if yes
73 bool hasCapability(
74 uint32_t capability //!< List of capabilities
75 )
76 {
77 return (cap_ & capability) == capability;
78 }
79
80 char *getType(void)
81 {
82 uint8_t *model = (uint8_t *) calloc(8,1);
83 memcpy(model, "LTC2975", 7);
84 return (char *) model;
85 }
86
87 uint8_t getNumPages(void)
88 {
89 return 4;
90 }
91
92 static LT_PMBusDevice *detect(LT_PMBus *pmbus, uint8_t address)
93 {
94 uint16_t id;
95 LT_PMBusDeviceLTC2975 *device;
96
97 id = pmbus->readMfrSpecialId(address);
98 if ( (id & 0xFFF0) == 0x0220)
99 {
100 device = new LT_PMBusDeviceLTC2975(pmbus, address);
101 device->probeSpeed();
102 return device;
103 }
104 else
105 return NULL;
106 }
107
108 };
109
110 #endif /* LT_PMBusDeviceLTC2975_H_ */
id
static int id
Definition: rail_logger.ino:99
LT_PMBusDeviceLTC2975::hasCapability
bool hasCapability(uint32_t capability)
Is/are these capability(s) supported?
Definition: LT_PMBusDeviceLTC2975.h:73
LT_PMBusDeviceLTC2975::LT_PMBusDeviceLTC2975
LT_PMBusDeviceLTC2975(LT_PMBus *pmbus, uint8_t address)
Definition: LT_PMBusDeviceLTC2975.h:61
LT_PMBusDeviceManager.h
LTC PSM Manager Device.
LT_PMBusDevice
Definition: LT_PMBusDevice.h:75
LT_PMBusDeviceLTC2975::getCapabilities
uint32_t getCapabilities()
Get the supported capabilities.
Definition: LT_PMBusDeviceLTC2975.h:65
LT_PMBusDeviceLTC2975::cap_
static uint32_t cap_
Definition: LT_PMBusDeviceLTC2975.h:59
address
static uint8_t address
Definition: DC2091A.ino:83
LT_PMBusDevice::pmbus
LT_PMBus * pmbus()
Definition: LT_PMBusDevice.cpp:70
LT_PMBusDeviceLTC2975::detect
static LT_PMBusDevice * detect(LT_PMBus *pmbus, uint8_t address)
Definition: LT_PMBusDeviceLTC2975.h:92
LT_PMBusDeviceLTC2975::getNumPages
uint8_t getNumPages(void)
Definition: LT_PMBusDeviceLTC2975.h:87
LT_PMBusDeviceManager
Definition: LT_PMBusDeviceManager.h:56
LT_PMBusDevice::probeSpeed
void probeSpeed()
Definition: LT_PMBusDevice.cpp:57
LT_PMBus::readMfrSpecialId
uint16_t readMfrSpecialId(uint8_t address)
Get speical ID.
Definition: LT_PMBus.cpp:3361
LT_PMBusDeviceLTC2975::getType
char * getType(void)
Definition: LT_PMBusDeviceLTC2975.h:80
device
ad5933_dev * device
Definition: CN-0413.ino:67
LT_PMBusDeviceLTC2975
Definition: LT_PMBusDeviceLTC2975.h:55
LT_PMBus
PMBus communication.
Definition: LT_PMBus.h:370