power_on(): add a delay when powering on.

This allows the PSU to come up before we get step losses if
we step immediately.
This commit is contained in:
Markus Hitter 2011-07-24 19:50:44 +02:00
parent 3b4953a631
commit eb734b173d
1 changed files with 13 additions and 4 deletions

17
pinio.c
View File

@ -1,11 +1,18 @@
#include "pinio.h" #include "pinio.h"
#include "delay.h"
static char ps_is_on = 0;
void power_on() { void power_on() {
#ifdef PS_ON_PIN if (ps_is_on == 0) {
WRITE(PS_ON_PIN, 0); #ifdef PS_ON_PIN
SET_OUTPUT(PS_ON_PIN); WRITE(PS_ON_PIN, 0);
#endif SET_OUTPUT(PS_ON_PIN);
_delay_ms(500);
#endif
ps_is_on = 1;
}
} }
void power_off() { void power_off() {
@ -19,4 +26,6 @@ void power_off() {
#ifdef PS_ON_PIN #ifdef PS_ON_PIN
SET_INPUT(PS_ON_PIN); SET_INPUT(PS_ON_PIN);
#endif #endif
ps_is_on = 0;
} }