interrupt endpoint works

This commit is contained in:
Firmware Batman
2017-04-27 11:32:14 -07:00
parent 59431408cd
commit 14e5931da9
2 changed files with 18 additions and 3 deletions

View File

@@ -117,18 +117,23 @@ void ICACHE_FLASH_ATTR some_timerfunc(void *arg) {
}
if (i != 0) {
espconn_send(&tcp_conn, buf, i*0x10);
espconn_send(&inter_conn, buf, i*0x10);
}
}
volatile int timer_started = 0;
void ICACHE_FLASH_ATTR inter_connect_cb(void *arg) {
struct espconn *conn = (struct espconn *)arg;
espconn_set_opt(&tcp_conn, ESPCONN_NODELAY);
// setup timer at 200hz
// TODO: disable when it runs out
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
os_timer_arm(&some_timer, 5, 1);
if (!timer_started) {
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
os_timer_arm(&some_timer, 5, 1);
timer_started = 1;
}
}
void ICACHE_FLASH_ATTR wifi_init() {

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python
import os
from panda.lib.panda import Panda
import time
if __name__ == "__main__":
if os.getenv("WIFI") is not None:
@@ -9,3 +10,12 @@ if __name__ == "__main__":
p = Panda()
print p.health()
while 1:
# flood
p.can_send(0xaa, "\xaa"*8, 0)
p.can_send(0xaa, "\xaa"*8, 1)
p.can_send(0xaa, "\xaa"*8, 4)
time.sleep(0.01)
print p.can_recv()