PWM (Pulse Width Modulation) DriverMCAL I/O Drivers 중 하나. 가변 pulse width를 가진 주기 신호를 생성한다. MCAL에서 SRS/SWS 문서 예시로도 자주 쓰이는 대표 드라이버. ICU의 대척점 (생성 ↔ 측정).

6가지 핵심 속성

속성의미
ChannelHW PWM에 연결된 숫자 식별자
Output statePWM 신호의 현재 출력 상태: HIGH / LOW
Idle statePwm_SetOutputToIdle() 또는 Pwm_DeInit() 호출 후의 출력 상태
Polarity각 PWM 채널의 시작 출력 상태 (period 시작 시점의 레벨)
Duty cycleperiod 대비 시작 레벨 구간의 비율
PeriodPWM 신호의 주기

Polarity · Idle state · Output state 구분: polarity는 “어느 레벨로 시작하는가”, idle state는 “쉴 때 어느 레벨인가”, output state는 “지금 어느 레벨인가”.

Duty Cycle 수치 표현

의미
0x00000%
0x8000100%

16-bit 정수로 0~100%를 0x0000 ~ 0x8000으로 매핑. 중간값은 비례 보간.

Mandatory Parameters (설정 시점)

  • 할당 HW channel
  • Period default
  • Duty cycle default (0x0000=0%, 0x8000=100%)
  • Polarity (high / low)
  • Idle state (high / low)
  • Channel class — fixed period / variable period

Functions

  • PWM 초기화 / 해제
  • Duty cycle, period, polarity, idle 출력 설정
  • PWM 출력 신호 읽기
  • PWM 신호 edge notification 활성/비활성

의존성

  • MCU Driver — prescaler, system clock, PLL
  • PORT Driver — port pin 기능 설정

MCAL 예시로서의 위상

MCAL 페이지의 Pwm_SetPeriodAndDuty 스펙 (Asynchronous / Reentrancy for different channel numbers), Pwm_PeriodTypeuint (8..32 bit)로 열려 있는 설계 철학이 PWM Driver의 구체예. μC 플랫폼별로 가장 효율적인 타입 폭을 고른다.

같이 보기