Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utility/M5IOE1_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ namespace m5
return true;
}

void M5IOE1_Class::setPwmFrequency(std::uint16_t frequency)
bool M5IOE1_Class::setPwmFrequency(std::uint16_t frequency)
{
std::uint8_t data[2] = { static_cast<std::uint8_t>(frequency & 0xFF), static_cast<std::uint8_t>(frequency >> 8) };
writeRegister(M5IOE1_REG_PWM_FREQ_L, data, sizeof(data));
return writeRegister(M5IOE1_REG_PWM_FREQ_L, data, sizeof(data));
}

bool M5IOE1_Class::setPwmDutyPercent(pwm_channel_t channel, std::uint32_t duty,
Expand Down
5 changes: 4 additions & 1 deletion src/utility/M5IOE1_Class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ namespace m5
bool digitalRead(uint8_t pin) override;
bool getInputLevel(uint8_t pin, bool* level) override;

void setPwmFrequency(std::uint16_t frequency);
/// set the PWM frequency in Hz.
/// @note The frequency is shared by all PWM channels, so changing it also
/// changes a channel that is already running.
bool setPwmFrequency(std::uint16_t frequency);

/// set PWM duty in percent.
/// @param channel PWM channel (pwm_ch1 - pwm_ch4).
Expand Down
Loading