Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
6148f8b7
Commit
6148f8b7
authored
Jun 09, 2015
by
Daniel Campora
Browse files
cc3200: Add contructor to the HeartBeat class.
parent
76285469
Changes
3
Hide whitespace changes
Inline
Side-by-side
cc3200/misc/mperror.c
View file @
6148f8b7
...
...
@@ -32,6 +32,7 @@
#include
"py/mpconfig.h"
#include MICROPY_HAL_H
#include
"py/obj.h"
#include
"py/runtime.h"
#include
"hw_ints.h"
#include
"hw_types.h"
#include
"hw_gpio.h"
...
...
@@ -63,6 +64,8 @@
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
STATIC
const
mp_obj_base_t
pyb_heartbeat_obj
=
{
&
pyb_heartbeat_type
};
struct
mperror_heart_beat
{
uint32_t
off_time
;
uint32_t
on_time
;
...
...
@@ -198,6 +201,17 @@ void nlr_jump_fail(void *val) {
/******************************************************************************/
// Micro Python bindings
/// \classmethod \constructor()
///
/// Return the heart beat object
STATIC
mp_obj_t
pyb_heartbeat_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
// check arguments
mp_arg_check_num
(
n_args
,
n_kw
,
0
,
0
,
false
);
// return constant object
return
(
mp_obj_t
)
&
pyb_heartbeat_obj
;
}
/// \function enable()
/// Enables the heartbeat signal
STATIC
mp_obj_t
pyb_enable_heartbeat
(
mp_obj_t
self
)
{
...
...
@@ -220,11 +234,11 @@ STATIC const mp_map_elem_t pyb_heartbeat_locals_dict_table[] = {
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_heartbeat_locals_dict
,
pyb_heartbeat_locals_dict_table
);
static
const
mp_obj_type_t
pyb_heartbeat_type
=
{
const
mp_obj_type_t
pyb_heartbeat_type
=
{
{
&
mp_type_type
},
.
name
=
MP_QSTR_HeartBeat
,
.
make_new
=
pyb_heartbeat_make_new
,
.
locals_dict
=
(
mp_obj_t
)
&
pyb_heartbeat_locals_dict
,
};
const
mp_obj_base_t
pyb_heartbeat_obj
=
{
&
pyb_heartbeat_type
};
#endif
cc3200/misc/mperror.h
View file @
6148f8b7
...
...
@@ -29,7 +29,7 @@
#define MPERROR_H_
#ifndef BOOTLOADER
extern
const
mp_obj_
bas
e_t
pyb_heartbeat_
obj
;
extern
const
mp_obj_
typ
e_t
pyb_heartbeat_
type
;
#endif
extern
void
NORETURN
__fatal_error
(
const
char
*
msg
);
...
...
cc3200/mods/modpyb.c
View file @
6148f8b7
...
...
@@ -287,7 +287,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Timer
),
(
mp_obj_t
)
&
pyb_timer_type
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_WDT
),
(
mp_obj_t
)
&
pyb_wdt_type
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Sleep
),
(
mp_obj_t
)
&
pyb_sleep_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_HeartBeat
),
(
mp_obj_t
)
&
pyb_heartbeat_
obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_HeartBeat
),
(
mp_obj_t
)
&
pyb_heartbeat_
type
},
#if MICROPY_HW_HAS_SDCARD
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_SD
),
(
mp_obj_t
)
&
pyb_sd_type
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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