Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unl-ece-keychain
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pscalise2
unl-ece-keychain
Commits
722ca9de
Commit
722ca9de
authored
4 months ago
by
Matthew Boeding
Browse files
Options
Downloads
Patches
Plain Diff
I2C working correctly. Both devices are detected
parent
bce508db
No related branches found
No related tags found
1 merge request
!1
Working LCD bitmaps.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.vscode/launch.json
+4
-4
4 additions, 4 deletions
.vscode/launch.json
Makefile
+1
-1
1 addition, 1 deletion
Makefile
src/main.c
+13
-10
13 additions, 10 deletions
src/main.c
with
18 additions
and
15 deletions
.vscode/launch.json
+
4
−
4
View file @
722ca9de
...
@@ -11,20 +11,20 @@
...
@@ -11,20 +11,20 @@
"targetId"
:
"py32f030x8"
,
"targetId"
:
"py32f030x8"
,
"svdFile"
:
"CMSIS/Device/PY32F0xx/py32f030axx.svd"
,
"svdFile"
:
"CMSIS/Device/PY32F0xx/py32f030axx.svd"
,
"preLaunchTask"
:
"Build"
,
"preLaunchTask"
:
"Build"
,
"showDevDebugOutput"
:
"
none
"
,
"showDevDebugOutput"
:
"
raw
"
,
},
},
{
{
"name"
:
"J-Link"
,
"name"
:
"J-Link"
,
"type"
:
"cortex-debug"
,
"type"
:
"cortex-debug"
,
"request"
:
"launch"
,
"request"
:
"launch"
,
"cwd"
:
"${workspaceRoot}"
,
"cwd"
:
"${workspaceRoot}"
,
"executable"
:
"build
/
${workspaceFolderBasename}.elf"
,
"executable"
:
"
${workspaceRoot}
\\
build
\\
${workspaceFolderBasename}.elf"
,
"servertype"
:
"jlink"
,
"servertype"
:
"jlink"
,
//
"armToolchainPath"
:
"C:
\\
Users
\\
developer
\\
Documents
\\
MBoeding
\\
Development
\\
13.2-Rel1
\\
bin"
,
"device"
:
"py32f030x8"
,
"device"
:
"py32f030x8"
,
//
"device"
:
"Cortex-M0"
,
"svdFile"
:
"CMSIS/Device/PY32F0xx/py32f030axx.svd"
,
"svdFile"
:
"CMSIS/Device/PY32F0xx/py32f030axx.svd"
,
"preLaunchTask"
:
"Build"
,
"preLaunchTask"
:
"Build"
,
"showDevDebugOutput"
:
"
none
"
,
"showDevDebugOutput"
:
"
raw
"
,
}
}
]
]
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Makefile
+
1
−
1
View file @
722ca9de
...
@@ -146,7 +146,7 @@ AS_INCLUDES =
...
@@ -146,7 +146,7 @@ AS_INCLUDES =
# compile gcc flags
# compile gcc flags
ASFLAGS
=
$(
MCU
)
$(
AS_DEFS
)
$(
AS_INCLUDES
)
$(
OPT
)
-Wall
-fdata-sections
-ffunction-sections
ASFLAGS
=
$(
MCU
)
$(
AS_DEFS
)
$(
AS_INCLUDES
)
$(
OPT
)
-Wall
-fdata-sections
-ffunction-sections
CFLAGS
=
$(
MCU
)
$(
C_DEFS
)
$(
C_INCLUDES
)
$(
OPT
)
-Wall
-Wno-maybe-uninitialized
-fdata-sections
-ffunction-sections
CFLAGS
=
$(
MCU
)
$(
C_DEFS
)
$(
C_INCLUDES
)
$(
OPT
)
-Wall
-Wno-maybe-uninitialized
-fdata-sections
-ffunction-sections
-v
ifeq
($(DEBUG), 1)
ifeq
($(DEBUG), 1)
CFLAGS
+=
-g
-gdwarf-2
CFLAGS
+=
-g
-gdwarf-2
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
13
−
10
View file @
722ca9de
#include
<stdio.h>
#include
<stdio.h>
#include
"
py32f0xx.h
"
#include
<
py32f0xx.h
>
#include
<py32f030x8.h>
#include
<py32f030x8.h>
#include
<py32f0xx_hal_gpio.h>
#include
<py32f0xx_hal_gpio.h>
#include
"
py32f0xx_hal_i2c.h
"
#include
<
py32f0xx_hal_i2c.h
>
#include
<py32f0xx_hal_gpio_ex.h>
#include
<py32f0xx_hal_gpio_ex.h>
#include
"
py32f0xx_hal.h
"
#include
<
py32f0xx_hal.h
>
#define DUMMY_REGISTER 0x00
#define DUMMY_REGISTER 0x00
#define I2C_SPEEDCLOCK 100000
/* Communication speed 100K */
#define I2C_SPEEDCLOCK 100000
/* Communication speed 100K */
...
@@ -19,21 +19,24 @@ void SysTick_Handler()
...
@@ -19,21 +19,24 @@ void SysTick_Handler()
}
}
void
GPIO_I2C_Init
(
void
)
{
void
GPIO_I2C_Init
(
void
)
{
__HAL_RCC_I2C_CLK_ENABLE
();
__HAL_RCC_GPIOB_CLK_ENABLE
();
GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
__HAL_RCC_I2C_CLK_ENABLE
();
__HAL_RCC_GPIOB_CLK_ENABLE
();
// Configure SCL (Pin 6)
// Configure SCL (Pin 6)
GPIO_InitStruct
.
Pin
=
GPIO_PIN_6
;
GPIO_InitStruct
.
Pin
=
GPIO_PIN_6
|
GPIO_PIN_7
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_OD
;
// Open Drain for I2C
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_OD
;
// Open Drain for I2C
//
GPIO_InitStruct.Pull = GPIO_PULLUP; // Pull-up resistor
GPIO_InitStruct
.
Pull
=
GPIO_PULLUP
;
// Pull-up resistor
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_VERY_HIGH
;
// High speed
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_VERY_HIGH
;
// High speed
GPIO_InitStruct
.
Alternate
=
GPIO_AF6_I2C
;
HAL_GPIO_Init
(
GPIOB
,
&
GPIO_InitStruct
);
HAL_GPIO_Init
(
GPIOB
,
&
GPIO_InitStruct
);
__HAL_RCC_I2C_FORCE_RESET
();
__HAL_RCC_I2C_RELEASE_RESET
();
// Configure SDA (Pin 7)
// Configure SDA (Pin 7)
GPIO_InitStruct
.
Pin
=
GPIO_PIN_7
;
//
GPIO_InitStruct.Pin = GPIO_PIN_7;
HAL_GPIO_Init
(
GPIOB
,
&
GPIO_InitStruct
);
//
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
}
void
I2C_Init
(
void
)
{
void
I2C_Init
(
void
)
{
...
...
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