Skip to content
Snippets Groups Projects
Commit a975868e authored by schneider's avatar schneider
Browse files

fix(testapp): Initialize pmic

parent 000af958
No related branches found
No related tags found
No related merge requests found
...@@ -67,8 +67,10 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS ...@@ -67,8 +67,10 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS
# Source files for this test (add path to VPATH below) # Source files for this test (add path to VPATH below)
SRCS = main.c SRCS = main.c
SRCS += pmic.c
SRCS += ../lib/card10/oled96.c SRCS += ../lib/card10/oled96.c
SRCS += ../lib/card10/fonts.c SRCS += ../lib/card10/fonts.c
SRCS += MAX77650-Arduino-Library.c
# Where to find source files for this test # Where to find source files for this test
...@@ -80,6 +82,9 @@ IPATH = . ...@@ -80,6 +82,9 @@ IPATH = .
IPATH += ../lib/card10 IPATH += ../lib/card10
VPATH += ../lib/card10 VPATH += ../lib/card10
IPATH += ../lib/maxim/MAX77650-Arduino-Library
VPATH += ../lib/maxim/MAX77650-Arduino-Library
# Enable assertion checking for development # Enable assertion checking for development
PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
#include "spi.h" #include "spi.h"
#include "MAX30003.h" #include "MAX30003.h"
#include "oled96.h" #include "oled96.h"
#include "stdbool.h" #include "pmic.h"
#include <stdbool.h>
/***** Definitions *****/ /***** Definitions *****/
...@@ -248,8 +249,12 @@ int main(void) ...@@ -248,8 +249,12 @@ int main(void)
TMR_Delay(MXC_TMR0, MSEC(1000), 0); TMR_Delay(MXC_TMR0, MSEC(1000), 0);
//Setup the I2CM //Setup the I2CM
I2C_Shutdown(I2C_DEVICE); I2C_Shutdown(MXC_I2C0_BUS0);
I2C_Init(I2C_DEVICE, I2C_FAST_MODE, NULL); I2C_Init(MXC_I2C0_BUS0, I2C_FAST_MODE, NULL);
I2C_Shutdown(MXC_I2C1_BUS0);
I2C_Init(MXC_I2C1_BUS0, I2C_FAST_MODE, NULL);
#if 0 #if 0
NVIC_EnableIRQ(I2C0_IRQn); // Not sure if we actually need this when not doing async requests NVIC_EnableIRQ(I2C0_IRQn); // Not sure if we actually need this when not doing async requests
#endif #endif
...@@ -258,12 +263,24 @@ int main(void) ...@@ -258,12 +263,24 @@ int main(void)
// "7-bit addresses 0b0000xxx and 0b1111xxx are reserved" // "7-bit addresses 0b0000xxx and 0b1111xxx are reserved"
for (int addr = 0x8; addr < 0x78; ++addr) { for (int addr = 0x8; addr < 0x78; ++addr) {
// A 0 byte write does not seem to work so always send a single byte. // A 0 byte write does not seem to work so always send a single byte.
int res = I2C_MasterWrite(I2C_DEVICE, addr << 1, dummy, 1, 0); int res = I2C_MasterWrite(MXC_I2C0_BUS0, addr << 1, dummy, 1, 0);
if(res == 1) {
printf("Found (7 bit) address 0x%02x on I2C0\n", addr);
}
res = I2C_MasterWrite(MXC_I2C1_BUS0, addr << 1, dummy, 1, 0);
if(res == 1) { if(res == 1) {
printf("Found (7 bit) address 0x%02x\n", addr); printf("Found (7 bit) address 0x%02x on I2C1\n", addr);
} }
} }
pmic_init();
pmic_set_led(0, 0);
pmic_set_led(1, 0);
pmic_set_led(2, 0);
TMR_Delay(MXC_TMR0, MSEC(1000), 0);
oledInit(0x3c, 0, 0); oledInit(0x3c, 0, 0);
oledFill(0x00); oledFill(0x00);
oledWriteString(0, 0, " card10", 1); oledWriteString(0, 0, " card10", 1);
...@@ -345,8 +362,9 @@ int main(void) ...@@ -345,8 +362,9 @@ int main(void)
if( ETAG[readECGSamples - 1] == FIFO_OVF_MASK ){ if( ETAG[readECGSamples - 1] == FIFO_OVF_MASK ){
ecg_write_reg(FIFO_RST , 0); // Reset FIFO ecg_write_reg(FIFO_RST , 0); // Reset FIFO
//printf("OV\n"); //printf("OV\n");
LED_On(0); // notifies the user that an over flow occured
//rLed = 1;//notifies the user that an over flow occured //LED_On(0);
pmic_set_led(0, 31);
} }
// Print results // Print results
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment