here is what analogWrite() does in hardware/teensy/avr/cores/teensy3/pins_teensy.c
Code:
max = 1 << analog_write_res;
if (val <= 0) {
digitalWrite(pin, LOW);
pinMode(pin, OUTPUT); // TODO: implement OUTPUT_LOW
return;
} else if (val >= max) {
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT); // TODO: implement OUTPUT_HIGH
return;
}
So if you use value of 256 or more (for 8-bit resolution), the teensy core will set the pin HIGH with digtalWrite(); For 255, as Donziboy2 notes, it will depend on how math works for the frequency divisors.
default frequency (488.28125 hz, FTM1_MOD is 49151, F_BUS 48mhz), 255 timer value is
cval = ((uint32_t)val * (uint32_t)(FTM1_MOD + 1)) >> analog_write_res;
For 255 with a scope or logic analyzer, i think you will see that at 75 Hz signal is low for 52 us, and at 488 Hz signal is low for 8 us
For the Arduino/AVR core, analogWrite(pin, 255) uses digitalWrite() to set pin HIGH,
see hardware/arduino/avr/cores/arduino/wiring_analog.c
https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/