Using millis() instead of delay

I agree with John that by making prev static, you will be mixing up the usage of the two calls to timer.
You are thinking that each timer call has its "own" copy of prev that is not reset. but actually, both timer calls are using the same prev variable.

when you say "use my library in separate classes", if you meant converting your timer function by wrapping it in a class that contains timer function and creating two instances of the class, then yes it will work, as each class instance will keep its own copy of prev. The Routine class you posted does exactly that.