Exemple qui effectue la charge d'un pack de 4 accus NiMH et qui affiche les informations de suivi du processus
#include <stdio.h>
#include <avr/pgmspace.h>
#include <avrio/led.h>
#include <avrio/delay.h>
#include <avrio/task.h>
#include <avrio/mutex.h>
#include <avrio/serial.h>
#include <avrio/term.h>
#include <avrio/battery.h>
#include "avrio-board-battery.h"
#define TEST_BAUDRATE 115200
#define MUTEX_LED 0x80
#define MUTEX_MON 0x40
#define MONITOR_INTERVAL xTaskConvertMs(SECONDS(10))
#define LED_IDLE_INTERVAL xTaskConvertMs(50)
#define LED_PRE_INTERVAL xTaskConvertMs(500)
#define LED_TOPOFF_INTERVAL xTaskConvertMs(250)
#define LED_FAST_INTERVAL xTaskConvertMs(125)
#define LED_TRICKLE_INTERVAL xTaskConvertMs(50)
#define LED_ERROR_INTERVAL xTaskConvertMs(250)
#define LED_ERROR_PULSE (250 / 8)
void
vPrintCurrentCharge (void) {
printf_P (PSTR("Off"));
break;
printf_P (PSTR("Top-Off"));
break;
printf_P (PSTR("Trickle"));
break;
printf_P (PSTR("Fast"));
break;
}
}
void
switch (eState) {
printf_P (PSTR("Low-Bat"));
break;
printf_P (PSTR("Idle"));
break;
printf_P (PSTR("Put-On"));
break;
printf_P (PSTR("Pre-Charge"));
break;
printf_P (PSTR("Top-Off"));
break;
printf_P (PSTR("Trickle"));
break;
printf_P (PSTR("Fast"));
break;
printf_P (PSTR("Error"));
break;
}
}
void
vPrintHeader (void) {
printf_P (PSTR("\nMode\tVBav\tVBmax\n"));
}
static void
}
static void
}
int
main (void) {
eBatState eCurrentState, ePreviousState = -1;
printf_P (PSTR("\nTest unitaire Chargeur batterie\n"));
xTaskMonitor =
xTaskCreate (MONITOR_INTERVAL , prvvTaskMonitor);
xTaskLed =
xTaskCreate (LED_IDLE_INTERVAL, prvvTaskLed);
vPrintHeader();
for (;;) {
if (ePreviousState != eCurrentState) {
ePreviousState = eCurrentState;
printf_P (PSTR("------- Process State Changed ----> "));
vPrintState (eCurrentState);
putchar ('\n');
}
uint8_t ucCount;
switch (eCurrentState) {
break;
break;
break;
break;
break;
for (ucCount = 0; ucCount < 4; ucCount++) {
}
break;
}
}
vPrintCurrentCharge();
printf_P (PSTR("\t%.3f\t%.3f\n"),
}
}
return 0;
}