mirror of
https://github.com/steve-m/hsdaoh-rp2350.git
synced 2026-01-27 16:57:18 +01:00
lib: make drivestrength and slewrate configurable
This commit is contained in:
parent
6108b0007c
commit
1bdf43ae94
7 changed files with 14 additions and 12 deletions
|
|
@ -129,7 +129,7 @@ int main()
|
|||
|
||||
stdio_init_all();
|
||||
|
||||
hsdaoh_init();
|
||||
hsdaoh_init(GPIO_DRIVE_STRENGTH_4MA, GPIO_SLEW_RATE_SLOW);
|
||||
hsdaoh_add_stream(0, 1, (SYS_CLK/8) * 1000, RBUF_MAX_DATA_LEN, ringbuffer);
|
||||
hsdaoh_start();
|
||||
init_pio_input();
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ int main()
|
|||
|
||||
stdio_init_all();
|
||||
|
||||
hsdaoh_init();
|
||||
hsdaoh_init(GPIO_DRIVE_STRENGTH_4MA, GPIO_SLEW_RATE_SLOW);
|
||||
hsdaoh_add_stream(0, 1, (SYS_CLK/8) * 1000, ADC_DATA_LEN, ringbuffer);
|
||||
hsdaoh_add_stream(1, 1, 75000, AUDIO_DATA_LEN, audio_ringbuffer);
|
||||
hsdaoh_start();
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ int main()
|
|||
|
||||
stdio_init_all();
|
||||
|
||||
hsdaoh_init();
|
||||
hsdaoh_init(GPIO_DRIVE_STRENGTH_4MA, GPIO_SLEW_RATE_SLOW);
|
||||
hsdaoh_add_stream(0, 1, (SYS_CLK/4) * 1000, ADC_DATA_LEN, ringbuffer);
|
||||
hsdaoh_add_stream(1, 1, 75000, AUDIO_DATA_LEN, audio_ringbuffer);
|
||||
hsdaoh_start();
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ int main()
|
|||
|
||||
stdio_init_all();
|
||||
|
||||
hsdaoh_init();
|
||||
hsdaoh_init(GPIO_DRIVE_STRENGTH_4MA, GPIO_SLEW_RATE_SLOW);
|
||||
hsdaoh_add_stream(0, 1, (SYS_CLK/8) * 1000, RBUF_MAX_DATA_LEN, ringbuffer);
|
||||
hsdaoh_start();
|
||||
init_adc_input();
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ int main()
|
|||
|
||||
stdio_init_all();
|
||||
|
||||
hsdaoh_init();
|
||||
hsdaoh_init(GPIO_DRIVE_STRENGTH_4MA, GPIO_SLEW_RATE_SLOW);
|
||||
hsdaoh_add_stream(0, 1, (SYS_CLK/8) * 1000, RBUF_MAX_DATA_LEN, ringbuffer);
|
||||
hsdaoh_start();
|
||||
init_pio_input();
|
||||
|
|
|
|||
|
|
@ -40,11 +40,8 @@
|
|||
#include "hardware/structs/hstx_ctrl.h"
|
||||
#include "hardware/structs/hstx_fifo.h"
|
||||
#include "pico/multicore.h"
|
||||
|
||||
#include "data_packet.h"
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#include "data_packet.h"
|
||||
#include "picohsdaoh.h"
|
||||
|
||||
// Section 5.4.2
|
||||
|
|
@ -305,7 +302,7 @@ int hsdaoh_add_stream(uint16_t stream_id, uint16_t format, uint32_t samplerate,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hsdaoh_init(void)
|
||||
void hsdaoh_init(int dstrength, int slewrate)
|
||||
{
|
||||
for (uint i = 0; i < MAX_STREAMS; i++)
|
||||
streams[i].active = false;
|
||||
|
|
@ -372,8 +369,13 @@ void hsdaoh_init(void)
|
|||
hstx_ctrl_hw->bit[bit + 1] = lane_data_sel_bits | HSTX_CTRL_BIT0_INV_BITS;
|
||||
}
|
||||
|
||||
for (int i = 12; i <= 19; ++i)
|
||||
for (int i = 12; i <= 19; ++i) {
|
||||
gpio_set_input_enabled(i, false);
|
||||
gpio_disable_pulls(i);
|
||||
gpio_set_drive_strength(i, dstrength);
|
||||
gpio_set_slew_rate(i, slewrate);
|
||||
gpio_set_function(i, 0); // HSTX
|
||||
}
|
||||
|
||||
/* All channels are set up identically, to transfer a whole scanline and
|
||||
* then chain to the net channel. Each time a channel finishes, we
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ typedef struct
|
|||
} __attribute__((packed, aligned(1))) metadata_t;
|
||||
|
||||
void hsdaoh_start(void);
|
||||
void hsdaoh_init(void);
|
||||
void hsdaoh_init(int dstrength, int slewrate);
|
||||
void hsdaoh_update_head(int stream_id, int head);
|
||||
int hsdaoh_add_stream(uint16_t stream_id, uint16_t format, uint32_t samplerate, uint length, uint16_t *ringbuf);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue