Skip to content

Commit 96ce43e

Browse files
authored
Added the correct files
1 parent 6628f49 commit 96ce43e

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

ports/raspberrypi/common-hal/pulseio/PulseIn.c

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
*/
2626

2727
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
28-
<<<<<<< HEAD
29-
=======
30-
#include "src/rp2_common/hardware_irq/include/hardware/irq.h"
31-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
3228

3329
#include <stdint.h>
3430

@@ -49,16 +45,7 @@ volatile uint16_t result = 0;
4945
volatile uint16_t buf_index = 0;
5046

5147
uint16_t pulsein_program[] = {
52-
<<<<<<< HEAD
5348
0x4001, // 1: in pins, 1
54-
=======
55-
0xe03f, // 0: set x, 31
56-
0x4001, // 1: in pins, 1
57-
0x0041, // 2: jmp x--, 2
58-
0x8060, // 3: push iffull block
59-
0xc020, // 4: irq wait 0
60-
0x0000, // 5: jmp 1
61-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
6249
};
6350

6451
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
@@ -80,11 +67,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
8067

8168
bool ok = rp2pio_statemachine_construct(&state_machine,
8269
pulsein_program, sizeof(pulsein_program) / sizeof(pulsein_program[0]),
83-
<<<<<<< HEAD
8470
1000000,
85-
=======
86-
1000000 * 3,
87-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
8871
NULL, 0,
8972
NULL, 0,
9073
pin, 1,
@@ -102,28 +85,14 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
10285
self->state_machine.state_machine = state_machine.state_machine;
10386
self->state_machine.sm_config = state_machine.sm_config;
10487
self->state_machine.offset = state_machine.offset;
105-
<<<<<<< HEAD
106-
=======
107-
if ( self->state_machine.pio == pio0 ) {
108-
self->pio_interrupt = PIO0_IRQ_0;
109-
} else {
110-
self->pio_interrupt = PIO1_IRQ_0;
111-
}
112-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
11388
pio_sm_clear_fifos(self->state_machine.pio,self->state_machine.state_machine);
11489
last_level = self->idle_state;
11590
level_count = 0;
11691
result = 0;
11792
buf_index = 0;
11893

11994
pio_sm_set_in_pins(state_machine.pio,state_machine.state_machine,pin->number);
120-
<<<<<<< HEAD
12195
common_hal_rp2pio_statemachine_set_interrupt_handler(&state_machine,&common_hal_pulseio_pulsein_interrupt,NULL,PIO_IRQ0_INTE_SM0_RXNEMPTY_BITS);
122-
=======
123-
irq_set_exclusive_handler(self->pio_interrupt, common_hal_pulseio_pulsein_interrupt);
124-
hw_clear_bits(&state_machine.pio->inte0, 1u << state_machine.state_machine);
125-
hw_set_bits(&state_machine.pio->inte0, 1u << (state_machine.state_machine+8));
126-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
12796

12897
// exec a set pindirs to 0 for input
12998
pio_sm_exec(state_machine.pio,state_machine.state_machine,0xe080);
@@ -134,10 +103,6 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
134103
pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0);
135104
}
136105
pio_sm_set_enabled(state_machine.pio, state_machine.state_machine, true);
137-
<<<<<<< HEAD
138-
=======
139-
irq_set_enabled(self->pio_interrupt, true);
140-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
141106
}
142107

143108
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
@@ -148,10 +113,6 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
148113
if (common_hal_pulseio_pulsein_deinited(self)) {
149114
return;
150115
}
151-
<<<<<<< HEAD
152-
=======
153-
irq_set_enabled(self->pio_interrupt, false);
154-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
155116
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false);
156117
pio_sm_unclaim (self->state_machine.pio, self->state_machine.state_machine);
157118
m_free(self->buffer);
@@ -185,23 +146,12 @@ void common_hal_pulseio_pulsein_interrupt() {
185146
}
186147
}
187148
}
188-
<<<<<<< HEAD
189-
=======
190-
// clear interrupt
191-
irq_clear(self->pio_interrupt);
192-
hw_clear_bits(&self->state_machine.pio->inte0, 1u << self->state_machine.state_machine);
193-
self->state_machine.pio->irq = 1u << self->state_machine.state_machine;
194-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
195149
// check for a pulse thats too long (4000 us) or maxlen reached, and reset
196150
if (( level_count > 4000 ) || (buf_index >= self->maxlen)) {
197151
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false);
198152
pio_sm_init(self->state_machine.pio, self->state_machine.state_machine, self->state_machine.offset, &self->state_machine.sm_config);
199153
pio_sm_restart(self->state_machine.pio,self->state_machine.state_machine);
200154
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true);
201-
<<<<<<< HEAD
202-
=======
203-
irq_set_enabled(self->pio_interrupt, true);
204-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
205155
}
206156
}
207157
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
@@ -219,17 +169,10 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
219169
gpio_put(self->pin, !self->idle_state);
220170
common_hal_mcu_delay_us((uint32_t)trigger_duration);
221171
gpio_set_function(self->pin ,GPIO_FUNC_PIO0);
222-
<<<<<<< HEAD
223172
common_hal_mcu_delay_us(225);
224173
}
225174

226175
// Reconfigure the pin for PIO
227-
=======
228-
}
229-
230-
// Reconfigure the pin for PIO
231-
common_hal_mcu_delay_us(200);
232-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
233176
gpio_set_function(self->pin, GPIO_FUNC_PIO0);
234177
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true);
235178
}

ports/raspberrypi/common-hal/pulseio/PulseIn.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ typedef struct {
4242
volatile uint16_t start;
4343
volatile uint16_t len;
4444
rp2pio_statemachine_obj_t state_machine;
45-
<<<<<<< HEAD
46-
=======
47-
uint16_t pio_interrupt;
48-
>>>>>>> a3c3e8a0fa5e06910747f1a95a12b899562a618d
4945
} pulseio_pulsein_obj_t;
5046

5147
void pulsein_reset(void);

0 commit comments

Comments
 (0)