感谢楼主,下载成功,安装提示缺少,Java Runtime Environment,然后我安装了Java,然后进入安装,自动选择安装目录,安装一阵,最后提醒, javaw.exe not found ,reinstall java jre;实际上,我的电脑里搜索,有javaw.exe 。因此,MicroXplorer无法安装,困惑。
生成代码鉴赏:论坛啥时候能支持代码片段呢????? 1 t' m: I! ~9 p( } , B/ u6 Q _$ `: n: A/**# |! k9 F# ^# n: o+ V. L
******************************************************************************$ R7 W6 d8 P1 _. | m
* File Name : mx_gpio.c' a: W( H3 N/ ^) ^' Q5 k
* Date : 03/01/2014 15:37:11$ z' \) R# f; b5 X' ^" _0 F9 v3 i
* Description : This file provides code for the configuration 4 C$ y, N5 b5 }) j* Q4 r * of all used GPIO pins.. X1 M4 s' |1 o" ~# M
****************************************************************************** $ @; u1 Y+ @: M8 ^# p% u m * # h4 c( m$ Y: N% g% F( P8 g * COPYRIGHT 2014 STMicroelectronics + \- M9 W* R) z& P$ \9 H *3 E) r6 `8 @4 R" I0 L; P
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");0 }9 k+ J% L/ c1 E
* You may not use this file except in compliance with the License.) D: a/ t ^0 B9 L/ s$ |* [9 X
* You may obtain a copy of the License at: [+ n! ]6 N% K
* ; R7 f o7 ]* n G$ X7 ~ * http:www.st.com/software_license_agreement_liberty_v2 ( r Q7 k5 F7 u" B * 9 f' f4 n/ H6 H/ B+ L5 E& Q1 z * Unless required by applicable law or agreed to in writing, software ( X0 D* d6 n; X; d# [) A * distributed under the License is distributed on an "AS IS" BASIS, * L* o5 Y0 }' s( N# Z' b' t* p * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.8 w; O- D) @0 W) }1 N
* See the License for the specific language governing permissions and ' ?( h* I2 y. s- g, K * limitations under the License.: m9 A3 ~1 r& J4 E: C8 q& o
*" I4 }% S, R( `' v; x
******************************************************************************# l' S* n& {* m+ f) _/ `
*/) J) n9 b: C6 d- y$ v3 p( U0 G
7 P. I( \3 @5 j) K# X) D
/* Includes ------------------------------------------------------------------*/* M( G6 j8 o/ n; o C8 ]7 O: m5 V
#include "mx_gpio.h" ! w- n* ?% s: J1 ? I" x1 I/* USER CODE BEGIN 0 */' k; g+ I( \: |7 ?
+ [& A4 I, V: L8 t2 p* j/* USER CODE END 0 */ ! F% a3 a) _8 G/ T3 K2 K $ Z. W1 X- i, X- n) S/*----------------------------------------------------------------------------*/( [- O# C# k% `: X8 o: \
/* Configure GPIO */ / _5 L' S% v, B5 H0 j/*----------------------------------------------------------------------------*/; V: y1 M8 N( n! s- z
/* USER CODE BEGIN 1 */# @7 s* n4 h7 I# v
8 o% [% v' v# P
/* USER CODE END 1 */6 E- X2 x! [4 m; W }5 i
" ?, j0 Z3 V. B% E. u' L9 s( W* S0 l
void mx_pinout_config(void) { 1 a5 R" U5 _* k! q) Y2 P! P' a /* Private typedef ---------------------------------------------------------*/ , d+ E9 ^. f8 @% ?; N2 @1 G% ?; k GPIO_InitTypeDef GPIO_InitStruct; * F, E, c8 _) ^8 X - F1 L2 X" q3 \* F$ r- \* B3 d8 a ; a, @3 T; w* B
/** ADC GPIO Configuration ) J% B4 q4 s6 n3 L7 @+ A9 s" I# ] PA1 ------> ADC_IN1 Y! `! _2 T& W5 B; v; b
*/) v6 B- O$ o% K, M# q
! Z3 ?3 t* L4 H$ U# F: V+ S 9 ]8 K' H5 _' n" |1 m$ B3 T7 G o /*Enable or disable the AHB peripheral clock */ q* c7 a$ e8 C- |: w6 B- z1 E, Y
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); ) ~" W7 z1 E- y6 h4 ?, e - P4 M- Y( p6 r! m6 z n0 i# m
/*Configure GPIO pin *// _5 h7 @6 P" V' W0 I0 K/ N u
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1; . k9 L! f1 M* k9 w3 p GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AN;: T. y. @4 @5 Z& A# l+ A
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;- v0 T% \' B3 s+ k% }8 A6 T/ i6 R0 x
GPIO_Init(GPIOA, &GPIO_InitStruct);9 i2 {0 b4 u+ m( Z7 a9 R- Q- \( |
5 C0 e6 T+ d, A ! \/ y* s. C6 x$ a; C6 x3 t /** I2C1 GPIO Configuration 0 F1 i, i0 N0 F2 |6 \& V PB6 ------> I2C1_SCL / W0 F" N+ J5 U2 j: ]8 L PB7 ------> I2C1_SDA, y; J& b2 v, ^- M7 E' y/ `
*/ % c7 K: N' @' l2 I' E4 L * f$ Z( l7 |0 e1 h' G2 K 8 S, k" z: x* m6 y. ]0 H) ]: N /*Enable or disable the AHB peripheral clock */ & u/ C/ C$ Y) d$ U. C& Z2 O( }0 ^' c RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);6 h& {1 R' q7 E, H8 B& e( ~( T
7 h6 V9 I+ b6 J9 ]& Q( ?
1 ?5 e' \$ u* w2 ]- V+ H //!!! GPIO_Init is commented because some parameters are missing4 \. W! H# `. o) w) C
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6; d8 U9 z, I1 S$ {* g! y) K GPIO_InitStruct.GPIO_Mode = ;0 g1 w7 W5 `' {2 U
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; ' y" e) n$ I; R8 y GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; 0 _9 `2 j3 _1 h3 Q" {3 I2 d8 k+ t GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;( m" r3 t5 U7 q3 I1 f
GPIO_Init(GPIOB, &GPIO_InitStruct);% t) d9 S+ L- g. p
7 E. K6 H* {. w: P
8 C& U' y2 F+ l* P2 U- r
//!!! GPIO_Init is commented because some parameters are missing! @' t3 w d+ s, x# O
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7;4 Q) M; E, s. p7 D
GPIO_InitStruct.GPIO_Mode = ;3 A* d7 k* b. _& j& P+ Q' u
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;4 g2 y3 ], H; c) V
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; / U+ g" s" @1 h9 ^4 f GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; 0 h5 X& m5 I. s0 J GPIO_Init(GPIOB, &GPIO_InitStruct); / ]& \. q7 D$ p1 ]5 b+ q " \$ b, n" z! Y6 G
/*Configure GPIO pin alternate function */* ?2 E4 o" J4 M9 ^4 p: d* L
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1); $ P; \1 ~ d- a0 h . X7 s8 a/ z# o3 `1 q7 W /*Configure GPIO pin alternate function */, r% g" W* V/ U8 A' r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1); ! y4 M8 z' C( L. z) ?0 F 4 H- \5 a0 I5 s9 I. M) u
1 y( ?! \# J& Y
/** SPI2 GPIO Configuration 1 c. @! ~% P* e& L5 q( K PB12 ------> SPI2_NSS , K/ y4 @/ {, t PB13 ------> SPI2_SCK c. v' r' O! V0 W2 r PB14 ------> SPI2_MISO ' T* r1 ]$ A9 s* U) S. T PB15 ------> SPI2_MOSI( _/ m3 F9 [0 R" A4 c: G
*/ $ {# P9 w: y' w8 H( `1 O3 J2 ~ 7 @( _2 |% }+ C- n: R
" A: ^0 ~9 ?% ?, ^3 R1 B$ L/ D8 q
/*Enable or disable the AHB peripheral clock */ : |+ z# @. w' h; R7 U6 ] RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);+ R4 ?; x( O! b2 u( H
3 {; I, m- I- K- G. \$ B
/ [" r$ @9 J0 {% \% Y% o- T# [( c
//!!! GPIO_Init is commented because some parameters are missing 3 K: z4 r+ }* V$ M& U# F' V GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12;/ y9 F" {/ h0 C
GPIO_InitStruct.GPIO_Mode = ;. `0 R# a6 E; k6 t% S- z
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; # ^. @! I/ i! k1 g GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;1 j& \1 U) m5 w" ~) S; m6 Y
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;' Y) n6 M6 b# b, Y* }2 v7 u
GPIO_Init(GPIOB, &GPIO_InitStruct);- s: X0 W6 C! B" |$ E9 G
" Y, A" ~# f; a* j/ F 5 t5 B2 o# U/ S c# M% n) y, L4 _. N //!!! GPIO_Init is commented because some parameters are missing 6 d. l6 G) U8 T GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13; + Q9 p6 H8 Y- q% s% }3 n GPIO_InitStruct.GPIO_Mode = ; 3 i( c. C6 Z+ V' v GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; 8 a [- B2 T6 O. T ~ GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; ( A5 z) j8 a: G1 O9 Z GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;8 n/ S K& l- Y" o0 n
GPIO_Init(GPIOB, &GPIO_InitStruct); 3 X. h3 f! `5 I2 [2 M B% ` - Y) [+ G" F6 ]* x/ U
4 x2 G/ \+ n( ~% U
//!!! GPIO_Init is commented because some parameters are missing. R# l: Y. j! \& w$ {0 ?
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_14; r! \6 J O8 u6 n; p GPIO_InitStruct.GPIO_Mode = ;) q# V3 n/ A' t( `* ?2 ]2 X
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;! d( p$ O5 o0 c. g
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;/ W! Y( X# M1 S3 N7 w* V; t& `5 S
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; ; ?0 b4 g) ]; Z7 Z! k GPIO_Init(GPIOB, &GPIO_InitStruct);4 L- a& V2 H) S* g: O3 J7 S
# l. r% k0 i: ~ O" ?/ h7 P6 R . A0 q( E5 I3 R3 H" Z9 U" m //!!! GPIO_Init is commented because some parameters are missing ) }( d4 v8 ^& C1 _/ u GPIO_InitStruct.GPIO_Pin = GPIO_Pin_15; / `. P7 T0 c, E$ p$ {7 ~7 v GPIO_InitStruct.GPIO_Mode = ;* T( ^' H: o5 l% C- s G3 b
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; : r) [( U) @) ~" w$ m7 v8 u GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;6 P: r" Z7 a% s, o
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;- p5 O1 ~% ^& `- D" |$ ~
GPIO_Init(GPIOB, &GPIO_InitStruct); # T# _* Q* N5 H, {0 C# B . ~1 x! f [# Y- [3 S& g
/*Configure GPIO pin alternate function */ 9 m% i v% `0 n5 E' V GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_SPI2);5 I" C7 E' Z# u* o/ l
9 ~0 y* {+ i: f! u) Z
/*Configure GPIO pin alternate function */ ; d) W- }" l! ^3 H0 g4 V GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_SPI2); 7 O; Y+ S. {8 w5 D/ l; l0 N : v9 Z/ {8 l0 \2 Y" J( u+ ~/ |
/*Configure GPIO pin alternate function */ - h0 x+ t$ f; m( U3 `- h# U GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_SPI2); ! I3 n3 l1 h+ ^" k7 Q' d ! Y V! {$ L7 p! v/ _& C ~ @! u
/*Configure GPIO pin alternate function */, d4 l, W' a' i: v# B
GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_SPI2); 3 |2 b6 Z* Z# J- ^# P" X1 u K6 z Q ! t; L3 l& G+ I. Y0 Z
3 P. [" u+ ^/ S9 p$ w& E. x /*Enable or disable the AHB peripheral clock */% ~4 o0 N* N5 e7 D* R
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); - ?) [8 K! Z, t o6 ~ + J5 X- c/ L+ D: A8 A' k! z
4 ?# T' j: U$ u, Z9 W //!!! GPIO_Init is commented because some parameters are missing- |% X; c3 ?* I4 x2 P4 g
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;. K4 p- B" R' x9 ?& X0 F$ l( \
GPIO_InitStruct.GPIO_Mode = ; 4 V. n4 y6 m; ? GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; " D% N- a( v; |0 u GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;' J6 o5 \* }! c1 P: ?0 |+ F
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; 2 p) l/ g, }- \4 a T- Q GPIO_Init(GPIOA, &GPIO_InitStruct);2 k0 E0 L q2 e8 u
* h M! E# a U1 D7 L& ^
7 f! h Q |: @' p
//!!! GPIO_Init is commented because some parameters are missing 8 R, o" L; }5 f! L- W% [& y X+ h+ V GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10; 2 Z) A, d2 C9 V; u GPIO_InitStruct.GPIO_Mode = ; / ?( c- V- E E3 z: s GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;6 _6 M, w5 M" V4 [# E2 A
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;7 X" q# a; _* H$ U% p6 [
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; O1 O' y" X% ~& a
GPIO_Init(GPIOA, &GPIO_InitStruct);& j* |; e! l4 g" s3 g: l
+ T+ H: l) `( O$ s! l) l4 m /*Configure GPIO pin alternate function */3 D# U; c$ j! V- ]% e
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1); 1 ?) n3 O2 y }/ f: \2 L- g5 `: a 1 ~3 l- m4 N4 v" H0 ]( `7 L /*Configure GPIO pin alternate function */' t d, f$ f! i
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1);/ u2 V) H0 z8 i( j/ L
1 Y* P% l& M( M6 ?3 z4 f! [2 ?
D5 M- o" h' ^& O0 S2 m n! } /** USB GPIO Configuration 1 Z- K$ e/ d, t. o; [+ b; z PA11 ------> USB_DM L/ q/ F1 B1 q PA12 ------> USB_DP$ [6 }- n+ S+ z& L6 j
*/ 5 x4 U) S1 N' o ! }/ U5 s- S5 f/ h6 R
; q: l5 m1 v8 N; u2 r F. L+ K2 E /*Enable or disable the AHB peripheral clock */( C' D$ _( B& I# O$ z( K6 Z! q i& H
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);7 D3 |# E! ]- l6 r+ l
& |1 a$ A X h+ B7 y
) C/ \$ O' o, \: t! R' w' A4 q //!!! GPIO_Init is commented because some parameters are missing - P, M5 `1 p% s/ I$ R: o X" D' u& P GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11; % U- \+ }8 R9 ]3 @0 f+ R GPIO_InitStruct.GPIO_Mode = ; 5 G1 c& D4 W- N0 F- S* V GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; $ `# }9 z7 l* e! X( s0 p GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; & K! x6 i' O3 h o1 w& P GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;: c: G3 f: d& S2 E1 B
GPIO_Init(GPIOA, &GPIO_InitStruct); % G5 g5 p' E- A5 _3 C9 X& i $ V9 c6 W7 U! O; E . V% m1 D" j- t! G( @ //!!! GPIO_Init is commented because some parameters are missing 4 w4 }, O. ^& X0 H. K) Q GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12; + v) Q; [0 x" j; ]0 J; r GPIO_InitStruct.GPIO_Mode = ;5 h5 r7 {7 Y( G' h* }8 h K( B
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; : J6 J M% W% q3 m0 k/ R GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;# C$ ~3 g# E6 n
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; * e- ^- j4 Q7 Y$ M2 H; K ?7 t GPIO_Init(GPIOA, &GPIO_InitStruct); # c% h. i$ ]% g( F- d& H . r5 ^. e7 C6 } F3 q/ a0 K% R7 }+ ^ /** Configure pins as GPIO 2 j4 P" U5 R: i! f PA8 ------> GPIO_Input6 W) U7 | F! \
*/ - a! ` X: _. D& R! A $ R# \; o6 d3 N: u$ b 4 b- t: r0 C7 ~1 k$ k" }
/*Enable or disable the AHB peripheral clock */" b. C$ S% V S
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);/ G3 Y0 ?7 L# `6 s7 w9 t4 D$ G% u
' N9 y1 a1 ?0 X8 T" _8 _9 L /*Configure GPIO pin */ . b' S. D+ y' h& F4 t& ~- F GPIO_InitStruct.GPIO_Pin = GPIO_Pin_8;! o% h9 h+ Q8 O8 Q
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;6 K& L0 X' V; c
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; 0 t* Q# h1 k! l1 v# u) ~ j1 [( l GPIO_Init(GPIOA, &GPIO_InitStruct);8 M* ]4 z, l3 {$ x! k7 X9 |: |
} % h! ~3 D% j5 Z+ G B, p- b# g# W( |; g1 V
/* USER CODE BEGIN 2 */ 7 I$ a6 Z2 E* P0 z4 O ! [3 H: ^# P0 z; K, D k/* USER CODE END 2 */ 7 u' t' Y5 i+ T4 H
for(i=0; i<4; i++)//R G B 中一个字节对应的发送缓存
{
tmp = (uint8_t)(color &0x00000003);
switch(tmp)
{9 E0 l3 Z) B3 _/ w2 P
case 0x00:( }- j2 X+ J- I" q
*pb = BIT00;
break;
case 0x01:8 ?5 P9 V N$ @9 E4 y% w/ F* o
*pb = BIT01;
break;
case 0x02:* F' f w) x6 X. e' O
*pb = BIT10;
break;7 I1 A: L9 D" u, r% n6 r
case 0x03:
*pb = BIT11;: J4 k0 T- r: e( C, y( o
break;
}4 H" H4 ~8 ]" i
color = color >>2;
pb--;
}
pb += 7;0 W* K$ n7 }6 E+ r5 o; g+ J
}
这样就可以了,在安装目录了里会有一个.jar文件,双击打开即可
RE:ST公司出品【图形化配置工具】
/**# |! k9 F# ^# n: o+ V. L
******************************************************************************$ R7 W6 d8 P1 _. | m
* File Name : mx_gpio.c' a: W( H3 N/ ^) ^' Q5 k
* Date : 03/01/2014 15:37:11$ z' \) R# f; b5 X' ^" _0 F9 v3 i
* Description : This file provides code for the configuration
* of all used GPIO pins.. X1 M4 s' |1 o" ~# M
******************************************************************************
*
* COPYRIGHT 2014 STMicroelectronics
*3 E) r6 `8 @4 R" I0 L; P
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");0 }9 k+ J% L/ c1 E
* You may not use this file except in compliance with the License.) D: a/ t ^0 B9 L/ s$ |* [9 X
* You may obtain a copy of the License at: [+ n! ]6 N% K
*
* http:www.st.com/software_license_agreement_liberty_v2
*
* 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.8 w; O- D) @0 W) }1 N
* See the License for the specific language governing permissions and
* limitations under the License.: m9 A3 ~1 r& J4 E: C8 q& o
*" I4 }% S, R( `' v; x
******************************************************************************# l' S* n& {* m+ f) _/ `
*/) J) n9 b: C6 d- y$ v3 p( U0 G
7 P. I( \3 @5 j) K# X) D
/* Includes ------------------------------------------------------------------*/* M( G6 j8 o/ n; o C8 ]7 O: m5 V
#include "mx_gpio.h"
/* USER CODE BEGIN 0 */' k; g+ I( \: |7 ?
/* USER CODE END 0 */
/*----------------------------------------------------------------------------*/( [- O# C# k% `: X8 o: \
/* Configure GPIO */
/*----------------------------------------------------------------------------*/; V: y1 M8 N( n! s- z
/* USER CODE BEGIN 1 */# @7 s* n4 h7 I# v
8 o% [% v' v# P
/* USER CODE END 1 */6 E- X2 x! [4 m; W }5 i
" ?, j0 Z3 V. B% E. u' L9 s( W* S0 l
void mx_pinout_config(void) {
/* Private typedef ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStruct;
; a, @3 T; w* B
/** ADC GPIO Configuration
PA1 ------> ADC_IN1 Y! `! _2 T& W5 B; v; b
*/) v6 B- O$ o% K, M# q
/*Enable or disable the AHB peripheral clock */ q* c7 a$ e8 C- |: w6 B- z1 E, Y
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
- P4 M- Y( p6 r! m6 z n0 i# m
/*Configure GPIO pin *// _5 h7 @6 P" V' W0 I0 K/ N u
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AN;: T. y. @4 @5 Z& A# l+ A
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;- v0 T% \' B3 s+ k% }8 A6 T/ i6 R0 x
GPIO_Init(GPIOA, &GPIO_InitStruct);9 i2 {0 b4 u+ m( Z7 a9 R- Q- \( |
/** I2C1 GPIO Configuration
PB6 ------> I2C1_SCL
PB7 ------> I2C1_SDA, y; J& b2 v, ^- M7 E' y/ `
*/
/*Enable or disable the AHB peripheral clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);6 h& {1 R' q7 E, H8 B& e( ~( T
7 h6 V9 I+ b6 J9 ]& Q( ?
//!!! GPIO_Init is commented because some parameters are missing4 \. W! H# `. o) w) C
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStruct.GPIO_Mode = ;0 g1 w7 W5 `' {2 U
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;( m" r3 t5 U7 q3 I1 f
GPIO_Init(GPIOB, &GPIO_InitStruct);% t) d9 S+ L- g. p
7 E. K6 H* {. w: P
8 C& U' y2 F+ l* P2 U- r
//!!! GPIO_Init is commented because some parameters are missing! @' t3 w d+ s, x# O
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7;4 Q) M; E, s. p7 D
GPIO_InitStruct.GPIO_Mode = ;3 A* d7 k* b. _& j& P+ Q' u
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;4 g2 y3 ], H; c) V
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;
GPIO_Init(GPIOB, &GPIO_InitStruct);
" \$ b, n" z! Y6 G
/*Configure GPIO pin alternate function */* ?2 E4 o" J4 M9 ^4 p: d* L
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);
/*Configure GPIO pin alternate function */, r% g" W* V/ U8 A' r
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1);
4 H- \5 a0 I5 s9 I. M) u
1 y( ?! \# J& Y
/** SPI2 GPIO Configuration
PB12 ------> SPI2_NSS
PB13 ------> SPI2_SCK
PB14 ------> SPI2_MISO
PB15 ------> SPI2_MOSI( _/ m3 F9 [0 R" A4 c: G
*/
7 @( _2 |% }+ C- n: R
" A: ^0 ~9 ?% ?, ^3 R1 B$ L/ D8 q
/*Enable or disable the AHB peripheral clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);+ R4 ?; x( O! b2 u( H
3 {; I, m- I- K- G. \$ B
/ [" r$ @9 J0 {% \% Y% o- T# [( c
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12;/ y9 F" {/ h0 C
GPIO_InitStruct.GPIO_Mode = ;. `0 R# a6 E; k6 t% S- z
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;1 j& \1 U) m5 w" ~) S; m6 Y
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;' Y) n6 M6 b# b, Y* }2 v7 u
GPIO_Init(GPIOB, &GPIO_InitStruct);- s: X0 W6 C! B" |$ E9 G
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStruct.GPIO_Mode = ;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;8 n/ S K& l- Y" o0 n
GPIO_Init(GPIOB, &GPIO_InitStruct);
- Y) [+ G" F6 ]* x/ U
4 x2 G/ \+ n( ~% U
//!!! GPIO_Init is commented because some parameters are missing. R# l: Y. j! \& w$ {0 ?
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStruct.GPIO_Mode = ;) q# V3 n/ A' t( `* ?2 ]2 X
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;! d( p$ O5 o0 c. g
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;/ W! Y( X# M1 S3 N7 w* V; t& `5 S
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;
GPIO_Init(GPIOB, &GPIO_InitStruct);4 L- a& V2 H) S* g: O3 J7 S
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStruct.GPIO_Mode = ;* T( ^' H: o5 l% C- s G3 b
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;6 P: r" Z7 a% s, o
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;- p5 O1 ~% ^& `- D" |$ ~
GPIO_Init(GPIOB, &GPIO_InitStruct);
. ~1 x! f [# Y- [3 S& g
/*Configure GPIO pin alternate function */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_SPI2);5 I" C7 E' Z# u* o/ l
9 ~0 y* {+ i: f! u) Z
/*Configure GPIO pin alternate function */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_SPI2);
: v9 Z/ {8 l0 \2 Y" J( u+ ~/ |
/*Configure GPIO pin alternate function */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_SPI2);
! Y V! {$ L7 p! v/ _& C ~ @! u
/*Configure GPIO pin alternate function */, d4 l, W' a' i: v# B
GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_SPI2);
! t; L3 l& G+ I. Y0 Z
/** USART1 GPIO Configuration ; b5 |, c- h5 ] j
PA9 ------> USART1_TX4 d3 K$ _* E/ W& \4 h( Z2 }
PA10 ------> USART1_RX
*/6 C7 z9 C0 r5 M5 ~ @5 O
" a6 g% h- Z! `) B; ]+ h( a! U' F
/*Enable or disable the AHB peripheral clock */% ~4 o0 N* N5 e7 D* R
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
+ J5 X- c/ L+ D: A8 A' k! z
//!!! GPIO_Init is commented because some parameters are missing- |% X; c3 ?* I4 x2 P4 g
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;. K4 p- B" R' x9 ?& X0 F$ l( \
GPIO_InitStruct.GPIO_Mode = ;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;' J6 o5 \* }! c1 P: ?0 |+ F
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;
GPIO_Init(GPIOA, &GPIO_InitStruct);2 k0 E0 L q2 e8 u
* h M! E# a U1 D7 L& ^
7 f! h Q |: @' p
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStruct.GPIO_Mode = ;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;6 _6 M, w5 M" V4 [# E2 A
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;7 X" q# a; _* H$ U% p6 [
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz; O1 O' y" X% ~& a
GPIO_Init(GPIOA, &GPIO_InitStruct);& j* |; e! l4 g" s3 g: l
/*Configure GPIO pin alternate function */3 D# U; c$ j! V- ]% e
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_USART1);
/*Configure GPIO pin alternate function */' t d, f$ f! i
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_USART1);/ u2 V) H0 z8 i( j/ L
1 Y* P% l& M( M6 ?3 z4 f! [2 ?
/** USB GPIO Configuration
PA11 ------> USB_DM
PA12 ------> USB_DP$ [6 }- n+ S+ z& L6 j
*/
! }/ U5 s- S5 f/ h6 R
/*Enable or disable the AHB peripheral clock */( C' D$ _( B& I# O$ z( K6 Z! q i& H
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);7 D3 |# E! ]- l6 r+ l
& |1 a$ A X h+ B7 y
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStruct.GPIO_Mode = ;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;: c: G3 f: d& S2 E1 B
GPIO_Init(GPIOA, &GPIO_InitStruct);
//!!! GPIO_Init is commented because some parameters are missing
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStruct.GPIO_Mode = ;5 h5 r7 {7 Y( G' h* }8 h K( B
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;# C$ ~3 g# E6 n
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_400KHz;
GPIO_Init(GPIOA, &GPIO_InitStruct);
/** Configure pins as GPIO
PA8 ------> GPIO_Input6 W) U7 | F! \
*/
4 b- t: r0 C7 ~1 k$ k" }
/*Enable or disable the AHB peripheral clock */" b. C$ S% V S
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);/ G3 Y0 ?7 L# `6 s7 w9 t4 D$ G% u
/*Configure GPIO pin */
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_8;! o% h9 h+ Q8 O8 Q
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;6 K& L0 X' V; c
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStruct);8 M* ]4 z, l3 {$ x! k7 X9 |: |
}
B, p- b# g# W( |; g1 V
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
回复:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
回复:ST公司出品【图形化配置工具】
回复:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】
RE:ST公司出品【图形化配置工具】