Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Miosix Kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Miosix Kernel
Commits
d62c388e
Commit
d62c388e
authored
6 years ago
by
Alvise de'Faveri
Browse files
Options
Downloads
Patches
Plain Diff
[alderaan] Fixed TIM2 initalization
parent
c2a41db2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
miosix/arch/cortexM3_stm32/stm32f103c8_skyward_alderaan/interfaces-impl/bsp.cpp
+9
-6
9 additions, 6 deletions
...tm32/stm32f103c8_skyward_alderaan/interfaces-impl/bsp.cpp
with
9 additions
and
6 deletions
miosix/arch/cortexM3_stm32/stm32f103c8_skyward_alderaan/interfaces-impl/bsp.cpp
+
9
−
6
View file @
d62c388e
...
@@ -63,8 +63,8 @@ void initSPI1()
...
@@ -63,8 +63,8 @@ void initSPI1()
spi1
::
miso
::
mode
(
Mode
::
ALTERNATE
);
spi1
::
miso
::
mode
(
Mode
::
ALTERNATE
);
spi1
::
mosi
::
mode
(
Mode
::
ALTERNATE
);
spi1
::
mosi
::
mode
(
Mode
::
ALTERNATE
);
// Clock
RCC
->
APB2ENR
|=
RCC_APB2ENR_SPI1EN
;
RCC
->
APB2ENR
|=
RCC_APB2ENR_SPI1EN
;
RCC_SYNC
();
SPI1
->
CR1
=
SPI_CR1_SSM
//No HW cs
SPI1
->
CR1
=
SPI_CR1_SSM
//No HW cs
|
SPI_CR1_SSI
|
SPI_CR1_SSI
...
@@ -79,10 +79,10 @@ void initSPI1()
...
@@ -79,10 +79,10 @@ void initSPI1()
void
initCAN1
()
void
initCAN1
()
{
{
using
namespace
interfaces
;
using
namespace
interfaces
;
// CAN1 initialization
can1
::
rx
::
mode
(
Mode
::
ALTERNATE
);
can1
::
rx
::
mode
(
Mode
::
ALTERNATE
);
can1
::
tx
::
mode
(
Mode
::
ALTERNATE
);
can1
::
tx
::
mode
(
Mode
::
ALTERNATE
);
// clock
RCC
->
APB1ENR
|=
RCC_APB1ENR_CAN1EN
;
RCC
->
APB1ENR
|=
RCC_APB1ENR_CAN1EN
;
NVIC_SetPriority
(
CAN1_RX1_IRQn
,
1
);
NVIC_SetPriority
(
CAN1_RX1_IRQn
,
1
);
...
@@ -105,13 +105,14 @@ void initTIM2()
...
@@ -105,13 +105,14 @@ void initTIM2()
/* Prescaler and Reload set to maximum = overflow every 59.6523235555 sec*/
/* Prescaler and Reload set to maximum = overflow every 59.6523235555 sec*/
TIM2
->
PSC
=
0xFFFF
;
TIM2
->
PSC
=
0xFFFF
;
TIM2
->
ARR
=
0xFFFF
;
TIM2
->
ARR
=
0xFFFF
;
/* Enable Counter */
TIM2
->
CR1
|=
TIM_CR1_CEN
;
/* Configure Interupt */
/* Configure Interupt */
TIM2
->
DIER
|=
TIM_DIER_UIE
;
TIM2
->
DIER
|=
TIM_DIER_UIE
;
NVIC_SetPriority
(
TIM2_IRQn
,
0
);
NVIC_SetPriority
(
TIM2_IRQn
,
0
);
NVIC_EnableIRQ
(
TIM2_IRQn
);
NVIC_EnableIRQ
(
TIM2_IRQn
);
/* Enable Counter */
TIM2
->
CR1
|=
TIM_CR1_CEN
;
}
}
...
@@ -148,15 +149,17 @@ void IRQbspInit()
...
@@ -148,15 +149,17 @@ void IRQbspInit()
initCAN1
();
initCAN1
();
initTIM2
();
initTIM2
();
// Uart works only in debug mode
//#ifdef DEBUG
//#ifdef DEBUG
// UART1 initialization
// UART1 initialization
uart1
::
tx
::
mode
(
Mode
::
OUTPUT
);
uart1
::
tx
::
mode
(
Mode
::
OUTPUT
);
uart1
::
rx
::
mode
(
Mode
::
INPUT
);
uart1
::
rx
::
mode
(
Mode
::
INPUT
);
/* No led in this board
_led::mode(Mode::OUTPUT_2MHz);
_led::mode(Mode::OUTPUT_2MHz);
ledOn();
ledOn();
delayMs(100);
delayMs(100);
ledOff
();
ledOff();
*/
DefaultConsole
::
instance
().
IRQset
(
intrusive_ref_ptr
<
Device
>
(
DefaultConsole
::
instance
().
IRQset
(
intrusive_ref_ptr
<
Device
>
(
#ifndef STDOUT_REDIRECTED_TO_DCC
#ifndef STDOUT_REDIRECTED_TO_DCC
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment