From 67579db883c25eed2082ebdde8cff923ba813e86 Mon Sep 17 00:00:00 2001 From: RedHawk Date: Thu, 6 Apr 2023 10:52:39 +0300 Subject: [PATCH 1/5] shoh: Fixing project includes. --- .../info.properties | 2 +- source/shoh/.cproject | 74 ++++++++++++------- source/shoh/src/main.cpp | 4 +- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/source/.mcuxpressoide_packages_support/info.properties b/source/.mcuxpressoide_packages_support/info.properties index 34605a1..e923eaa 100644 --- a/source/.mcuxpressoide_packages_support/info.properties +++ b/source/.mcuxpressoide_packages_support/info.properties @@ -1,5 +1,5 @@ #MCUXpresso IDE -#Tue Apr 04 17:46:16 EEST 2023 +#Thu Apr 06 10:42:38 EEST 2023 product.name=MCUXpresso IDE v11.5.1 [Build 7266] [2022-04-13] product.version=11.5.1 product.build=7266 diff --git a/source/shoh/.cproject b/source/shoh/.cproject index a864a24..12a087c 100644 --- a/source/shoh/.cproject +++ b/source/shoh/.cproject @@ -47,6 +47,10 @@ + + + + @@ -181,6 +193,10 @@ @@ -205,6 +221,10 @@ @@ -276,31 +300,31 @@ - <?xml version="1.0" encoding="UTF-8"?> -<TargetConfig> -<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/> -<infoList vendor="NXP"> -<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"> -<chip> -<name>LPC11U68</name> -<family>LPC11U6x</family> -<vendor>NXP (formerly Philips)</vendor> -<reset board="None" core="Real" sys="Real"/> -<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/> -<memory can_program="true" id="Flash" is_ro="true" type="Flash"/> -<memory id="RAM" type="RAM"/> -<memory id="Periph" is_volatile="true" type="Peripheral"/> -<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/> -<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/> -<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/> -<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/> -</chip> -<processor> -<name gcc_name="cortex-m0">Cortex-M0</name> -<family>Cortex-M</family> -</processor> -</info> -</infoList> + <?xml version="1.0" encoding="UTF-8"?> +<TargetConfig> +<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/> +<infoList vendor="NXP"> +<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"> +<chip> +<name>LPC11U68</name> +<family>LPC11U6x</family> +<vendor>NXP (formerly Philips)</vendor> +<reset board="None" core="Real" sys="Real"/> +<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/> +<memory can_program="true" id="Flash" is_ro="true" type="Flash"/> +<memory id="RAM" type="RAM"/> +<memory id="Periph" is_volatile="true" type="Peripheral"/> +<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/> +<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/> +<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/> +<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/> +</chip> +<processor> +<name gcc_name="cortex-m0">Cortex-M0</name> +<family>Cortex-M</family> +</processor> +</info> +</infoList> </TargetConfig> diff --git a/source/shoh/src/main.cpp b/source/shoh/src/main.cpp index 9bd3574..fb5ea66 100644 --- a/source/shoh/src/main.cpp +++ b/source/shoh/src/main.cpp @@ -3,8 +3,8 @@ #include "FreeRTOS.h" #include "task.h" #include -#include "FreeRTOSCPP/Kernel.hpp" -#include "threads/master/Master.h" +#include "Kernel.hpp" +#include "Master.h" int main(void) { From c6629366899a33fb85d2c463b6b99a75b7b92609 Mon Sep 17 00:00:00 2001 From: RedHawk Date: Thu, 6 Apr 2023 11:12:47 +0300 Subject: [PATCH 2/5] peripherals: Commented out until fixed. Peripherals were following old lpc chip pinout (lpc15xx). We have different (lpc11u6x). I decided to comment them out until we figure out correct pinout. (project should always build in master) --- source/shoh/src/peripherals/DigitalIoPin.cpp | 7 +++++++ source/shoh/src/peripherals/DigitalIoPin.h | 9 +++++++++ source/shoh/src/peripherals/EEPROMWrapper.cpp | 8 ++++++++ source/shoh/src/peripherals/EEPROMWrapper.h | 10 ++++++++++ source/shoh/src/peripherals/I2C.cpp | 8 ++++++++ source/shoh/src/peripherals/I2C.h | 9 +++++++++ source/shoh/src/peripherals/LiquidCrystal.cpp | 8 ++++++++ source/shoh/src/peripherals/LiquidCrystal.h | 10 +++++++++- source/shoh/src/peripherals/LpcUart.cpp | 8 ++++++++ source/shoh/src/peripherals/LpcUart.h | 10 ++++++++++ 10 files changed, 86 insertions(+), 1 deletion(-) diff --git a/source/shoh/src/peripherals/DigitalIoPin.cpp b/source/shoh/src/peripherals/DigitalIoPin.cpp index 13f7d87..5972107 100644 --- a/source/shoh/src/peripherals/DigitalIoPin.cpp +++ b/source/shoh/src/peripherals/DigitalIoPin.cpp @@ -7,6 +7,10 @@ #include "DigitalIoPin.h" +// Remove this when code will be reworked. +#ifndef DIGITALIOPIN_NOT_FIXED +// Remove this when code will be reworked. + DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup, bool invert) { @@ -62,3 +66,6 @@ DigitalIoPin::write (bool value) Chip_GPIO_SetPinState (LPC_GPIO, _io._port, _io._pin, ((_io._invert) ? !value : value)); } +//Remove this when code will be reworked. +#endif /* DIGITALIOPIN_NOT_FIXED */ +//Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/DigitalIoPin.h b/source/shoh/src/peripherals/DigitalIoPin.h index de004af..8745c2d 100644 --- a/source/shoh/src/peripherals/DigitalIoPin.h +++ b/source/shoh/src/peripherals/DigitalIoPin.h @@ -8,6 +8,11 @@ #ifndef DIGITALIOPIN_H_ #define DIGITALIOPIN_H_ +// Remove this when code will be reworked. +#define DIGITALIOPIN_NOT_FIXED +#ifndef DIGITALIOPIN_NOT_FIXED +// Remove this when code will be reworked. + #define UINT8_MAX_VALUE 255 #include @@ -40,4 +45,8 @@ private: void setIoPin (); }; +//Remove this when code will be reworked. +#endif /* DIGITALIOPIN_NOT_FIXED */ +//Remove this when code will be reworked. + #endif /* DIGITALIOPIN_H_ */ diff --git a/source/shoh/src/peripherals/EEPROMWrapper.cpp b/source/shoh/src/peripherals/EEPROMWrapper.cpp index 4f9f160..3f6a28f 100644 --- a/source/shoh/src/peripherals/EEPROMWrapper.cpp +++ b/source/shoh/src/peripherals/EEPROMWrapper.cpp @@ -7,6 +7,10 @@ #include +// Remove this when code will be reworked. +#ifndef EEPROMWRAPPER_NOT_FIXED +// Remove this when code will be reworked. + EEPROM_Wrapper::EEPROM_Wrapper () { /* Enable EEPROM clock and reset EEPROM controller */ @@ -93,3 +97,7 @@ EEPROM_Wrapper::write_to (uint32_t addr, void *data, uint32_t size_of_data) e_memcpy (data, buffer, size_of_data); eeprom_use (buffer, addr, size_of_data, WRITE); } + +// Remove this when code will be reworked. +#endif /* EEPROMWRAPPER_NOT_FIXED */ +// Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/EEPROMWrapper.h b/source/shoh/src/peripherals/EEPROMWrapper.h index b0aed9b..94d0278 100644 --- a/source/shoh/src/peripherals/EEPROMWrapper.h +++ b/source/shoh/src/peripherals/EEPROMWrapper.h @@ -8,6 +8,12 @@ #ifndef EEPROMWRAPPER_H_ #define EEPROMWRAPPER_H_ +// Remove this when code will be reworked. +#define EEPROMWRAPPER_NOT_FIXED +#ifndef EEPROMWRAPPER_NOT_FIXED +// Remove this when code will be reworked. + + #include "FreeRTOS.h" #include "task.h" #include "chip.h" @@ -80,4 +86,8 @@ private: uint8_t buffer[EEPROM_MAX_BUFER_SIZE] = { 0 }; }; +// Remove this when code will be reworked. +#endif /* EEPROMWRAPPER_NOT_FIXED */ +// Remove this when code will be reworked. + #endif /* EEPROMWRAPPER_H_ */ diff --git a/source/shoh/src/peripherals/I2C.cpp b/source/shoh/src/peripherals/I2C.cpp index 19a0b6f..ce365dc 100644 --- a/source/shoh/src/peripherals/I2C.cpp +++ b/source/shoh/src/peripherals/I2C.cpp @@ -40,6 +40,10 @@ #include "I2C.h" +// Remove this when code will be reworked. +#ifndef I2C_NOT_FIXED +// Remove this when code will be reworked. + I2C::I2C (const I2C_config &cfg) : device (nullptr) { // if(cfg.device_number == 0) { @@ -158,3 +162,7 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer) } return ret; } + +// Remove this when code will be reworked. +#endif /* I2C_NOT_FIXED */ +// Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/I2C.h b/source/shoh/src/peripherals/I2C.h index 910a596..733debd 100644 --- a/source/shoh/src/peripherals/I2C.h +++ b/source/shoh/src/peripherals/I2C.h @@ -8,6 +8,11 @@ #ifndef I2C_H_ #define I2C_H_ +// Remove this when code will be reworked. +#define I2C_NOT_FIXED +#ifndef I2C_NOT_FIXED +// Remove this when code will be reworked. + #include "chip.h" struct I2C_config { @@ -30,4 +35,8 @@ private: static uint32_t I2CM_XferBlocking(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer); }; +// Remove this when code will be reworked. +#endif /* I2C_NOT_FIXED */ +// Remove this when code will be reworked. + #endif /* I2C_H_ */ diff --git a/source/shoh/src/peripherals/LiquidCrystal.cpp b/source/shoh/src/peripherals/LiquidCrystal.cpp index 234f925..6fe05ef 100644 --- a/source/shoh/src/peripherals/LiquidCrystal.cpp +++ b/source/shoh/src/peripherals/LiquidCrystal.cpp @@ -1,5 +1,10 @@ #include "LiquidCrystal.h" +// Remove this when code will be reworked. +#ifndef LiquidCrystal_NOT_FIXED +// Remove this when code will be reworked. + + #include #include "chip.h" @@ -287,3 +292,6 @@ void LiquidCrystal::write4bits(uint8_t value) { pulseEnable(); } +// Remove this when code will be reworked. +#endif /* LiquidCrystal_NOT_FIXED */ +// Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/LiquidCrystal.h b/source/shoh/src/peripherals/LiquidCrystal.h index 7c4dcee..546565e 100644 --- a/source/shoh/src/peripherals/LiquidCrystal.h +++ b/source/shoh/src/peripherals/LiquidCrystal.h @@ -1,6 +1,10 @@ #ifndef LiquidCrystal_h #define LiquidCrystal_h +// Remove this when code will be reworked. +#define LiquidCrystal_NOT_FIXED +#ifndef LiquidCrystal_NOT_FIXED +// Remove this when code will be reworked. #include #include @@ -94,4 +98,8 @@ private: uint8_t _numlines,_currline; }; -#endif +// Remove this when code will be reworked. +#endif /* LiquidCrystal_NOT_FIXED */ +// Remove this when code will be reworked. + +#endif /* LiquidCrystal_h */ diff --git a/source/shoh/src/peripherals/LpcUart.cpp b/source/shoh/src/peripherals/LpcUart.cpp index e90bcc0..7e4e08d 100644 --- a/source/shoh/src/peripherals/LpcUart.cpp +++ b/source/shoh/src/peripherals/LpcUart.cpp @@ -9,6 +9,10 @@ #include #include "LpcUart.h" +// Remove this when code will be reworked. +#ifndef LPCUART_NOT_FIXED +// Remove this when code will be reworked. + static LpcUart *u0; static LpcUart *u1; @@ -313,3 +317,7 @@ bool LpcUart::txempty() return (RingBuffer_GetCount(&txring) == 0); } + +// Remove this when code will be reworked. +#endif /* LPCUART_NOT_FIXED */ +// Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/LpcUart.h b/source/shoh/src/peripherals/LpcUart.h index 2e7e799..38a88ac 100644 --- a/source/shoh/src/peripherals/LpcUart.h +++ b/source/shoh/src/peripherals/LpcUart.h @@ -8,6 +8,12 @@ #ifndef LPCUART_H_ #define LPCUART_H_ +// Remove this when code will be reworked. +#define LPCUART_NOT_FIXED +#ifndef LPCUART_NOT_FIXED +// Remove this when code will be reworked. + + #include "chip.h" #include "FreeRTOS.h" #include "task.h" @@ -69,4 +75,8 @@ private: Fmutex write_mutex; }; +// Remove this when code will be reworked. +#endif /* LPCUART_NOT_FIXED */ +// Remove this when code will be reworked. + #endif /* LPCUART_H_ */ From 8977eeb8f65622f5a15fe2e2f6981dc045dfff21 Mon Sep 17 00:00:00 2001 From: RedHawk Date: Thu, 6 Apr 2023 11:43:42 +0300 Subject: [PATCH 3/5] DigitalIoPin: Fine --- source/shoh/src/peripherals/DigitalIoPin.cpp | 8 -------- source/shoh/src/peripherals/DigitalIoPin.h | 9 --------- 2 files changed, 17 deletions(-) diff --git a/source/shoh/src/peripherals/DigitalIoPin.cpp b/source/shoh/src/peripherals/DigitalIoPin.cpp index 5972107..8255644 100644 --- a/source/shoh/src/peripherals/DigitalIoPin.cpp +++ b/source/shoh/src/peripherals/DigitalIoPin.cpp @@ -7,10 +7,6 @@ #include "DigitalIoPin.h" -// Remove this when code will be reworked. -#ifndef DIGITALIOPIN_NOT_FIXED -// Remove this when code will be reworked. - DigitalIoPin::DigitalIoPin (int port, int pin, bool input, bool pullup, bool invert) { @@ -65,7 +61,3 @@ DigitalIoPin::write (bool value) assert (!(_io._input)); Chip_GPIO_SetPinState (LPC_GPIO, _io._port, _io._pin, ((_io._invert) ? !value : value)); } - -//Remove this when code will be reworked. -#endif /* DIGITALIOPIN_NOT_FIXED */ -//Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/DigitalIoPin.h b/source/shoh/src/peripherals/DigitalIoPin.h index 8745c2d..de004af 100644 --- a/source/shoh/src/peripherals/DigitalIoPin.h +++ b/source/shoh/src/peripherals/DigitalIoPin.h @@ -8,11 +8,6 @@ #ifndef DIGITALIOPIN_H_ #define DIGITALIOPIN_H_ -// Remove this when code will be reworked. -#define DIGITALIOPIN_NOT_FIXED -#ifndef DIGITALIOPIN_NOT_FIXED -// Remove this when code will be reworked. - #define UINT8_MAX_VALUE 255 #include @@ -45,8 +40,4 @@ private: void setIoPin (); }; -//Remove this when code will be reworked. -#endif /* DIGITALIOPIN_NOT_FIXED */ -//Remove this when code will be reworked. - #endif /* DIGITALIOPIN_H_ */ From 88d68aac56c5705193b752a75a96b2fc8d79963c Mon Sep 17 00:00:00 2001 From: RedHawk Date: Sun, 16 Apr 2023 16:00:35 +0300 Subject: [PATCH 4/5] I2C: Adapted 15xx wrapper to 11u6x. #15 * Refactured class initialisation. * Refactured I2C::I2CM_XferBlocking() function. * (!Chip_I2CM_IsMasterPending(pI2C)) -> (Chip_I2CM_StateChanged(pI2C) == 0) --- source/shoh/src/peripherals/I2C.cpp | 53 ++++++++++++++--------------- source/shoh/src/peripherals/I2C.h | 10 +----- 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/source/shoh/src/peripherals/I2C.cpp b/source/shoh/src/peripherals/I2C.cpp index ce365dc..74a32b1 100644 --- a/source/shoh/src/peripherals/I2C.cpp +++ b/source/shoh/src/peripherals/I2C.cpp @@ -40,19 +40,24 @@ #include "I2C.h" -// Remove this when code will be reworked. -#ifndef I2C_NOT_FIXED -// Remove this when code will be reworked. - I2C::I2C (const I2C_config &cfg) : device (nullptr) { // if(cfg.device_number == 0) { - device = LPC_I2C0; - // board init must have been called before the pins can be configured - Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | cfg.i2c_mode); - Chip_IOCON_PinMuxSet (LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | cfg.i2c_mode); - Chip_SWM_EnableFixedPin (SWM_FIXED_I2C0_SCL); - Chip_SWM_EnableFixedPin (SWM_FIXED_I2C0_SDA); + this->device = LPC_I2C0; + + /* + Pins + The pin requires an external pull-up to provide output functionality. + When power is switched off, this pin is floating and does not disturb the I2C lines. + + I2C0_SCL (0, 4). (Available for Fast Mode Plus) + I2C1_SCL (0, 7), (1, 11), (1, 30). (Not open-drain) + I2C0_SDA (0, 5). (Available for Fast Mode Plus) + I2C1_SDA (1, 3), (1, 14), (1, 24). (Not open-drain) + */ + Chip_SYSCTL_PeriphReset(RESET_I2C0); + Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_DIGMODE_EN | cfg.i2c_mode); + Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_DIGMODE_EN | cfg.i2c_mode); //} // else { // currently we support only I2C number 0 @@ -62,23 +67,21 @@ I2C::I2C (const I2C_config &cfg) : device (nullptr) { /* Enable I2C clock and reset I2C peripheral - the boot ROM does not do this */ - Chip_I2C_Init (LPC_I2C0); + Chip_I2CM_Init(this->device); /* Setup clock rate for I2C */ - Chip_I2C_SetClockDiv (LPC_I2C0, cfg.clock_divider); + //No clock divider requiered? /* Setup I2CM transfer rate */ - Chip_I2CM_SetBusSpeed (LPC_I2C0, cfg.speed); + //Bus speed (Determines required amount of clockcyckles for LOW and HIGH signals itself) + Chip_I2CM_SetBusSpeed(this->device, cfg.speed); /* Enable Master Mode */ - Chip_I2CM_Enable (LPC_I2C0); + //Enabled by Chip_I2CM_SendStart() } } -I2C::~I2C () -{ - // TODO Auto-generated destructor stub -} +I2C::~I2C () {} bool I2C::write (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize) @@ -99,8 +102,7 @@ I2C::transaction (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize, I2CM_XFER_T i2cmXferRec; // make sure that master is idle - while (!Chip_I2CM_IsMasterPending (LPC_I2C0)) - ; + while (Chip_I2CM_StateChanged(this->device) == 0); /* Setup I2C transfer record */ i2cmXferRec.slaveAddr = devAddr; @@ -110,7 +112,7 @@ I2C::transaction (uint8_t devAddr, uint8_t *txBuffPtr, uint16_t txSize, i2cmXferRec.txBuff = txBuffPtr; i2cmXferRec.rxBuff = rxBuffPtr; - I2CM_XferBlocking (LPC_I2C0, &i2cmXferRec); + I2CM_XferBlocking (this->device, &i2cmXferRec); // Chip_I2CM_XferBlocking returns before stop condition is fully completed // therefore we need to wait for master to be idle when doing back-to-back // transactions (see beginning of the function) @@ -140,7 +142,8 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer) /* set the transfer status as busy */ xfer->status = I2CM_STATUS_BUSY; /* Clear controller state. */ - Chip_I2CM_ClearStatus (pI2C, I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR); + Chip_I2CM_ResetControl(pI2C); + /* Write Address and RW bit to data register */ // Chip_I2CM_WriteByte(pI2C, (xfer->slaveAddr << 1) | (xfer->txSz == 0)); // // original NXP version @@ -154,7 +157,7 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer) while (ret == 0) { /* wait for status change interrupt */ - while (!Chip_I2CM_IsMasterPending (pI2C)) + while (Chip_I2CM_StateChanged(pI2C) == 0) { } /* call state change handler */ @@ -162,7 +165,3 @@ I2C::I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer) } return ret; } - -// Remove this when code will be reworked. -#endif /* I2C_NOT_FIXED */ -// Remove this when code will be reworked. diff --git a/source/shoh/src/peripherals/I2C.h b/source/shoh/src/peripherals/I2C.h index 733debd..34a856b 100644 --- a/source/shoh/src/peripherals/I2C.h +++ b/source/shoh/src/peripherals/I2C.h @@ -8,12 +8,8 @@ #ifndef I2C_H_ #define I2C_H_ -// Remove this when code will be reworked. -#define I2C_NOT_FIXED -#ifndef I2C_NOT_FIXED -// Remove this when code will be reworked. - #include "chip.h" +#include "board.h" struct I2C_config { unsigned int device_number; @@ -35,8 +31,4 @@ private: static uint32_t I2CM_XferBlocking(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer); }; -// Remove this when code will be reworked. -#endif /* I2C_NOT_FIXED */ -// Remove this when code will be reworked. - #endif /* I2C_H_ */ From 48d577f8fb2e32e1f8416a26010e6f9b682838c3 Mon Sep 17 00:00:00 2001 From: RedHawk Date: Tue, 18 Apr 2023 12:01:12 +0300 Subject: [PATCH 5/5] I2C: Fixing pin Muxing. #15 --- source/shoh/src/peripherals/I2C.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/shoh/src/peripherals/I2C.cpp b/source/shoh/src/peripherals/I2C.cpp index 74a32b1..2104c06 100644 --- a/source/shoh/src/peripherals/I2C.cpp +++ b/source/shoh/src/peripherals/I2C.cpp @@ -55,9 +55,10 @@ I2C::I2C (const I2C_config &cfg) : device (nullptr) I2C0_SDA (0, 5). (Available for Fast Mode Plus) I2C1_SDA (1, 3), (1, 14), (1, 24). (Not open-drain) */ + //Manual: Table 83 & 90 Chip_SYSCTL_PeriphReset(RESET_I2C0); - Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_DIGMODE_EN | cfg.i2c_mode); - Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_DIGMODE_EN | cfg.i2c_mode); + Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode); + Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode); //} // else { // currently we support only I2C number 0