#ifndef __TIMER8B_H__
#define __TIMER8B_H__

#include "../common/def.h"

void t8bInit();
void t8bPrescaler(uint8_t cs2, uint8_t cs1, uint8_t cs0);

#endif /* __TIMER8B_H__ */
// timer8b.c
#include "timer8b.h"

// 8-bit Timer 설정
void t8bInit() {
    TIMER8B_REG |= (1 << WGM00) | (1 << WGM01) | (1 << COM01);      // Fast PWM + Clear Mode
    FPWM_OUT |= (1 << PB4);                                         // PORTB 4 Pin Output 설정
}

// CS02, CS01, CS00 값 입력 받아 분주비 설정
void t8bPrescaler(uint8_t cs2, uint8_t cs1, uint8_t cs0) {
    TIMER8B_REG |= (cs2 << CS02) | (cs1 << CS01) | (cs0 << CS00);
}
#ifndef __TIMER16B_H__
#define __TIMER16B_H__

#include "../common/def.h"  

void t16bInit();
void t16bPrescaler(uint8_t cs2, uint8_t cs1, uint8_t cs0);

#endif /* __TIMER16B_H__ */
// timer16b.c
#include "timer16b.h"

// 16-bit Timer 설정
void t16bInit() {         
    TIMER16B_REGA |= (1 << WGM11) | (1 << COM1A1);      // Fast PWM + Clear Mode
    TIMER16B_REGB |= (1 << WGM12) | (1 << WGM13);
    TIMER16B_TOP = 4999;                                // TOP = (16MHz / (64분주 * (50Hz 설정))) - 1
    FPWM_OUT |= (1 << PB5);                             // PORTB 5 Pin Output 설정
}

// CS02, CS01, CS00 값 입력 받아 분주비 설정
void t16bPrescaler(uint8_t cs2, uint8_t cs1, uint8_t cs0) {   
    TIMER16B_REGB |= (cs2 << CS12) | (cs1 << CS11) | (cs0 << CS10);
}