Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fleur
firmware
Commits
4c71aad9
Verified
Commit
4c71aad9
authored
Jun 28, 2019
by
Rahix
Browse files
chore: Format
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
546a203c
Changes
6
Hide whitespace changes
Inline
Side-by-side
epicardium/epicardium.h
View file @
4c71aad9
...
...
@@ -12,7 +12,7 @@ API(API_UART_WRITE, void epic_uart_write_str(const char*str, intptr_t length));
#define API_UART_READ 0x2
API
(
API_UART_READ
,
char
epic_uart_read_chr
(
void
));
#define API_LEDS_SET 0x3
#define API_LEDS_SET
0x3
API
(
API_LEDS_SET
,
void
epic_leds_set
(
int
led
,
uint8_t
r
,
uint8_t
g
,
uint8_t
b
));
#endif
/* _EPICARDIUM_H */
epicardium/main.c
View file @
4c71aad9
...
...
@@ -37,7 +37,7 @@ int main(void)
card10_init
();
card10_diag
();
cdcacm_init
();
cdcacm_init
();
printf
(
"Initializing dispatcher ...
\n
"
);
api_dispatcher_init
();
...
...
pycardium/main.c
View file @
4c71aad9
...
...
@@ -2,7 +2,7 @@
#include
"py/gc.h"
#include
"lib/utils/pyexec.h"
static
char
*
stack_top
;
static
char
*
stack_top
;
static
char
heap
[
4096
];
int
main
(
void
)
...
...
@@ -24,9 +24,11 @@ int main(void)
void
gc_collect
(
void
)
{
/* TODO: Replace this with a proper heap implementation */
void
*
dummy
;
void
*
dummy
;
gc_collect_start
();
gc_collect_root
(
&
dummy
,
((
mp_uint_t
)
stack_top
-
(
mp_uint_t
)
&
dummy
)
/
sizeof
(
mp_uint_t
));
gc_collect_root
(
&
dummy
,
((
mp_uint_t
)
stack_top
-
(
mp_uint_t
)
&
dummy
)
/
sizeof
(
mp_uint_t
));
gc_collect_end
();
}
pycardium/modules/leds.c
View file @
4c71aad9
...
...
@@ -11,7 +11,7 @@ static mp_obj_t mp_leds_set(mp_obj_t led_in, mp_obj_t color_in)
if
(
!
mp_obj_is_type
(
color_in
,
&
mp_type_list
))
{
mp_raise_TypeError
(
"color must be a list"
);
}
mp_obj_list_t
*
color
=
MP_OBJ_TO_PTR
(
color_in
);
mp_obj_list_t
*
color
=
MP_OBJ_TO_PTR
(
color_in
);
if
(
color
->
len
<
3
)
{
mp_raise_ValueError
(
"color list must have 3 elements"
);
...
...
@@ -35,7 +35,7 @@ static const mp_rom_map_elem_t leds_module_globals_table[] = {
static
MP_DEFINE_CONST_DICT
(
leds_module_globals
,
leds_module_globals_table
);
const
mp_obj_module_t
leds_module
=
{
.
base
=
{
&
mp_type_module
},
.
base
=
{
&
mp_type_module
},
.
globals
=
(
mp_obj_dict_t
*
)
&
leds_module_globals
,
};
...
...
pycardium/modules/utime.c
View file @
4c71aad9
...
...
@@ -4,10 +4,10 @@
#include
"mxc_delay.h"
static
const
mp_rom_map_elem_t
time_module_globals_table
[]
=
{
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_utime
)},
{
MP_ROM_QSTR
(
MP_QSTR_sleep
),
MP_ROM_PTR
(
&
mp_utime_sleep_obj
)},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_ms
),
MP_ROM_PTR
(
&
mp_utime_sleep_ms_obj
)},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_us
),
MP_ROM_PTR
(
&
mp_utime_sleep_us_obj
)},
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_utime
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep
),
MP_ROM_PTR
(
&
mp_utime_sleep_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_ms
),
MP_ROM_PTR
(
&
mp_utime_sleep_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_us
),
MP_ROM_PTR
(
&
mp_utime_sleep_us_obj
)
},
#if 0
/* TODO: Implement those */
{MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_utime_ticks_ms_obj)},
...
...
@@ -20,7 +20,7 @@ static const mp_rom_map_elem_t time_module_globals_table[] = {
static
MP_DEFINE_CONST_DICT
(
time_module_globals
,
time_module_globals_table
);
const
mp_obj_module_t
mp_module_utime
=
{
.
base
=
{
&
mp_type_module
},
.
base
=
{
&
mp_type_module
},
.
globals
=
(
mp_obj_dict_t
*
)
&
time_module_globals
,
};
...
...
pycardium/mphalport.c
View file @
4c71aad9
...
...
@@ -20,7 +20,7 @@ int mp_hal_stdin_rx_chr(void)
}
/* Send string of given length */
void
mp_hal_stdout_tx_strn
(
const
char
*
str
,
mp_uint_t
len
)
void
mp_hal_stdout_tx_strn
(
const
char
*
str
,
mp_uint_t
len
)
{
epic_uart_write_str
(
str
,
len
);
}
...
...
@@ -43,10 +43,14 @@ void mp_hal_delay_us(mp_uint_t us)
* Fatal Errors
*/
void
NORETURN
nlr_jump_fail
(
void
*
val
)
void
NORETURN
nlr_jump_fail
(
void
*
val
)
{
/* TODO: Report error and restart */
char
msg
[]
=
" >>> nlr_jump_fail <<<
\r\n
"
;
epic_uart_write_str
(
msg
,
sizeof
(
msg
));
while
(
1
)
{
__asm
(
"nop"
);
}
}
...
...
@@ -54,13 +58,13 @@ void NORETURN nlr_jump_fail(void *val)
* Stubs
*/
mp_lexer_t
*
mp_lexer_new_from_file
(
const
char
*
filename
)
mp_lexer_t
*
mp_lexer_new_from_file
(
const
char
*
filename
)
{
/* TODO: Do we need an implementation for this? */
mp_raise_OSError
(
MP_ENOENT
);
}
mp_obj_t
mp_builtin_open
(
size_t
n_args
,
const
mp_obj_t
*
args
,
mp_map_t
*
kwargs
)
mp_obj_t
mp_builtin_open
(
size_t
n_args
,
const
mp_obj_t
*
args
,
mp_map_t
*
kwargs
)
{
/* TODO: Once fs is implemented, get this working as well */
return
mp_const_none
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment