File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- extern I2C_HandleTypeDef I2cHandle ;
21extern const mp_obj_type_t pyb_accel_type ;
32
43void accel_init (void );
Original file line number Diff line number Diff line change 2626#include "exti.h"
2727#include "usrsw.h"
2828#include "usb.h"
29- #include "rng.h"
3029#include "rtc.h"
3130#include "storage.h"
3231#include "sdcard.h"
3332#include "ff.h"
3433#include "lcd.h"
34+ #include "rng.h"
3535#include "i2c.h"
3636#include "accel.h"
3737#include "servo.h"
@@ -221,28 +221,6 @@ int main(void) {
221221 lcd_init ();
222222#endif
223223
224- #if MICROPY_HW_ENABLE_RNG
225- // RNG
226- rng_init ();
227- #endif
228-
229- #if MICROPY_HW_ENABLE_SERVO
230- // servo
231- servo_init ();
232- #endif
233-
234- #if 0
235- #if MICROPY_HW_ENABLE_TIMER
236- // timer
237- timer_init ();
238- #endif
239- #endif
240-
241- #if MICROPY_HW_ENABLE_DAC
242- // DAC
243- dac_init ();
244- #endif
245-
246224 pin_map_init ();
247225
248226 // check if user switch held (initiates reset of filesystem)
@@ -376,13 +354,36 @@ int main(void) {
376354 pyb_usb_dev_init (USBD_DEVICE_CDC_MSC , usbd_medium_kind );
377355#endif
378356
357+ #if MICROPY_HW_ENABLE_RNG
358+ // RNG
359+ rng_init ();
360+ #endif
361+
362+ // I2C
379363 i2c_init ();
380364
381365#if MICROPY_HW_HAS_MMA7660
382366 // MMA accel: init and reset
383367 accel_init ();
384368#endif
385369
370+ #if MICROPY_HW_ENABLE_SERVO
371+ // servo
372+ servo_init ();
373+ #endif
374+
375+ #if 0
376+ #if MICROPY_HW_ENABLE_TIMER
377+ // timer
378+ timer_init ();
379+ #endif
380+ #endif
381+
382+ #if MICROPY_HW_ENABLE_DAC
383+ // DAC
384+ dac_init ();
385+ #endif
386+
386387 // run main script
387388 {
388389 vstr_t * vstr = vstr_new ();
Original file line number Diff line number Diff line change @@ -253,13 +253,6 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
253253 { MP_OBJ_NEW_QSTR (MP_QSTR_SD ), (mp_obj_t )& pyb_sdcard_obj },
254254#endif
255255
256- #if MICROPY_HW_HAS_MMA7660
257- { MP_OBJ_NEW_QSTR (MP_QSTR_Accel ), (mp_obj_t )& pyb_accel_type },
258- #endif
259-
260- #if 0
261- { MP_OBJ_NEW_QSTR (MP_QSTR_hid ), (mp_obj_t )& pyb_hid_send_report_obj },
262- #endif
263256 { MP_OBJ_NEW_QSTR (MP_QSTR_Led ), (mp_obj_t )& pyb_led_type },
264257 { MP_OBJ_NEW_QSTR (MP_QSTR_I2C ), (mp_obj_t )& pyb_i2c_type },
265258 { MP_OBJ_NEW_QSTR (MP_QSTR_Usart ), (mp_obj_t )& pyb_Usart_obj },
@@ -271,6 +264,14 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
271264 { MP_OBJ_NEW_QSTR (MP_QSTR_DAC ), (mp_obj_t )& pyb_dac_type },
272265#endif
273266
267+ #if MICROPY_HW_HAS_MMA7660
268+ { MP_OBJ_NEW_QSTR (MP_QSTR_Accel ), (mp_obj_t )& pyb_accel_type },
269+ #endif
270+
271+ #if 0
272+ { MP_OBJ_NEW_QSTR (MP_QSTR_hid ), (mp_obj_t )& pyb_hid_send_report_obj },
273+ #endif
274+
274275 // input
275276 { MP_OBJ_NEW_QSTR (MP_QSTR_input ), (mp_obj_t )& pyb_input_obj },
276277
You can’t perform that action at this time.
0 commit comments