Fork of Library for MAXREFDES72# that supports configuration of shield for different PMOD types and the DS3231 RTC
Fork of ard2pmod by
ard2pmod.h@6:9e75c6a2dff5, 2014-12-03 (annotated)
- Committer:
- j3
- Date:
- Wed Dec 03 04:17:15 2014 +0000
- Revision:
- 6:9e75c6a2dff5
- Parent:
- 4:349f2ec17a4b
- Child:
- 7:d3881d2c2d6b
added default constructor, all mux switches open.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 0:bb62cd328247 | 1 | /******************************************************************//** |
j3 | 0:bb62cd328247 | 2 | * @file ard2pmod.h |
j3 | 0:bb62cd328247 | 3 | * |
j3 | 0:bb62cd328247 | 4 | * @author Justin Jordan |
j3 | 0:bb62cd328247 | 5 | * |
j3 | 0:bb62cd328247 | 6 | * @version 0.0 |
j3 | 0:bb62cd328247 | 7 | * |
j3 | 0:bb62cd328247 | 8 | * Started: 11NOV14 |
j3 | 0:bb62cd328247 | 9 | * |
j3 | 0:bb62cd328247 | 10 | * Updated: |
j3 | 0:bb62cd328247 | 11 | * |
j3 | 0:bb62cd328247 | 12 | * @brief Header file for ard2pmod class |
j3 | 0:bb62cd328247 | 13 | * |
j3 | 0:bb62cd328247 | 14 | *********************************************************************** |
j3 | 0:bb62cd328247 | 15 | * |
j3 | 0:bb62cd328247 | 16 | * @copyright |
j3 | 0:bb62cd328247 | 17 | * Copyright (C) 2013 Maxim Integrated Products, Inc., All Rights Reserved. |
j3 | 0:bb62cd328247 | 18 | * |
j3 | 0:bb62cd328247 | 19 | * Permission is hereby granted, free of charge, to any person obtaining a |
j3 | 0:bb62cd328247 | 20 | * copy of this software and associated documentation files (the "Software"), |
j3 | 0:bb62cd328247 | 21 | * to deal in the Software without restriction, including without limitation |
j3 | 0:bb62cd328247 | 22 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
j3 | 0:bb62cd328247 | 23 | * and/or sell copies of the Software, and to permit persons to whom the |
j3 | 0:bb62cd328247 | 24 | * Software is furnished to do so, subject to the following conditions: |
j3 | 0:bb62cd328247 | 25 | * |
j3 | 0:bb62cd328247 | 26 | * The above copyright notice and this permission notice shall be included |
j3 | 0:bb62cd328247 | 27 | * in all copies or substantial portions of the Software. |
j3 | 0:bb62cd328247 | 28 | * |
j3 | 0:bb62cd328247 | 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
j3 | 0:bb62cd328247 | 30 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
j3 | 0:bb62cd328247 | 31 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
j3 | 0:bb62cd328247 | 32 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
j3 | 0:bb62cd328247 | 33 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
j3 | 0:bb62cd328247 | 34 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
j3 | 0:bb62cd328247 | 35 | * OTHER DEALINGS IN THE SOFTWARE. |
j3 | 0:bb62cd328247 | 36 | * |
j3 | 0:bb62cd328247 | 37 | * Except as contained in this notice, the name of Maxim Integrated |
j3 | 0:bb62cd328247 | 38 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
j3 | 0:bb62cd328247 | 39 | * Products, Inc. Branding Policy. |
j3 | 0:bb62cd328247 | 40 | * |
j3 | 0:bb62cd328247 | 41 | * The mere transfer of this software does not imply any licenses |
j3 | 0:bb62cd328247 | 42 | * of trade secrets, proprietary technology, copyrights, patents, |
j3 | 0:bb62cd328247 | 43 | * trademarks, maskwork rights, or any other form of intellectual |
j3 | 0:bb62cd328247 | 44 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
j3 | 0:bb62cd328247 | 45 | * ownership rights. |
j3 | 0:bb62cd328247 | 46 | **********************************************************************/ |
j3 | 0:bb62cd328247 | 47 | |
j3 | 0:bb62cd328247 | 48 | |
j3 | 0:bb62cd328247 | 49 | #ifndef ARD2PMOD_H |
j3 | 0:bb62cd328247 | 50 | #define ARD2PMOD_H |
j3 | 0:bb62cd328247 | 51 | |
j3 | 0:bb62cd328247 | 52 | |
j3 | 0:bb62cd328247 | 53 | #include "mbed.h" |
j3 | 0:bb62cd328247 | 54 | #include "max14661.h" |
j3 | 0:bb62cd328247 | 55 | #include "ds3231.h" |
j3 | 0:bb62cd328247 | 56 | |
j3 | 0:bb62cd328247 | 57 | |
j3 | 0:bb62cd328247 | 58 | #define ARD2PMOD_SDA D14 |
j3 | 0:bb62cd328247 | 59 | #define ARD2PMOD_SCL D15 |
j3 | 0:bb62cd328247 | 60 | |
j3 | 0:bb62cd328247 | 61 | |
j3 | 0:bb62cd328247 | 62 | typedef enum |
j3 | 0:bb62cd328247 | 63 | { |
j3 | 3:64d54fa4dd3c | 64 | PMOD_TYPE_I2C_A, |
j3 | 3:64d54fa4dd3c | 65 | PMOD_TYPE_I2C_B, |
j3 | 3:64d54fa4dd3c | 66 | PMOD_TYPE_I2C_AB, |
j3 | 0:bb62cd328247 | 67 | PMOD_TYPE_1_GPIO, |
j3 | 0:bb62cd328247 | 68 | PMOD_TYPE_2_SPI, |
j3 | 0:bb62cd328247 | 69 | PMOD_TYPE_3_UART, |
j3 | 0:bb62cd328247 | 70 | PMOD_TYPE_4_UART, |
j3 | 0:bb62cd328247 | 71 | PMOD_TYPE_5_HBRIDGE, |
j3 | 0:bb62cd328247 | 72 | PMOD_TYPE_6_HBRIDGE |
j3 | 0:bb62cd328247 | 73 | }pmod_type_t; |
j3 | 0:bb62cd328247 | 74 | |
j3 | 0:bb62cd328247 | 75 | |
j3 | 0:bb62cd328247 | 76 | /******************************************************************//** |
j3 | 0:bb62cd328247 | 77 | * Ard2Pmod Class |
j3 | 0:bb62cd328247 | 78 | * Used for establishing PMOD type, MAX14661 16:2 mux, |
j3 | 0:bb62cd328247 | 79 | * and DS3231 RTC interface |
j3 | 0:bb62cd328247 | 80 | * |
j3 | 0:bb62cd328247 | 81 | * Please See MAXREFDES72# pcb schematic for constraints. |
j3 | 0:bb62cd328247 | 82 | * |
j3 | 4:349f2ec17a4b | 83 | * PMOD_TYPE_I2C_A - |
j3 | 4:349f2ec17a4b | 84 | * Switches SWA9, SWA12 and SWB10, SWB11 closed. All other switches |
j3 | 4:349f2ec17a4b | 85 | * open |
j3 | 4:349f2ec17a4b | 86 | * |
j3 | 4:349f2ec17a4b | 87 | * PMOD_TYPE_I2C_B - |
j3 | 4:349f2ec17a4b | 88 | * Switches SWA9, SWA7 and SWB10, SWB8 closed. All other switches |
j3 | 4:349f2ec17a4b | 89 | * open |
j3 | 4:349f2ec17a4b | 90 | * |
j3 | 4:349f2ec17a4b | 91 | * PMOD_TYPE_I2C_AB - |
j3 | 0:bb62cd328247 | 92 | * Switches SWA7, SWA9, SWA12 and SWB8, SWB10, SWB11 closed. All other |
j3 | 0:bb62cd328247 | 93 | * switches open |
j3 | 0:bb62cd328247 | 94 | * |
j3 | 0:bb62cd328247 | 95 | * PMOD_TYPE_1_GPIO - |
j3 | 0:bb62cd328247 | 96 | * Switches all open, mux not used |
j3 | 0:bb62cd328247 | 97 | * |
j3 | 0:bb62cd328247 | 98 | * PMOD_TYPE_2_SPI - |
j3 | 0:bb62cd328247 | 99 | * Switches all open, mux not used |
j3 | 0:bb62cd328247 | 100 | * |
j3 | 0:bb62cd328247 | 101 | * PMOD_TYPE_3_UART - |
j3 | 0:bb62cd328247 | 102 | * Switches SWA2, SWA12 and SWB1, SWB11 closed. All other switches open |
j3 | 0:bb62cd328247 | 103 | * |
j3 | 0:bb62cd328247 | 104 | * PMOD_TYPE_4_UART - |
j3 | 0:bb62cd328247 | 105 | * Switches SWA1, SWA13 and SWB2, SWB12 closed. All other switches open |
j3 | 0:bb62cd328247 | 106 | * |
j3 | 0:bb62cd328247 | 107 | * PMOD_TYPE_5_HBRIDGE - |
j3 | 0:bb62cd328247 | 108 | * Switches all open, mux not used |
j3 | 0:bb62cd328247 | 109 | * |
j3 | 0:bb62cd328247 | 110 | * PMOD_TYPE_6_HBRIDGE - |
j3 | 0:bb62cd328247 | 111 | * Switches all open, mux not used |
j3 | 0:bb62cd328247 | 112 | **********************************************************************/ |
j3 | 0:bb62cd328247 | 113 | class Ard2Pmod : public Max14661, public Ds3231 |
j3 | 0:bb62cd328247 | 114 | { |
j3 | 0:bb62cd328247 | 115 | public: |
j3 | 6:9e75c6a2dff5 | 116 | /**************************************************************//** |
j3 | 6:9e75c6a2dff5 | 117 | * Default constructor for Ard2Pmod Class, all mux switches open |
j3 | 6:9e75c6a2dff5 | 118 | * Use with Max14661 member functions for custom mux settings |
j3 | 6:9e75c6a2dff5 | 119 | * |
j3 | 6:9e75c6a2dff5 | 120 | * On Entry: |
j3 | 6:9e75c6a2dff5 | 121 | * |
j3 | 6:9e75c6a2dff5 | 122 | * On Exit: |
j3 | 6:9e75c6a2dff5 | 123 | * @return none |
j3 | 6:9e75c6a2dff5 | 124 | * |
j3 | 6:9e75c6a2dff5 | 125 | * Example: |
j3 | 6:9e75c6a2dff5 | 126 | * @code |
j3 | 6:9e75c6a2dff5 | 127 | * #include "ard2pmod.h" |
j3 | 6:9e75c6a2dff5 | 128 | * |
j3 | 6:9e75c6a2dff5 | 129 | * int main(void) |
j3 | 6:9e75c6a2dff5 | 130 | * { |
j3 | 6:9e75c6a2dff5 | 131 | * Ard2Pmod ard2pmod(); |
j3 | 6:9e75c6a2dff5 | 132 | * |
j3 | 6:9e75c6a2dff5 | 133 | * //main app. |
j3 | 6:9e75c6a2dff5 | 134 | * for(;;) |
j3 | 6:9e75c6a2dff5 | 135 | * { |
j3 | 6:9e75c6a2dff5 | 136 | * } |
j3 | 6:9e75c6a2dff5 | 137 | * } |
j3 | 6:9e75c6a2dff5 | 138 | * @endcode |
j3 | 6:9e75c6a2dff5 | 139 | ******************************************************************/ |
j3 | 6:9e75c6a2dff5 | 140 | Ard2Pmod(); |
j3 | 6:9e75c6a2dff5 | 141 | |
j3 | 6:9e75c6a2dff5 | 142 | |
j3 | 0:bb62cd328247 | 143 | /**************************************************************//** |
j3 | 0:bb62cd328247 | 144 | * Constructor for Ard2Pmod Class |
j3 | 0:bb62cd328247 | 145 | * |
j3 | 0:bb62cd328247 | 146 | * On Entry: |
j3 | 0:bb62cd328247 | 147 | * @param[in] pmod_type - desired PMOD interface |
j3 | 0:bb62cd328247 | 148 | * |
j3 | 0:bb62cd328247 | 149 | * On Exit: |
j3 | 0:bb62cd328247 | 150 | * @return none |
j3 | 0:bb62cd328247 | 151 | * |
j3 | 0:bb62cd328247 | 152 | * Example: |
j3 | 0:bb62cd328247 | 153 | * @code |
j3 | 0:bb62cd328247 | 154 | * #include "ard2pmod.h" |
j3 | 0:bb62cd328247 | 155 | * |
j3 | 0:bb62cd328247 | 156 | * int main(void) |
j3 | 0:bb62cd328247 | 157 | * { |
j3 | 0:bb62cd328247 | 158 | * Ard2Pmod ard2pmod(PMOD_TYPE_1_GPIO); |
j3 | 0:bb62cd328247 | 159 | * |
j3 | 0:bb62cd328247 | 160 | * //main app. |
j3 | 0:bb62cd328247 | 161 | * for(;;) |
j3 | 0:bb62cd328247 | 162 | * { |
j3 | 0:bb62cd328247 | 163 | * } |
j3 | 0:bb62cd328247 | 164 | * } |
j3 | 0:bb62cd328247 | 165 | * @endcode |
j3 | 0:bb62cd328247 | 166 | ******************************************************************/ |
j3 | 0:bb62cd328247 | 167 | Ard2Pmod(pmod_type_t pmod_type); |
j3 | 0:bb62cd328247 | 168 | |
j3 | 0:bb62cd328247 | 169 | }; |
j3 | 0:bb62cd328247 | 170 | |
j3 | 0:bb62cd328247 | 171 | |
j3 | 0:bb62cd328247 | 172 | #endif /* ARD2PMOD_H*/ |