Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
bcc9298e
Commit
bcc9298e
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal: Add TODO's to exti.c; fix delay in lcd.c.
parent
c63f9846
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
stmhal/exti.c
+3
-0
3 additions, 0 deletions
stmhal/exti.c
stmhal/lcd.c
+8
-3
8 additions, 3 deletions
stmhal/lcd.c
with
11 additions
and
3 deletions
stmhal/exti.c
+
3
−
0
View file @
bcc9298e
...
@@ -66,6 +66,8 @@
...
@@ -66,6 +66,8 @@
// There is also a C API, so that drivers which require EXTI interrupt lines
// There is also a C API, so that drivers which require EXTI interrupt lines
// can also use this code. See exti.h for the available functions and
// can also use this code. See exti.h for the available functions and
// usrsw.h for an example of using this.
// usrsw.h for an example of using this.
//
// TODO Add python method to change callback object.
#define EXTI_OFFSET (EXTI_BASE - PERIPH_BASE)
#define EXTI_OFFSET (EXTI_BASE - PERIPH_BASE)
...
@@ -302,6 +304,7 @@ void Handle_EXTI_Irq(uint32_t line) {
...
@@ -302,6 +304,7 @@ void Handle_EXTI_Irq(uint32_t line) {
if
(
line
<
EXTI_NUM_VECTORS
)
{
if
(
line
<
EXTI_NUM_VECTORS
)
{
exti_vector_t
*
v
=
&
exti_vector
[
line
];
exti_vector_t
*
v
=
&
exti_vector
[
line
];
if
(
v
->
callback_obj
!=
mp_const_none
)
{
if
(
v
->
callback_obj
!=
mp_const_none
)
{
// TODO need to wrap this in an nlr_buf; really need a general function for this
rt_call_function_1
(
v
->
callback_obj
,
MP_OBJ_NEW_SMALL_INT
(
line
));
rt_call_function_1
(
v
->
callback_obj
,
MP_OBJ_NEW_SMALL_INT
(
line
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
stmhal/lcd.c
+
8
−
3
View file @
bcc9298e
#include
<stdio.h>
#include
<string.h>
#include
<string.h>
#include
<stm32f4xx_hal.h>
#include
<stm32f4xx_hal.h>
...
@@ -59,8 +60,12 @@
...
@@ -59,8 +60,12 @@
#define LCD_INSTR (0)
#define LCD_INSTR (0)
#define LCD_DATA (1)
#define LCD_DATA (1)
static
void
lcd_delay
(
void
)
{
__asm
volatile
(
"nop
\n
nop"
);
}
static
void
lcd_out
(
int
instr_data
,
uint8_t
i
)
{
static
void
lcd_out
(
int
instr_data
,
uint8_t
i
)
{
HAL_D
elay
(
0
);
lcd_d
elay
();
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_CS1_PIN
;
// CS=0; enable
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_CS1_PIN
;
// CS=0; enable
if
(
instr_data
==
LCD_INSTR
)
{
if
(
instr_data
==
LCD_INSTR
)
{
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_A0_PIN
;
// A0=0; select instr reg
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_A0_PIN
;
// A0=0; select instr reg
...
@@ -69,7 +74,7 @@ static void lcd_out(int instr_data, uint8_t i) {
...
@@ -69,7 +74,7 @@ static void lcd_out(int instr_data, uint8_t i) {
}
}
// send byte bigendian, latches on rising clock
// send byte bigendian, latches on rising clock
for
(
uint32_t
n
=
0
;
n
<
8
;
n
++
)
{
for
(
uint32_t
n
=
0
;
n
<
8
;
n
++
)
{
HAL_D
elay
(
0
);
lcd_d
elay
();
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_SCL_PIN
;
// SCL=0
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_SCL_PIN
;
// SCL=0
if
((
i
&
0x80
)
==
0
)
{
if
((
i
&
0x80
)
==
0
)
{
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_SI_PIN
;
// SI=0
PYB_LCD_PORT
->
BSRRH
=
PYB_LCD_SI_PIN
;
// SI=0
...
@@ -77,7 +82,7 @@ static void lcd_out(int instr_data, uint8_t i) {
...
@@ -77,7 +82,7 @@ static void lcd_out(int instr_data, uint8_t i) {
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_SI_PIN
;
// SI=1
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_SI_PIN
;
// SI=1
}
}
i
<<=
1
;
i
<<=
1
;
HAL_D
elay
(
0
);
lcd_d
elay
();
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_SCL_PIN
;
// SCL=1
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_SCL_PIN
;
// SCL=1
}
}
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_CS1_PIN
;
// CS=1; disable
PYB_LCD_PORT
->
BSRRL
=
PYB_LCD_CS1_PIN
;
// CS=1; disable
...
...
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