kopia lustrzana https://github.com/pimoroni/pimoroni-pico
DV Display: Expose reset functionality
rodzic
9a0b21d417
commit
a396512e7f
|
@ -118,6 +118,10 @@ namespace pimoroni {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DVDisplay::reset() {
|
||||||
|
swd_reset();
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t DVDisplay::get_gpio() {
|
uint8_t DVDisplay::get_gpio() {
|
||||||
return i2c->reg_read_uint8(I2C_ADDR, I2C_REG_GPIO);
|
return i2c->reg_read_uint8(I2C_ADDR, I2C_REG_GPIO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,7 @@ namespace pimoroni {
|
||||||
|
|
||||||
void init(uint16_t width, uint16_t height, Mode mode = MODE_RGB555);
|
void init(uint16_t width, uint16_t height, Mode mode = MODE_RGB555);
|
||||||
void flip();
|
void flip();
|
||||||
|
void reset();
|
||||||
|
|
||||||
// 32 colour palette mode. Note that palette entries range from 0-31,
|
// 32 colour palette mode. Note that palette entries range from 0-31,
|
||||||
// but when writing colour values the palette entry is in bits 6-2, so the
|
// but when writing colour values the palette entry is in bits 6-2, so the
|
||||||
|
|
|
@ -339,20 +339,30 @@ static bool start(uint pc, uint sp) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool swd_load_program(const uint* addresses, const uint** data, const uint* data_len_in_bytes, uint num_sections, uint pc = 0x20000001, uint sp = 0x20042000, bool use_xip_as_ram = false) {
|
static bool swd_reset_internal() {
|
||||||
gpio_init(2);
|
gpio_init(2);
|
||||||
gpio_init(3);
|
gpio_init(3);
|
||||||
gpio_disable_pulls(2);
|
gpio_disable_pulls(2);
|
||||||
gpio_pull_up(3);
|
gpio_pull_up(3);
|
||||||
|
|
||||||
mp_printf(&mp_plat_print, "Connecting\n");
|
|
||||||
|
|
||||||
bool ok = connect(true, 0xf);
|
bool ok = connect(true, 0xf);
|
||||||
mp_printf(&mp_plat_print, "Reset %s\n", ok ? "OK" : "Fail");
|
mp_printf(&mp_plat_print, "Reset %s\n", ok ? "OK" : "Fail");
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool swd_reset() {
|
||||||
|
bool ok = swd_reset_internal();
|
||||||
|
unload_pio();
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool swd_load_program_internal(const uint* addresses, const uint** data, const uint* data_len_in_bytes, uint num_sections, uint pc, uint sp, bool use_xip_as_ram) {
|
||||||
|
bool ok = swd_reset_internal();
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_printf(&mp_plat_print, "Connecting\n");
|
||||||
ok = connect(false, 0);
|
ok = connect(false, 0);
|
||||||
|
|
||||||
mp_printf(&mp_plat_print, "Connected core 0 %s\n", ok ? "OK" : "Fail");
|
mp_printf(&mp_plat_print, "Connected core 0 %s\n", ok ? "OK" : "Fail");
|
||||||
|
@ -382,6 +392,11 @@ bool swd_load_program(const uint* addresses, const uint** data, const uint* data
|
||||||
|
|
||||||
ok |= start(0, 0x20041000);
|
ok |= start(0, 0x20041000);
|
||||||
|
|
||||||
unload_pio();
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool swd_load_program(const uint* addresses, const uint** data, const uint* data_len_in_bytes, uint num_sections, uint pc = 0x20000001, uint sp = 0x20042000, bool use_xip_as_ram = false) {
|
||||||
|
bool ok = swd_load_program_internal(addresses, data, data_len_in_bytes, num_sections, pc, sp, use_xip_as_ram);
|
||||||
|
unload_pio();
|
||||||
|
return ok;
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
bool swd_load_program(const uint* addresses, const uint** data, const uint* data_len_in_bytes, uint num_sections, uint pc = 0x20000001, uint sp = 0x20042000, bool use_xip_as_ram = false);
|
bool swd_load_program(const uint* addresses, const uint** data, const uint* data_len_in_bytes, uint num_sections, uint pc = 0x20000001, uint sp = 0x20042000, bool use_xip_as_ram = false);
|
||||||
|
bool swd_reset();
|
Ładowanie…
Reference in New Issue