text:
provided_modules = ['redhat_support_tool.vendors.ACMECorp.open_case']
ignored_modules = ['redhat_support_tool.plugins.get_case',
                   'redhat_support_tool.plugins.list_cases',
                   'redhat_support_tool.plugins.open_case',
                   'redhat_support_tool.plugins.modify_case']

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html >

          <title>forms - forms</title>
          <meta name="description" content="forms - forms" />
          <meta name="keywords" content="forms forms" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

forms

        package

        forms

<input id="mbrsel-input" type="text" accesskey="/" />

            Visibility

Public

All

Value Members

        object

        SignInForm

The form which handles the submission of the credentials.

        object

        SignUpForm

The form which handles the sign up process.

Ungrouped


text:
set -e

curl https://install.meteor.com | /bin/sh
meteor --test


text:
<?php

$endpoint = "$URL/$version/itembank/conversion/toqti";
$resource = 'toqti';

?>

<ul class="nav nav-tabs" id="nav-dataapi-<?php echo $resource; ?>">

<a href="#tab-request-form-<?php echo $resource; ?>" data-toggle="tab">Request Form

<a href="#tab-request-json-<?php echo $resource; ?>" data-toggle="tab">Request JSON

<a href="#tab-response-<?php echo $resource; ?>" data-toggle="tab">Response

    <div class="tab-pane active" id="tab-request-form-<?php echo $resource; ?>">
        <form class="form-horizontal" role="form" method="post" id="frm-data-api-<?php echo $resource; ?>" data-resource="<?php echo $resource; ?>">

                URL

                    <input type="text" class="form-control" id="endpoint" value="<?php echo $endpoint; ?>" readonly>

                Items or Questions

                    <textarea class="form-control" id="api-items" data-type="json">
[
    {
        "type": "mcq",
        "widget_type": "response",
        "reference": "6b29c4b7-5352-444c-bca1-b328181ec2cc_3",
        "data": {
            "options": [
                {
                    "label": "[Choice A]",
                    "value": "0"
                },
                {
                    "label": "[Choice B]",
                    "value": "1"
                },
                {
                    "label": "[Choice C]",
                    "value": "2"
                },
                {
                    "label": "[Choice D]",
                    "value": "3"
                }
            ],
            "stimulus": "
[This is the stem.]
",
            "type": "mcq",
            "ui_style": {
                "choice_label": "upper-alpha",
                "type": "block"
            },
            "validation": {
                "scoring_type": "exactMatch",
                "valid_response": {
                    "score": 1,
                    "value": [
                        "2"
                    ]
                }
            }
        }
    }
]

                    </textarea>

                    <button type="submit" class="ladda-button" data-style="expand-right">Submit</button>

            <input type="hidden" name="input-request" id="input-request" value="">
        </form>

    <div class="tab-pane" id="tab-request-json-<?php echo $resource; ?>">

<code id="request-<?php echo $resource; ?>">

    <div class="tab-pane" id="tab-response-<?php echo $resource; ?>">

<code id="response-<?php echo $resource; ?>">Submit the request form to see a response


text:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;

namespace WebcomicAssistant
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // For an unknown reason WPF ignores the user's region and defaults to en-US,
            // resulting in dates, etc, being displayed incorrectly for most of the world.
            // Manually set the language to the user's current.
            // Taken from http://weblog.west-wind.com/posts/2009/Jun/14/WPF-Bindings-and-CurrentCulture-Formatting.
            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(
                    XmlLanguage.GetLanguage(
                        CultureInfo.CurrentCulture.IetfLanguageTag
                    )
                )
            );
        }
    }
}


text:
package org.kaaproject.kaa.server.common.nosql.cassandra.dao.model;

import java.io.Serializable;
import java.nio.ByteBuffer;

import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import com.datastax.driver.mapping.annotations.Transient;

@Table(name = CassandraModelConstants.EP_BY_ENDPOINT_GROUP_ID_COLUMN_FAMILY_NAME)
public class CassandraEPByEndpointGroupId implements Serializable {

    @Transient
    private static final long serialVersionUID = 4892433114353644609L;

    @PartitionKey
    @Column(name = CassandraModelConstants.EP_BY_ENDPOINT_GROUP_ID_ENDPOINT_GROUP_ID_PROPERTY)
    private String epGroupId;
    @ClusteringColumn
    @Column(name = CassandraModelConstants.EP_BY_ENDPOINT_GROUP_ID_ENDPOINT_KEY_HASH_PROPERTY)
    private ByteBuffer endpointKeyHash;

    public CassandraEPByEndpointGroupId() {
    }

    public CassandraEPByEndpointGroupId(String epGroupId, ByteBuffer endpointKeyHash) {
        this.epGroupId = epGroupId;
        this.endpointKeyHash = endpointKeyHash;
    }

    public String getEpGroupId() {
        return epGroupId;
    }

    public void setEpGroupId(String epGroupId) {
        this.epGroupId = epGroupId;
    }

    public ByteBuffer getEndpointKeyHash() {
        return endpointKeyHash;
    }

    public void setEndpointKeyHash(ByteBuffer endpointKeyHash) {
        this.endpointKeyHash = endpointKeyHash;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((endpointKeyHash == null) ? 0 : endpointKeyHash.hashCode());
        result = prime * result + ((epGroupId == null) ? 0 : epGroupId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        CassandraEPByEndpointGroupId other = (CassandraEPByEndpointGroupId) obj;
        if (endpointKeyHash == null) {
            if (other.endpointKeyHash != null)
                return false;
        } else if (!endpointKeyHash.equals(other.endpointKeyHash))
            return false;
        if (epGroupId == null) {
            if (other.epGroupId != null)
                return false;
        } else if (!epGroupId.equals(other.epGroupId))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "CassandraEPByAccessToken{" +
                "epGroupId='" + epGroupId + '\'' +
                ", endpointKeyHash=" + endpointKeyHash +
                '}';
    }
}


text:
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

import gulp from 'gulp';
import debug from 'gulp-debug';
import changed from 'gulp-changed';
import babel from 'gulp-babel';
import sourcemaps from 'gulp-sourcemaps';
import fs from 'fs-promise';
import colors from 'colour';

import * as Paths from '../../src/shared/paths';

gulp.task('browser-server:babel', () =>
  gulp.src(`${Paths.BROWSER_SERVER_SRC}/**/*.@(js|jsx)`)
    .pipe(changed(Paths.BROWSER_SERVER_DST, { extension: '.js' }))
    .pipe(debug({ title: `Running ${colors.command('babel')}` }))
    .pipe(sourcemaps.init())
    .pipe(babel(fs.readJsonSync('.babelrc')))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(Paths.BROWSER_SERVER_DST)));

gulp.task('browser-server:build', gulp.series(
  'browser-server:babel',
));


text:
#include <mcp3004.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <wiringPi.h>
#include "board_setup.hpp"
#include "settings.hpp"

// pin base for the chip. channels will be addressed from base to base + 7
#define MCP_BASE        100
// spi channel that the peripheral is connected to
#define SPI_CHAN        0
// analog channel for the dry soil mesurment
#define SENSOR_CHAN     0

#define HIGH            1
#define LOW             0

// private methods
int board_setup_class::init_board (
        void)
{
    int result = 0;

    if (result == 0)
    {
        if (geteuid () != 0)
        {
            printf ("need to be root to run");
            result = -1;
        }
    }

    if (result == 0)
    {
        if (wiringPiSetup () == -1)
        {
            printf ("wiringPiSetup has failed");
            result = -1;
        }
    }

    // Setup mcp3008
    if (result == 0)
    {
        //mcp3004Setup (MCP_BASE, SPI_CHAN);
    }

    return result;
}

// public methods
board_setup_class::board_setup_class (
        void)
{
    if (init_board () != 0)
    {
        printf ("board setup has failed. quit");
        exit (EXIT_FAILURE);
    }

    pinMode (settings_class::get_instance ().relay_pump_gpio (), OUTPUT);
    digitalWrite (settings_class::get_instance ().relay_pump_gpio (), LOW);

    //pinMode (settings_class::get_instance ().relay_checker_gpio (), OUTPUT);
    //digitalWrite (settings_class::get_instance ().relay_checker_gpio (), LOW);

    pinMode (settings_class::get_instance ().status_led_gpio (), OUTPUT);
    digitalWrite (settings_class::get_instance ().status_led_gpio (), LOW);
}

bool board_setup_class::is_time_for_watering (
        void)
{
    bool result = false;

    status_led_signal (true);

    digitalWrite (settings_class::get_instance ().relay_checker_gpio (), HIGH);
    sleep (1);

    unsigned int soil_level = analogRead (MCP_BASE + SENSOR_CHAN);
    printf ("soil_level %d\n", soil_level);
    if (soil_level >= settings_class::get_instance ().get_soil_dry_threshold ())
        result = true;

    digitalWrite (settings_class::get_instance ().relay_checker_gpio (), LOW);

    status_led_signal (false);

    return result;
}

void board_setup_class::activate_pump (
        void)
{
    /*unsigned int water_level = analogRead (PCF + 1);
    if (water_level < 30)
    {
        printf ("there is no water in the tank\n");
        return;
    }*/

    printf ("gpio %d\n", settings_class::get_instance ().relay_pump_gpio ());
    digitalWrite (settings_class::get_instance ().relay_pump_gpio (), HIGH);

    //sleep (settings_class::get_instance ().get_pump_active_time ());
    sleep (1);

    digitalWrite (settings_class::get_instance ().relay_pump_gpio (), LOW);
}

void board_setup_class::status_led_signal (
        bool signal)
{
    int data = HIGH;

    if (signal == false)
        data = LOW;

    digitalWrite (settings_class::get_instance ().status_led_gpio (), data);
}

board_setup_class::~board_setup_class (
        void)
{
    digitalWrite (settings_class::get_instance ().relay_pump_gpio (), LOW);
    //digitalWrite (settings_class::get_instance ().relay_checker_gpio (), LOW);
    digitalWrite (settings_class::get_instance ().status_led_gpio (), LOW);
}


text:
import settings
from os import path
import site

site.addsitedir(path.join(path.dirname(__file__), "../"))
from flaskcma.app import app
app.config.from_object(settings)

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=8001, debug=True)


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddCardListColumnInUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->longText('card_list')->nullable();
            $table->longText('deck_list')->nullable();
            $table->longText('card_book')->nullable();
            $table->longText('player_info')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('card_list');
            $table->dropColumn('deck_list');
            $table->dropColumn('card_book');
            $table->dropColumn('player_info');
        });
    }
}


text:
var SEPARATOR_DIV = '

';

