SD-Init-Fix (LVS/Samsung-T7-Micro-SD)
This commit is contained in:
1 parent
d3dca674aa
commit
bb9827f821
8 files changed
+1744
-1977
No files matched your search
@@ -59,38 +59,39 @@ void finish_pins_leds() {
|
||||
gpio_disable_input_output(pwr_pin());
|
||||
}
|
||||
|
||||
void halt_with_error(uint32_t err, uint32_t bits)
|
||||
void halt_with_error(uint32_t long_mask, uint32_t blinks)
|
||||
{
|
||||
finish_pins_except_leds();
|
||||
pio_set_sm_mask_enabled(pio0, 0xF, false);
|
||||
pio_set_sm_mask_enabled(pio1, 0xF, false);
|
||||
set_sys_clock_khz(48000, true);
|
||||
vreg_set_voltage(VREG_VOLTAGE_0_95);
|
||||
if (bits != 1)
|
||||
if (blinks != 1)
|
||||
{
|
||||
put_pixel(0);
|
||||
sleep_ms(PAUSE_BEFORE);
|
||||
}
|
||||
for(int j = 0; j < CODE_REPEATS; j++)
|
||||
{
|
||||
for(int i = 0; i < bits; i++)
|
||||
for(int i = 0; i < blinks; i++)
|
||||
{
|
||||
bool is_long = err & (1 << (bits - i - 1));
|
||||
// Long mask in reverse.
|
||||
bool is_long = long_mask & (1 << (blinks - i - 1));
|
||||
sleep_ms(is_long ? LONG_PAUSE_TIME : SHORT_PAUSE_TIME);
|
||||
bool success = bits == 1 && is_long == 0;
|
||||
if (success)
|
||||
bool success = blinks == 1 && is_long == 0;
|
||||
if (blinks == 1)
|
||||
put_pixel(PIX_whi);
|
||||
else
|
||||
put_pixel(PIX_yel);
|
||||
put_pixel(0x004600); // GRB red; preserve native error blink timing
|
||||
sleep_ms(is_long ? LONG_TIME : success ? SHORT_TIME * 2 : SHORT_TIME);
|
||||
put_pixel(0);
|
||||
if (i != bits - 1 || j != CODE_REPEATS - 1)
|
||||
if (i != blinks - 1 || j != CODE_REPEATS - 1)
|
||||
sleep_ms(is_long ? LONG_PAUSE_TIME : SHORT_PAUSE_TIME);
|
||||
if (i == bits - 1 && j != CODE_REPEATS - 1)
|
||||
if (i == blinks - 1 && j != CODE_REPEATS - 1)
|
||||
sleep_ms(PAUSE_BETWEEN);
|
||||
}
|
||||
// first write case, do not repeat this kind of error code
|
||||
if (bits == 1)
|
||||
if (blinks == 1)
|
||||
break;
|
||||
}
|
||||
finish_pins_leds();
|
||||
|
||||
Reference in new issue
Block a user