InfiniTime.git

commit 800e217e7c79c34f9392f4a70280bfc7bd159563

Author: JF <jf@codingfield.com>

Merge branch 'debug_touchscreen' of JF/PineTime into develop

 src/CMakeLists.txt | 2 
 src/SystemTask/SystemTask.cpp | 7 +
 src/SystemTask/SystemTask.h | 4 
 src/drivers/Cst816s.cpp | 52 +++++-------
 src/drivers/Cst816s.h | 30 +++----
 src/drivers/TwiMaster.cpp | 140 +++++++++++++++++++++++++++++++++++++
 src/drivers/TwiMaster.h | 38 ++++++++++
 src/main.cpp | 15 +++
 src/sdk_config.h | 4 


diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ff2e18126dadfbf3ad20f58873d47a847b566a79..e60c2cfe94e7d59d481c81fa469ba51c5c8c84de 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -371,6 +371,7 @@   DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c
   DisplayApp/Fonts/jetbrains_mono_bold_20.c
 
   SystemTask/SystemTask.cpp
+    drivers/TwiMaster.cpp
 )
 
 list(APPEND GRAPHICS_SOURCE_FILES
@@ -444,6 +445,7 @@   DisplayApp/LittleVgl.h
   SystemTask/SystemTask.h
   SystemTask/SystemMonitor.h
   DisplayApp/Screens/Symbols.h
+    drivers/TwiMaster.h
 )
 
 include_directories(




diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp
index 39e9751b9aeb20ae8a3b504b43f6677586c4d027..8f565860b9fd89d98333ac405660fc43a6d7d47c 100644
--- a/src/SystemTask/SystemTask.cpp
+++ b/src/SystemTask/SystemTask.cpp
@@ -24,12 +24,14 @@ }
 
 
 SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd,
-                       Pinetime::Drivers::SpiNorFlash& spiNorFlash, Drivers::Cst816S &touchPanel,
+                       Pinetime::Drivers::SpiNorFlash& spiNorFlash,
+                       Drivers::TwiMaster& twiMaster, Drivers::Cst816S &touchPanel,
                        Components::LittleVgl &lvgl,
                        Controllers::Battery &batteryController, Controllers::Ble &bleController,
                        Controllers::DateTime &dateTimeController,
                        Pinetime::Controllers::NotificationManager& notificationManager) :
-                       spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController},
+                       spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash},
+                       twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController},
                        bleController{bleController}, dateTimeController{dateTimeController},
                        watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager},
                        nimbleController(*this, bleController,dateTimeController, notificationManager, spiNorFlash) {
@@ -67,6 +69,7 @@   nimbleController.Init();
   nimbleController.StartAdvertising();
   lcd.Init();
 
+  twiMaster.Init();
   touchPanel.Init();
   batteryController.Init();
 




diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h
index 860647a12848757c9cb1fbc6c798efdbc606522e..8fa7e7d1a31d047a9086367cd715f409dff66350 100644
--- a/src/SystemTask/SystemTask.h
+++ b/src/SystemTask/SystemTask.h
@@ -21,7 +21,8 @@             BleFirmwareUpdateStarted, BleFirmwareUpdateFinished, OnTouchEvent, OnButtonEvent
         };
 
         SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd,
-                   Pinetime::Drivers::SpiNorFlash& spiNorFlash, Drivers::Cst816S &touchPanel,
+                   Pinetime::Drivers::SpiNorFlash& spiNorFlash,
+                   Drivers::TwiMaster& twiMaster, Drivers::Cst816S &touchPanel,
                    Components::LittleVgl &lvgl,
                    Controllers::Battery &batteryController, Controllers::Ble &bleController,
                    Controllers::DateTime &dateTimeController,
@@ -42,6 +43,7 @@
         Pinetime::Drivers::SpiMaster& spi;
         Pinetime::Drivers::St7789& lcd;
         Pinetime::Drivers::SpiNorFlash& spiNorFlash;
+        Pinetime::Drivers::TwiMaster& twiMaster;
         Pinetime::Drivers::Cst816S& touchPanel;
         Pinetime::Components::LittleVgl& lvgl;
         Pinetime::Controllers::Battery& batteryController;




diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp
index 61bce94c5a39b7ecd8c168db2a8ea3f13a10002f..60cd402cbc421a112f5ccfb44ca0c057f2cf8f61 100644
--- a/src/drivers/Cst816s.cpp
+++ b/src/drivers/Cst816s.cpp
@@ -13,51 +13,42 @@  *
  * TODO : we need a complete datasheet and protocol reference!
  * */
 
