github.com/martinohmann/rfoutlet@v1.2.1-0.20220707195255-8a66aa411105/pkg/gpio/options.go (about) 1 package gpio 2 3 // ReceiverOption is the signature of funcs that are used to configure a 4 // *Receiver. 5 type ReceiverOption func(*Receiver) 6 7 // ReceiverProtocols configures the protocols the receiver should try to 8 // detect. If not overridden explicitly, DefaultProtocols is used. 9 func ReceiverProtocols(protocols []Protocol) ReceiverOption { 10 return func(r *Receiver) { 11 r.protocols = protocols 12 } 13 } 14 15 // TransmitterOption is the signature of funcs that are used to configure a 16 // *Transmitter. 17 type TransmitterOption func(*Transmitter) 18 19 // TransmissionCount configures how many times a code should be transmitted in 20 // a row. The higher the value, the more likely it is that an outlet actually 21 // received the code. 22 func TransmissionCount(count int) TransmitterOption { 23 return func(t *Transmitter) { 24 t.transmissionCount = count 25 } 26 }