Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r 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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
fecee2b0
Commit
fecee2b0
authored
11 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
Floats work with MP on board; function for LCD pixel manipulation.
parent
e0b18643
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
stm/lcd.c
+13
-2
13 additions, 2 deletions
stm/lcd.c
stm/lcd.h
+1
-0
1 addition, 0 deletions
stm/lcd.h
stm/main.c
+13
-0
13 additions, 0 deletions
stm/main.c
stm/mpyconfig.h
+1
-1
1 addition, 1 deletion
stm/mpyconfig.h
with
28 additions
and
3 deletions
stm/lcd.c
+
13
−
2
View file @
fecee2b0
...
@@ -198,8 +198,8 @@ void lcd_print_strn(const char *str, unsigned int len) {
...
@@ -198,8 +198,8 @@ void lcd_print_strn(const char *str, unsigned int len) {
chr
=
127
;
chr
=
127
;
}
}
const
uint8_t
*
chr_data
=
&
font_petme128_8x8
[(
chr
-
32
)
*
8
];
const
uint8_t
*
chr_data
=
&
font_petme128_8x8
[(
chr
-
32
)
*
8
];
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
lcd_out
(
LCD_DATA
,
chr_data
[
i
]);
lcd_out
(
LCD_DATA
,
chr_data
[
j
]);
}
}
}
}
...
@@ -207,3 +207,14 @@ void lcd_print_strn(const char *str, unsigned int len) {
...
@@ -207,3 +207,14 @@ void lcd_print_strn(const char *str, unsigned int len) {
sys_tick_delay_ms
(
200
);
sys_tick_delay_ms
(
200
);
}
}
}
}
// writes 8 vertical pixels
// pos 0 is upper left, pos 1 is 8 pixels to right of that, pos 128 is 8 pixels below that
void
lcd_draw_pixel_8
(
int
pos
,
int
val
)
{
int
page
=
pos
/
128
;
int
offset
=
pos
-
(
page
*
128
);
lcd_out
(
LCD_INSTR
,
0xb0
|
page
);
// page address set
lcd_out
(
LCD_INSTR
,
0x10
|
((
offset
>>
4
)
&
0x0f
));
// column address set upper
lcd_out
(
LCD_INSTR
,
0x00
|
(
offset
&
0x0f
));
// column address set lower
lcd_out
(
LCD_DATA
,
val
);
// write data
}
This diff is collapsed.
Click to expand it.
stm/lcd.h
+
1
−
0
View file @
fecee2b0
void
lcd_init
(
void
);
void
lcd_init
(
void
);
void
lcd_print_str
(
const
char
*
str
);
void
lcd_print_str
(
const
char
*
str
);
void
lcd_print_strn
(
const
char
*
str
,
unsigned
int
len
);
void
lcd_print_strn
(
const
char
*
str
,
unsigned
int
len
);
void
lcd_draw_pixel_8
(
int
pos
,
int
val
);
This diff is collapsed.
Click to expand it.
stm/main.c
+
13
−
0
View file @
fecee2b0
...
@@ -603,6 +603,13 @@ py_obj_t pyb_rtc_read(void) {
...
@@ -603,6 +603,13 @@ py_obj_t pyb_rtc_read(void) {
return
py_const_none
;
return
py_const_none
;
}
}
py_obj_t
pyb_lcd8
(
py_obj_t
pos
,
py_obj_t
val
)
{
int
pos_val
=
py_get_int
(
pos
);
int
val_val
=
py_get_int
(
val
);
lcd_draw_pixel_8
(
pos_val
,
val_val
);
return
py_const_none
;
}
int
main
(
void
)
{
int
main
(
void
)
{
// TODO disable JTAG
// TODO disable JTAG
...
@@ -673,6 +680,7 @@ soft_reset:
...
@@ -673,6 +680,7 @@ soft_reset:
rt_store_attr
(
m
,
qstr_from_str_static
(
"uout"
),
rt_make_function_1
(
pyb_usart_send
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"uout"
),
rt_make_function_1
(
pyb_usart_send
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"uin"
),
rt_make_function_0
(
pyb_usart_receive
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"uin"
),
rt_make_function_0
(
pyb_usart_receive
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"ustat"
),
rt_make_function_0
(
pyb_usart_status
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"ustat"
),
rt_make_function_0
(
pyb_usart_status
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"lcd8"
),
rt_make_function_2
(
pyb_lcd8
));
rt_store_name
(
qstr_from_str_static
(
"pyb"
),
m
);
rt_store_name
(
qstr_from_str_static
(
"pyb"
),
m
);
}
}
...
@@ -1027,3 +1035,8 @@ soft_reset:
...
@@ -1027,3 +1035,8 @@ soft_reset:
printf
(
"PYB: soft reboot
\n
"
);
printf
(
"PYB: soft reboot
\n
"
);
goto
soft_reset
;
goto
soft_reset
;
}
}
double
__aeabi_f2d
(
float
x
)
{
// TODO
return
0
.
0
;
}
This diff is collapsed.
Click to expand it.
stm/mpyconfig.h
+
1
−
1
View file @
fecee2b0
// options to control how Micro Python is built
// options to control how Micro Python is built
#define MICROPY_ENABLE_FLOAT (
0
)
#define MICROPY_ENABLE_FLOAT (
1
)
#define MICROPY_EMIT_CPYTHON (0)
#define MICROPY_EMIT_CPYTHON (0)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_THUMB (1)
#define MICROPY_EMIT_THUMB (1)
...
...
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