type
RegisterType* = uint8 | uint16 | uint32
RegisterPtr* = ptr RegisterType
RegisterAttr = enum
Readable,
Writable
RegisterAttrs = set[RegisterAttr]
NimbedConfig = object
RegisterConfig[
TAddress: static RegisterPtr,
TReadWriteAttr: static RegisterAttrs,
] = distinct NimbedConfig
proc initRegister*[T: RegisterType](address: static int, rwAttrs: static
RegisterAttrs): auto = # Generic parameters in proc headers are resolved at
declaration generally... need auto.
result = RegisterConfig[cast[ptr T](address), rwAttrs](NimbedConfig()) #
Give return type here
const a = initRegister[uint8](0x0100, {Readable, Writable})
Run
Seems to work. `RegisterConfig` is a typeclass when used as a type with no
generic parameters, but if you mean is that the name of a type delimited by
statics no. They're just value delimited generics.