Projekte
BirgerT
nibo2_fork#01
nibo2_register.c
Projekte
Forum
Doku
Öffentliche Projekte
Startseite
Beispielprogramme
Projekte von anderen
Welcome
Username
Passwort
Eingeloggt bleiben
Zugangsdaten vergessen?
Registrieren
Projektverwaltung
⇨ Please choose! ⇦
——————————————————
✎ Create new project...
★ Browse existing projects...
——————————————————
⚬ MotorTest#1
⚬ C Tutorial 8#1
⚬ NIBO2 C Project#1
⚙ C Tutorial 15#1
⚬ 2010_11_18_el_test001#1
nibo2_fork#01
BSD_license.h
bt_lib_debugutil.c
bt_lib_debugutil.h
bt_lib_glcd.c
bt_lib_glcd.h
bt_lib_grafix.c
bt_lib_grafix.h
bt_lib_terminal.c
bt_lib_terminal.h
bt_lib_uart.c
bt_lib_uart.h
bt_lib_utils.h
lumpylumpy.h
main.c
nibo2_audio.c
nibo2_audio.h
nibo2_copro.c
nibo2_copro.h
nibo2_copro_cmd.h
nibo2_font.h
nibo2_global.h
nibo2_main_menu.h
nibo2_pwm_leds.c
nibo2_pwm_leds.h
nibo2_register.c
nibo2_register.h
nibo2_sensors.c
nibo2_sensors.h
test_debugutil.h
test_gfx_draw.h
xmas1.h
Project details
Compiler settings
Nachrichten
Sie sind nicht eingeloggt.
Neuigkeiten
★
NiboRoboLib 3.6
2017-01-17: Neue Version 3.6
★
NiboRoboLib 3.4.1
2016-04-16: Neue Version 3.4.1
★
Coding Tutorial
2015-11-22: Jetzt auch für den NIBO burger!
Site-Statistic
7426 private projects
385 public projects
16180353 lines compiled
58212 builds
NIBO
@
nibo2_fork_01/nibo2_register.c [read only]
/****************************************************************** NIBO2 Register ******************************************************************/ // BSD License see "license.h" #include "BSD_license.h" #include "nibo2_register.h" // Makros, Header, etc. #include <util/crc16.h> // ====================================================== REGISTER eep_param_t eep_param; // // ========================================================== INIT // uint8_t register_init(){ // Lokale Variablen uint16_t crc = 0xffff; uint8_t i = sizeof(eep_param) - sizeof(eep_param.eep_crc); uint8_t* bptr = (uint8_t*) &eep_param; // EEPROM Parameter lesen eeprom_read_block(&eep_param, EEP_PARAM_OFS, sizeof(eep_param)); // EEPROM Daten mit CRC prüfen do { crc = _crc16_update(crc, *bptr++); } while (--i != 0); // konnten die Parameter aus dem EEPROM gelesen werden? if (crc == eep_param.eep_crc) { return 1; } // EEPROM Fehler - Lade Defaultwerte else { // uint16_t cal_black[4]; werden nicht überschrieben // uint16_t cal_white[4]; // lieber Variable für Variable setzen, Zeiger zu gefährlich //--------- für die UARTs (siehe bt_lib_uart.h) eep_param.uart0_set = UART0_SET; eep_param.uart1_set = UART1_SET; //--------- PWM Werte für LEDs nach Einschalten eep_param.pwm_leds = PWM_LEDS; eep_param.pwm_head = PWM_HEAD; eep_param.pwm_glcd = PWM_GLCD; //--------- Standard Applikation eep_param.programm = PROGRAMM; eep_param.cntdown = CNTDOWN; //--------- Melodie Nummern eep_param.snd_start = SND_START; eep_param.snd_error = SND_ERROR; eep_param.snd_trip = SND_TRIP; eep_param.snd_ende = SND_ENDE; eep_param.snd_linit = SND_LIMIT; //--------- Odometrie Ticks eep_param.ticks360 = TICKS360; eep_param.ticks_10 = TICKS_10; //--------- Reflexsensor Grenzwerte eep_param.fl_lift = FL_LIFT; eep_param.fl_dark = FL_DARK; eep_param.fl_norm = FL_NORM; //--------- Grenzwerte für Distanzsensoren eep_param.dist_free = DIST_FREE; eep_param.dist_near = DIST_NEAR; eep_param.dist_low = DIST_LOW; //--------- Grenzwerte Strom und Akku eep_param.cur_max = CUR_MAX; eep_param.pow_limit = POW_LIMIT; eep_param.pow_voll = POW_VOLL; //--------- Copro PID Parameter eep_param.co_pid_p = CO_PID_P; eep_param.co_pid_i = CO_PID_I; eep_param.co_pid_d = CO_PID_D; //--------- Checksumme CRC16 //eep_param.eep_crc = 0xffff; // return 0; } } // // ======================================================== UPDATE // // Nibo2 Einstellungen ins EEPROM speichern // void register_update(){ // Lokale Variablen uint16_t crc = 0xffff; uint8_t i = sizeof(eep_param) - sizeof(eep_param.eep_crc); uint8_t* bptr = (uint8_t*) &eep_param; // EEPROM Daten mit CRC prüfen do { crc = _crc16_update(crc, *bptr++); } while (--i != 0); eep_param.eep_crc = crc; // EEPROM Parameter schreiben (mit Update-Makro) eeprom_update_block(&eep_param, EEP_PARAM_OFS, sizeof(eep_param)); } // // ========================================================== SAVE // // Nibo2 Einstellungen ins EEPROM speichern // uint8_t register_save(){ register_update(); return 0; } // // ========================================================== LOAD // // Nibo2 Einstellungen aus EEPROM laden uint8_t register_load(){ eeprom_read_block(&eep_param, EEP_PARAM_OFS, sizeof(eep_param_t)); return 0; }
Compiler results:
Werbung
Online
brittney747920000
romanrendall465571132
warrenhinder6456