Skip to content
Snippets Groups Projects
Commit 203dfcc1 authored by Martino Facchin's avatar Martino Facchin Committed by Cristian Maglie
Browse files

Rewrite PMIC initialization using Sercom (no error checking)

parent 70eff4b8
No related branches found
No related tags found
No related merge requests found
...@@ -69,9 +69,6 @@ SECTIONS ...@@ -69,9 +69,6 @@ SECTIONS
KEEP(*(.sketch_boot)) KEEP(*(.sketch_boot))
/* After the constructors, call PMIC handling stuff (precompiled) */
KEEP(*(.init_pmic_variant))
. = ALIGN(0x2000); . = ALIGN(0x2000);
KEEP(*(.isr_vector)) KEEP(*(.isr_vector))
*(.text*) *(.text*)
......
...@@ -168,26 +168,28 @@ SERCOM sercom5(SERCOM5); ...@@ -168,26 +168,28 @@ SERCOM sercom5(SERCOM5);
#if defined(USE_BQ24195L_PMIC) #if defined(USE_BQ24195L_PMIC)
#if 0 #include "wiring_private.h"
/* generate .o out of this function and attach it to the linker */
#define PMIC_ADDRESS 0x6B #define PMIC_ADDRESS 0x6B
#define PMIC_REG02 0x02 #define PMIC_REG02 0x02
static inline void set_pmic_safe_defaults() { static inline void set_pmic_safe_defaults() {
Wire.begin(); PERIPH_WIRE.initMasterWIRE(100000);
Wire.beginTransmission(PMIC_ADDRESS); PERIPH_WIRE.enableWIRE();
Wire.write(PMIC_REG02); pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
Wire.write(0); pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
Wire.endTransmission();
Wire.end(); PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG02);
PERIPH_WIRE.sendDataMasterWIRE(0);
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
} }
#else void initVariant() {
__attribute__ ((section(".__init_pmic_variant"))) set_pmic_safe_defaults();
unsigned char init_pmic[0x4000] = { }
};
#endif
#endif #endif
// Serial1 // Serial1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment