@@ -349,6 +349,16 @@ def writeGo(outdir, device):
349
349
volatile.StoreUint8(&r.Reg, volatile.LoadUint8(&r.Reg) &^ value)
350
350
}}
351
351
352
+ // HasBits reads the register and then checks to see if the passed bits are set. It
353
+ // is the volatile equivalent of:
354
+ //
355
+ // (*r.Reg & value) > 0
356
+ //
357
+ //go:inline
358
+ func (r *Register8) HasBits(value uint8) bool {{
359
+ return (r.Get() & value) > 0
360
+ }}
361
+
352
362
type Register16 struct {{
353
363
Reg uint16
354
364
}}
@@ -391,6 +401,16 @@ def writeGo(outdir, device):
391
401
volatile.StoreUint16(&r.Reg, volatile.LoadUint16(&r.Reg) &^ value)
392
402
}}
393
403
404
+ // HasBits reads the register and then checks to see if the passed bits are set. It
405
+ // is the volatile equivalent of:
406
+ //
407
+ // (*r.Reg & value) > 0
408
+ //
409
+ //go:inline
410
+ func (r *Register16) HasBits(value uint16) bool {{
411
+ return (r.Get() & value) > 0
412
+ }}
413
+
394
414
type Register32 struct {{
395
415
Reg uint32
396
416
}}
@@ -433,6 +453,16 @@ def writeGo(outdir, device):
433
453
volatile.StoreUint32(&r.Reg, volatile.LoadUint32(&r.Reg) &^ value)
434
454
}}
435
455
456
+ // HasBits reads the register and then checks to see if the passed bits are set. It
457
+ // is the volatile equivalent of:
458
+ //
459
+ // (*r.Reg & value) > 0
460
+ //
461
+ //go:inline
462
+ func (r *Register32) HasBits(value uint32) bool {{
463
+ return (r.Get() & value) > 0
464
+ }}
465
+
436
466
// Some information about this device.
437
467
const (
438
468
DEVICE = "{name}"
0 commit comments