function splitTable(table, maxHeight) {
    var header = table.children("thead");
    if (!header.length)
        return;

    var headerHeight = header.outerHeight();
    var header = header.detach();

    var splitIndices = [0];
    var rows = table.children("tbody").children();

    maxHeight -= headerHeight;
    var currHeight = 0;
    rows.each(function(i, row) {
        currHeight += $(rows[i]).outerHeight();
        if (currHeight > maxHeight) {
            splitIndices.push(i);
            currHeight = $(rows[i]).outerHeight();
        }
    });
    splitIndices.push(undefined);

    table = table.replaceWith('

');
    table.empty();

    for(var i=0; i<splitIndices.length-1; i++) {
        var newTable = table.clone();
        header.clone().appendTo(newTable);
        $('
').appendTo(newTable);
        rows.slice(splitIndices[i], splitIndices[i+1]).appendTo(newTable.children('tbody'));
        newTable.appendTo("#_split_table_wrapper");
        if (splitIndices[i+1] !== undefined) {
            $(SEPARATOR_DIV).appendTo("#_split_table_wrapper");
        }
    }
}

function split($table, chunkSize) {
    var cols = $("th", $table).length - 1;
    var n = cols / chunkSize;

    var $newTable = $table.clone()
    $table.after($newTable);
    $table.after($(SEPARATOR_DIV))
    for (var i = chunkSize; i > 0; i--) {
        $('td:nth-child('+i+'),th:nth-child('+i+')', $newTable).remove();
    }
    for (var i = cols; i > chunkSize; i--) {
        $('td:nth-child('+i+'),th:nth-child('+i+')', $table).remove();
    }
}


text:
@class AMRpcException;
@class APResponse;

@protocol AMRpcCallback < NSObject, JavaObject >

- (void)onResult:(APResponse *)response;

- (void)onError:(AMRpcException *)e;

@end

J2OBJC_EMPTY_STATIC_INIT(AMRpcCallback)

J2OBJC_TYPE_LITERAL_HEADER(AMRpcCallback)

#define ImActorModelNetworkRpcCallback AMRpcCallback

#endif // _AMRpcCallback_H_


text:
#if defined(USE_FULL_LL_DRIVER)

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_ll_adc.h"
#include "stm32h7xx_ll_bus.h"

#ifdef  USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif

/** @addtogroup STM32H7xx_LL_Driver
  * @{
  */

#if defined (ADC1) || defined (ADC2) || defined (ADC3)

/** @addtogroup ADC_LL ADC
  * @{
  */

/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @addtogroup ADC_LL_Private_Constants
  * @{
  */

/* Definitions of ADC hardware constraints delays */
/* Note: Only ADC peripheral HW delays are defined in ADC LL driver driver,   */
/*       not timeout values:                                                  */
/*       Timeout values for ADC operations are dependent to device clock      */
/*       configuration (system clock versus ADC clock),                       */
/*       and therefore must be defined in user application.                   */
/*       Refer to @ref ADC_LL_EC_HW_DELAYS for description of ADC timeout     */
/*       values definition.                                                   */
/* Note: ADC timeout values are defined here in CPU cycles to be independent  */
/*       of device clock setting.                                             */
/*       In user application, ADC timeout values should be defined with       */
/*       temporal values, in function of device clock settings.               */
/*       Highest ratio CPU clock frequency vs ADC clock frequency:            */
/*        - ADC clock from synchronous clock with AHB prescaler 512,          */
/*          APB prescaler 16, ADC prescaler 4.                                */
/*        - ADC clock from asynchronous clock (PLL) with prescaler 1,         */
/*          with highest ratio CPU clock frequency vs HSI clock frequency     */
/* Unit: CPU cycles.                                                          */
#define ADC_CLOCK_RATIO_VS_CPU_HIGHEST          (512UL * 16UL * 4UL)
#define ADC_TIMEOUT_DISABLE_CPU_CYCLES          (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1UL)
#define ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES  (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1UL)

/**
  * @}
  */

/* Private macros ------------------------------------------------------------*/

/** @addtogroup ADC_LL_Private_Macros
  * @{
  */

/* Check of parameters for configuration of ADC hierarchical scope:           */
/* common to several ADC instances.                                           */
#define IS_LL_ADC_COMMON_CLOCK(__CLOCK__)                                      \
  (   ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV1)                             \
   || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV2)                             \
   || ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV4)                             \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV1)                                 \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV2)                                 \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV4)                                 \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV6)                                 \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV8)                                 \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV10)                                \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV12)                                \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV16)                                \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV32)                                \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV64)                                \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV128)                               \
   || ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV256)                               \
  )

/* Check of parameters for configuration of ADC hierarchical scope:           */
/* ADC instance.                                                              */
#define IS_LL_ADC_RESOLUTION(__RESOLUTION__)                                   \
  (   ((__RESOLUTION__) == LL_ADC_RESOLUTION_16B)                              \
   || ((__RESOLUTION__) == LL_ADC_RESOLUTION_14B)                              \
   || ((__RESOLUTION__) == LL_ADC_RESOLUTION_12B)                              \
   || ((__RESOLUTION__) == LL_ADC_RESOLUTION_10B)                              \
   || ((__RESOLUTION__) == LL_ADC_RESOLUTION_8B)                               \
  )

#define IS_LL_ADC_LEFT_BIT_SHIFT(__LEFT_BIT_SHIFT__)                           \
  (   ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_NONE)                     \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_1)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_2)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_3)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_4)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_5)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_6)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_7)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_8)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_9)                        \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_10)                       \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_11)                       \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_12)                       \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_13)                       \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_14)                       \
   || ((__LEFT_BIT_SHIFT__) == LL_ADC_LEFT_BIT_SHIFT_15)                       \
  )

#define IS_LL_ADC_LOW_POWER(__LOW_POWER__)                                     \
  (   ((__LOW_POWER__) == LL_ADC_LP_MODE_NONE)                                 \
   || ((__LOW_POWER__) == LL_ADC_LP_AUTOWAIT)                                  \
  )

/* Check of parameters for configuration of ADC hierarchical scope:           */
/* ADC group regular                                                          */
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__)                         \
  (   ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE)                      \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH1)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH2)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH2)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_CH4)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11)               \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO2)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO2)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM6_TRGO)                 \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM15_TRGO)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_CH4)                  \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_HRTIM_TRG1)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_HRTIM_TRG3)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_LPTIM1_OUT)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_LPTIM2_OUT)                \
   || ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_LPTIM3_OUT)                \
  )

#define IS_LL_ADC_REG_CONTINUOUS_MODE(__REG_CONTINUOUS_MODE__)                 \
  (   ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_SINGLE)                    \
   || ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_CONTINUOUS)                \
  )

#define IS_LL_ADC_REG_DATA_TRANSFER_MODE(__REG_DATA_TRANSFER_MODE__)           \
  (   ((__REG_DATA_TRANSFER_MODE__) == LL_ADC_REG_DR_TRANSFER)                 \
   || ((__REG_DATA_TRANSFER_MODE__) == LL_ADC_REG_DMA_TRANSFER_LIMITED)        \
   || ((__REG_DATA_TRANSFER_MODE__) == LL_ADC_REG_DMA_TRANSFER_UNLIMITED)      \
   || ((__REG_DATA_TRANSFER_MODE__) == LL_ADC_REG_DFSDM_TRANSFER)              \
  )

#define IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(__REG_OVR_DATA_BEHAVIOR__)             \
  (   ((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_PRESERVED)           \
   || ((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_OVERWRITTEN)         \
  )

#define IS_LL_ADC_REG_SEQ_SCAN_LENGTH(__REG_SEQ_SCAN_LENGTH__)                 \
  (   ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_DISABLE)               \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS)         \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS)        \
   || ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS)        \
  )

#define IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(__REG_SEQ_DISCONT_MODE__)          \
  (   ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_DISABLE)           \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_1RANK)             \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_2RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_3RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_4RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_5RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_6RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_7RANKS)            \
   || ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_8RANKS)            \
  )

/* Check of parameters for configuration of ADC hierarchical scope:           */
/* ADC group injected                                                         */
#define IS_LL_ADC_INJ_TRIG_SOURCE(__INJ_TRIG_SOURCE__)                         \
  (   ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE)                      \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_CH1)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH4)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_EXTI_LINE15)               \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH4)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH3)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH1)                  \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM6_TRGO)                 \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM15_TRGO)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_HRTIM_TRG2)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_HRTIM_TRG4)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_LPTIM1_OUT)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_LPTIM2_OUT)                \
   || ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_LPTIM3_OUT)                \
  )

#define IS_LL_ADC_INJ_TRIG_EXT_EDGE(__INJ_TRIG_EXT_EDGE__)                     \
  (   ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_RISING)                  \
   || ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_FALLING)                 \
   || ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_RISINGFALLING)           \
  )

#define IS_LL_ADC_INJ_TRIG_AUTO(__INJ_TRIG_AUTO__)                             \
  (   ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_INDEPENDENT)                     \
   || ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_FROM_GRP_REGULAR)                \
  )

#define IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(__INJ_SEQ_SCAN_LENGTH__)                 \
  (   ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_DISABLE)               \
   || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS)         \
   || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS)         \
   || ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS)         \
  )

#define IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(__INJ_SEQ_DISCONT_MODE__)          \
  (   ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_DISABLE)           \
   || ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_1RANK)             \
  )

/* Check of parameters for configuration of ADC hierarchical scope:           */
/* multimode.                                                                 */
#define IS_LL_ADC_MULTI_MODE(__MULTI_MODE__)                                   \
  (   ((__MULTI_MODE__) == LL_ADC_MULTI_INDEPENDENT)                           \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIMULT)                       \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTERL)                       \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_SIMULT)                       \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_ALTERN)                       \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM)                  \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT)                  \
   || ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM)                  \
  )

#define IS_LL_ADC_MULTI_DMA_TRANSFER(__MULTI_DMA_TRANSFER__)                   \
  (   ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_EACH_ADC)              \
   || ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_RES_32_10B)            \
   || ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_RES_8B)                \
  )
#define IS_LL_ADC_MULTI_TWOSMP_DELAY(__MULTI_TWOSMP_DELAY__)                    \
  (   ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE_5)          \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5_8_BITS)  \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5_10_BITS) \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES)           \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5_12_BITS) \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES_5)         \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES)           \
   || ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES)           \
  )

#define IS_LL_ADC_MULTI_MASTER_SLAVE(__MULTI_MASTER_SLAVE__)                   \
  (   ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER)                        \
   || ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_SLAVE)                         \
   || ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER_SLAVE)                  \
  )

/**
  * @}
  */

/* Private function prototypes -----------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
/** @addtogroup ADC_LL_Exported_Functions
  * @{
  */

/** @addtogroup ADC_LL_EF_Init
  * @{
  */

/**
  * @brief  De-initialize registers of all ADC instances belonging to
  *         the same ADC common instance to their default reset values.
  * @note   This function is performing a hard reset, using high level
  *         clock source RCC ADC reset.
  *         Caution: On this STM32 serie, if several ADC instances are available
  *         on the selected device, RCC ADC reset will reset
  *         all ADC instances belonging to the common ADC instance.
  *         To de-initialize only 1 ADC instance, use
  *         function @ref LL_ADC_DeInit().
  * @param  ADCxy_COMMON ADC common instance
  *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC common registers are de-initialized
  *          - ERROR: not applicable
  */
ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON)
{
  /* Check the parameters */
  assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));

  if(ADCxy_COMMON == ADC12_COMMON)
  {
    /* Force reset of ADC clock (core clock) */
    LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_ADC12);

    /* Release reset of ADC clock (core clock) */
    LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_ADC12);
  }
  else
  {
#if defined (ADC3)
    /* Force reset of ADC clock (core clock) */
    LL_AHB4_GRP1_ForceReset(LL_AHB4_GRP1_PERIPH_ADC3);

    /* Release reset of ADC clock (core clock) */
    LL_AHB4_GRP1_ReleaseReset(LL_AHB4_GRP1_PERIPH_ADC3);
#endif
  }

  return SUCCESS;
}

