Library for the MAX11300
Dependents: MAX_IOT_KIT MAX_IOT_KIT
Fork of MAX11300 by
The MAX11300/01/11/12 are configurable mixed signal integrated circuits. The MAX11300/11 offer a SPI interface while the MAX11301/12 offer an I2C interface. The MAX11300/01 are 20 port devices while the MAX11311/12 are 12 port devices.
This library supports the family of parts by providing member functions that can manipulate the GPIO, ADC, DAC, and analog switches of the device, after it has been configured. For configuration of the device, this library requires a header file that can be generated by the MAX11300/01/11/12 Configuration Software. The configuration software can be found at the following link.
Include the generated MAX113XXHex.h file into your project and update the #include in MAX113XX_Pixi.h.
Revision 18:8ee1928ffe6c, committed 2017-09-06
- Comitter:
- j3
- Date:
- Wed Sep 06 12:38:11 2017 -0700
- Parent:
- 17:658202c79f33
- Commit message:
- Fixed variable length array error/warning
Changed in this revision
MAX113XX_Pixi.cpp | Show annotated file Show diff for this revision Revisions of this file |
MAX113XX_Pixi.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 658202c79f33 -r 8ee1928ffe6c MAX113XX_Pixi.cpp --- a/MAX113XX_Pixi.cpp Sat May 13 00:11:38 2017 +0000 +++ b/MAX113XX_Pixi.cpp Wed Sep 06 12:38:11 2017 -0700 @@ -378,7 +378,7 @@ float &data) { MAX113XX_Pixi::CmdResult_e result = MAX113XX_Pixi::OpFailure; - int16_t temp; + int16_t temp = 0; if(m_device == MAX11300 || m_device == MAX11301) //20 port device { @@ -587,7 +587,8 @@ const uint8_t num_reg) { uint16_t numBytes = ((num_reg * 2) + 1); - char localData[numBytes]; + //No variable length array + char localData[MAX113XX_Pixi::MAX_REGISTER_ADRS]; uint8_t idx(0), dataIdx(0); localData[idx++] = reg; @@ -598,15 +599,15 @@ } while(idx < numBytes); - m_i2cBus.write(m_w_adrs, localData, numBytes); + m_i2cBus.write(m_w_adrs, localData, numBytes); } //********************************************************************* void MAX113XX_I2C::blockRead(uint8_t reg, uint16_t *data, const uint8_t num_reg) { uint16_t numBytes = (num_reg * 2); - char localData[numBytes]; - + //No variable length array + char localData[MAX113XX_Pixi::MAX_REGISTER_ADRS]; localData[0] = reg; if(m_i2cBus.write(m_w_adrs, localData, 1, true) == 0)
diff -r 658202c79f33 -r 8ee1928ffe6c MAX113XX_Pixi.h --- a/MAX113XX_Pixi.h Sat May 13 00:11:38 2017 +0000 +++ b/MAX113XX_Pixi.h Wed Sep 06 12:38:11 2017 -0700 @@ -169,6 +169,8 @@ ///Diode connected Q2 External2 }; + + static const uint8_t MAX_REGISTER_ADRS = 0x73; ///Command results enum CmdResult_e @@ -351,4 +353,4 @@ }; -#endif /* _MAX113XX_PIXI_H_ */ \ No newline at end of file +#endif /* _MAX113XX_PIXI_H_ */