Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Huebler
firmware
Commits
6b956ce0
Verified
Commit
6b956ce0
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
chore(epicardium): Move hw-init into hardware.c
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
e9fbd11d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/main.c
+3
-57
3 additions, 57 deletions
epicardium/main.c
epicardium/modules/hardware.c
+66
-0
66 additions, 0 deletions
epicardium/modules/hardware.c
with
69 additions
and
57 deletions
epicardium/main.c
+
3
−
57
View file @
6b956ce0
#include
<stdio.h>
#include
<stdlib.h>
#include
<ff.h>
#include
"max32665.h"
#include
"uart.h"
#include
"cdcacm.h"
#include
"gpio.h"
#include
"card10.h"
#include
"pmic.h"
#include
"leds.h"
#include
"api/dispatcher.h"
#include
"modules/modules.h"
#include
"modules/log.h"
#include
"modules/stream.h"
#include
"modules/filesystem.h"
#include
"api/interrupt-sender.h"
#include
"gfx.h"
#include
"display.h"
#include
"card10-version.h"
#include
"FreeRTOS.h"
#include
"task.h"
#include
<stdlib.h>
TaskHandle_t
dispatcher_task_id
;
void
vBleTask
(
void
*
pvParameters
);
...
...
@@ -34,41 +16,9 @@ int main(void)
LOG_INFO
(
"startup"
,
"Epicardium startup ..."
);
LOG_INFO
(
"startup"
,
"Version "
CARD10_VERSION
);
LOG_INFO
(
"startup"
,
"Initializing hardware ..."
);
hardware_early_init
();
#ifdef CARD10_DEBUG_CORE1
LOG_WARN
(
"startup"
,
"Core 1 Debugger Mode"
);
static
const
gpio_cfg_t
swclk
=
{
PORT_0
,
PIN_7
,
GPIO_FUNC_ALT3
,
GPIO_PAD_NONE
,
};
static
const
gpio_cfg_t
swdio
=
{
PORT_0
,
PIN_6
,
GPIO_FUNC_ALT3
,
GPIO_PAD_NONE
,
};
GPIO_Config
(
&
swclk
);
GPIO_Config
(
&
swdio
);
#endif
/* CARD10_DEBUG_CORE1 */
/* TODO: Move this to its own function */
SCB
->
SCR
|=
SCB_SCR_SEVONPEND_Msk
;
if
(
cdcacm_init
()
<
0
)
{
LOG_ERR
(
"startup"
,
"USB-Serial unavailable"
);
}
fatfs_init
();
api_interrupt_init
();
stream_init
();
LOG_INFO
(
"startup"
,
"Initializing dispatcher ..."
);
api_dispatcher_init
();
LOG_INFO
(
"startup"
,
"Initializing tasks ..."
);
/* Serial */
...
...
@@ -123,10 +73,6 @@ int main(void)
abort
();
}
/* light sensor */
LOG_INFO
(
"startup"
,
"starting light sensor ..."
);
epic_light_sensor_run
();
/* Lifecycle */
if
(
xTaskCreate
(
vLifecycleTask
,
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/hardware.c
+
66
−
0
View file @
6b956ce0
#include
"epicardium.h"
#include
"api/dispatcher.h"
#include
"api/interrupt-sender.h"
#include
"cdcacm.h"
#include
"modules/filesystem.h"
#include
"modules/log.h"
#include
"modules/modules.h"
#include
"modules/stream.h"
#include
"card10.h"
...
...
@@ -10,6 +18,60 @@
int
hardware_early_init
(
void
)
{
card10_init
();
#ifdef CARD10_DEBUG_CORE1
/*
* The SAO pins can be reconfigured for SWCLK2 and SWDIO2 which allows
* debugging core 1. This feature can optionally be enabled at
* compile-time.
*/
LOG_WARN
(
"init"
,
"Core 1 Debugger Mode"
);
static
const
gpio_cfg_t
swclk
=
{
PORT_0
,
PIN_7
,
GPIO_FUNC_ALT3
,
GPIO_PAD_NONE
,
};
static
const
gpio_cfg_t
swdio
=
{
PORT_0
,
PIN_6
,
GPIO_FUNC_ALT3
,
GPIO_PAD_NONE
,
};
GPIO_Config
(
&
swclk
);
GPIO_Config
(
&
swdio
);
#endif
/* CARD10_DEBUG_CORE1 */
/*
* Enable SEV-ON-PEND which is needed for proper working of the FreeRTOS
* tickless idle sleep in Epicardium.
*/
SCB
->
SCR
|=
SCB_SCR_SEVONPEND_Msk
;
/*
* USB-Serial
*/
if
(
cdcacm_init
()
<
0
)
{
LOG_ERR
(
"init"
,
"USB-Serial unavailable"
);
}
/*
* Flash & FatFS
*/
fatfs_init
();
/*
* API Dispatcher & API Interrupts
*/
api_interrupt_init
();
api_dispatcher_init
();
/*
* Sensor streams
*/
stream_init
();
return
0
;
}
...
...
@@ -23,6 +85,10 @@ int hardware_early_init(void)
*/
int
hardware_init
(
void
)
{
/* Light Sensor */
LOG_INFO
(
"init"
,
"Starting light sensor ..."
);
epic_light_sensor_run
();
return
0
;
}
...
...
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