Attiny85 Frequency Generation PB4

Hey guys, working on a project here and I need a little help. I've never played with the internal timers before on the tiny85. Anyways, I'm trying to generate a 58khz square wave on pin PB4 with a 50% duty cycle. After some digging I found some code that seems to be able to do this on pin PB1 using timer 0.

#elif defined(IR_USE_TIMER_TINY0)
#define TIMER_RESET
#define TIMER_ENABLE_PWM     (TCCR0A |= _BV(COM0B1))
#define TIMER_DISABLE_PWM    (TCCR0A &= ~(_BV(COM0B1)))
#define TIMER_CONFIG_KHZ(val) ({ \
  const uint8_t pwmval = SYSCLOCK / 2000 / (val); \
  TCCR0A = _BV(WGM00); \
  TCCR0B = _BV(WGM02) | _BV(CS00); \
  OCR0A = pwmval; \
  OCR0B = pwmval / 3; \
})
#define TIMER_COUNT_TOP      (SYSCLOCK * USECPERTICK / 1000000)
#if (TIMER_COUNT_TOP < 256)
#define TIMER_CONFIG_NORMAL() ({ \
  TCCR0A = _BV(WGM01); \
  TCCR0B = _BV(CS00); \
  OCR0A = TIMER_COUNT_TOP; \
  TCNT0 = 0; \
})
#else
#define TIMER_CONFIG_NORMAL() ({ \
  TCCR0A = _BV(WGM01); \
  TCCR0B = _BV(CS01); \
  OCR0A = TIMER_COUNT_TOP / 8; \
  TCNT0 = 0; \
})
#endif

Here, I would be using TIMER_CONFIG_KHZ, and the two enable and disable functions.

I'm pretty sure in order to port this to pin pb4 I would have to use timer1 which may or may not allow the use of delay() in the regular IDE? I'm also aware that pb4 is controlled by OC1B on the tiny85. But beyond this I'm not really sure what is happening or what needs to happen. Any guidance is appreciated. Thanks!

/*~58khz square wave on pin PB4 with a 50% duty cycle
  8 MHz cpu
  TCCR1 = B00000001; prevents Timer/Counter-1 from using pin OC1A, prescaler = 1
  GTCCR = B01100000; enables pwm on OC1B
  OCR1C = 140; f(PWM output) = 8 MHz/prescaler/(OCR1C+1) this may require some fine-tuning
  OCR1B = 70; OCR1C/2 for 50% duty cycle
*/
void setup() {
  pinMode(4, OUTPUT) ;
  TCCR1 = B00000001;
  GTCCR = B01100000;
  OCR1C = 140;
  OCR1B = 70;
}

void loop() {
  /* OCR1B = 70;//delay test (ok)
    delay(1000);
    OCR1B = 0;
    delay(1000);
  */
}

Depends whether the board definition package (sometimes called a "core") you're using uses timer1 or timer0 for millis.

My core uses timer0 for millis (like the cores for almost every other AVR micro), but some did use timer1 for millis on the tiny85 because... Because they thought that people would be more comfortable using the 8-bit timer0 for user code instead of the weirdo timer1. Except, nobody is familiar with the 8-bit timer0 because on every other AVR you don't use it anyway because it's used for millis...

Actually, with my core, you should be able to use Tone() on pin 4/PB4 and have it just work. Tone() on my core will use hardware PWM if the pin is on the tone timer (note - it's not smart enough to figure out that PB1 also is on timer1 on the t85), and will use hardware PWM in that case, otherwise, it'll use interrupts.