summaryrefslogtreecommitdiffstats
path: root/fpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fpm.c')
-rw-r--r--fpm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fpm.c b/fpm.c
index 550a103..44f8b4c 100644
--- a/fpm.c
+++ b/fpm.c
@@ -43,7 +43,7 @@ static inline void send(uint8_t pktid, uint8_t *data, uint8_t n)
write_bulk(addr, 4);
write(pktid);
- pktlen = n + 2;
+ pktlen = n + 3;
write((uint8_t)(pktlen >> 8));
write((uint8_t)pktlen);
@@ -123,8 +123,22 @@ static inline uint8_t check_pwd(void)
buf[4] = (uint8_t)((uint32_t)FPM_PWD & 0xFF);
send(0x01, buf, 5);
+ recv(buf, &n);
+ return buf[0] == OK;
+}
+
+static inline void uint8_t aura_on(void)
+{
+ unsigned int n;
+ uint8_t buf[MAXPDLEN];
+
+ buf[0] = 0x35;
+ buf[1] = 0x01;
+ buf[2] = 0x00;
+ buf[3] = 0x01;
+ buf[4] = 0x00;
- n = 0;
+ send(0x01, buf, 5);
recv(buf, &n);
return buf[0] == OK;
}
@@ -142,6 +156,7 @@ uint8_t fpm_init(void)
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
_delay_ms(RST_DELAY_MS);
+ aura_on();
return check_pwd();
}