is32flcommon: Allow custom PWM frequency config
Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
parent
f30e12adcf
commit
af4f40ddf6
@ -114,6 +114,10 @@
|
|||||||
#define ISSI_PWM_REG_1ST 0x01
|
#define ISSI_PWM_REG_1ST 0x01
|
||||||
#define ISSI_SCL_REG_1ST 0x01
|
#define ISSI_SCL_REG_1ST 0x01
|
||||||
|
|
||||||
|
#define ISSI_REG_TEST 0xE0
|
||||||
|
#define ISSI_REG_CUSTOM_PWM 0xE2
|
||||||
|
#define ISSI_CUSTOM_PWM_32K 0xE0
|
||||||
|
|
||||||
// Map CS SW locations to order in PWM / Scaling buffers
|
// Map CS SW locations to order in PWM / Scaling buffers
|
||||||
// This matches the ORDER in the Datasheet Register not the POSITION
|
// This matches the ORDER in the Datasheet Register not the POSITION
|
||||||
// It will always count from 0x00 to (ISSI_MAX_LEDS - 1)
|
// It will always count from 0x00 to (ISSI_MAX_LEDS - 1)
|
||||||
|
@ -89,6 +89,21 @@ void IS31FL_unlock_register(uint8_t addr, uint8_t page) {
|
|||||||
IS31FL_write_single_register(addr, ISSI_COMMANDREGISTER, page);
|
IS31FL_write_single_register(addr, ISSI_COMMANDREGISTER, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only known to work on IS31FL3743
|
||||||
|
void IS31FL_common_set_pwm_frequency(uint8_t addr, uint8_t freq) {
|
||||||
|
// Unlock the command register & select Function Register
|
||||||
|
//IS31FL_unlock_register(addr, ISSI_PAGE_FUNCTION);
|
||||||
|
|
||||||
|
// Enable test mode to unlock PWM freqency register
|
||||||
|
IS31FL_write_single_register(addr, ISSI_REG_TEST, 0x01);
|
||||||
|
|
||||||
|
IS31FL_write_single_register(addr, ISSI_REG_CUSTOM_PWM, freq);
|
||||||
|
|
||||||
|
// Disable test mode again
|
||||||
|
IS31FL_write_single_register(addr, ISSI_REG_TEST, 0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IS31FL_common_init(uint8_t addr, uint8_t ssr) {
|
void IS31FL_common_init(uint8_t addr, uint8_t ssr) {
|
||||||
// Setup phase, need to take out of software shutdown and configure
|
// Setup phase, need to take out of software shutdown and configure
|
||||||
// ISSI_SSR_x is passed to allow Master / Slave setting where applicable
|
// ISSI_SSR_x is passed to allow Master / Slave setting where applicable
|
||||||
@ -116,6 +131,11 @@ void IS31FL_common_init(uint8_t addr, uint8_t ssr) {
|
|||||||
IS31FL_write_single_register(addr, ISSI_REG_PWM_SET, ISSI_PWM_SET);
|
IS31FL_write_single_register(addr, ISSI_REG_PWM_SET, ISSI_PWM_SET);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ISSI_CUSTOM_PWM_FREQ
|
||||||
|
// Instead of default 29kHz increase to 32.25kHz PWM Frequency
|
||||||
|
IS31FL_common_set_pwm_frequency(addr, ISSI_CUSTOM_PWM_32K);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Wait 10ms to ensure the device has woken up.
|
// Wait 10ms to ensure the device has woken up.
|
||||||
wait_ms(10);
|
wait_ms(10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user