The BP1048B2 supports external PWM dimming via the EN/PWM pin.
Programming steps:
Example for microcontroller (Arduino-style pseudo-code): Bp1048b2 Programming
// Set PWM frequency to 500 Hz
// Duty cycle = brightness percent / 100
analogWriteFrequency(500);
analogWrite(EN_PIN, brightness_percent * 255 / 100);
Important restrictions:
BES_DFU_Tool or BES_Flash_Tool (Windows)⚠️ No public open-source SDK exists. This chip is not like ESP32 or nRF52. Reverse engineering is extremely difficult. The BP1048B2 supports external PWM dimming via the
__bp_interrupt(BP_INT_TIMER1, BP_PRIO_HIGHEST)
void timer1_isr(void)
// No prologue/epilogue – uses shadow registers
bp_gpio_toggle(PIN_LED_RED);
bp_timer_clear_flag(TIMER1);
Warning: Avoid calling any function that might cause a context switch inside a zero-latency ISR. The shadow bank does not preserve floating-point state. Programming steps:
The Bp1048b2 has a vectored interrupt controller with 64 priority levels. One critical nuance in Bp1048b2 programming is the "shadow register bank" – interrupts can switch to a second set of registers automatically, saving stack push/pop cycles.
bp_pm_configure_deepsleep(PM_RETAIN_BANK0);
bp_rtc_set_alarm(5); // Wake in 5 seconds
bp_pm_enter_deepsleep();
// Execution resumes here after wake
bp_reinit_clock(); // Must manually restore PLL