/**
  * @brief  Initialize some features of ADC common parameters
  *         (all ADC instances belonging to the same ADC common instance)
  *         and multimode (for devices with several ADC instances available).
  * @note   The setting of ADC common parameters is conditioned to
  *         ADC instances state:
  *         All ADC instances belonging to the same ADC common instance
  *         must be disabled.
  * @param  ADCxy_COMMON ADC common instance
  *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
  * @param  ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC common registers are initialized
  *          - ERROR: ADC common registers are not initialized
  */
ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
{
  ErrorStatus status = SUCCESS;

  /* Check the parameters */
  assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
  assert_param(IS_LL_ADC_COMMON_CLOCK(ADC_CommonInitStruct->CommonClock));

  assert_param(IS_LL_ADC_MULTI_MODE(ADC_CommonInitStruct->Multimode));
  if (ADC_CommonInitStruct->Multimode != LL_ADC_MULTI_INDEPENDENT)
  {
    assert_param(IS_LL_ADC_MULTI_DMA_TRANSFER(ADC_CommonInitStruct->MultiDMATransfer));
    assert_param(IS_LL_ADC_MULTI_TWOSMP_DELAY(ADC_CommonInitStruct->MultiTwoSamplingDelay));
  }

  /* Note: Hardware constraint (refer to description of functions             */
  /*       "LL_ADC_SetCommonXXX()" and "LL_ADC_SetMultiXXX()"):               */
  /*       On this STM32 serie, setting of these features is conditioned to   */
  /*       ADC state:                                                         */
  /*       All ADC instances of the ADC common group must be disabled.        */
  if (__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(ADCxy_COMMON) == 0UL)
  {
    /* Configuration of ADC hierarchical scope:                               */
    /*  - common to several ADC                                               */
    /*    (all ADC instances belonging to the same ADC common instance)       */
    /*    - Set ADC clock (conversion clock)                                  */
    /*  - multimode (if several ADC instances available on the                */
    /*    selected device)                                                    */
    /*    - Set ADC multimode configuration                                   */
    /*    - Set ADC multimode DMA transfer                                    */
    /*    - Set ADC multimode: delay between 2 sampling phases                */
    if (ADC_CommonInitStruct->Multimode != LL_ADC_MULTI_INDEPENDENT)
    {
      MODIFY_REG(ADCxy_COMMON->CCR,
                 ADC_CCR_CKMODE
                 | ADC_CCR_PRESC
                 | ADC_CCR_DUAL
                 | ADC_CCR_DAMDF
                 | ADC_CCR_DELAY
                 ,
                 ADC_CommonInitStruct->CommonClock
                 | ADC_CommonInitStruct->Multimode
                 | ADC_CommonInitStruct->MultiDMATransfer
                 | ADC_CommonInitStruct->MultiTwoSamplingDelay
                );
    }
    else
    {
      MODIFY_REG(ADCxy_COMMON->CCR,
                 ADC_CCR_CKMODE
                 | ADC_CCR_PRESC
                 | ADC_CCR_DUAL
                 | ADC_CCR_DAMDF
                 | ADC_CCR_DELAY
                 ,
                 ADC_CommonInitStruct->CommonClock
                 | LL_ADC_MULTI_INDEPENDENT
                );
    }
  }
  else
  {
    /* Initialization error: One or several ADC instances belonging to        */
    /* the same ADC common instance are not disabled.                         */
    status = ERROR;
  }

  return status;
}

/**
  * @brief  Set each @ref LL_ADC_CommonInitTypeDef field to default value.
  * @param  ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
  *                              whose fields will be set to default values.
  * @retval None
  */
void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
{
  /* Set ADC_CommonInitStruct fields to default values */
  /* Set fields of ADC common */
  /* (all ADC instances belonging to the same ADC common instance) */
  ADC_CommonInitStruct->CommonClock = LL_ADC_CLOCK_SYNC_PCLK_DIV2;

  /* Set fields of ADC multimode */
  ADC_CommonInitStruct->Multimode             = LL_ADC_MULTI_INDEPENDENT;
  ADC_CommonInitStruct->MultiDMATransfer      = LL_ADC_MULTI_REG_DMA_EACH_ADC;
  ADC_CommonInitStruct->MultiTwoSamplingDelay = LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE_5;
}

/**
  * @brief  De-initialize registers of the selected ADC instance
  *         to their default reset values.
  * @note   To reset all ADC instances quickly (perform a hard reset),
  *         use function @ref LL_ADC_CommonDeInit().
  * @note   If this functions returns error status, it means that ADC instance
  *         is in an unknown state.
  *         In this case, perform a hard reset using high level
  *         clock source RCC ADC reset.
  *         Caution: On this STM32 serie, if several ADC instances are available
  *         on the selected device, RCC ADC reset will reset
  *         all ADC instances belonging to the common ADC instance.
  *         Refer to function @ref LL_ADC_CommonDeInit().
  * @param  ADCx ADC instance
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC registers are de-initialized
  *          - ERROR: ADC registers are not de-initialized
  */
ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx)
{
  ErrorStatus status = SUCCESS;

  __IO uint32_t timeout_cpu_cycles = 0UL;

  /* Check the parameters */
  assert_param(IS_ADC_ALL_INSTANCE(ADCx));

  /* Disable ADC instance if not already disabled.                            */
  if (LL_ADC_IsEnabled(ADCx) == 1UL)
  {
    /* Set ADC group regular trigger source to SW start to ensure to not      */
    /* have an external trigger event occurring during the conversion stop    */
    /* ADC disable process.                                                   */
    LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);

    /* Stop potential ADC conversion on going on ADC group regular.           */
    if (LL_ADC_REG_IsConversionOngoing(ADCx) != 0UL)
    {
      if (LL_ADC_REG_IsStopConversionOngoing(ADCx) == 0UL)
      {
        LL_ADC_REG_StopConversion(ADCx);
      }
    }

    /* Set ADC group injected trigger source to SW start to ensure to not     */
    /* have an external trigger event occurring during the conversion stop    */
    /* ADC disable process.                                                   */
    LL_ADC_INJ_SetTriggerSource(ADCx, LL_ADC_INJ_TRIG_SOFTWARE);

    /* Stop potential ADC conversion on going on ADC group injected.          */
    if (LL_ADC_INJ_IsConversionOngoing(ADCx) != 0UL)
    {
      if (LL_ADC_INJ_IsStopConversionOngoing(ADCx) == 0UL)
      {
        LL_ADC_INJ_StopConversion(ADCx);
      }
    }

    /* Wait for ADC conversions are effectively stopped                       */
    timeout_cpu_cycles = ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES;
    while ((LL_ADC_REG_IsStopConversionOngoing(ADCx)
            | LL_ADC_INJ_IsStopConversionOngoing(ADCx)) == 1UL)
    {
      timeout_cpu_cycles--;
      if (timeout_cpu_cycles == 0UL)
      {
        /* Time-out error */
        status = ERROR;
        break;
      }
    }

    /* Flush group injected contexts queue (register JSQR):                   */
    /* Note: Bit JQM must be set to empty the contexts queue (otherwise       */
    /*       contexts queue is maintained with the last active context).      */
    LL_ADC_INJ_SetQueueMode(ADCx, LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY);

    /* Disable the ADC instance */
    LL_ADC_Disable(ADCx);

    /* Wait for ADC instance is effectively disabled */
    timeout_cpu_cycles = ADC_TIMEOUT_DISABLE_CPU_CYCLES;
    while (LL_ADC_IsDisableOngoing(ADCx) == 1UL)
    {
      timeout_cpu_cycles--;
      if (timeout_cpu_cycles == 0UL)
      {
        /* Time-out error */
        status = ERROR;
        break;
      }
    }
  }

  /* Check whether ADC state is compliant with expected state */
  if (READ_BIT(ADCx->CR,
               (ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | ADC_CR_ADSTART
                | ADC_CR_ADDIS | ADC_CR_ADEN)
              )
      == 0UL)
  {
    /* ========== Reset ADC registers ========== */
    /* Reset register IER */
    CLEAR_BIT(ADCx->IER,
              (LL_ADC_IT_ADRDY
               | LL_ADC_IT_EOC
               | LL_ADC_IT_EOS
               | LL_ADC_IT_OVR
               | LL_ADC_IT_EOSMP
               | LL_ADC_IT_JEOC
               | LL_ADC_IT_JEOS
               | LL_ADC_IT_JQOVF
               | LL_ADC_IT_AWD1
               | LL_ADC_IT_AWD2
               | LL_ADC_IT_AWD3
              )
             );

    /* Reset register ISR */
    SET_BIT(ADCx->ISR,
            (LL_ADC_FLAG_ADRDY
             | LL_ADC_FLAG_EOC
             | LL_ADC_FLAG_EOS
             | LL_ADC_FLAG_OVR
             | LL_ADC_FLAG_EOSMP
             | LL_ADC_FLAG_JEOC
             | LL_ADC_FLAG_JEOS
             | LL_ADC_FLAG_JQOVF
             | LL_ADC_FLAG_AWD1
             | LL_ADC_FLAG_AWD2
             | LL_ADC_FLAG_AWD3
            )
           );

    /* Reset register CR */
    /*  - Bits ADC_CR_JADSTP, ADC_CR_ADSTP, ADC_CR_JADSTART, ADC_CR_ADSTART,  */
    /*    ADC_CR_ADCAL, ADC_CR_ADDIS, ADC_CR_ADEN are in                      */
    /*    access mode "read-set": no direct reset applicable.                 */
    /*  - Reset Calibration mode to default setting (single ended).           */
    /*  - Disable ADC internal voltage regulator.                             */
    /*  - Enable ADC deep power down.                                         */
    /*    Note: ADC internal voltage regulator disable and ADC deep power     */
    /*          down enable are conditioned to ADC state disabled:            */
    /*          already done above.                                           */
    CLEAR_BIT(ADCx->CR, ADC_CR_ADVREGEN | ADC_CR_ADCALDIF);
    SET_BIT(ADCx->CR, ADC_CR_DEEPPWD);

    /* Reset register CFGR */
    CLEAR_BIT(ADCx->CFGR,
              (  ADC_CFGR_AWD1CH  | ADC_CFGR_JAUTO   | ADC_CFGR_JAWD1EN
               | ADC_CFGR_AWD1EN  | ADC_CFGR_AWD1SGL | ADC_CFGR_JQM
               | ADC_CFGR_JDISCEN | ADC_CFGR_DISCNUM | ADC_CFGR_DISCEN
               | ADC_CFGR_AUTDLY  | ADC_CFGR_CONT    | ADC_CFGR_OVRMOD
               | ADC_CFGR_EXTEN   | ADC_CFGR_EXTSEL  | ADC_CFGR_RES
               | ADC_CFGR_DMNGT  )
             );

    SET_BIT(ADCx->CFGR, ADC_CFGR_JQDIS);

    /* Reset register CFGR2 */
    CLEAR_BIT(ADCx->CFGR2,
              (  ADC_CFGR2_LSHIFT  | ADC_CFGR2_OVSR    | ADC_CFGR2_RSHIFT1
               | ADC_CFGR2_RSHIFT4 | ADC_CFGR2_RSHIFT3 | ADC_CFGR2_RSHIFT2
               | ADC_CFGR2_RSHIFT1 | ADC_CFGR2_ROVSM   | ADC_CFGR2_TROVS
               | ADC_CFGR2_OVSS    | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSE)
             );

    /* Reset register SMPR1 */
    CLEAR_BIT(ADCx->SMPR1,
              (ADC_SMPR1_SMP9 | ADC_SMPR1_SMP8 | ADC_SMPR1_SMP7
               | ADC_SMPR1_SMP6 | ADC_SMPR1_SMP5 | ADC_SMPR1_SMP4
               | ADC_SMPR1_SMP3 | ADC_SMPR1_SMP2 | ADC_SMPR1_SMP1)
             );

    /* Reset register SMPR2 */
    CLEAR_BIT(ADCx->SMPR2,
              (ADC_SMPR2_SMP19 | ADC_SMPR2_SMP18 | ADC_SMPR2_SMP17
               | ADC_SMPR2_SMP16 | ADC_SMPR2_SMP15 | ADC_SMPR2_SMP14
               | ADC_SMPR2_SMP13 | ADC_SMPR2_SMP12 | ADC_SMPR2_SMP11
               | ADC_SMPR2_SMP10)
             );

    /* Reset register TR1 */
    CLEAR_BIT(ADCx->LTR1, ADC_LTR_LT);
    SET_BIT(ADCx->HTR1, ADC_HTR_HT);

    CLEAR_BIT(ADCx->LTR2, ADC_LTR_LT);
    SET_BIT(ADCx->HTR2, ADC_HTR_HT);
    CLEAR_BIT(ADCx->LTR3, ADC_LTR_LT);
    SET_BIT(ADCx->HTR3, ADC_HTR_HT);

    /* Reset register SQR1 */
    CLEAR_BIT(ADCx->SQR1,
              (ADC_SQR1_SQ4 | ADC_SQR1_SQ3 | ADC_SQR1_SQ2
               | ADC_SQR1_SQ1 | ADC_SQR1_L)
             );

    /* Reset register SQR2 */
    CLEAR_BIT(ADCx->SQR2,
              (ADC_SQR2_SQ9 | ADC_SQR2_SQ8 | ADC_SQR2_SQ7
               | ADC_SQR2_SQ6 | ADC_SQR2_SQ5)
             );

    /* Reset register SQR3 */
    CLEAR_BIT(ADCx->SQR3,
              (ADC_SQR3_SQ14 | ADC_SQR3_SQ13 | ADC_SQR3_SQ12
               | ADC_SQR3_SQ11 | ADC_SQR3_SQ10)
             );

    /* Reset register SQR4 */
    CLEAR_BIT(ADCx->SQR4, ADC_SQR4_SQ16 | ADC_SQR4_SQ15);

    /* Reset register JSQR */
    CLEAR_BIT(ADCx->JSQR,
              (ADC_JSQR_JL
               | ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN
               | ADC_JSQR_JSQ4    | ADC_JSQR_JSQ3
               | ADC_JSQR_JSQ2    | ADC_JSQR_JSQ1)
             );

    /* Reset register DR */
    /* Note: bits in access mode read only, no direct reset applicable */

    /* Reset register OFR1 */
    CLEAR_BIT(ADCx->OFR1, ADC_OFR1_OFFSET1 | ADC_OFR1_OFFSET1_CH | ADC_OFR1_SSATE);
    /* Reset register OFR2 */
    CLEAR_BIT(ADCx->OFR2, ADC_OFR2_OFFSET2 | ADC_OFR2_OFFSET2_CH | ADC_OFR2_SSATE);
    /* Reset register OFR3 */
    CLEAR_BIT(ADCx->OFR3, ADC_OFR3_OFFSET3 | ADC_OFR3_OFFSET3_CH | ADC_OFR3_SSATE);
    /* Reset register OFR4 */
    CLEAR_BIT(ADCx->OFR4, ADC_OFR4_OFFSET4 | ADC_OFR4_OFFSET4_CH | ADC_OFR4_SSATE);

    /* Reset registers JDR1, JDR2, JDR3, JDR4 */
    /* Note: bits in access mode read only, no direct reset applicable */

    /* Reset register AWD2CR */
    CLEAR_BIT(ADCx->AWD2CR, ADC_AWD2CR_AWD2CH);

    /* Reset register AWD3CR */
    CLEAR_BIT(ADCx->AWD3CR, ADC_AWD3CR_AWD3CH);

    /* Reset register DIFSEL */
    CLEAR_BIT(ADCx->DIFSEL, ADC_DIFSEL_DIFSEL);

    /* Reset register CALFACT */
    CLEAR_BIT(ADCx->CALFACT, ADC_CALFACT_CALFACT_D | ADC_CALFACT_CALFACT_S);

    /* Reset register CALFACT2 */
    CLEAR_BIT(ADCx->CALFACT2, ADC_CALFACT2_LINCALFACT);
  }
  else
  {
    /* ADC instance is in an unknown state */
    /* Need to performing a hard reset of ADC instance, using high level      */
    /* clock source RCC ADC reset.                                            */
    /* Caution: On this STM32 serie, if several ADC instances are available   */
    /*          on the selected device, RCC ADC reset will reset              */
    /*          all ADC instances belonging to the common ADC instance.       */
    /* Caution: On this STM32 serie, if several ADC instances are available   */
    /*          on the selected device, RCC ADC reset will reset              */
    /*          all ADC instances belonging to the common ADC instance.       */
    status = ERROR;
  }

  return status;
}

/**
  * @brief  Initialize some features of ADC instance.
  * @note   These parameters have an impact on ADC scope: ADC instance.
  *         Affects both group regular and group injected (availability
  *         of ADC group injected depends on STM32 families).
  *         Refer to corresponding unitary functions into
  *         @ref ADC_LL_EF_Configuration_ADC_Instance .
  * @note   The setting of these parameters by function @ref LL_ADC_Init()
  *         is conditioned to ADC state:
  *         ADC instance must be disabled.
  *         This condition is applied to all ADC features, for efficiency
  *         and compatibility over all STM32 families. However, the different
  *         features can be set under different ADC state conditions
  *         (setting possible with ADC enabled without conversion on going,
  *         ADC enabled with conversion on going, ...)
  *         Each feature can be updated afterwards with a unitary function
  *         and potentially with ADC in a different state than disabled,
  *         refer to description of each function for setting
  *         conditioned to ADC state.
  * @note   After using this function, some other features must be configured
  *         using LL unitary functions.
  *         The minimum configuration remaining to be done is:
  *          - Set ADC group regular or group injected sequencer:
  *            map channel on the selected sequencer rank.
  *            Refer to function @ref LL_ADC_REG_SetSequencerRanks().
  *          - Set ADC channel sampling time
  *            Refer to function LL_ADC_SetChannelSamplingTime();
  * @param  ADCx ADC instance
  * @param  ADC_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC registers are initialized
  *          - ERROR: ADC registers are not initialized
  */
ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct)
{
  ErrorStatus status = SUCCESS;

  /* Check the parameters */
  assert_param(IS_ADC_ALL_INSTANCE(ADCx));

  assert_param(IS_LL_ADC_RESOLUTION(ADC_InitStruct->Resolution));
  assert_param(IS_LL_ADC_LEFT_BIT_SHIFT(ADC_InitStruct->LeftBitShift));
  assert_param(IS_LL_ADC_LOW_POWER(ADC_InitStruct->LowPowerMode));

  /* Note: Hardware constraint (refer to description of this function):       */
  /*       ADC instance must be disabled.                                     */
  if (LL_ADC_IsEnabled(ADCx) == 0UL)
  {
    /* Configuration of ADC hierarchical scope:                               */
    /*  - ADC instance                                                        */
    /*    - Set ADC data resolution                                           */
    /*    - Set ADC conversion data alignment                                 */
    /*    - Set ADC low power mode                                            */
    MODIFY_REG(ADCx->CFGR,
               ADC_CFGR_RES
               | ADC_CFGR_AUTDLY
               ,
               ADC_InitStruct->Resolution
               | ADC_InitStruct->LowPowerMode
              );

    MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_LSHIFT, ADC_InitStruct->LeftBitShift);
  }
  else
  {
    /* Initialization error: ADC instance is not disabled. */
    status = ERROR;
  }
  return status;
}

/**
  * @brief  Set each @ref LL_ADC_InitTypeDef field to default value.
  * @param  ADC_InitStruct Pointer to a @ref LL_ADC_InitTypeDef structure
  *                        whose fields will be set to default values.
  * @retval None
  */
void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct)
{
  /* Set ADC_InitStruct fields to default values */
  /* Set fields of ADC instance */
  ADC_InitStruct->Resolution    = LL_ADC_RESOLUTION_16B;
  ADC_InitStruct->LeftBitShift  = LL_ADC_LEFT_BIT_SHIFT_NONE;
  ADC_InitStruct->LowPowerMode  = LL_ADC_LP_MODE_NONE;

}

