Every line of 'golang initialize struct' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
92 func init() { fn() }
99 func (h *MPU6050Driver) initialize() (err error) { 100 if err = h.connection.I2cStart(mpu6050Address); err != nil { 101 return 102 } 103 104 // setClockSource 105 if err = h.connection.I2cWrite(mpu6050Address, []byte{MPU6050_RA_PWR_MGMT_1, 106 MPU6050_PWR1_CLKSEL_BIT, 107 MPU6050_PWR1_CLKSEL_LENGTH, 108 MPU6050_CLOCK_PLL_XGYRO}); err != nil { 109 return 110 } 111 112 // setFullScaleGyroRange 113 if err = h.connection.I2cWrite(mpu6050Address, []byte{MPU6050_RA_GYRO_CONFIG, 114 MPU6050_GCONFIG_FS_SEL_BIT, 115 MPU6050_GCONFIG_FS_SEL_LENGTH, 116 MPU6050_GYRO_FS_250}); err != nil { 117 return 118 } 119 120 // setFullScaleAccelRange 121 if err = h.connection.I2cWrite(mpu6050Address, []byte{MPU6050_RA_ACCEL_CONFIG, 122 MPU6050_ACONFIG_AFS_SEL_BIT, 123 MPU6050_ACONFIG_AFS_SEL_LENGTH, 124 MPU6050_ACCEL_FS_2}); err != nil { 125 return 126 } 127 128 // setSleepEnabled 129 if err = h.connection.I2cWrite(mpu6050Address, []byte{MPU6050_RA_PWR_MGMT_1, 130 MPU6050_PWR1_ENABLE_BIT, 131 0}); err != nil { 132 return 133 } 134 135 return nil 136 }
38 func (p *PtrKindNode) initialize(field string, parent NodeInterface, t reflect.Type, rt *ResourceTree) { 39 p.NodeData.initialize(field, parent, t, rt) 40 p.objKind = t.Elem().Kind() 41 }
25 func init() { 26 if !C.openssl_global_init() { 27 panic("Failed to initalize OpenSSL") // nolint 28 } 29 }
38 func (s *StructKindNode) initialize(field string, parent NodeInterface, t reflect.Type, rt *ResourceTree) { 39 s.NodeData.initialize(field, parent, t, rt) 40 }
68 func init() { 69 var memStats MemStats 70 if sizeof_C_MStats != unsafe.Sizeof(memStats) { 71 println(sizeof_C_MStats, unsafe.Sizeof(memStats)) 72 throw("MStats vs MemStatsType size mismatch") 73 } 74 }
16 func init() { 17 tm := []glib.TypeMarshaler{ 18 {glib.Type(C.gtk_alignment_get_type()), marshalAlignment}, 19 {glib.Type(C.gtk_arrow_get_type()), marshalArrow}, 20 {glib.Type(C.gtk_misc_get_type()), marshalMisc}, 21 {glib.Type(C.gtk_status_icon_get_type()), marshalStatusIcon}, 22 } 23 glib.RegisterGValueMarshalers(tm) 24 25 //Contribute to casting 26 for k, v := range map[string]WrapFn{ 27 "GtkAlignment": wrapAlignment, 28 "GtkArrow": wrapArrow, 29 "GtkMisc": wrapMisc, 30 "GtkStatusIcon": wrapStatusIcon, 31 } { 32 WrapMap[k] = v 33 } 34 }
14 func init() { 15 generic.Declare(func() { 16 plz.Max(int(0)) 17 plz.Max(float64(0)) 18 plz.Max(model.User{}, "Score") 19 }) 20 }
107 func (s *Survey) Init(length, intval int) { 108 s.sent.Init(length/intval, intval) 109 s.recved.Init(length/intval, intval) 110 s.latencyMin = -1 111 }
503 func (ly *Layer) InitGInc() { 504 for ni := range ly.Neurons { 505 nrn := &ly.Neurons[ni] 506 nrn.GeInc = 0 507 nrn.GiInc = 0 508 } 509 for _, p := range ly.RecvPrjns { 510 if p.IsOff() { 511 continue 512 } 513 p.(LeabraPrjn).InitGInc() 514 } 515 }