File tree Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,6 @@ SECTIONS
69
69
70
70
KEEP(*(.sketch_boot))
71
71
72
- /* After the constructors, call PMIC handling stuff (precompiled) */
73
- KEEP(*(.init_pmic_variant))
74
-
75
72
. = ALIGN (0x2000);
76
73
KEEP(*(.isr_vector))
77
74
*(.text*)
Original file line number Diff line number Diff line change @@ -168,26 +168,28 @@ SERCOM sercom5(SERCOM5);
168
168
169
169
#if defined(USE_BQ24195L_PMIC)
170
170
171
- #if 0
172
- /* generate .o out of this function and attach it to the linker */
171
+ #include " wiring_private.h "
172
+
173
173
#define PMIC_ADDRESS 0x6B
174
174
#define PMIC_REG02 0x02
175
175
176
176
static inline void set_pmic_safe_defaults () {
177
- Wire.begin();
178
- Wire.beginTransmission(PMIC_ADDRESS);
179
- Wire.write(PMIC_REG02);
180
- Wire.write(0);
181
- Wire.endTransmission();
182
- Wire.end();
177
+ PERIPH_WIRE.initMasterWIRE (100000 );
178
+ PERIPH_WIRE.enableWIRE ();
179
+ pinPeripheral (PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType );
180
+ pinPeripheral (PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType );
181
+
182
+ PERIPH_WIRE.startTransmissionWIRE ( PMIC_ADDRESS, WIRE_WRITE_FLAG );
183
+ PERIPH_WIRE.sendDataMasterWIRE (PMIC_REG02);
184
+ PERIPH_WIRE.sendDataMasterWIRE (0 );
185
+ PERIPH_WIRE.prepareCommandBitsWire (WIRE_MASTER_ACT_STOP);
186
+ PERIPH_WIRE.disableWIRE ();
183
187
}
184
188
185
- # else
186
- __attribute__ ((section( " .__init_pmic_variant " )))
187
- unsigned char init_pmic[0x4000] = {
189
+ void initVariant () {
190
+ set_pmic_safe_defaults ();
191
+ }
188
192
189
- };
190
- #endif
191
193
#endif
192
194
193
195
// Serial1
You can’t perform that action at this time.
0 commit comments