-void Pinetime::Drivers::Cst816S::Init() {
+Cst816S::Cst816S(TwiMaster &twiMaster, uint8_t twiAddress) : twiMaster{twiMaster}, twiAddress{twiAddress} {
+
+}
+
+void Cst816S::Init() {
   nrf_gpio_cfg_output(pinReset);
+  nrf_gpio_pin_set(pinReset);
+  vTaskDelay(50);
   nrf_gpio_pin_clear(pinReset);
-  vTaskDelay(20);
+  vTaskDelay(5);
   nrf_gpio_pin_set(pinReset);
-  vTaskDelay(200);
+  vTaskDelay(50);
 
-  nrfx_twi_config_t config;
-  config.frequency = NRF_TWI_FREQ_400K;
-  config.scl = 7;
-  config.sda = 6;
-  config.interrupt_priority = NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY;
-  config.hold_bus_uninit = NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT;
+  // Wake the touchpanel up
+  uint8_t dummy;
+  twiMaster.Read(twiAddress, 0x15, &dummy, 1);
+  vTaskDelay(5);
+  twiMaster.Read(twiAddress, 0xa7, &dummy, 1);
 
-  // Configure TWI in blocking mode (event_handler = nullptr)
-  auto ret = nrfx_twi_init(&twi, &config, nullptr, this);
-  nrfx_twi_enable(&twi);
 }
 
 
-void Cst816S::Probe() {
-  nrfx_err_t ret;
-  for(int i = 0; i < 127; i++) {
-    uint8_t data;
-    ret = nrfx_twi_rx(&twi, i, &data, 1);
-    if(ret == NRFX_SUCCESS) {
-      NRF_LOG_INFO("I2C device detected at address %d", i);
-    }
-  }
-}
-
 Cst816S::TouchInfos Cst816S::GetTouchInfo() {
   Cst816S::TouchInfos info;
 
-  nrfx_twi_rx(&twi, address, touchData, 63);
+  twiMaster.Read(twiAddress, 0, touchData, 63);
   auto nbTouchPoints = touchData[2] & 0x0f;
 
 //  uint8_t i = 0;
 //  NRF_LOG_INFO("#########################")
   for(int i = 0; i < 1; i++) {
-  uint8_t pointId = (touchData[touchIdIndex + (touchStep * i)]) >> 4;
-  if(nbTouchPoints == 0 && pointId == lastTouchId) return info;
+    uint8_t pointId = (touchData[touchIdIndex + (touchStep * i)]) >> 4;
+    if(nbTouchPoints == 0 && pointId == lastTouchId) return info;
 
-  // We fetch only the first touch point (the controller seems to handle only one anyway...)
-  info.isTouch = true;
+    // We fetch only the first touch point (the controller seems to handle only one anyway...)
+    info.isTouch = true;
 
 
     auto xHigh = touchData[touchXHighIndex + (touchStep * i)] & 0x0f;
@@ -106,11 +97,12 @@   return info;
 }
 
 void Cst816S::Sleep() {
-  nrfx_twi_disable(&twi);
+  // TODO re enable sleep mode
+  //twiMaster.Sleep();
   nrf_gpio_cfg_default(6);
   nrf_gpio_cfg_default(7);
 }
 
 void Cst816S::Wakeup() {
   Init();
-}
+}
\ No newline at end of file




diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h
index 4a5dda6008d48528b835d3f0c90202e23db8c8b9..b115a6880978316e014e2a2079f201bda880c0f6 100644
--- a/src/drivers/Cst816s.h
+++ b/src/drivers/Cst816s.h
@@ -1,20 +1,21 @@
 #pragma once
 
 #include <nrfx_twi.h>
+#include "TwiMaster.h"
 
 namespace Pinetime {
   namespace Drivers {
     class Cst816S {
       public :
         enum class Gestures : uint8_t {
-          None = 0x00,
-          SlideDown = 0x01,
-          SlideUp = 0x02,
-          SlideLeft = 0x03,
-          SlideRight = 0x04,
-          SingleTap = 0x05,
-          DoubleTap = 0x0B,
-          LongPress = 0x0C
+            None = 0x00,
+            SlideDown = 0x01,
+            SlideUp = 0x02,
+            SlideLeft = 0x03,
+            SlideRight = 0x04,
+            SingleTap = 0x05,
+            DoubleTap = 0x0B,
+            LongPress = 0x0C
         };
         struct TouchInfos {
           uint16_t x;
@@ -27,21 +28,19 @@           Gestures gesture;
           bool isTouch = false;
         };
 
-        Cst816S() = default;
+        Cst816S(TwiMaster& twiMaster, uint8_t twiAddress);
         Cst816S(const Cst816S&) = delete;
         Cst816S& operator=(const Cst816S&) = delete;
         Cst816S(Cst816S&&) = delete;
         Cst816S& operator=(Cst816S&&) = delete;
 
         void Init();
-        void Probe();
         TouchInfos GetTouchInfo();
         void Sleep();
         void Wakeup();
       private:
         static constexpr uint8_t pinIrq = 28;
         static constexpr uint8_t pinReset = 10;
-        static constexpr uint8_t address = 0x15;
         static constexpr uint8_t lastTouchId = 0x0f;
         static constexpr uint8_t touchPointNumIndex = 2;
         static constexpr uint8_t touchMiscIndex = 8;
@@ -56,12 +55,9 @@         static constexpr uint8_t touchStep = 6;
         static constexpr uint8_t gestureIndex = 1;
 
         uint8_t touchData[63];
-
-        // TODO TWI (i²C) should be created outside and injected into this class
-        // It will be needed when implementing other I²C devices
-        // (0x15 = touch, 0x18 = accelerometer, 0x44 = HR sensor)
-        nrfx_twi_t twi = NRFX_TWI_INSTANCE(1); // Use instance 1, because instance 0 is already used by SPI
+        TwiMaster& twiMaster;
+        uint8_t twiAddress;
     };
 
   }
-}
+}
\ No newline at end of file




diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5d8fcf6b9d0fef4d10fe28058fbbe20393e381b0
--- /dev/null
+++ b/src/drivers/TwiMaster.cpp
@@ -0,0 +1,140 @@
+#include <sdk/integration/nrfx/nrfx_log.h>
+#include <sdk/modules/nrfx/hal/nrf_gpio.h>
+#include <cstring>
+#include "TwiMaster.h"
+
+using namespace Pinetime::Drivers;
+
+// TODO use shortcut to automatically send STOP when receive LastTX, for example
+// TODO use DMA/IRQ
+
+TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module{module}, params{params} {
+  mutex = xSemaphoreCreateBinary();
+}
+
+void TwiMaster::Init() {
+  NRF_GPIO->PIN_CNF[params.pinScl] = ((uint32_t)GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect    << GPIO_PIN_CNF_INPUT_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup      << GPIO_PIN_CNF_PULL_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0D1       << GPIO_PIN_CNF_DRIVE_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled   << GPIO_PIN_CNF_SENSE_Pos);
+
+  NRF_GPIO->PIN_CNF[params.pinSda] = ((uint32_t)GPIO_PIN_CNF_DIR_Input        << GPIO_PIN_CNF_DIR_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect    << GPIO_PIN_CNF_INPUT_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup      << GPIO_PIN_CNF_PULL_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0D1       << GPIO_PIN_CNF_DRIVE_Pos)
+                                     | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled   << GPIO_PIN_CNF_SENSE_Pos);
+
+  switch(module) {
+    case Modules::TWIM1: twiBaseAddress = NRF_TWIM1; break;
+    default:
+      return;
+  }
+
+  switch(static_cast<Frequencies>(params.frequency)) {
+    case Frequencies::Khz100 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K100; break;
+    case Frequencies::Khz250 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K250; break;
+    case Frequencies::Khz400 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K400; break;
+  }
+
+  twiBaseAddress->PSEL.SCL = params.pinScl;
+  twiBaseAddress->PSEL.SDA = params.pinSda;
+  twiBaseAddress->EVENTS_LASTRX = 0;
+  twiBaseAddress->EVENTS_STOPPED = 0;
+  twiBaseAddress->EVENTS_LASTTX = 0;
+  twiBaseAddress->EVENTS_ERROR = 0;
+  twiBaseAddress->EVENTS_RXSTARTED = 0;
+  twiBaseAddress->EVENTS_SUSPENDED = 0;
+  twiBaseAddress->EVENTS_TXSTARTED = 0;
+
+  twiBaseAddress->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos);
+
+
+  /* // IRQ
+     NVIC_ClearPendingIRQ(_IRQn);
+     NVIC_SetPriority(_IRQn, 2);
+     NVIC_EnableIRQ(_IRQn);
+   */
+
+  xSemaphoreGive(mutex);
+
+}
+
+void TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t *data, size_t size) {
+  xSemaphoreTake(mutex, portMAX_DELAY);
+  Write(deviceAddress, &registerAddress, 1, false);
+  Read(deviceAddress, data, size, true);
+  xSemaphoreGive(mutex);
+}
+
+void TwiMaster::Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t *data, size_t size) {
+  ASSERT(size <= maxDataSize);
+  xSemaphoreTake(mutex, portMAX_DELAY);
+  internalBuffer[0] = registerAddress;
+  std::memcpy(internalBuffer+1, data, size);
+  Write(deviceAddress, internalBuffer, size+1, true);
+  xSemaphoreGive(mutex);
+}
+
+
+void TwiMaster::Read(uint8_t deviceAddress, uint8_t *buffer, size_t size, bool stop) {
+  twiBaseAddress->ADDRESS = deviceAddress;
+  twiBaseAddress->TASKS_RESUME = 0x1UL;
+  twiBaseAddress->RXD.PTR = (uint32_t)buffer;
+  twiBaseAddress->RXD.MAXCNT = size;
+
+  twiBaseAddress->TASKS_STARTRX = 1;
+
+  while(!twiBaseAddress->EVENTS_RXSTARTED && !twiBaseAddress->EVENTS_ERROR);
+  twiBaseAddress->EVENTS_RXSTARTED = 0x0UL;
+
+  while(!twiBaseAddress->EVENTS_LASTRX && !twiBaseAddress->EVENTS_ERROR);
+  twiBaseAddress->EVENTS_LASTRX = 0x0UL;
+
+  if (stop || twiBaseAddress->EVENTS_ERROR) {
+    twiBaseAddress->TASKS_STOP = 0x1UL;
+    while(!twiBaseAddress->EVENTS_STOPPED);
+    twiBaseAddress->EVENTS_STOPPED = 0x0UL;
+  }
+  else {
+    twiBaseAddress->TASKS_SUSPEND = 0x1UL;
+    while(!twiBaseAddress->EVENTS_SUSPENDED);
+    twiBaseAddress->EVENTS_SUSPENDED = 0x0UL;
+  }
+
+  if (twiBaseAddress->EVENTS_ERROR) {
+    twiBaseAddress->EVENTS_ERROR = 0x0UL;
+  }
+}
+
+void TwiMaster::Write(uint8_t deviceAddress, const uint8_t *data, size_t size, bool stop) {
+  twiBaseAddress->ADDRESS = deviceAddress;
+  twiBaseAddress->TASKS_RESUME = 0x1UL;
+  twiBaseAddress->TXD.PTR = (uint32_t)data;
+  twiBaseAddress->TXD.MAXCNT = size;
+
+  twiBaseAddress->TASKS_STARTTX = 1;
+
+  while(!twiBaseAddress->EVENTS_TXSTARTED && !twiBaseAddress->EVENTS_ERROR);
+  twiBaseAddress->EVENTS_TXSTARTED = 0x0UL;
+
+  while(!twiBaseAddress->EVENTS_LASTTX && !twiBaseAddress->EVENTS_ERROR);
+  twiBaseAddress->EVENTS_LASTTX = 0x0UL;
+
+  if (stop || twiBaseAddress->EVENTS_ERROR) {
+    twiBaseAddress->TASKS_STOP = 0x1UL;
+    while(!twiBaseAddress->EVENTS_STOPPED);
+    twiBaseAddress->EVENTS_STOPPED = 0x0UL;
+  }
+  else {
+    twiBaseAddress->TASKS_SUSPEND = 0x1UL;
+    while(!twiBaseAddress->EVENTS_SUSPENDED);
+    twiBaseAddress->EVENTS_SUSPENDED = 0x0UL;
+  }
+
+  if (twiBaseAddress->EVENTS_ERROR) {
+    twiBaseAddress->EVENTS_ERROR = 0x0UL;
+    uint32_t error = twiBaseAddress->ERRORSRC;
+    twiBaseAddress->ERRORSRC = error;
+  }
+}
\ No newline at end of file




diff --git a/src/drivers/TwiMaster.h b/src/drivers/TwiMaster.h
new file mode 100644
index 0000000000000000000000000000000000000000..3b7555f5377283a66c7a7855d472d36fb5731119
--- /dev/null
+++ b/src/drivers/TwiMaster.h
@@ -0,0 +1,38 @@
+#pragma once
+#include <FreeRTOS.h>
+#include <semphr.h>
+#include <drivers/include/nrfx_twi.h>
+
+
+namespace Pinetime {
+  namespace Drivers {
+    class TwiMaster {
+      public:
+        enum class Modules { TWIM1 };
+        enum class Frequencies {Khz100, Khz250, Khz400};
+        struct Parameters {
+          uint32_t frequency;
+          uint8_t pinSda;
+          uint8_t pinScl;
+        };
+
+        TwiMaster(const Modules module, const Parameters& params);
+
+        void Init();
+        void Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t* buffer, size_t size);
+        void Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t* data, size_t size);
+
+      private:
+        void Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop);
+        void Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop);
+        NRF_TWIM_Type* twiBaseAddress;
+        SemaphoreHandle_t mutex;
+        const Modules module;
+        const Parameters params;
+        static constexpr uint8_t maxDataSize{8};
+        static constexpr uint8_t registerSize{1};
+        uint8_t internalBuffer[maxDataSize + registerSize];
+
+    };
+  }
+}
\ No newline at end of file




