/** * Initialisation des differents capteurs et du bluetooth */ void init(void) { nx_display_clear(); nx_display_cursor_set_pos(0, 0); nx_display_string("Lo52 project\n"); nx_display_cursor_set_pos(0, 2); //on affiche le niveau de la batterie nx_display_uint(nx_avr_get_battery_voltage()); nx_display_cursor_set_pos(4, 2); nx_display_string("/4000\n"); nx_systick_install_scheduler(watchdog); // initialise le radar ultrason nx_radar_init(RADAR_SENSOR); //initialise le bluetooth bt_init(); nx_display_string("bluetooth...OK"); //initialise le son nx__sound_init(); // initialise le capteur de contact nx_sensors_analog_enable(TOUCH_SENSOR); //initialise le capteur de luminosité nx_sensors_analog_enable(LIGHT_SENSOR); nx_sensors_analog_digi_set(LIGHT_SENSOR, DIGI0); }
void tests_sysinfo(void) { U32 i; U32 t = 0; const U32 display_seconds = 15; U8 avr_major, avr_minor; hello(); nx_avr_get_version(&avr_major, &avr_minor); for (i=0; i<(display_seconds*4); i++) { if (i % 4 == 0) t = nx_systick_get_ms(); nx_display_clear(); nx_display_cursor_set_pos(0,0); nx_display_string("- System info -\n" "----------------\n"); nx_display_string("Time : "); nx_display_uint(t); nx_display_end_line(); nx_display_string("Boot from "); if (NX_BOOT_FROM_SAMBA) nx_display_string("SAM-BA"); else if (NX_BOOT_FROM_ENH_FW) nx_display_string("ENH-FW"); else nx_display_string("ROM"); nx_display_end_line(); nx_display_string("Free RAM: "); nx_display_uint(NX_USERSPACE_SIZE); nx_display_end_line(); nx_display_string("Buttons: "); nx_display_uint(nx_avr_get_button()); nx_display_end_line(); nx_display_string("Battery: "); nx_display_uint(nx_avr_get_battery_voltage()); nx_display_string(" mV"); nx_display_end_line(); nx_systick_wait_ms(250); } goodbye(); }