Isn't it possible at all to write code generically for the Raspberry Pi and Arduino?

So in regards to a blinking led program for both a raspbierry pi pico and arduino.

Here is an example of avr/arduino

    loop {
        led.toggle();
        arduino_hal::delay_ms(100);
        led.toggle();
        arduino_hal::delay_ms(100);
        led.toggle();
        arduino_hal::delay_ms(100);
        led.toggle();
        arduino_hal::delay_ms(800);
    }

And an example for the raspberry pi pico

    loop {
        led_pin.set_high().unwrap();
        // TODO: Replace with proper 1s delays once we have clocks working
        delay.delay_ms(500);
        led_pin.set_low().unwrap();
        delay.delay_ms(500);
    }

as you can see they are different. Is there a way they can be written generically?

I get that the initialization will be different but why are they different in other areas such as turning on and off the LED?

Advised by another guy

https://github.com/rust-embedded/embedded-hal/issues/395#issuecomment-1220713142