~aleteoryx/muditaos

efa0a165438b2f97e7f2301080bad29730617705 — Lucjan Bryndza 4 years ago 7fa175d
[BH-848] Split board h for bell and pure

Split board.h for the bell and Pure

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
34 files changed, 313 insertions(+), 88 deletions(-)

M module-audio/board/rt1051/RT1051AudioCodec.cpp
M module-audio/board/rt1051/RT1051CellularAudio.cpp
M module-bsp/board/rt1051/bellpx/CMakeLists.txt
R module-bsp/board/rt1051/{bsp => bellpx/board}/BoardDefinitions.hpp
M module-bsp/board/rt1051/bellpx/bsp/eink/eink_pin_config.cpp
A module-bsp/board/rt1051/bellpx/debug_console.cpp
M module-bsp/board/rt1051/bellpx/irq_gpio.cpp
M module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp
M module-bsp/board/rt1051/bsp/audio/CodecMAX98090.cpp
M module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.hpp
M module-bsp/board/rt1051/bsp/eeprom/eeprom.cpp
M module-bsp/board/rt1051/bsp/eink/ED028TC1.cpp
M module-bsp/board/rt1051/bsp/eink/bsp_eink.cpp
M module-bsp/board/rt1051/bsp/eink_frontlight/eink_frontlight.cpp
M module-bsp/board/rt1051/bsp/headset/headset.cpp
M module-bsp/board/rt1051/bsp/keypad_backlight/keypad_backlight.cpp
M module-bsp/board/rt1051/bsp/light_sensor/light_sensor.cpp
M module-bsp/board/rt1051/bsp/lpm/RT1051LPM.cpp
M module-bsp/board/rt1051/bsp/magnetometer/magnetometer.cpp
M module-bsp/board/rt1051/bsp/torch/torch.cpp
M module-bsp/board/rt1051/bsp/vibrator/vibrator.cpp
M module-bsp/board/rt1051/common/audio.cpp
M module-bsp/board/rt1051/common/board.cpp
A module-bsp/board/rt1051/common/board/debug_console.hpp
M module-bsp/board/rt1051/puretx/CMakeLists.txt
A module-bsp/board/rt1051/puretx/board/BoardDefinitions.hpp
M module-bsp/board/rt1051/puretx/bsp/battery_charger/battery_charger.cpp
M module-bsp/board/rt1051/puretx/bsp/eink/eink_pin_config.cpp
M module-bsp/board/rt1051/puretx/bsp/keyboard/keyboard.cpp
A module-bsp/board/rt1051/puretx/debug_console.cpp
M module-bsp/board/rt1051/puretx/irq_gpio.cpp
M module-platform/rt1051/src/disk_eeprom.cpp
M module-platform/rt1051/src/disk_emmc.cpp
M module-services/service-eink/EinkDisplay.cpp
M module-audio/board/rt1051/RT1051AudioCodec.cpp => module-audio/board/rt1051/RT1051AudioCodec.cpp +1 -1
@@ 6,7 6,7 @@
#include "dma_config.h"
#include <log.hpp>

#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "board/rt1051/common/audio.hpp"

using audio::codec::Configuration;

M module-audio/board/rt1051/RT1051CellularAudio.cpp => module-audio/board/rt1051/RT1051CellularAudio.cpp +1 -1
@@ 6,7 6,7 @@
#include "dma_config.h"
#include <log.hpp>

#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

