summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/eeprom.avr.c
diff options
context:
space:
mode:
authorJérémy Dufour2009-05-08 17:17:44 +0200
committerJérémy Dufour2009-05-08 17:17:44 +0200
commit73c73c4a2c56ce76299c7a0631d4e1c3bae9b720 (patch)
tree3f1f6350e6894b541363433ed1382694b06098a4 /digital/io/src/eeprom.avr.c
parent79456a7d1b2116fc8f50b82bd73b877cf8ef1bdf (diff)
* digital/io:
- remove the old trap module (for the position of the servo motors), - add a new module for the position of the servo motors, - increase number of servo motors supported, - new version of eeprom data structure.
Diffstat (limited to 'digital/io/src/eeprom.avr.c')
-rw-r--r--digital/io/src/eeprom.avr.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/digital/io/src/eeprom.avr.c b/digital/io/src/eeprom.avr.c
index 04aa2b7a..4e4eff39 100644
--- a/digital/io/src/eeprom.avr.c
+++ b/digital/io/src/eeprom.avr.c
@@ -27,7 +27,7 @@
#include "eeprom.h"
#include "servo.h" /* SERVO_NUMBER */
-#include "trap.h" /* trap_high_time_pos */
+#include "servo_pos.h"
#include "sharp.h" /* sharp_threshold */
#include <avr/eeprom.h> /* eeprom_{read,write}_byte */
@@ -48,7 +48,7 @@
* @warning: you must update this value every time you change the structure of
* data stored into the EEPROM.
*/
-#define EEPROM_PARAM_KEY 0x04
+#define EEPROM_PARAM_KEY 0x05
/** @} */
@@ -57,6 +57,7 @@ void
eeprom_load_param ()
{
uint8_t compt;
+ uint8_t pos;
uint16_t *ptr16;
/* The parameters start at the given address */
@@ -66,12 +67,11 @@ eeprom_load_param ()
/* Error, stop here */
return;
- /* Load trap module data */
- /* Extreme position of the servos motor (high time value of the PWM) */
+ /* Load servo pos module data */
for (compt = 0; compt < SERVO_NUMBER; compt++)
{
- trap_high_time_pos[0][compt] = eeprom_read_byte(ptr8++);
- trap_high_time_pos[1][compt] = eeprom_read_byte(ptr8++);
+ for (pos = 0; pos < SERVO_POS_NUMBER; pos++)
+ servo_pos_high_time[compt][pos] = eeprom_read_byte(ptr8++);
}
/* Load sharp module data */
@@ -88,7 +88,7 @@ eeprom_load_param ()
void
eeprom_save_param ()
{
- uint8_t compt;
+ uint8_t compt, pos;
uint16_t *ptr16;
/* The parameters start at the given address */
@@ -96,12 +96,11 @@ eeprom_save_param ()
/* Store the key */
eeprom_write_byte (ptr8++, EEPROM_PARAM_KEY);
- /* Store trap module data */
- /* Extreme position of the servos motor (high time value of the PWM) */
+ /* Store servo pos module data */
for (compt = 0; compt < SERVO_NUMBER; compt++)
{
- eeprom_write_byte (ptr8++, trap_high_time_pos[0][compt]);
- eeprom_write_byte (ptr8++, trap_high_time_pos[1][compt]);
+ for (pos = 0; pos < SERVO_POS_NUMBER; pos++)
+ eeprom_write_byte (ptr8++, servo_pos_high_time[compt][pos]);
}
/* Store sharp module data */