/**
  * @brief  Initialize some features of ADC group regular.
  * @note   These parameters have an impact on ADC scope: ADC group regular.
  *         Refer to corresponding unitary functions into
  *         @ref ADC_LL_EF_Configuration_ADC_Group_Regular
  *         (functions with prefix "REG").
  * @note   The setting of these parameters by function @ref LL_ADC_Init()
  *         is conditioned to ADC state:
  *         ADC instance must be disabled.
  *         This condition is applied to all ADC features, for efficiency
  *         and compatibility over all STM32 families. However, the different
  *         features can be set under different ADC state conditions
  *         (setting possible with ADC enabled without conversion on going,
  *         ADC enabled with conversion on going, ...)
  *         Each feature can be updated afterwards with a unitary function
  *         and potentially with ADC in a different state than disabled,
  *         refer to description of each function for setting
  *         conditioned to ADC state.
  * @note   After using this function, other features must be configured
  *         using LL unitary functions.
  *         The minimum configuration remaining to be done is:
  *          - Set ADC group regular or group injected sequencer:
  *            map channel on the selected sequencer rank.
  *            Refer to function @ref LL_ADC_REG_SetSequencerRanks().
  *          - Set ADC channel sampling time
  *            Refer to function LL_ADC_SetChannelSamplingTime();
  * @param  ADCx ADC instance
  * @param  ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC registers are initialized
  *          - ERROR: ADC registers are not initialized
  */
ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
{
  ErrorStatus status = SUCCESS;

  /* Check the parameters */
  assert_param(IS_ADC_ALL_INSTANCE(ADCx));
  assert_param(IS_LL_ADC_REG_TRIG_SOURCE(ADC_REG_InitStruct->TriggerSource));
  assert_param(IS_LL_ADC_REG_SEQ_SCAN_LENGTH(ADC_REG_InitStruct->SequencerLength));
  if (ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
  {
    assert_param(IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(ADC_REG_InitStruct->SequencerDiscont));
  }
  assert_param(IS_LL_ADC_REG_CONTINUOUS_MODE(ADC_REG_InitStruct->ContinuousMode));
  assert_param(IS_LL_ADC_REG_DATA_TRANSFER_MODE(ADC_REG_InitStruct->DataTransferMode));
  assert_param(IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(ADC_REG_InitStruct->Overrun));

  /* Note: Hardware constraint (refer to description of this function):       */
  /*       ADC instance must be disabled.                                     */
  if (LL_ADC_IsEnabled(ADCx) == 0UL)
  {
    /* Configuration of ADC hierarchical scope:                               */
    /*  - ADC group regular                                                   */
    /*    - Set ADC group regular trigger source                              */
    /*    - Set ADC group regular sequencer length                            */
    /*    - Set ADC group regular sequencer discontinuous mode                */
    /*    - Set ADC group regular continuous mode                             */
    /*    - Set ADC group regular conversion data transfer: no transfer or    */
    /*      transfer by DMA, and DMA requests mode                            */
    /*    - Set ADC group regular overrun behavior                            */
    /* Note: On this STM32 serie, ADC trigger edge is set to value 0x0 by     */
    /*       setting of trigger source to SW start.                           */
    if (ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
    {
      MODIFY_REG(ADCx->CFGR,
                 ADC_CFGR_EXTSEL
                 | ADC_CFGR_EXTEN
                 | ADC_CFGR_DISCEN
                 | ADC_CFGR_DISCNUM
                 | ADC_CFGR_CONT
                 | ADC_CFGR_DMNGT
                 | ADC_CFGR_OVRMOD
                 ,
                 ADC_REG_InitStruct->TriggerSource
                 | ADC_REG_InitStruct->SequencerDiscont
                 | ADC_REG_InitStruct->ContinuousMode
                 | ADC_REG_InitStruct->DataTransferMode
                 | ADC_REG_InitStruct->Overrun
                );
    }
    else
    {
      MODIFY_REG(ADCx->CFGR,
                 ADC_CFGR_EXTSEL
                 | ADC_CFGR_EXTEN
                 | ADC_CFGR_DISCEN
                 | ADC_CFGR_DISCNUM
                 | ADC_CFGR_CONT
                 | ADC_CFGR_DMNGT
                 | ADC_CFGR_OVRMOD
                 ,
                 ADC_REG_InitStruct->TriggerSource
                 | LL_ADC_REG_SEQ_DISCONT_DISABLE
                 | ADC_REG_InitStruct->ContinuousMode
                 | ADC_REG_InitStruct->DataTransferMode
                 | ADC_REG_InitStruct->Overrun
                );
    }

    /* Set ADC group regular sequencer length and scan direction */
    LL_ADC_REG_SetSequencerLength(ADCx, ADC_REG_InitStruct->SequencerLength);
  }
  else
  {
    /* Initialization error: ADC instance is not disabled. */
    status = ERROR;
  }
  return status;
}

/**
  * @brief  Set each @ref LL_ADC_REG_InitTypeDef field to default value.
  * @param  ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
  *                            whose fields will be set to default values.
  * @retval None
  */
void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
{
  /* Set ADC_REG_InitStruct fields to default values */
  /* Set fields of ADC group regular */
  /* Note: On this STM32 serie, ADC trigger edge is set to value 0x0 by       */
  /*       setting of trigger source to SW start.                             */
  ADC_REG_InitStruct->TriggerSource    = LL_ADC_REG_TRIG_SOFTWARE;
  ADC_REG_InitStruct->SequencerLength  = LL_ADC_REG_SEQ_SCAN_DISABLE;
  ADC_REG_InitStruct->SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
  ADC_REG_InitStruct->ContinuousMode   = LL_ADC_REG_CONV_SINGLE;
  ADC_REG_InitStruct->DataTransferMode = LL_ADC_REG_DR_TRANSFER;
  ADC_REG_InitStruct->Overrun          = LL_ADC_REG_OVR_DATA_OVERWRITTEN;
}

/**
  * @brief  Initialize some features of ADC group injected.
  * @note   These parameters have an impact on ADC scope: ADC group injected.
  *         Refer to corresponding unitary functions into
  *         @ref ADC_LL_EF_Configuration_ADC_Group_Regular
  *         (functions with prefix "INJ").
  * @note   The setting of these parameters by function @ref LL_ADC_Init()
  *         is conditioned to ADC state:
  *         ADC instance must be disabled.
  *         This condition is applied to all ADC features, for efficiency
  *         and compatibility over all STM32 families. However, the different
  *         features can be set under different ADC state conditions
  *         (setting possible with ADC enabled without conversion on going,
  *         ADC enabled with conversion on going, ...)
  *         Each feature can be updated afterwards with a unitary function
  *         and potentially with ADC in a different state than disabled,
  *         refer to description of each function for setting
  *         conditioned to ADC state.
  * @note   After using this function, other features must be configured
  *         using LL unitary functions.
  *         The minimum configuration remaining to be done is:
  *          - Set ADC group injected sequencer:
  *            map channel on the selected sequencer rank.
  *            Refer to function @ref LL_ADC_INJ_SetSequencerRanks().
  *          - Set ADC channel sampling time
  *            Refer to function LL_ADC_SetChannelSamplingTime();
  * @param  ADCx ADC instance
  * @param  ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
  * @retval An ErrorStatus enumeration value:
  *          - SUCCESS: ADC registers are initialized
  *          - ERROR: ADC registers are not initialized
  */
ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
{
  ErrorStatus status = SUCCESS;

  /* Check the parameters */
  assert_param(IS_ADC_ALL_INSTANCE(ADCx));
  assert_param(IS_LL_ADC_INJ_TRIG_SOURCE(ADC_INJ_InitStruct->TriggerSource));
  assert_param(IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(ADC_INJ_InitStruct->SequencerLength));
  if (ADC_INJ_InitStruct->SequencerLength != LL_ADC_INJ_SEQ_SCAN_DISABLE)
  {
    assert_param(IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(ADC_INJ_InitStruct->SequencerDiscont));
  }
  assert_param(IS_LL_ADC_INJ_TRIG_AUTO(ADC_INJ_InitStruct->TrigAuto));

  /* Note: Hardware constraint (refer to description of this function):       */
  /*       ADC instance must be disabled.                                     */
  if (LL_ADC_IsEnabled(ADCx) == 0UL)
  {
    /* Configuration of ADC hierarchical scope:                               */
    /*  - ADC group injected                                                  */
    /*    - Set ADC group injected trigger source                             */
    /*    - Set ADC group injected sequencer length                           */
    /*    - Set ADC group injected sequencer discontinuous mode               */
    /*    - Set ADC group injected conversion trigger: independent or         */
    /*      from ADC group regular                                            */
    /* Note: On this STM32 serie, ADC trigger edge is set to value 0x0 by     */
    /*       setting of trigger source to SW start.                           */
    if (ADC_INJ_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
    {
      MODIFY_REG(ADCx->CFGR,
                 ADC_CFGR_JDISCEN
                 | ADC_CFGR_JAUTO
                 ,
                 ADC_INJ_InitStruct->SequencerDiscont
                 | ADC_INJ_InitStruct->TrigAuto
                );
    }
    else
    {
      MODIFY_REG(ADCx->CFGR,
                 ADC_CFGR_JDISCEN
                 | ADC_CFGR_JAUTO
                 ,
                 LL_ADC_REG_SEQ_DISCONT_DISABLE
                 | ADC_INJ_InitStruct->TrigAuto
                );
    }

    MODIFY_REG(ADCx->JSQR,
               ADC_JSQR_JEXTSEL
               | ADC_JSQR_JEXTEN
               | ADC_JSQR_JL
               ,
               ADC_INJ_InitStruct->TriggerSource
               | ADC_INJ_InitStruct->SequencerLength
              );
  }
  else
  {
    /* Initialization error: ADC instance is not disabled. */
    status = ERROR;
  }
  return status;
}

/**
  * @brief  Set each @ref LL_ADC_INJ_InitTypeDef field to default value.
  * @param  ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
  *                            whose fields will be set to default values.
  * @retval None
  */
void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
{
  /* Set ADC_INJ_InitStruct fields to default values */
  /* Set fields of ADC group injected */
  ADC_INJ_InitStruct->TriggerSource    = LL_ADC_INJ_TRIG_SOFTWARE;
  ADC_INJ_InitStruct->SequencerLength  = LL_ADC_INJ_SEQ_SCAN_DISABLE;
  ADC_INJ_InitStruct->SequencerDiscont = LL_ADC_INJ_SEQ_DISCONT_DISABLE;
  ADC_INJ_InitStruct->TrigAuto         = LL_ADC_INJ_TRIG_INDEPENDENT;
}

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

#endif /* ADC1 || ADC2 || ADC3 */

/**
  * @}
  */

#endif /* USE_FULL_LL_DRIVER */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
#ifndef SRC_TRACE_PROCESSOR_DYNAMIC_EXPERIMENTAL_FLAMEGRAPH_GENERATOR_H_
#define SRC_TRACE_PROCESSOR_DYNAMIC_EXPERIMENTAL_FLAMEGRAPH_GENERATOR_H_

#include "src/trace_processor/dynamic/dynamic_table_generator.h"
#include "src/trace_processor/dynamic/flamegraph_construction_algorithms.h"
#include "src/trace_processor/storage/trace_storage.h"

namespace perfetto {
namespace trace_processor {

class TraceProcessorContext;

class ExperimentalFlamegraphGenerator : public DynamicTableGenerator {
 public:
  enum class ProfileType { kGraph, kHeapProfile, kPerf };

  struct InputValues {
    ProfileType profile_type;
    int64_t ts;
    std::vector<TimeConstraints> time_constraints;
    base::Optional<UniquePid> upid;
    base::Optional<std::string> upid_group;
    std::string focus_str;
  };

  explicit ExperimentalFlamegraphGenerator(TraceProcessorContext* context);
  virtual ~ExperimentalFlamegraphGenerator() override;

  Table::Schema CreateSchema() override;
  std::string TableName() override;
  uint32_t EstimateRowCount() override;
  base::Status ValidateConstraints(const QueryConstraints&) override;
  base::Status ComputeTable(const std::vector<Constraint>& cs,
                            const std::vector<Order>& ob,
                            const BitVector& cols_used,
                            std::unique_ptr<Table>& table_return) override;

 private:
  TraceProcessorContext* context_ = nullptr;
};

}  // namespace trace_processor
}  // namespace perfetto

#endif  // SRC_TRACE_PROCESSOR_DYNAMIC_EXPERIMENTAL_FLAMEGRAPH_GENERATOR_H_


text:
package tasks.hasselt.detection;

import com.systemincloud.ext.vip.modeler.api.javatask.data.Image;
import com.systemincloud.modeler.tasks.javatask.api.InputPort;
import com.systemincloud.modeler.tasks.javatask.api.JavaTask;
import com.systemincloud.modeler.tasks.javatask.api.OutputPort;
import com.systemincloud.modeler.tasks.javatask.api.annotations.InputPortInfo;
import com.systemincloud.modeler.tasks.javatask.api.annotations.JavaTaskInfo;
import com.systemincloud.modeler.tasks.javatask.api.annotations.OutputPortInfo;
import com.systemincloud.modeler.tasks.javatask.api.data.Float64;

@JavaTaskInfo
public class Hue extends JavaTask {

	@InputPortInfo(name = "In", dataType = Image.class)
	public InputPort in;
	@OutputPortInfo(name = "a", dataType = Float64.class)
	public OutputPort a;
	@OutputPortInfo(name = "b", dataType = Float64.class)
	public OutputPort b;

    private static final double x_wp = .950456;
    private static final double y_wp = 1;
    private static final double z_wp = 1.088754;
    private static final double th   = .008856;

	@Override
	public void execute(int grp) {
		Image img = in.getData(Image.class);
        int[] inValues = img.getValues();
        double[] aValues = new double[img.getNumberOfElements()];
        double[] bValues = new double[img.getNumberOfElements()];
        for(int i = 0; i < aValues.length; i++) {
            int inRGB = inValues[i];
            int r = (inRGB >> 16 & 0xff);
            int g = (inRGB >> 8 & 0xff);
            int b = (inRGB & 0xff);

            double x = .412453*r+.357580*g+.180423*b;
            double y = .212671*r+.715160*g+.072169*b;
            double z = .019334*r+.119193*g+.950227*b;

            double x_n = x/x_wp;
            double y_n = y/y_wp;
            double z_n = z/z_wp;

            double a  = 500.*(f(x_n)-f(y_n));
            double b_ = 500.*(f(y_n)-f(z_n));

            if     (a > 100) a = 100;
            else if(a <-100) a = -100;
            if     (b_>100)  b_= 100;
            else if(b_<-100) b_= -100;
            //
            // Hue = arctan(b/a)/(Math.PI*2)
            //
            aValues[i] = a;
            bValues[i] = b;
        }
        a.putData(new Float64(img.getDimensions(), aValues));
        b.putData(new Float64(img.getDimensions(), bValues));
	}

    private static double f(double x) {
        return x > th ? Math.pow(x,1./3) : 7.787*x+16./116;
    }
}


text:
from lambdaimage.utils.params import Params
from nose.tools import assert_true
from numpy import array, array_equal

class TestParams:

    def test_paramsMethods(self):

        param1 = {'name': 'p1',
                  'value': array([1, 2, 3])}
        param2 = {'name': 'p2',
                  'value': array([4, 5, 6])}
        params = Params([param1, param2])

        target1 = array([1, 2, 3])
        target = array([[1, 2, 3], [4, 5, 6]])

        assert_true(params.names() == ['p1', 'p2'])
        assert_true(array_equal(params.values(), target))

        assert_true(array_equal(params.values('p1'), target1))
        assert_true(array_equal(params.values(['p1', 'p2']), target))
        assert_true(array_equal(params.values(('p1', 'p2')), target))


text:
AudioSystem* theSoundSystem = NULL;

//===========================================================================================================

///----------------------------------------------------------------------------------------------------------
///constructors

AudioSystem::AudioSystem(){
	if (!theSoundSystem) {
		 theSoundSystem = this;
	}
	//register events
	if (IsEventSystemCreated()) {
		RegisterEventMethodCallback("PlaySound", &AudioSystem::EventPlaySound, *theSoundSystem);
		RegisterEventMethodCallback("StopSound", &AudioSystem::EventStopSound, *theSoundSystem);
	}
}

AudioSystem::~AudioSystem(){
	//do nothing
}

//-----------------------------------------------------------------------------------------------------------

void AudioSystem::EventPlaySound(NamedProperties& params) {
	std::string soundFileNameStr;
	float volumeParam = 1.0f;
	int loopCountParam = 0;
	params.Get("soundFileName", soundFileNameStr);
	params.Get("soundLoopCount", loopCountParam);
	params.Get("soundVolume", volumeParam);

	PlayASound(soundFileNameStr, loopCountParam, volumeParam);
}

//-----------------------------------------------------------------------------------------------------------

void AudioSystem::EventStopSound(NamedProperties& params) {
	std::string soundToStopName = "";
	params.Get("soundFileName", soundToStopName);

	StopSoundByName(soundToStopName);
}

//-----------------------------------------------------------------------------------------------------------

//===========================================================================================================


text:
#ifndef h2o__socket_pool_h
#define h2o__socket_pool_h

#if defined( __cplusplus) && !defined(__c_as_cpp)
extern "C" {
#endif

#ifdef _WIN32
    #include <ws2tcpip.h>
#else
    #include <netinet/in.h>
    #include <arpa/inet.h>
#endif
#include <pthread.h>
#include "h2o/linklist.h"
#include "h2o/multithread.h"
#include "h2o/socket.h"
#include "h2o/timeout.h"

typedef enum en_h2o_socketpool_type_t { H2O_SOCKETPOOL_TYPE_NAMED, H2O_SOCKETPOOL_TYPE_SOCKADDR } h2o_socketpool_type_t;

typedef struct st_h2o_socketpool_t {

    /* read-only vars */
    h2o_socketpool_type_t type;
    union {
        struct {
            h2o_iovec_t host;
            h2o_iovec_t port;
        } named;
        struct {
            struct sockaddr_storage bytes;
            socklen_t len;
        } sockaddr;
    } peer;
    size_t capacity;
    uint64_t timeout; /* in milliseconds (UINT64_MAX if not set) */
    struct {
        h2o_loop_t *loop;
        h2o_timeout_t timeout;
        h2o_timeout_entry_t entry;
    } _interval_cb;

    /* vars that are modified by multiple threads */
    struct {
        size_t count; /* synchronous operations should be used to access the variable */
        pthread_mutex_t mutex;
        h2o_linklist_t sockets; /* guarded by the mutex; list of struct pool_entry_t defined in socket/pool.c */
    } _shared;
} h2o_socketpool_t;

typedef struct st_h2o_socketpool_connect_request_t h2o_socketpool_connect_request_t;

typedef void (*h2o_socketpool_connect_cb)(h2o_socket_t *sock, const char *errstr, void *data);
/**
 * initializes a socket loop
 */
void h2o_socketpool_init_by_address(h2o_socketpool_t *pool, struct sockaddr *sa, socklen_t salen, size_t capacity);
/**
 * initializes a socket loop
 */
void h2o_socketpool_init_by_hostport(h2o_socketpool_t *pool, h2o_iovec_t host, uint16_t port, size_t capacity);
/**
 * disposes of a socket loop
 */
void h2o_socketpool_dispose(h2o_socketpool_t *pool);
/**
 * sets a close timeout for the sockets being pooled
 */
void h2o_socketpool_set_timeout(h2o_socketpool_t *pool, h2o_loop_t *loop, uint64_t msec);
/**
 * connects to the peer (or returns a pooled connection)
 */
void h2o_socketpool_connect(h2o_socketpool_connect_request_t **req, h2o_socketpool_t *pool, h2o_loop_t *loop,
                            h2o_multithread_receiver_t *getaddr_receiver, h2o_socketpool_connect_cb cb, void *data);
/**
 * cancels a connect request
 */
void h2o_socketpool_cancel_connect(h2o_socketpool_connect_request_t *req);
/**
 * returns an idling socket to the socket pool
 */
int h2o_socketpool_return(h2o_socketpool_t *pool, h2o_socket_t *sock);
/**
 * determines if a socket belongs to the socket pool
 */
static int h2o_socketpool_is_owned_socket(h2o_socketpool_t *pool, h2o_socket_t *sock);

/* inline defs */

inline int h2o_socketpool_is_owned_socket(h2o_socketpool_t *pool, h2o_socket_t *sock)
{
    return sock->on_close.data == pool;
}

#if defined( __cplusplus) && !defined(__c_as_cpp)
}
#endif

#endif


text:
package com.github.theholywaffle.teamspeak3.api.wrapper;

import com.github.theholywaffle.teamspeak3.api.Property;

import java.util.Map;

public class Wrapper {

	private final Map<String, String> map;

	public Wrapper(Map<String, String> map) {
		this.map = map;
	}

	public Map<String, String> getMap() {
		return map;
	}

	public boolean getBoolean(String str) {
		return getInt(str) == 1;
	}

	public boolean getBoolean(Property p) {
		return getBoolean(p.getName());
	}

	public double getDouble(String str) {
		final String value = get(str);
		if (value == null || value.isEmpty()) {
			return -1D;
		}
		return Double.valueOf(value);
	}

	public double getDouble(Property p) {
		return getDouble(p.getName());
	}

	public long getLong(String str) {
		final String value = get(str);
		if (value == null || value.isEmpty()) {
			return -1L;
		}
		return Long.valueOf(value);
	}

	public long getLong(Property p) {
		return getLong(p.getName());
	}

	public int getInt(String str) {
		final String value = get(str);
		if (value == null || value.isEmpty()) {
			return -1;
		}
		return Integer.valueOf(value);
	}

	public int getInt(Property p) {
		return getInt(p.getName());
	}

	/**
	 * Only use this if you know what you are doing.
	 */
	public String get(String str) {
		final String result = map.get(str);
		return result != null ? result : "";
	}

	/**
	 * Only use this if you know what you are doing.
	 */
	public String get(Property p) {
		return get(p.getName());
	}

	@Override
	public String toString() {
		return map.toString();
	}

}


text:
require 'rails_helper'

RSpec.describe Api::V1::UserResource, type: :resource do
  let(:user) { create(:user) }
  let(:resource) { Api::V1::UserResource.new(user, nil) }

  subject { resource }

  its(:id) { is_expected.to eq(user.id) }
  its(:name) { is_expected.to eq(user.name) }
  its(:email) { is_expected.to eq(user.email) }
end


text:
"use strict";

/* jshint camelcase: false, expr: true */
var chai      = require('chai')
  , expect    = chai.expect
  , Support   = require(__dirname + '/../support')
  , DataTypes = require(__dirname + "/../../lib/data-types")
  , Sequelize = require(__dirname + "/../../index")
  , Promise   = Sequelize.Promise
  , _ = require('lodash');

chai.config.includeStack = true;

describe(Support.getTestDialectTeaser("Self"), function() {
  it('supports freezeTableName', function () {
    var Group = this.sequelize.define('Group', {}, {
      tableName: 'user_group',
      timestamps: false,
      underscored: true,
      freezeTableName: true
    });

    Group.belongsTo(Group, { as: 'Parent', foreignKey: 'parent_id' });
    return Group.sync({force: true}).then(function () {
      return Group.findAll({
        include: [{
          model: Group,
          as: 'Parent'
        }]
      });
    });
  });

  it('can handle 1:m associations', function () {
    var Person = this.sequelize.define('Person', { name: DataTypes.STRING });

    Person.hasMany(Person, { as: 'Children', foreignKey: 'parent_id'});

    expect(Person.rawAttributes.parent_id).to.be.ok;

    return this.sequelize.sync({force: true}).then(function () {
      return Promise.all([
        Person.create({ name: 'Mary' }),
        Person.create({ name: 'John' }),
        Person.create({ name: 'Chris' })
      ]);
    }).spread(function (mary, john, chris) {
      return mary.setChildren([john, chris]);
    });
  });

  it('can handle n:m associations', function() {
    var self = this;

    var Person = this.sequelize.define('Person', { name: DataTypes.STRING });

    Person.hasMany(Person, { as: 'Parents', through: 'Family' });
    Person.hasMany(Person, { as: 'Childs', through: 'Family' });

    var foreignIdentifiers = _.map(_.values(Person.associations), 'foreignIdentifier');
    var rawAttributes = _.keys(this.sequelize.models.Family.rawAttributes);

    expect(foreignIdentifiers.length).to.equal(2);
    expect(rawAttributes.length).to.equal(4);

    expect(foreignIdentifiers).to.have.members([ 'PersonId', 'ChildId' ]);
    expect(rawAttributes).to.have.members([ 'createdAt', 'updatedAt', 'PersonId', 'ChildId' ]);

    return this.sequelize.sync({ force: true }).then(function() {
      return self.sequelize.Promise.all([
        Person.create({ name: 'Mary' }),
        Person.create({ name: 'John' }),
        Person.create({ name: 'Chris' })
      ]).spread(function (mary, john, chris) {
        return mary.setParents([john]).then(function() {
          return chris.addParent(john);
        }).then(function() {
          return john.getChilds();
        }).then(function(children) {
          expect(_.map(children, 'id')).to.have.members([mary.id, chris.id]);
        });
      });
    });
  });

  it('can handle n:m associations with pre-defined through table', function() {
    var Person = this.sequelize.define('Person', { name: DataTypes.STRING });
    var Family = this.sequelize.define('Family', {
      preexisting_child: {
        type: DataTypes.INTEGER,
        primaryKey: true
      },
      preexisting_parent: {
        type: DataTypes.INTEGER,
        primaryKey: true
      }
    }, { timestamps: false });

    Person.hasMany(Person, { as: 'Parents', through: Family, foreignKey: 'preexisting_child' });
    Person.hasMany(Person, { as: 'Children', through: Family, foreignKey: 'preexisting_parent' });

    var foreignIdentifiers = _.map(_.values(Person.associations), 'foreignIdentifier');
    var rawAttributes = _.keys(Family.rawAttributes);

    expect(foreignIdentifiers.length).to.equal(2);
    expect(rawAttributes.length).to.equal(2);

    expect(foreignIdentifiers).to.have.members([ 'preexisting_parent', 'preexisting_child' ]);
    expect(rawAttributes).to.have.members([ 'preexisting_parent', 'preexisting_child' ]);

    return this.sequelize.sync({ force: true }).bind(this).then(function() {
      return Promise.all([
        Person.create({ name: 'Mary' }),
        Person.create({ name: 'John' }),
        Person.create({ name: 'Chris' })
      ]);
    }).spread(function (mary, john, chris) {
      this.mary = mary;
      this.chris = chris;
      this.john = john;
      return mary.setParents([john]).on('sql', function(sql) {
        if (sql.match(/INSERT/)) {
          expect(sql).to.have.string('preexisting_child');
          expect(sql).to.have.string('preexisting_parent');
        }
      });
    }).then(function () {
      return this.mary.addParent(this.chris).on('sql', function(sql) {
        if (sql.match(/INSERT/)) {
            expect(sql).to.have.string('preexisting_child');
            expect(sql).to.have.string('preexisting_parent');
        }
      });
    }).then(function () {
      return this.john.getChildren().on('sql', function(sql) {
        var whereClause = sql.split('FROM')[1]; // look only in the whereClause
        expect(whereClause).to.have.string('preexisting_child');
        expect(whereClause).to.have.string('preexisting_parent');
      });
    }).then(function(children) {
      expect(_.map(children, 'id')).to.have.members([this.mary.id]);
    });
  });
});


text:
namespace Problem_2_BankAccounts.Contract
{
    public interface IWithdraw
    {
        void Withdraw(decimal money);
    }
}


text:
const assert = require('assert');
const should = require('should');
const BinaryTree = require('../common/binaryTree');
const isBST = require('../src/isBST');

describe('isBST', function () {
  let tree = null,
    leftTree = null,
    rightTree = null;
  beforeEach(function () {
    leftTree = new BinaryTree();
    leftTree.add(5);
    rightTree = new BinaryTree();
    rightTree.add(15);
    tree = new BinaryTree();
    tree.add(10);
    tree.root.left = leftTree.root;
    tree.root.right = rightTree.root;
  })
  it('should be "TRUE" if binary search tree', function () {
    /* Tree
                10
          5           15
       2    7      12    20
    */
    leftTree.add(2);
    leftTree.add(7);
    rightTree.add(12);
    rightTree.add(20);
    isBST(tree).should.be.exactly(true);
  });
  it('should be "FALSE" if left part of tree is unbalanced', function () {
    /* Tree
                10
          5           15
       2    11     12    20
    */
    leftTree.add(2);
    leftTree.add(11);
    rightTree.add(12);
    rightTree.add(20);
    isBST(tree).should.be.exactly(false);
  });
  it('should be "FALSE" if right part of tree is unbalanced', function () {
    /* Tree
                10
          5           15
       2    7       8    20
    */
    leftTree.add(2);
    leftTree.add(7);
    rightTree.add(8);
    rightTree.add(20);
    isBST(tree).should.be.exactly(false);
  });
});


text:
package org.cyclops.colossalchests.blockentity;

import com.google.common.collect.Sets;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.cyclops.colossalchests.ColossalChests;
import org.cyclops.colossalchests.RegistryEntries;
import org.cyclops.colossalchests.client.render.blockentity.RenderTileEntityUncolossalChest;
import org.cyclops.cyclopscore.config.extendedconfig.BlockEntityConfig;

/**
 * Config for the {@link BlockEntityUncolossalChest}.
 * @author rubensworks
 *
 */
public class BlockEntityUncolossalChestConfig extends BlockEntityConfig<BlockEntityUncolossalChest> {

    public BlockEntityUncolossalChestConfig() {
        super(
                ColossalChests._instance,
                "uncolossal_chest",
                (eConfig) -> new BlockEntityType<>(BlockEntityUncolossalChest::new,
                        Sets.newHashSet(RegistryEntries.BLOCK_UNCOLOSSAL_CHEST), null)
        );
    }

    @Override
    @OnlyIn(Dist.CLIENT)
    public void onRegistered() {
        super.onRegistered();
        ColossalChests._instance.getProxy().registerRenderer(getInstance(), RenderTileEntityUncolossalChest::new);
    }

}


text:
package models

import java.sql.Connection
import java.time.Instant

case class ShippingDeliveryDate(
  shippingDate: Instant, deliveryDate: Instant
) {
  def save(
    siteUser: Option[SiteUser], transactionSiteId: Long
  )(
    implicit conn: Connection
  ) {
    TransactionShipStatus.updateShippingDeliveryDate(siteUser, transactionSiteId, shippingDate, deliveryDate)
    TransactionShipStatus.update(siteUser, transactionSiteId, TransactionStatus.CONFIRMED)
  }
}


text:
package ru.kpakulov.quadratic;

import org.apache.commons.io.output.ByteArrayOutputStream;
//import org.junit.Ignore;
import org.junit.Test;

import java.io.PrintStream;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * Testing Quadratic class.
 *
 * @author Konstantin Pakulov
 * @version 11/7/2016
 */

//@Ignore

public class QuadraticTest {

    /**
     * Mandatory javadoc.
     */
    private final int constOne = 1;

    /**
     * Mandatory javadoc.
     */
    private final int constTwo = 2;

    /**
     * Mandatory javadoc.
     */
    private final int constThree = 3;

    /**
     * Mandatory javadoc.
     */
    private final int constFour = 4;

    /**
     * Mandatory javadoc.
     */
    private final double constResult = 27.0;

    /**
     * Mandatory comment.
     * @throws Exception something
     */
    @Test
    public void whenSettingABCThenQuadraticExpected() throws Exception {
        Quadratic quadra = new Quadratic(constOne, constTwo, constThree);
        double quadraResult = quadra.quadraEq(constFour);
        assertThat(quadraResult, is(constResult));
    }

    /**
     * Mandatory comment.
     * @throws Exception something
     */
    @Test
    public void whenMainIsPrintingThenCatchOutput() throws Exception {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        System.setOut(new PrintStream(out));

        String[] arrgs = {"1", "2", "3", "6", "7", "1"};
        Quadratic.main(arrgs);
        assertThat(out.toString(), is("51.0\n66.0\n"));
    }
}


text:
package org.kuali.rice.ken.util;

import org.apache.log4j.Logger;
import org.kuali.rice.ken.bo.NotificationContentTypeBo;
import org.kuali.rice.ken.service.NotificationContentTypeService;

/**
 * Utility base class for Entity and LSResource Resolvers that should resolve
 * arguments to XSDs defined for NotificationContentTypes
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class ContentTypeResourceResolver {
    protected static final String CONTENT_TYPE_PREFIX = "resource:notification/ContentType";

    protected final Logger LOG = Logger.getLogger(getClass());

    private NotificationContentTypeService notificationContentTypeService;

    /**
     * Constructs a ContentTypeResourceResolver.java.
     * @param notificationContentTypeService
     */
    public ContentTypeResourceResolver(NotificationContentTypeService notificationContentTypeService) {
	this.notificationContentTypeService = notificationContentTypeService;
    }

    /**
     * This method resolves the NotificationContentType by id.
     * @param id
     * @return
     */
    public NotificationContentTypeBo resolveContentType(String id) {
	if (!id.startsWith(CONTENT_TYPE_PREFIX)) return null;
        String contentType = id.substring(CONTENT_TYPE_PREFIX.length());
        NotificationContentTypeBo notificationContentType = notificationContentTypeService.getNotificationContentType(contentType);
        if (contentType == null) {
            LOG.warn("Content type '" + contentType + "' not found in notification database");
            return null;
        }

        LOG.info("Resolved '" + id + "' to notification content type: " + notificationContentType);
        return notificationContentType;
    }
}


text:
namespace UpgradeYourself.Api.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Linq.Expressions;

    using UpgradeYourself.Models;

    public class AnswerViewModel
    {
        public static Expression<Func<Answer, AnswerViewModel>> FromAnswer
        {
            get
            {
                return q => new AnswerViewModel
                {
                    Id = q.Id,
                    Content = q.Content,
                    QuestionId = q.QuestionId,
                    IsCorrect = q.IsCorrect
                };
            }
        }

        public int Id { get; set; }

        [Required]
        [StringLength(500)]
        public string Content { get; set; }

        public int QuestionId { get; set; }

        public bool IsCorrect { get; set; }
    }
}


text:
#include <togo/core/error/assert.hpp>
#include <togo/core/utility/utility.hpp>
#include <togo/core/log/log.hpp>
#include <togo/core/memory/memory.hpp>
#include <togo/window/input/input.hpp>
#include <togo/game/app/app.hpp>

#include <togo/support/test.hpp>

using namespace togo;
using namespace togo::game;

struct TestAppData {
	unsigned x{42};

	~TestAppData() {
		TOGO_LOG("~TestAppData()\n");
	}
};

using TestApp = App<TestAppData>;
using TestAppModel = AppModel<TestAppData>;

template<>
void TestAppModel::init(TestApp& app) {
	TOGO_LOG("init()\n");
	TOGO_ASSERTE(app.data.x == 42);
}

template<>
void TestAppModel::shutdown(TestApp& app) {
	TOGO_LOG("shutdown()\n");
	TOGO_ASSERTE(app.data.x == 42);
}

template<>
void TestAppModel::update(TestApp& app, float /*dt*/) {
	//TOGO_LOG("update()\n");
	if (input::key_released(app.window, KeyCode::escape)) {
		app::quit();
	}
}

template<>
void TestAppModel::render(TestApp& /*app*/) {
	//TOGO_LOG("render()\n");
}

signed main(signed argc, char* argv[]) {
	memory_init();

	app::init<TestAppData>(
		memory::default_allocator(),
		array_ref(argv, unsigned_cast(argc)),
		"data/project/package/",
		1.0f / 30.0f
	);
	app::run();
	app::shutdown();
	return 0;
}


text:
<ion-view title="Account">
    <ion-content class="has-header">

{{account.Name}}

                Call
{{account.Phone}}

    </ion-content>
</ion-view>


text:
Dr. {{ $ctrl.doctor.user.firstName }} {{ $ctrl.doctor.user.lastName }}

{{ $ctrl.doctor.user.email }}

      {{ s.name }}

        {{ i.address.street_name }} {{ i.address.street_number }}, {{ i.address.city }}, {{ i.address.state }}

          (Ver mapa)

    <star-rating-comp on-click="$ctrl.onDoctorRated($event)" rating="$ctrl.ratingAverage"
                      labelText="Calificación" show-hover-stars="true" star-type="icon">
    </star-rating-comp>


text:
This is a quick hack.

My girlfriend needed a way to organise a Secret Santa party, so I built it for her.

This has been a great way to learn the basics of AngularJS and build an application on the (M)EAN stack. Things can probably improved in major ways. However, since I wanted to put this online and we're already december 6th at the time of writing this, a lot of dirty hacks made it into the codebase.

## Website

[www.memofromsanta.com](http://www.memofromsanta.com/ "http://www.memofromsanta.com")

## To do / to learn

A lot of these could have been done if I did not have such a strict deadline. I had to hack things together quickly because I really wanted this to be working in the first week of December (and even that was a little too late).

- Clean up
- Learn to write tests properly and adopt a test-driven workflow. Too much time has been wasted on testing various parts of the application manually.
- Learn to structure server-side code properly and adopt an async mindset.
- Update to Angular 1.2 and dig deep into the framework. Figure out where to put non-Angular helper methods, learn about filters.

## Contributing

Suggestions and pull requests are always welcome.

Changes and new features will be included for the 2014 edition.


text:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M1.825,22 L22.175,1.625V22ZM14.9,19.725H19.9V7.125L14.9,12.125Z"/>
</vector>


text:
<?php
use Cake\Routing\Router;

Router::plugin(
    'Acl',
    ['path' => '/acl'],
    function ($routes) {
        $routes->fallbacks('DashedRoute');
        $routes->connect('/',['controller' => 'Permissions', 'action' => 'index']);
    }
);

Router::scope('/users/:action', ['plugin' => 'Acl'],function ($routes) {
    $routes->connect('/', ['controller' => 'Users']);
});


text:
<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="author" content="Martin Suchan">
	<title>win10.19555.to.win10.19569.diff</title>

Windows <input checked type="checkbox" id="aea23489ce3aa9b6406ebb28e0cda430" />

Security <input checked type="checkbox" id="7d40d41fdcfc7a98d20d072e2f9f9f1f" />

Isolation <input checked type="checkbox" id="116fe7350bdaa6ff038b4ee8c7d381e0" />

IsolatedWindowsEnvironmentPostMessageResult
<input/>

IsolatedWindowsEnvironmentPostMessageStatus
<input/>

Storage <input checked type="checkbox" id="2a4e8d4f00374e11ba3a2201a177ebe3" />

Provider <input checked type="checkbox" id="41353acb7a1ffda11a4b66de9aab7bf4" />

IStorageProviderHandlerFactory
<input/>

IStorageProviderStatusSource
<input/>

StorageProviderError
<input/>

StorageProviderErrorCommand
<input/>

StorageProviderState
<input/>

StorageProviderStatus
<input/>

System <input checked type="checkbox" id="f7547a84d04036940d5782755d7278a9" />

Implementation <input checked type="checkbox" id="363c21267c32772352e5797dc85dc35a" />

FileExplorer <input checked type="checkbox" id="da3b83c4f6ebab241e1e25455b0ab28f" />

ISysStorageProviderEventSource
<input/>

ISysStorageProviderHandlerFactory
<input/>

ISysStorageProviderHttpRequestProvider
<input/>

SysStorageProviderEventReceivedEventArgs
<input/>

UI <input checked type="checkbox" id="6d75e4aed471f90fb1c9988aade0b0d1" />

Input <input checked type="checkbox" id="30c15dbf0170be0bb6daea9c98bef129" />

Inking <input checked type="checkbox" id="a1b0887f4eec0219f415ae573f7a0d1f" />

DelegatedInkTrail
<input/>

DelegatedInkTrailPoints
<input/>

DelegatedInkTrailRenderParams
<input/>

WindowManagement <input checked type="checkbox" id="5e479c6c15a179edf683a01423882ce5" />

AppWindowShowOptions
<input/>

SpanningPresentationConfiguration
<input/>

VisibilityChangedDetails
<input/>

WindowInformation
<input/>

WindowVisibilityState
<input/>

WindowReference
<input/>

WindowReferenceId
<input/>


text:
namespace cpponfiguration {
	namespace grammar {
		using namespace pegtl;

		// not_space ::= '!'..'~'
		struct not_space : range<'!', '~'> {};  // `print` except ' '

		// name ::= '"' .* '"'
		struct name : if_must<one<'"'>, until<one<'"'>, print>> {};

		// comment ::= '#' .*
		struct comment : seq<string<'#'>, star<not_one<'\n'>>> {};

		// commented ::= \s+ [comment]
		struct commented : opt<seq<plus<blank>, comment>> {};

		// line_comment ::= \s* comment eol
		struct line_comment : seq<star<blank>, comment, eolf> {};

		// sof_comments ::= line_comment* eol*
		struct sof_comments : seq<star<line_comment>, star<eolf>> {};

		// property ::= name '=' name
		struct property : seq<name, string<'='>, name> {};

		// property_line ::= \s* property commented eol
		struct property_line : seq<star<blank>, property, commented, eolf> {};

		// category ::= [name \s*] { commented eol
		//                      property_line*
		//                      } eol+
		struct category : seq<opt<name>, star<blank>, string<'{'>, commented, eolf,  //
		                      star<property_line>,                                   //
		                      string<'}'>, eolf> {};

		// file ::= sof_comments
		//          category*
		//          [eol comment]
		//          eol*
		//          eof
		struct file : seq<sof_comments,        //
		                  star<category>,      //
		                  opt<eolf, comment>,  //
		                  star<eol>,           //
		                  eof> {};

		template <class Rule>
		struct action : nothing<Rule> {};

		template <>
		struct action<line_comment> {
			template <class T0, class LineCommentsAcc, class... TT>
			static void apply(const input & in, T0 &&, LineCommentsAcc & acc, TT &&...) {
				std::cout << "line_comment:\"" << (std::find(in.begin(), in.end(), '#') + 1) << "\"XXXXX\n";
				acc.emplace_back(std::find_if(std::find(in.begin(), in.end(), '#') + 1, in.end(), [](auto c) { return c != ' ' && c != '\t'; }));
			}
		};

		template <>
		struct action<sof_comments> {
			template <class SOFComments, class LineCommentsAcc, class... TT>
			static void apply(const input &, SOFComments & comments, LineCommentsAcc & acc, TT &&...) {
				std::move(comments.begin(), comments.end(), std::back_inserter(comments));
				acc.clear();
			}
		};
	}
}

namespace cpponfig = cpponfiguration;


text:
package es.uvigo.ei.sing.vda.core;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class RColors {

	public static String colorList(int size) {
		return 	colorList(Arrays.asList(R_COLORS).subList(0, size));
	}

	public static String colorList(List<String> colors) {
		return colors.stream().collect(Collectors.joining("\", \"", "c(\"", "\")"));
	}

	public static final String[] R_COLORS = new String[]{
			"red",
			"blue",
			"green",
			"orange",
			"yellow",
			"brown",
			"turquoise",
			"orangered",
			"lavenderblush",
			"lightslateblue",
			"gold4",
			"forestgreen",
			"plum",
			"gray",
			"darkgray",
			"brown"
	};
}


text:
package monitor

// taken from https://github.com/gohugoio/hugo/blob/master/watcher/batcher.go
// and changed according to this use case

import (
	"strings"
	"time"

	"github.com/fsnotify/fsnotify"
	log "github.com/sirupsen/logrus"
)

// Batcher batches file watch events in a given interval.
type Batcher struct {
	*fsnotify.Watcher
	interval time.Duration
	done     chan struct{}

	Events chan map[string]bool // Events are returned on this channel
}

// NewBatcher creates and starts a Batcher with the given time interval.
func NewBatcher(interval time.Duration) (*Batcher, error) {
	watcher, err := fsnotify.NewWatcher()

	batcher := &Batcher{}
	batcher.Watcher = watcher
	batcher.interval = interval
	batcher.done = make(chan struct{}, 1)
	batcher.Events = make(chan map[string]bool, 1)

	if err == nil {
		go batcher.run()
	}

	return batcher, err
}

func (b *Batcher) run() {
	tick := time.Tick(b.interval)
	evs := make(map[string]bool, 0)
OuterLoop:
	for {
		select {
		case ev := <-b.Watcher.Events:
			if ev.Op&fsnotify.Remove == fsnotify.Remove || ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Rename == fsnotify.Rename {
				parts := strings.Split(ev.Name, "/")
				if strings.HasPrefix(parts[len(parts)-1], ".") {
					continue
				}
				if _, ok := evs[parts[len(parts)-1]]; !ok {
					evs[parts[len(parts)-1]] = true
				}
			}
		case <-tick:
			log.Debug("Batch interval done")
			if len(evs) == 0 {
				continue
			}
			b.Events <- evs
			evs = make(map[string]bool, 0)
		case <-b.done:
			break OuterLoop
		}
	}
	close(b.done)
}

// Close stops the watching of the files.
func (b *Batcher) Close() {
	b.done <- struct{}{}
	b.Watcher.Close()
}


text:
package io.apiman.gateway.engine.es.beans;

/**
 * A simple bean used to store the last updated time for the ES registry store
 * as a whole.  In other words, whenever the ES registry index is updated
 *
 * @author eric.wittmann@redhat.com
 */
public class DataVersionBean {

    private long updatedOn;

    /**
     * Constructor.
     */
    public DataVersionBean() {
    }

    /**
     * @return the updatedOn
     */
    public long getUpdatedOn() {
        return updatedOn;
    }

    /**
     * @param updatedOn the updatedOn to set
     */
    public void setUpdatedOn(long updatedOn) {
        this.updatedOn = updatedOn;
    }

}