Update for simpler AFE
This commit is contained in:
		
							parent
							
								
									68c65fdb54
								
							
						
					
					
						commit
						2195c46dbf
					
				
					 1 changed files with 5 additions and 12 deletions
				
			
		
							
								
								
									
										15
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/main.c
									
									
									
									
									
								
							|  | @ -29,8 +29,8 @@ | |||
| #define INIT_GAIN 127 | ||||
| 
 | ||||
| #define LO_PIN 9 | ||||
| #define RX_PIN 13 | ||||
| #define FB_PIN 5 | ||||
| #define RX_PIN 10 | ||||
| #define FB_PIN 11 | ||||
| #define PSU_PIN 23 | ||||
| 
 | ||||
| #define PIO pio1 | ||||
|  | @ -161,17 +161,12 @@ static void init_fb() | |||
| 	gpio_disable_pulls(FB_PIN); | ||||
| 	pio_gpio_init(PIO, FB_PIN); | ||||
| 
 | ||||
| 	// NOTE: Not sure if this is ideal.
 | ||||
| 	hw_set_bits(&PIO->input_sync_bypass, 1u << RX_PIN); | ||||
| 
 | ||||
| 	gpio_set_input_hysteresis_enabled(RX_PIN, false); | ||||
| 	gpio_set_drive_strength(FB_PIN, GPIO_DRIVE_STRENGTH_2MA); | ||||
| 	gpio_set_slew_rate(FB_PIN, GPIO_SLEW_RATE_SLOW); | ||||
| 
 | ||||
| 	const uint16_t insn[] = { | ||||
| 		pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_sideset(1, 1) | | ||||
| 			pio_encode_delay(0), | ||||
| 		//pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(0),
 | ||||
| 		pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_delay(3), | ||||
| 	}; | ||||
| 
 | ||||
| 	pio_program_t prog = { | ||||
|  | @ -187,11 +182,9 @@ static void init_fb() | |||
| 		origin_fb = pio_add_program(PIO, &prog); | ||||
| 
 | ||||
| 	pio_sm_config pc = pio_get_default_sm_config(); | ||||
| 	sm_config_set_sideset(&pc, 1, false, true); | ||||
| 	sm_config_set_in_pins(&pc, RX_PIN); | ||||
| 	sm_config_set_out_pins(&pc, FB_PIN, 1); | ||||
| 	sm_config_set_set_pins(&pc, FB_PIN, 1); | ||||
| 	sm_config_set_sideset_pins(&pc, FB_PIN); | ||||
| 	sm_config_set_wrap(&pc, origin_fb, origin_fb + prog.length - 1); | ||||
| 	sm_config_set_clkdiv_int_frac(&pc, 1, 0); | ||||
| 	pio_sm_init(PIO, SM_FB, origin_fb, &pc); | ||||
|  | @ -288,9 +281,9 @@ static void init_ad() | |||
| 
 | ||||
| static void lo_generate_phase(uint32_t *buf, size_t len, uint32_t step, uint32_t phase) | ||||
| { | ||||
| 	for (size_t i = 0; i < len; i++) { | ||||
| 	uint32_t bits = 0; | ||||
| 
 | ||||
| 	for (size_t i = 0; i < len; i++) { | ||||
| 		for (int j = 0; j < 32; j++) { | ||||
| 			bits <<= 1; | ||||
| 			bits |= phase >> 31; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue