According to the datasheet, the TOV flag is set depending on the active Waveform Generation Mode. It can be set either when the timer reaches the TOP value, the MAX value, or the BOTTOM value (for example, see Table 15-5).
Currently, we only update it when we reach the TOP value, which is the the correct behavior in some cases (e.g. CTC mode).
According to the datasheet, the TOV flag is set depending on the active Waveform Generation Mode. It can be set either when the timer reaches the TOP value, the MAX value, or the BOTTOM value (for example, see Table 15-5).
Currently, we only update it when we reach the TOP value, which is the the correct behavior in some cases (e.g. CTC mode).