Sony's LANC camera control protocol project.
Dependencies: aconno_LANC aconno_bsp aconno_SEGGER_RTT
Diff: main.cpp
- Revision:
- 3:eb5b87baf6cf
- Parent:
- 2:b28027b9c099
- Child:
- 4:6560e2966186
--- a/main.cpp Wed Nov 01 11:53:16 2017 +0000 +++ b/main.cpp Wed Nov 01 12:13:07 2017 +0000 @@ -48,7 +48,7 @@ void sendCommand(void){ static int timePassed_ms = 0; - static int lastIntTime_ms = 0; + static int lastIntTime_us = 0; /* * Na prvi interrupt pokreni frameTimer. @@ -61,14 +61,10 @@ frameTimer.start(); } - lastIntTime_ms = frameTimer.read_ms() - lastIntTime_ms; + lastIntTime_us = frameTimer.read_us(); frameTimer.reset(); - if(lastIntTime_ms > 15){ - state = 0; - if(!state){ - lancTimer.start(); - } + if(lastIntTime_us > 10000 || state == 1){ state++; if(state == 1){ @@ -76,6 +72,7 @@ } else if(state == 2){ NRF_I2S->TXD.PTR = (uint32_t)startStopAddr; + state = 0; } if(state<=2){ @@ -87,14 +84,6 @@ NRF_I2S->TASKS_START = 1; flag = 1; } - else{ - timePassed_ms = lancTimer.read_ms(); - if(timePassed_ms > 8){ - lancTimer.reset(); - timePassed_ms = 0; - //state = 0; - } - } } }