Based on existing HSI code. Tested with f100c8, on custom board with no external crystals or resonators.