Skip to content

Instantly share code, notes, and snippets.

@mattgaidica
Created October 10, 2024 17:29
Show Gist options
  • Save mattgaidica/754e91385527945931330407f4b32b98 to your computer and use it in GitHub Desktop.
Save mattgaidica/754e91385527945931330407f4b32b98 to your computer and use it in GitHub Desktop.
const ulp_insn_t ulp_program[] = {
// Initialize transition counter (R3 <- 0)
I_MOVI(R3, 0), // Set R3 to 0 (counter)
I_MOVI(R2, 1), // Set R2 to address RTC_SLOW_MEM[1]
// Increment 1
I_ADDI(R3, R3, 1), // Increment R3 by 1
I_ST(R3, R2, 0), // Store R3 in RTC_SLOW_MEM[1]
// Increment 2
I_ADDI(R3, R3, 1), // Increment R3 by 1
I_ST(R3, R2, 0), // Store R3 in RTC_SLOW_MEM[1]
// Increment 3
I_ADDI(R3, R3, 1), // Increment R3 by 1
I_ST(R3, R2, 0), // Store R3 in RTC_SLOW_MEM[1]
// Halt the ULP program
I_HALT(), // Halt the ULP program
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment