mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 14:34:54 +01:00
pulse_counter_ulp: Add run_count to ULP program
This commit is contained in:
parent
31e72a5232
commit
2ba3b85440
2 changed files with 12 additions and 0 deletions
|
@ -65,6 +65,7 @@ bool UlpPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
|
|||
* Note that the ULP reads only the lower 16 bits of these variables.
|
||||
*/
|
||||
ulp_edge_count = 0;
|
||||
ulp_run_count = 0;
|
||||
ulp_debounce_counter = 3;
|
||||
ulp_debounce_max_count = 3;
|
||||
ulp_next_edge = 0;
|
||||
|
|
|
@ -55,6 +55,11 @@ debounce_max_count:
|
|||
edge_count:
|
||||
.long 0
|
||||
|
||||
/* Number of times program run since last read */
|
||||
.global run_count
|
||||
run_count:
|
||||
.long 0
|
||||
|
||||
/* Total number of signal edges acquired */
|
||||
.global edge_count_total
|
||||
edge_count_total:
|
||||
|
@ -70,6 +75,12 @@ io_number:
|
|||
.text
|
||||
.global entry
|
||||
entry:
|
||||
/* Increment run_count */
|
||||
move r3, run_count
|
||||
ld r2, r3, 0
|
||||
add r2, r2, 1
|
||||
st r2, r3, 0
|
||||
|
||||
/* Load io_number */
|
||||
move r3, io_number
|
||||
ld r3, r3, 0
|
||||
|
|
Loading…
Reference in a new issue