namespace audio
{

M module-bsp/board/rt1051/bellpx/CMakeLists.txt => module-bsp/board/rt1051/bellpx/CMakeLists.txt +1 -0
@@ 17,6 17,7 @@ target_sources(
        pin_mux.c
        clock_config.cpp
        irq_gpio.cpp
        debug_console.cpp


    PUBLIC

R module-bsp/board/rt1051/bsp/BoardDefinitions.hpp => module-bsp/board/rt1051/bellpx/board/BoardDefinitions.hpp +1 -4
@@ 1,8 1,7 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#ifndef PUREPHONE_BOARDDEFINITIONS_HPP
#define PUREPHONE_BOARDDEFINITIONS_HPP
#pragma once

#include "drivers/dmamux/DriverDMAMux.hpp"
#include "drivers/dma/DriverDMA.hpp"


@@ 142,5 141,3 @@ enum class BoardDefinitions
    EEPROM_I2C          = AUDIOCODEC_I2C,
    EEPROM_I2C_BAUDRATE = I2C_STD_BAUDRATE,
};

#endif // PUREPHONE_BOARDDEFINITIONS_HPP

M module-bsp/board/rt1051/bellpx/bsp/eink/eink_pin_config.cpp => module-bsp/board/rt1051/bellpx/bsp/eink/eink_pin_config.cpp +1 -1
@@ 2,7 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "drivers/gpio/DriverGPIO.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

namespace bsp::eink
{

A module-bsp/board/rt1051/bellpx/debug_console.cpp => module-bsp/board/rt1051/bellpx/debug_console.cpp +63 -0
@@ 0,0 1,63 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <board/debug_console.hpp>
#include <stdint.h>

extern "C"
{
#include "fsl_common.h"
#include "fsl_clock.h"
#if LOG_LUART_ENABLED
#include "fsl_lpuart.h"
#endif
}

namespace bsp::board
{

#if LOG_LUART_ENABLED
    namespace
    {
        lpuart_handle_t g_lpuartHandle;

        /* Get debug console frequency. */
        [[maybe_unused]] uint32_t BOARD_DebugConsoleSrcFreq(void)
        {
            uint32_t freq;

            /* To make it simple, we assume default PLL and divider settings, and the only variable
               from application is use PLL3 source or OSC source */
            if (CLOCK_GetMux(kCLOCK_UartMux) == 0) /* PLL3 div6 80M */
            {
                freq = (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
            }
            else {
                freq = CLOCK_GetOscFreq() / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
            }

            return freq;
        }
    } // namespace
#endif

