aboutsummaryrefslogtreecommitdiff
path: root/stm
diff options
context:
space:
mode:
authorDamien George2014-01-05 15:54:51 -0800
committerDamien George2014-01-05 15:54:51 -0800
commit73595feb75d36501a5b1fdea979357b2b6863fc2 (patch)
tree587493638de524c046b54852bab63459478feb77 /stm
parent6b0b4a0cad348813f54d1395cee5fe77ea38dad0 (diff)
parent860ffb0a4365bba62cbd692392375df9fd4a72e7 (diff)
Merge pull request #89 from pfalcon/c99-tagged-structs
Convert many object types structs to use C99 tagged initializer syntax.
Diffstat (limited to 'stm')
-rw-r--r--stm/i2c.c10
-rw-r--r--stm/led.c10
-rw-r--r--stm/main.c2
-rw-r--r--stm/servo.c10
4 files changed, 7 insertions, 25 deletions
diff --git a/stm/i2c.c b/stm/i2c.c
index 3f29f02c0..9e25ff983 100644
--- a/stm/i2c.c
+++ b/stm/i2c.c
@@ -329,14 +329,8 @@ static MP_DEFINE_CONST_FUN_OBJ_1(i2c_obj_stop_obj, i2c_obj_stop);
static const mp_obj_type_t i2c_obj_type = {
{ &mp_const_type },
"I2C",
- i2c_obj_print, // print
- NULL, // make_new
- NULL, // call_n
- NULL, // unary_op
- NULL, // binary_op
- NULL, // getiter
- NULL, // iternext
- { // method list
+ .print = i2c_obj_print,
+ .methods = {
{ "start", &i2c_obj_start_obj },
{ "write", &i2c_obj_write_obj },
{ "read", &i2c_obj_read_obj },
diff --git a/stm/led.c b/stm/led.c
index 1692eaea7..9809c2177 100644
--- a/stm/led.c
+++ b/stm/led.c
@@ -179,14 +179,8 @@ static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
static const mp_obj_type_t led_obj_type = {
{ &mp_const_type },
"Led",
- led_obj_print, // print
- NULL, // make_new
- NULL, // call_n
- NULL, // unary_op
- NULL, // binary_op
- NULL, // getiter
- NULL, // iternext
- { // method list
+ .print = led_obj_print,
+ .methods = {
{ "on", &led_obj_on_obj },
{ "off", &led_obj_off_obj },
{ NULL, NULL },
diff --git a/stm/main.c b/stm/main.c
index 2121742fd..07c974eff 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -699,7 +699,7 @@ static const mp_obj_type_t file_obj_type = {
NULL, // binary_op
NULL, // getiter
NULL, // iternext
- { // method list
+ .methods = {
{ "read", &file_obj_read_obj },
{ "write", &file_obj_write_obj },
{ "close", &file_obj_close_obj },
diff --git a/stm/servo.c b/stm/servo.c
index 1e31db514..31190ce79 100644
--- a/stm/servo.c
+++ b/stm/servo.c
@@ -140,14 +140,8 @@ static MP_DEFINE_CONST_FUN_OBJ_2(servo_obj_angle_obj, servo_obj_angle);
static const mp_obj_type_t servo_obj_type = {
{ &mp_const_type },
"Servo",
- servo_obj_print, // print
- NULL, // make_new
- NULL, // call_n
- NULL, // unary_op
- NULL, // binary_op
- NULL, // getiter
- NULL, // iternext
- { // method list
+ .print = servo_obj_print,
+ .methods = {
{ "angle", &servo_obj_angle_obj },
{ NULL, NULL },
}