diff options
| author | Damien George | 2014-02-15 11:34:50 +0000 |
|---|---|---|
| committer | Damien George | 2014-02-15 11:34:50 +0000 |
| commit | a71c83a1d1aeca1d81d7c673929f8e836dec131e (patch) | |
| tree | 5c49441e19c3feffbc792eec7ecfbc3ca3036830 /stm | |
| parent | 8ac72b9d000ecc48a2d558bdb7c73c7f98d4be62 (diff) | |
Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr. This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/Makefile | 2 | ||||
| -rw-r--r-- | stm/adc.c | 4 | ||||
| -rw-r--r-- | stm/file.c | 2 | ||||
| -rw-r--r-- | stm/i2c.c | 2 | ||||
| -rw-r--r-- | stm/lcd.c | 2 | ||||
| -rw-r--r-- | stm/led.c | 2 | ||||
| -rw-r--r-- | stm/qstrdefsport.h | 3 | ||||
| -rw-r--r-- | stm/sdcard.c | 2 | ||||
| -rw-r--r-- | stm/servo.c | 2 | ||||
| -rw-r--r-- | stm/usart.c | 2 |
10 files changed, 13 insertions, 10 deletions
diff --git a/stm/Makefile b/stm/Makefile index 7229f86e1..5048af382 100644 --- a/stm/Makefile +++ b/stm/Makefile @@ -18,7 +18,7 @@ DFU=../tools/dfu.py CROSS_COMPILE = arm-none-eabi- CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -CFLAGS = -I. -I$(PY_SRC) -I$(CMSIS_DIR) -I$(STMPERIPH_DIR) -I$(STMUSB_DIR) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) $(COPT) +CFLAGS = -I. -I$(PY_SRC) -I$(CMSIS_DIR) -I$(STMPERIPH_DIR) -I$(STMUSB_DIR) -Wall -Werror -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) $(COPT) CFLAGS += -I$(STMUSBD_DIR) CFLAGS += -I$(STMUSBH_DIR) CFLAGS += -I$(FATFS_DIR) @@ -333,7 +333,7 @@ static const mp_method_t adc_all_methods[] = { static const mp_obj_type_t adc_all_type = { { &mp_const_type }, - "ADC_all", + .name = MP_QSTR_ADC, .print = adc_all_print, .methods = adc_all_methods, }; @@ -387,7 +387,7 @@ static const mp_method_t adc_methods[] = { static const mp_obj_type_t adc_type = { { &mp_const_type }, - "ADC", + .name = MP_QSTR_ADC, .print = adc_print, .methods = adc_methods, }; diff --git a/stm/file.c b/stm/file.c index 36658e7a6..f50d3771a 100644 --- a/stm/file.c +++ b/stm/file.c @@ -61,7 +61,7 @@ static const mp_method_t file_methods[] = { static const mp_obj_type_t file_obj_type = { { &mp_const_type }, - "File", + .name = MP_QSTR_File, .print = file_obj_print, .methods = file_methods, }; @@ -336,7 +336,7 @@ static const mp_method_t i2c_methods[] = { static const mp_obj_type_t i2c_obj_type = { { &mp_const_type }, - "I2C", + .name = MP_QSTR_I2C, .print = i2c_obj_print, .methods = i2c_methods, }; @@ -287,7 +287,7 @@ static mp_obj_t pyb_lcd_init(void) { lcd_next_line = 0; // Micro Python interface - mp_obj_t o = mp_obj_new_type("LCD", mp_const_empty_tuple, mp_obj_new_dict(0)); + mp_obj_t o = mp_obj_new_type(MP_QSTR_LCD, mp_const_empty_tuple, mp_obj_new_dict(0)); rt_store_attr(o, qstr_from_str("lcd8"), rt_make_function_n(2, lcd_draw_pixel_8)); rt_store_attr(o, qstr_from_str("clear"), rt_make_function_n(0, lcd_pix_clear)); rt_store_attr(o, qstr_from_str("get"), rt_make_function_n(2, lcd_pix_get)); @@ -149,7 +149,7 @@ static const mp_method_t led_methods[] = { static const mp_obj_type_t led_obj_type = { { &mp_const_type }, - "Led", + .name = MP_QSTR_Led, .print = led_obj_print, .methods = led_methods, }; diff --git a/stm/qstrdefsport.h b/stm/qstrdefsport.h index 4fbcb1e5a..162e659f3 100644 --- a/stm/qstrdefsport.h +++ b/stm/qstrdefsport.h @@ -21,9 +21,12 @@ Q(hid) Q(time) Q(rand) Q(Led) +Q(LCD) Q(Servo) +Q(SDcard) Q(I2C) Q(gpio) Q(Usart) Q(ADC) Q(open) +Q(File) diff --git a/stm/sdcard.c b/stm/sdcard.c index d0ec45a23..c98bab4d9 100644 --- a/stm/sdcard.c +++ b/stm/sdcard.c @@ -203,7 +203,7 @@ static const mp_method_t sdcard_methods[] = { static const mp_obj_type_t sdcard_type = { { &mp_const_type }, - "SDcard", + .name = MP_QSTR_SDcard, .methods = sdcard_methods, }; diff --git a/stm/servo.c b/stm/servo.c index 31d65283b..4b69eefcf 100644 --- a/stm/servo.c +++ b/stm/servo.c @@ -145,7 +145,7 @@ static const mp_method_t servo_methods[] = { static const mp_obj_type_t servo_obj_type = { { &mp_const_type }, - "Servo", + .name = MP_QSTR_Servo, .print = servo_obj_print, .methods = servo_methods, }; diff --git a/stm/usart.c b/stm/usart.c index 306284d5a..e24211a83 100644 --- a/stm/usart.c +++ b/stm/usart.c @@ -243,7 +243,7 @@ static const mp_method_t usart_methods[] = { static const mp_obj_type_t usart_obj_type = { { &mp_const_type }, - "Usart", + .name = MP_QSTR_Usart, .print = usart_obj_print, .methods = usart_methods, }; |
