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
GitLab 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
fca34934
Commit
fca34934
authored
May 26, 2015
by
Daniel Campora
Browse files
Options
Downloads
Patches
Plain Diff
cc3200: Add make_new method to the RTC, like in stmhal.
parent
5a0c5f8f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cc3200/mods/modpyb.c
+1
-1
1 addition, 1 deletion
cc3200/mods/modpyb.c
cc3200/mods/pybrtc.c
+13
-3
13 additions, 3 deletions
cc3200/mods/pybrtc.c
cc3200/mods/pybrtc.h
+1
-1
1 addition, 1 deletion
cc3200/mods/pybrtc.h
with
15 additions
and
5 deletions
cc3200/mods/modpyb.c
+
1
−
1
View file @
fca34934
...
@@ -266,7 +266,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
...
@@ -266,7 +266,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
#endif
#endif
#if MICROPY_HW_ENABLE_RTC
#if MICROPY_HW_ENABLE_RTC
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_RTC
),
(
mp_obj_t
)
&
pyb_rtc_
obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_RTC
),
(
mp_obj_t
)
&
pyb_rtc_
type
},
#endif
#endif
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Pin
),
(
mp_obj_t
)
&
pin_type
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Pin
),
(
mp_obj_t
)
&
pin_type
},
...
...
This diff is collapsed.
Click to expand it.
cc3200/mods/pybrtc.c
+
13
−
3
View file @
fca34934
...
@@ -71,6 +71,7 @@ typedef struct {
...
@@ -71,6 +71,7 @@ typedef struct {
******************************************************************************/
******************************************************************************/
STATIC
pybrtc_data_t
pybrtc_data
;
STATIC
pybrtc_data_t
pybrtc_data
;
STATIC
const
mp_cb_methods_t
pybrtc_cb_methods
;
STATIC
const
mp_cb_methods_t
pybrtc_cb_methods
;
STATIC
const
mp_obj_base_t
pyb_rtc_obj
=
{
&
pyb_rtc_type
};
/******************************************************************************
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
DECLARE PUBLIC FUNCTIONS
...
@@ -123,6 +124,16 @@ STATIC void pyb_rtc_callback_enable (mp_obj_t self_in) {
...
@@ -123,6 +124,16 @@ STATIC void pyb_rtc_callback_enable (mp_obj_t self_in) {
/******************************************************************************/
/******************************************************************************/
// Micro Python bindings
// Micro Python bindings
/// \classmethod \constructor()
/// Create an RTC object.
STATIC
mp_obj_t
pyb_rtc_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_rtc_obj
;
}
/// \method datetime([datetimetuple])
/// \method datetime([datetimetuple])
/// Get or set the date and time of the RTC.
/// Get or set the date and time of the RTC.
///
///
...
@@ -235,9 +246,10 @@ STATIC const mp_map_elem_t pyb_rtc_locals_dict_table[] = {
...
@@ -235,9 +246,10 @@ STATIC const mp_map_elem_t pyb_rtc_locals_dict_table[] = {
};
};
STATIC
MP_DEFINE_CONST_DICT
(
pyb_rtc_locals_dict
,
pyb_rtc_locals_dict_table
);
STATIC
MP_DEFINE_CONST_DICT
(
pyb_rtc_locals_dict
,
pyb_rtc_locals_dict_table
);
STATIC
const
mp_obj_type_t
pyb_rtc_type
=
{
const
mp_obj_type_t
pyb_rtc_type
=
{
{
&
mp_type_type
},
{
&
mp_type_type
},
.
name
=
MP_QSTR_RTC
,
.
name
=
MP_QSTR_RTC
,
.
make_new
=
pyb_rtc_make_new
,
.
locals_dict
=
(
mp_obj_t
)
&
pyb_rtc_locals_dict
,
.
locals_dict
=
(
mp_obj_t
)
&
pyb_rtc_locals_dict
,
};
};
...
@@ -246,5 +258,3 @@ STATIC const mp_cb_methods_t pybrtc_cb_methods = {
...
@@ -246,5 +258,3 @@ STATIC const mp_cb_methods_t pybrtc_cb_methods = {
.
enable
=
pyb_rtc_callback_enable
,
.
enable
=
pyb_rtc_callback_enable
,
.
disable
=
pyb_rtc_callback_disable
,
.
disable
=
pyb_rtc_callback_disable
,
};
};
const
mp_obj_base_t
pyb_rtc_obj
=
{
&
pyb_rtc_type
};
This diff is collapsed.
Click to expand it.
cc3200/mods/pybrtc.h
+
1
−
1
View file @
fca34934
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define RTC_U16MS_CYCLES(msec) ((msec * 1024) / 1000)
#define RTC_U16MS_CYCLES(msec) ((msec * 1024) / 1000)
#define RTC_CYCLES_U16MS(cycles) ((cycles * 1000) / 1024)
#define RTC_CYCLES_U16MS(cycles) ((cycles * 1000) / 1024)
extern
const
mp_obj_
bas
e_t
pyb_rtc_
obj
;
extern
const
mp_obj_
typ
e_t
pyb_rtc_
type
;
void
pybrtc_init
(
void
);
void
pybrtc_init
(
void
);
void
pyb_rtc_callback_disable
(
mp_obj_t
self_in
);
void
pyb_rtc_callback_disable
(
mp_obj_t
self_in
);
...
...
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