Adding Auto-fire

A project log for Digi:[S]NES

USB to SNES/NES controller using Digispark

danjovicdanjovic 04/29/2016 at 22:340 Comments

Somebody suggested me adding programming features and auto-fire to the DIGI-SNES.

The auto-fire is easy to implement, but it took me some minutes to find an elegant way of activating the auto-fire to the desired functions but the solution is quite simple:

- Held the the desired buttons pressed while plug the DIGI-SNES on the USB port. Then the firmware will use the state of the activated buttons to initialize one variable that holds a mask to be applied over the button states at given intervals thus simulating sequential releases for a button that is continuously pressed.

In the code below the button is active in '1' and the auto-fire mask bit is active in '0'.

	// Modulate buttons with auto-fire 
	if (++count & 2 )  {  
		Buttons_low &= mask; 

As for the programming I have to think it better because if I want to keep the functionality of all buttons and still can record some button sequences it will involve adding more keys to the project. Maybe a foot switch will suit to this function.