    /* Initialize debug console. */
    void initDebugConsole(void)
    {
#if LOG_LUART_ENABLED
        /* The user initialization should be placed here */
        lpuart_config_t lpuartConfig;

        LPUART_GetDefaultConfig(&lpuartConfig);
        lpuartConfig.baudRate_Bps = 115200;
        lpuartConfig.enableTx     = true;
        lpuartConfig.enableRx     = true;

        LPUART_TransferCreateHandle(LPUART3, &g_lpuartHandle, NULL, NULL);

        LPUART_Init(LPUART3, &lpuartConfig, BOARD_DebugConsoleSrcFreq());
        LPUART_EnableTx(LPUART3, true);
        LPUART_EnableRx(LPUART3, true);
#endif
    }
} // namespace bsp::board

M module-bsp/board/rt1051/bellpx/irq_gpio.cpp => module-bsp/board/rt1051/bellpx/irq_gpio.cpp +1 -1
@@ 11,7 11,7 @@
#include "board/rt1051/bsp/eink/bsp_eink.h"
#include <hal/battery_charger/AbstractBatteryCharger.hpp>
#include <hal/key_input/AbstractKeyInput.hpp>
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "bsp/light_sensor/light_sensor.hpp"

namespace bsp

M module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp => module-bsp/board/rt1051/bluetooth/BluetoothCommon.cpp +1 -1
@@ 7,7 7,7 @@
#include "FreeRTOS.h"
#include "board.h"
#include "fsl_lpuart_edma.h"
#include <bsp/BoardDefinitions.hpp>
#include <board/BoardDefinitions.hpp>

#if DEBUG_BLUETOOTH_HCI_COMS == 1
#define logHciComs(...) LOG_DEBUG(__VA_ARGS__)

M module-bsp/board/rt1051/bsp/audio/CodecMAX98090.cpp => module-bsp/board/rt1051/bsp/audio/CodecMAX98090.cpp +1 -1
@@ 3,7 3,7 @@

#include "CodecMAX98090.hpp"
#include "max98090_regs.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#include <module-utils/Utils.hpp>


M module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.hpp => module-bsp/board/rt1051/bsp/cellular/rt1051_cellular.hpp +1 -1
@@ 13,7 13,7 @@

#include "bsp/cellular/bsp_cellular.hpp"
#include "bsp/cellular/CellularResult.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#include "drivers/pll/DriverPLL.hpp"
#include "drivers/dmamux/DriverDMAMux.hpp"

M module-bsp/board/rt1051/bsp/eeprom/eeprom.cpp => module-bsp/board/rt1051/bsp/eeprom/eeprom.cpp +1 -1
@@ 3,7 3,7 @@

#include "M24256.hpp"
#include "bsp/eeprom/eeprom.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "drivers/i2c/DriverI2C.hpp"

#include "fsl_common.h"

M module-bsp/board/rt1051/bsp/eink/ED028TC1.cpp => module-bsp/board/rt1051/bsp/eink/ED028TC1.cpp +1 -1
@@ 28,7 28,7 @@
#include "drivers/pll/DriverPLL.hpp"
#include "drivers/dmamux/DriverDMAMux.hpp"
#include "drivers/dma/DriverDMA.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#define EPD_BOOSTER_START_PERIOD_10MS 0
#define EPD_BOOSTER_START_PERIOD_20MS 1

M module-bsp/board/rt1051/bsp/eink/bsp_eink.cpp => module-bsp/board/rt1051/bsp/eink/bsp_eink.cpp +1 -1
@@ 17,7 17,7 @@
#include "drivers/dmamux/DriverDMAMux.hpp"
#include "drivers/dma/DriverDMA.hpp"
#include "drivers/gpio/DriverGPIO.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#define BSP_EINK_LPSPI_PCS_TO_SCK_DELAY       1000
#define BSP_EINK_LPSPI_SCK_TO_PSC_DELAY       1000

M module-bsp/board/rt1051/bsp/eink_frontlight/eink_frontlight.cpp => module-bsp/board/rt1051/bsp/eink_frontlight/eink_frontlight.cpp +2 -2
@@ 1,8 1,8 @@
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "bsp/eink_frontlight/eink_frontlight.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "drivers/pwm/DriverPWM.hpp"
#include "fsl_common.h"
#include <cmath>

M module-bsp/board/rt1051/bsp/headset/headset.cpp => module-bsp/board/rt1051/bsp/headset/headset.cpp +1 -1
@@ 3,7 3,7 @@

#include "headset.hpp"

#include "BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "DriverI2C.hpp"
#include "DriverGPIO.hpp"
#include "fsl_common.h"

M module-bsp/board/rt1051/bsp/keypad_backlight/keypad_backlight.cpp => module-bsp/board/rt1051/bsp/keypad_backlight/keypad_backlight.cpp +1 -1
@@ 4,7 4,7 @@
#include "bsp/keypad_backlight/keypad_backlight.hpp"
#include "LP55281.hpp"

#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "drivers/i2c/DriverI2C.hpp"

#include "fsl_common.h"

M module-bsp/board/rt1051/bsp/light_sensor/light_sensor.cpp => module-bsp/board/rt1051/bsp/light_sensor/light_sensor.cpp +2 -2
@@ 1,9 1,9 @@
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "bsp/light_sensor/light_sensor.hpp"
#include "LTR303ALS.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "drivers/i2c/DriverI2C.hpp"
#include "drivers/gpio/DriverGPIO.hpp"


M module-bsp/board/rt1051/bsp/lpm/RT1051LPM.cpp => module-bsp/board/rt1051/bsp/lpm/RT1051LPM.cpp +1 -1
@@ 6,7 6,7 @@
#include "board.h"
#include "reboot_codes.hpp"
#include <log.hpp>
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "bsp/watchdog/watchdog.hpp"
#include <board/clock_config.h>
#include <fsl_clock.h>

M module-bsp/board/rt1051/bsp/magnetometer/magnetometer.cpp => module-bsp/board/rt1051/bsp/magnetometer/magnetometer.cpp +1 -1
@@ 6,7 6,7 @@
#include <module-utils/Utils.hpp> // for byte conversion functions. it is included first because of magic enum define

#include "ALS31300.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#include "drivers/i2c/DriverI2C.hpp"


M module-bsp/board/rt1051/bsp/torch/torch.cpp => module-bsp/board/rt1051/bsp/torch/torch.cpp +1 -1
@@ 4,7 4,7 @@
#include "bsp/torch/torch.hpp"
#include "AL3644TT.hpp"

#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "drivers/i2c/DriverI2C.hpp"

#include "fsl_common.h"

M module-bsp/board/rt1051/bsp/vibrator/vibrator.cpp => module-bsp/board/rt1051/bsp/vibrator/vibrator.cpp +1 -1
@@ 3,7 3,7 @@

#include "bsp/vibrator/vibrator.hpp"

#include <bsp/BoardDefinitions.hpp>
#include <board/BoardDefinitions.hpp>
#include <drivers/gpio/DriverGPIO.hpp>

static std::shared_ptr<drivers::DriverGPIO> port;

M module-bsp/board/rt1051/common/audio.cpp => module-bsp/board/rt1051/common/audio.cpp +2 -2
@@ 1,9 1,9 @@
// Copyright (c) 2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "audio.hpp"

#include "BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

extern "C"
{

M module-bsp/board/rt1051/common/board.cpp => module-bsp/board/rt1051/common/board.cpp +3 -55
@@ 16,6 16,7 @@ extern "C"
#include "chip.hpp"
#include "board/irq_gpio.hpp"
#include "reboot_codes.hpp"
#include <board/debug_console.hpp>

#include <cstdint>



@@ 24,58 25,6 @@ extern std::uint8_t __sdram_cached_start[];
namespace bsp
{

#if LOG_LUART_ENABLED
    static lpuart_handle_t g_lpuartHandle;
#endif

    /* Get debug console frequency. */
    __attribute__((unused)) static uint32_t BOARD_DebugConsoleSrcFreq(void)
    {
        uint32_t freq;

        /* To make it simple, we assume default PLL and divider settings, and the only variable
           from application is use PLL3 source or OSC source */
        if (CLOCK_GetMux(kCLOCK_UartMux) == 0) /* PLL3 div6 80M */
        {
            freq = (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
        }
        else {
            freq = CLOCK_GetOscFreq() / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
        }

        return freq;
    }

    /* Initialize debug console. */
    static void BOARD_InitDebugConsole(void)
    {
#if LOG_LUART_ENABLED
        /* The user initialization should be placed here */
        lpuart_config_t lpuartConfig;

        /* Initialize the LPUART. */
        /*
         * lpuartConfig.baudRate_Bps = 115200U;
         * lpuartConfig.parityMode = kLPUART_ParityDisabled;
         * lpuartConfig.stopBitCount = kLPUART_OneStopBit;
         * lpuartConfig.txFifoWatermark = 0;
         * lpuartConfig.rxFifoWatermark = 0;
         * lpuartConfig.enableTx = false;
         * lpuartConfig.enableRx = false;
         */
        LPUART_GetDefaultConfig(&lpuartConfig);
        lpuartConfig.baudRate_Bps = 115200;
        lpuartConfig.enableTx     = true;
        lpuartConfig.enableRx     = true;

        LPUART_TransferCreateHandle(LPUART3, &g_lpuartHandle, NULL, NULL);

        LPUART_Init(LPUART3, &lpuartConfig, BOARD_DebugConsoleSrcFreq());
        LPUART_EnableTx(LPUART3, true);
        LPUART_EnableRx(LPUART3, true);
#endif
    }

    /* MPU configuration. */
    static void BOARD_ConfigMPU(void)
    {


@@ 89,7 38,7 @@ namespace bsp

        /* Disable MPU */
        ARM_MPU_Disable();
        

        /* MPU configure:
         * Use ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size)
         * API in core_cm7.h.


@@ 115,7 64,6 @@ namespace bsp
         * param Size              Region size of the region to be configured. use ARM_MPU_REGION_SIZE_xxx MACRO in core_cm7.h.
         */


        /* Region 0 setting: Memory with Device type, not shareable, non-cacheable. */
        MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U);
        MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);


@@ 198,7 146,7 @@ namespace bsp
        BOARD_InitBootClocks();
        BOARD_ConfigMPU();

        BOARD_InitDebugConsole();
        board::initDebugConsole();

        irq_gpio_Init();


A module-bsp/board/rt1051/common/board/debug_console.hpp => module-bsp/board/rt1051/common/board/debug_console.hpp +10 -0
@@ 0,0 1,10 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

namespace bsp::board
{
    //! Initialize debug console
    void initDebugConsole();
} // namespace bsp::board
\ No newline at end of file

M module-bsp/board/rt1051/puretx/CMakeLists.txt => module-bsp/board/rt1051/puretx/CMakeLists.txt +2 -0
@@ 18,10 18,12 @@ target_sources(
        pin_mux.c
        clock_config.cpp
        irq_gpio.cpp
        debug_console.cpp
        
    PUBLIC
        eink-config.h
        board/pin_mux.h
        board/clock_config.h
        board/irq_gpio.hpp
        board/BoardDefinitions.hpp
)

A module-bsp/board/rt1051/puretx/board/BoardDefinitions.hpp => module-bsp/board/rt1051/puretx/board/BoardDefinitions.hpp +141 -0
@@ 0,0 1,141 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "drivers/dmamux/DriverDMAMux.hpp"
#include "drivers/dma/DriverDMA.hpp"
#include "drivers/i2c/DriverI2C.hpp"
#include "drivers/pll/DriverPLL.hpp"
#include "drivers/gpio/DriverGPIO.hpp"
#include "drivers/lpspi/DriverLPSPI.hpp"
#include "drivers/usdhc/DriverUSDHC.hpp"
#include "drivers/lpuart/DriverLPUART.hpp"

enum class BoardDefinitions
{

    POWER_SWITCH_HOLD_GPIO   = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    POWER_SWITCH_HOLD_BUTTON = 7,

    USB_FUNCTION_MUX_SELECT = 25, // GPIO_AD_B1_09, USB_MUX_SEL0
    USB_POWER_ACK           = 3,  // GPIO_B0_03  Note: pull-up in order to read
    I2C_STD_BAUDRATE        = 100000,

    AUDIOCODEC_I2C_BAUDRATE   = I2C_STD_BAUDRATE,
    AUDIOCODEC_I2C            = static_cast<int>(drivers::I2CInstances ::I2C2),
    AUDIOCODEC_DMAMUX         = static_cast<int>(drivers::DMAMuxInstances ::DMAMUX0),
    AUDIOCODEC_DMA            = static_cast<int>(drivers::DMAInstances ::DMA_0),
    AUDIOCODEC_TX_DMA_CHANNEL = 6,
    AUDIOCODEC_RX_DMA_CHANNEL = 7,
    AUDIOCODEC_IRQ            = 31, // GPIO_B1_15  requires pull-up 10kΩ
    AUDIOCODEC_IRQ_GPIO       = static_cast<int>(drivers::GPIOInstances ::GPIO_2),

    MIC_BIAS_DRIVER_GPIO = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    MIC_BIAS_DRIVER_EN   = 19, // GPIO_B1_03 MIC_LDO_EN

    CELLULAR_AUDIO_DMAMUX         = AUDIOCODEC_DMAMUX,
    CELLULAR_AUDIO_DMA            = AUDIOCODEC_DMA,
    CELLULAR_AUDIO_TX_DMA_CHANNEL = 2,
    CELLULAR_AUDIO_RX_DMA_CHANNEL = 3,

    KEYBOARD_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    KEYBOARD_I2C          = AUDIOCODEC_I2C,
    KEYBOARD_GPIO         = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    KEYBOARD_RF_BUTTON    = 6,
    KEYBOARD_IRQ_PIN      = 28,
    KEYBOARD_RESET_PIN    = 29,

    HEADSET_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    HEADSET_I2C          = AUDIOCODEC_I2C,
    HEADSET_GPIO         = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    HEADSET_IRQ_PIN      = 30,

    BATTERY_CHARGER_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    BATTERY_CHARGER_I2C          = AUDIOCODEC_I2C,
    BATTERY_CHARGER_GPIO         = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    BATTERY_CHARGER_INOKB_PIN    = 12,
    BATTERY_CHARGER_WCINOKB      = 13, // UNUSABLE as WCIN is not connected to the charger !
    BATTERY_CHARGER_INTB_PIN     = 14, // interrupt on charger/fuel-gauge event

    CELLULAR_DMA               = static_cast<int>(drivers::DMAInstances ::DMA_0),
    CELLULAR_DMAMUX            = static_cast<int>(drivers::DMAMuxInstances ::DMAMUX0),
    CELLULAR_TX_DMA_CHANNEL    = 4,
    CELLULAR_RX_DMA_CHANNEL    = 5,
    CELLULAR_GPIO_1            = static_cast<int>(drivers::GPIOInstances ::GPIO_1),
    CELLULAR_GPIO_2            = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    CELLULAR_GPIO_3            = static_cast<int>(drivers::GPIOInstances ::GPIO_3),
    CELLULAR_GPIO_1_CTS_PIN    = 14,
    CELLULAR_GPIO_1_RTS_PIN    = 15,
    CELLULAR_GPIO_3_DTR_PIN    = 27,
    CELLULAR_GPIO_2_POWER_PIN  = 18,
    CELLULAR_GPIO_2_RESET_PIN  = 17,
    CELLULAR_GPIO_2_RI_PIN     = 21,
    CELLULAR_GPIO_2_APRDY_PIN  = 16,
    CELLULAR_GPIO_2_WAKEUP_PIN = 22, // GPIO_B1_06, long time no see. Active low, external pull-down 10kΩ. docs: 6. Do
                                     // not pull up WAKEUP_IN, […], pins unless the module starts up sucessfully.
    CELLULAR_GPIO_2_WIRELESS_DISABLE_PIN  = 23, // GPIO_B1_07, pull-up in modem, active low, equiv. AT+CFUN=4, see docs
    CELLULAR_GPIO_2_SIM_TRAY_INSERTED_PIN = 11,
    CELLULAR_GPIO_2_NC                    = 10, // GPIO_B0_10
    CELLULAR_GPIO_2_SIMCARD_PRESENCE_PIN  = 9,
    CELLULAR_GPIO_2_SIMSEL_PIN            = 20, // GPIO_B1_04
    CELLULAR_GPIO_2_ANTSEL_PIN            = 2,
    CELLULAR_GPIO_1_STATUS_PIN            = 2,  // GPIO_AD_B0_02
    CELLULAR_GPIO_2_USB_BOOT_PIN          = 24, // GPIO_B1_08, output
    CELLULAR_LPUART_INSTANCE              = static_cast<int>(drivers::LPUARTInstances::LPUART_1),

    EINK_DMA            = static_cast<int>(drivers::DMAInstances ::DMA_0),
    EINK_DMAMUX         = static_cast<int>(drivers::DMAMuxInstances ::DMAMUX0),
    EINK_TX_DMA_CHANNEL = 0,
    EINK_RX_DMA_CHANNEL = 1,
    EINK_GPIO           = static_cast<int>(drivers::GPIOInstances ::GPIO_3),
    EINK_CS_PIN         = 13,
    EINK_RESET_PIN      = 16,
    EINK_BUSY_PIN       = 17,
    EINK_PLL            = static_cast<int>(drivers::PLLInstances::PLL2_PFD2),
    EINK_LPSPI_INSTANCE = static_cast<int>(drivers::LPSPIInstances::LPSPI_1),

    BLUETOOTH_DMA            = static_cast<int>(drivers::DMAInstances ::DMA_0),
    BLUETOOTH_DMAMUX         = static_cast<int>(drivers::DMAMuxInstances ::DMAMUX0),
    BLUETOOTH_TX_DMA_CHANNEL = 8,
    BLUETOOTH_RX_DMA_CHANNEL = 9,

    EMMC_PLL            = static_cast<int>(drivers::PLLInstances::PLL2_PFD2),
    EMMC_USDHC_INSTANCE = static_cast<int>(drivers::USDHCInstances::USDHC_2),

    AUDIO_PLL = static_cast<int>(drivers::PLLInstances::PLL4_Audio),

    VIBRATOR_GPIO = static_cast<int>(drivers::GPIOInstances::GPIO_1),
    VIBRATOR_EN   = 0, // GPIO_AD_B0_00

    MAGNETOMETER_I2C          = AUDIOCODEC_I2C,
    MAGNETOMETER_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    MAGNETOMETER_GPIO         = static_cast<int>(drivers::GPIOInstances::GPIO_1),
    MAGNETOMETER_IRQ          = 20, // GPIO_AD_B1_04

    TORCH_DRIVER_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE, // can do 400 kHz
    TORCH_DRIVER_I2C          = AUDIOCODEC_I2C,
    TORCH_DRIVER_GPIO         = static_cast<int>(drivers::GPIOInstances::GPIO_1),
    TORCH_DRIVER_EN = 21, // GPIO_AD_B1_05 Active HIGH. Internal pulldown resistor of 300kΩ between HWEN and GND.

    KEYPAD_BACKLIGHT_DRIVER_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    KEYPAD_BACKLIGHT_DRIVER_I2C          = AUDIOCODEC_I2C,
    KEYPAD_BACKLIGHT_DRIVER_GPIO         = static_cast<int>(drivers::GPIOInstances::GPIO_1),
    KEYPAD_BACKLIGHT_DRIVER_NRST =
        3, // GPIO_AD_B0_03 Active LOW. External pulldown resistor of 10kΩ between NRST and GND.

    EINK_FRONTLIGHT_PWM_INSTANCE = 2, // GPIO_AD_B0_01 = FLEXPWM2_PWM3_B
    EINK_FRONTLIGHT_PWM_MODULE   = 3,
    EINK_FRONTLIGHT_PWM_CHANNEL  = 1, // B

    LIGHT_SENSOR_I2C          = AUDIOCODEC_I2C,
    LIGHT_SENSOR_I2C_BAUDRATE = AUDIOCODEC_I2C_BAUDRATE,
    LIGHT_SENSOR_IRQ_GPIO     = static_cast<int>(drivers::GPIOInstances::GPIO_2),
    LIGHT_SENSOR_IRQ          = 15, // GPIO_B0_15

    DCDC_INVERTER_MODE_GPIO = static_cast<int>(drivers::GPIOInstances ::GPIO_2),
    DCDC_INVERTER_MODE_PIN  = 26,

    EEPROM_I2C          = AUDIOCODEC_I2C,
    EEPROM_I2C_BAUDRATE = I2C_STD_BAUDRATE,
};

M module-bsp/board/rt1051/puretx/bsp/battery_charger/battery_charger.cpp => module-bsp/board/rt1051/puretx/bsp/battery_charger/battery_charger.cpp +1 -1
@@ 5,7 5,7 @@
#include "battery_charger_utils.hpp"

#include <fsl_common.h>
#include <bsp/BoardDefinitions.hpp>
#include <board/BoardDefinitions.hpp>
#include <EventStore.hpp>
#include <drivers/gpio/DriverGPIO.hpp>
#include <drivers/i2c/DriverI2C.hpp>

M module-bsp/board/rt1051/puretx/bsp/eink/eink_pin_config.cpp => module-bsp/board/rt1051/puretx/bsp/eink/eink_pin_config.cpp +1 -1
@@ 2,7 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "drivers/gpio/DriverGPIO.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

namespace bsp::eink
{

M module-bsp/board/rt1051/puretx/bsp/keyboard/keyboard.cpp => module-bsp/board/rt1051/puretx/bsp/keyboard/keyboard.cpp +1 -1
@@ 8,7 8,7 @@
#include <task.h>
#include <timers.h>
#include <bsp/keyboard/keyboard.hpp>
#include <bsp/BoardDefinitions.hpp>
#include <board/BoardDefinitions.hpp>
#include <board.h>
#include <fsl_common.h>


A module-bsp/board/rt1051/puretx/debug_console.cpp => module-bsp/board/rt1051/puretx/debug_console.cpp +63 -0
@@ 0,0 1,63 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <board/debug_console.hpp>
#include <stdint.h>

extern "C"
{
#include "fsl_common.h"
#include "fsl_clock.h"
#if LOG_LUART_ENABLED
#include "fsl_lpuart.h"
#endif
}

namespace bsp::board
{

#if LOG_LUART_ENABLED
    namespace
    {
        lpuart_handle_t g_lpuartHandle;

        /* Get debug console frequency. */
        [[maybe_unused]] uint32_t BOARD_DebugConsoleSrcFreq(void)
        {
            uint32_t freq;

            /* To make it simple, we assume default PLL and divider settings, and the only variable
               from application is use PLL3 source or OSC source */
            if (CLOCK_GetMux(kCLOCK_UartMux) == 0) /* PLL3 div6 80M */
            {
                freq = (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
            }
            else {
                freq = CLOCK_GetOscFreq() / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
            }

            return freq;
        }
    } // namespace
#endif

    /* Initialize debug console. */
    void initDebugConsole(void)
    {
#if LOG_LUART_ENABLED
        /* The user initialization should be placed here */
        lpuart_config_t lpuartConfig;

        LPUART_GetDefaultConfig(&lpuartConfig);
        lpuartConfig.baudRate_Bps = 115200;
        lpuartConfig.enableTx     = true;
        lpuartConfig.enableRx     = true;

        LPUART_TransferCreateHandle(LPUART3, &g_lpuartHandle, NULL, NULL);

        LPUART_Init(LPUART3, &lpuartConfig, BOARD_DebugConsoleSrcFreq());
        LPUART_EnableTx(LPUART3, true);
        LPUART_EnableRx(LPUART3, true);
#endif
    }
} // namespace bsp::board

M module-bsp/board/rt1051/puretx/irq_gpio.cpp => module-bsp/board/rt1051/puretx/irq_gpio.cpp +1 -1
@@ 13,7 13,7 @@
#include <hal/key_input/AbstractKeyInput.hpp>
#include "bsp/cellular/bsp_cellular.hpp"
#include "bsp/headset/headset.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"
#include "bsp/magnetometer/magnetometer.hpp"
#include "bsp/light_sensor/light_sensor.hpp"


M module-platform/rt1051/src/disk_eeprom.cpp => module-platform/rt1051/src/disk_eeprom.cpp +1 -1
@@ 4,7 4,7 @@

#include "bsp/eeprom/eeprom.hpp"
#include "board/rt1051/bsp/eeprom/M24256.hpp"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

namespace purefs::blkdev
{

M module-platform/rt1051/src/disk_emmc.cpp => module-platform/rt1051/src/disk_emmc.cpp +1 -1
@@ 5,7 5,7 @@

#include <bsp/common.hpp>
#include "board/rt1051/bsp/eMMC/fsl_mmc.h"
#include "bsp/BoardDefinitions.hpp"
#include "board/BoardDefinitions.hpp"

#include <unistd.h>
#include <cstring>

M module-services/service-eink/EinkDisplay.cpp => module-services/service-eink/EinkDisplay.cpp +1 -1
@@ 4,7 4,7 @@
#include "EinkDisplay.hpp"

#if defined(TARGET_RT1051)
#include <bsp/BoardDefinitions.hpp>
#include <board/BoardDefinitions.hpp>
#endif

#include <gui/core/Color.hpp>