diff options
author | jaseg <git@jaseg.net> | 2018-11-14 09:39:43 +0900 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2018-11-14 09:39:43 +0900 |
commit | 9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915 (patch) | |
tree | cc85ad5f592b460f57471a3741d2ddeee6103912 /src/demo.c | |
parent | 370301e06da15aada3772461d9f96d50d87475ca (diff) | |
download | secure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.tar.gz secure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.tar.bz2 secure-hid-9249e792a1cc7ef6d04fa6a8eba6bd9bbc066915.zip |
GUI pairing working as it should
Diffstat (limited to 'src/demo.c')
-rw-r--r-- | src/demo.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -61,8 +61,8 @@ static uint8_t remote_key_reference[CURVE25519_KEY_LEN]; void _fini(void);
-static inline void delay_ms_busy_loop(uint32_t ms) {
- for (volatile uint32_t i = 0; i < 14903*ms; i++);
+static inline void delay(uint32_t n) {
+ for (volatile uint32_t i = 0; i < 1490*n; i++);
}
@@ -414,10 +414,16 @@ int main(void) if (generate_identity_key(&noise_state))
LOG_PRINTF("Error generating identiy key\n");
+ int poll_ctr = 0;
while (23) {
- TRACING_SET(TR_USBH_POLL);
- usbh_poll(tim6_get_time_us());
- TRACING_CLEAR(TR_USBH_POLL);
+ delay(1);
+
+ if (++poll_ctr == 10) {
+ poll_ctr = 0;
+ TRACING_SET(TR_USBH_POLL);
+ usbh_poll(tim6_get_time_us());
+ TRACING_CLEAR(TR_USBH_POLL);
+ }
TRACING_SET(TR_HOST_PKT_HANDLER);
if (host_packet_length > 0) {
|