diff --git a/src/main.cpp b/src/main.cpp
index 41943892ce6bc45ac942f2b0c7ef9d9ce023cab3..fe4135852e505357a13a4afd64c590a5f0a5135e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -42,6 +42,9 @@ static constexpr uint8_t pinSpiMiso = 4;
 static constexpr uint8_t pinSpiFlashCsn = 5;
 static constexpr uint8_t pinLcdCsn = 25;
 static constexpr uint8_t pinLcdDataCommand = 18;
+static constexpr uint8_t pinTwiScl = 7;
+static constexpr uint8_t pinTwiSda = 6;
+static constexpr uint8_t touchPanelTwiAddress = 0x15;
 
 Pinetime::Drivers::SpiMaster spi{Pinetime::Drivers::SpiMaster::SpiModule::SPI0, {
         Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb,
@@ -58,7 +61,15 @@ Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand};
 
 Pinetime::Drivers::Spi flashSpi {spi, pinSpiFlashCsn};
 Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi};
-Pinetime::Drivers::Cst816S touchPanel {};
+
+// The TWI device should work @ up to 400Khz but there is a HW bug which prevent it from
+// respecting correct timings. According to erratas heet, this magic value makes it run
+// at ~390Khz with correct timings.
+static constexpr uint32_t MaxTwiFrequencyWithoutHardwareBug{0x06200000};
+Pinetime::Drivers::TwiMaster twiMaster{Pinetime::Drivers::TwiMaster::Modules::TWIM1,
+                                       Pinetime::Drivers::TwiMaster::Parameters {
+                                               MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}};
+Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress};
 Pinetime::Components::LittleVgl lvgl {lcd, touchPanel};
 
 
@@ -213,7 +224,7 @@   nrf_drv_clock_init();
 
   debounceTimer = xTimerCreate ("debounceTimer", 200, pdFALSE, (void *) 0, DebounceTimerCallback);
 
-  systemTask.reset(new Pinetime::System::SystemTask(spi, lcd, spiNorFlash, touchPanel, lvgl, batteryController, bleController,
+  systemTask.reset(new Pinetime::System::SystemTask(spi, lcd, spiNorFlash, twiMaster, touchPanel, lvgl, batteryController, bleController,
                                                     dateTimeController, notificationManager));
   systemTask->Start();
   nimble_port_init();




diff --git a/src/sdk_config.h b/src/sdk_config.h
index e83bde4b14d26d0a5b9f73d1b2a1d27aa64c844b..aa1bbb3af19c31b53170e454f2ec7dbca926874b 100644
--- a/src/sdk_config.h
+++ b/src/sdk_config.h
@@ -5244,7 +5244,7 @@
 // <e> NRFX_TWI_ENABLED - nrfx_twi - TWI peripheral driver
 //==========================================================
 #ifndef NRFX_TWI_ENABLED
-#define NRFX_TWI_ENABLED 1
+#define NRFX_TWI_ENABLED 0
 #endif
 // <q> NRFX_TWI0_ENABLED  - Enable TWI0 instance
 
@@ -5257,7 +5257,7 @@ //  NRFX_TWI1_ENABLED  - Enable TWI1 instance
 
 
 #ifndef NRFX_TWI1_ENABLED
-#define NRFX_TWI1_ENABLED 1
+#define NRFX_TWI1_ENABLED 0
 #endif
 
 // <o> NRFX_TWI_DEFAULT_CONFIG_FREQUENCY  - Frequency