Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 131: Add BNO055, RF430CL331H, update BME680, IS25xp #132

Merged
merged 10 commits into from
Jul 30, 2024
4 changes: 2 additions & 2 deletions setup.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
JLINKPATH = <full path to JLink binary>
ARMGCC_DIR = /usr/
JLINKPATH = JLinkExe
ARMGCC_DIR = /Users/hamid/bare-metal-arm/gcc-arm-none-eabi-4_8-2014q1
91 changes: 35 additions & 56 deletions src/boot/ksdk1.1.0/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
volatile WarpI2CDeviceState deviceMMA8451QState;
#endif
#if (WARP_BUILD_ENABLE_DEVBNO055)
warpPrint("hello\n");
KomaGR marked this conversation as resolved.
Show resolved Hide resolved
#include "devBNO055.h"
volatile WarpI2CDeviceState deviceBNO055State;
#endif
Expand Down Expand Up @@ -266,7 +267,7 @@ static void repeatRegisterReadForDeviceAndAddress(WarpSensorDevice warpSens
static int char2int(int character);
static void activateAllLowPowerSensorModes(bool verbose);
static void powerupAllSensors(void);
static uint8_t readHexByte(void);
static uint8_t readHexByte(void);
static int read4digits(void);
static void writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever);
static void printAllSensors(bool printHeadersAndCalibration, bool hexModeFlag, int menuDelayBetweenEachRun, bool loopForever);
Expand Down Expand Up @@ -419,8 +420,6 @@ callback0(power_manager_notify_struct_t * notify, power_manager_callback_data_t
* Derived from KSDK power_manager_demo.c <<END
*/



void
sleepUntilReset(void)
{
Expand All @@ -440,7 +439,6 @@ sleepUntilReset(void)
}
}


void
enableLPUARTpins(void)
{
Expand Down Expand Up @@ -483,7 +481,6 @@ enableLPUARTpins(void)
LPUART_DRV_Init(0,(lpuart_state_t *)&lpuartState,(lpuart_user_config_t *)&lpuartUserConfig);
}


void
disableLPUARTpins(void)
{
Expand Down Expand Up @@ -521,8 +518,6 @@ disableLPUARTpins(void)
CLOCK_SYS_DisableLpuartClock(0);
}



WarpStatus
sendBytesToUART(uint8_t * bytes, size_t nbytes)
{
Expand All @@ -537,8 +532,6 @@ sendBytesToUART(uint8_t * bytes, size_t nbytes)
return kWarpStatusOK;
}



void
warpEnableSPIpins(void)
{
Expand All @@ -563,15 +556,13 @@ warpEnableSPIpins(void)
*/
uint32_t calculatedBaudRate;
spiUserConfig.polarity = kSpiClockPolarity_ActiveHigh;
spiUserConfig.phase = kSpiClockPhase_FirstEdge;
spiUserConfig.phase = kSpiClockPhase_FirstEdge;
spiUserConfig.direction = kSpiMsbFirst;
spiUserConfig.bitsPerSec = gWarpSpiBaudRateKbps * 1000;
SPI_DRV_MasterInit(0 /* SPI master instance */, (spi_master_state_t *)&spiMasterState);
SPI_DRV_MasterConfigureBus(0 /* SPI master instance */, (spi_master_user_config_t *)&spiUserConfig, &calculatedBaudRate);
}



void
warpDisableSPIpins(void)
{
Expand Down Expand Up @@ -646,8 +637,6 @@ warpDeasserAllSPIchipSelects(void)
#endif
}



void
debugPrintSPIsinkBuffer(void)
{
Expand All @@ -658,8 +647,6 @@ debugPrintSPIsinkBuffer(void)
warpPrint("\n");
}



void
warpEnableI2Cpins(void)
{
Expand All @@ -684,8 +671,6 @@ warpEnableI2Cpins(void)
// #endif
}



void
warpDisableI2Cpins(void)
{
Expand All @@ -709,7 +694,6 @@ warpDisableI2Cpins(void)
#endif
}


#if (WARP_BUILD_ENABLE_GLAUX_VARIANT)
void
lowPowerPinStates(void)
Expand Down Expand Up @@ -909,7 +893,6 @@ disableTPS62740(void)
}
#endif


#if (!WARP_BUILD_ENABLE_GLAUX_VARIANT && !WARP_BUILD_ENABLE_FRDMKL03)
void
enableTPS62740(uint16_t voltageMillivolts)
Expand All @@ -935,7 +918,6 @@ enableTPS62740(uint16_t voltageMillivolts)
}
#endif


#if (!WARP_BUILD_ENABLE_GLAUX_VARIANT && !WARP_BUILD_ENABLE_FRDMKL03)
void
setTPS62740CommonControlLines(uint16_t voltageMillivolts)
Expand Down Expand Up @@ -1118,8 +1100,6 @@ setTPS62740CommonControlLines(uint16_t voltageMillivolts)
}
#endif



void
warpScaleSupplyVoltage(uint16_t voltageMillivolts)
{
Expand All @@ -1141,8 +1121,6 @@ warpScaleSupplyVoltage(uint16_t voltageMillivolts)
#endif
}



void
warpDisableSupplyVoltage(void)
{
Expand All @@ -1156,7 +1134,6 @@ warpDisableSupplyVoltage(void)
#endif
}


void
warpLowPowerSecondsSleep(uint32_t sleepSeconds, bool forceAllPinsIntoLowPowerState)
{
Expand Down Expand Up @@ -1226,7 +1203,6 @@ dumpProcessorState(void)
warpPrint("\r\tTPM clock: %d\n", CLOCK_SYS_GetTpmGateCmd(0));
}


void
printBootSplash(uint16_t gWarpCurrentSupplyVoltage, uint8_t menuRegisterAddress, WarpPowerManagerCallbackStructure * powerManagerCallbackStructure)
{
Expand Down Expand Up @@ -1473,8 +1449,8 @@ main(void)
uint8_t key;
WarpSensorDevice menuTargetSensor = kWarpSensorBMX055accel;
volatile WarpI2CDeviceState * menuI2cDevice = NULL;
uint8_t menuRegisterAddress = 0x00;
rtc_datetime_t warpBootDate;
uint8_t menuRegisterAddress = 0x00;
rtc_datetime_t warpBootDate;
power_manager_user_config_t warpPowerModeWaitConfig;
power_manager_user_config_t warpPowerModeStopConfig;
power_manager_user_config_t warpPowerModeVlpwConfig;
Expand All @@ -1488,7 +1464,7 @@ main(void)
* We use this as a template later below and change the .mode fields for the different other modes.
*/
const power_manager_user_config_t warpPowerModeVlprConfig = {
.mode = kPowerManagerVlpr,
.mode = kPowerManagerVlpr,
.sleepOnExitValue = false,
.sleepOnExitOption = false
};
Expand Down Expand Up @@ -2057,8 +2033,7 @@ main(void)
warpPrint("\r\n\tFlash status after going into low power mode\n");
flashStatusIS25xP();
#endif



warpDisableI2Cpins();
blinkLED(kGlauxPinLED);
warpPrint("About to go into VLLS0...\n");
Expand Down Expand Up @@ -2901,7 +2876,8 @@ main(void)
*/
case '1':
{
uint8_t ops1[] = {
uint8_t ops1[] =
{
/* Read JEDEC ID Command */
0x9F, /* Instruction Code */
0x00, /* Dummy Receive Byte */
Expand All @@ -2922,7 +2898,8 @@ main(void)
deviceIS25xPState.spiSinkBuffer[3]);
}

uint8_t ops2[] = {
uint8_t ops2[] =
{
/* Read Manufacturer & Device ID */
0x90, /* Instruction Code */
0x00, /* Dummy Byte 1 */
Expand All @@ -2945,7 +2922,8 @@ main(void)
deviceIS25xPState.spiSinkBuffer[5]);
}

uint8_t ops3[] = {
uint8_t ops3[] =
{
/* Read ID / Release Power Down */
0xAB, /* Instruction Code */
0x00, /* Dummy Byte */
Expand Down Expand Up @@ -2998,7 +2976,8 @@ main(void)
BYTE_TO_BINARY(deviceIS25xPState.spiSinkBuffer[1]));
}

uint8_t ops6[] = {
uint8_t ops6[] =
{
/* Read Read Parameters */
0x61, /* RDRP */
0x00, /* Dummy Byte1 */
Expand All @@ -3015,7 +2994,8 @@ main(void)
BYTE_TO_BINARY(deviceIS25xPState.spiSinkBuffer[1]));
}

uint8_t ops7[] = {
uint8_t ops7[] =
{
/* Read Extended Read Parameters */
0x81, /* RDERP */
0x00, /* Dummy Byte1 */
Expand All @@ -3032,7 +3012,8 @@ main(void)
BYTE_TO_BINARY(deviceIS25xPState.spiSinkBuffer[1]));
}

uint8_t ops8[] = {
uint8_t ops8[] =
{
/* Read Unique ID */
0x4B, /* RDUID */
0x00, /* Dummy Byte */
Expand Down Expand Up @@ -3060,7 +3041,8 @@ main(void)
*/
case '2':
{
uint8_t ops[] = {
uint8_t ops[] =
{
/* Read JEDEC Discoverable Params */
0x5A, /* RDSFDP */
0x00, /* Address Byte */
Expand Down Expand Up @@ -3133,9 +3115,10 @@ main(void)
case '3':
{
WarpStatus status;
uint8_t ops[] = {
uint8_t ops[] =
{
0x06, /* WREN */
};
};

status = spiTransactionIS25xP(ops, 1);
if (status != kWarpStatusOK)
Expand Down Expand Up @@ -3320,9 +3303,9 @@ writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever)
sensorBitField = sensorBitField | kWarpFlashBME680BitField;
#endif
#if (WARP_BUILD_ENABLE_DEVBNO055)
numberOfConfigErrors += configureSensorRegisterBNO055(0x00, 0x02);
numberOfConfigErrors += configureSensorRegisterBNO055(0x00, 0x07);

// sensorBitField = sensorBitField | kWarpFlashBNO055BitField;
sensorBitField = sensorBitField | kWarpFlashBNO055BitField;
#endif
#if (WARP_BUILD_ENABLE_DEVBMX055)
numberOfConfigErrors += configureSensorBMX055accel(
Expand Down Expand Up @@ -3360,14 +3343,14 @@ writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever)
#if (WARP_BUILD_ENABLE_DEVRF430CL331H)
numberOfConfigErrors += configureSensorRegisterRF430CL331H(0x0040);

// sensorBitField = sensorBitField | kWarpFlashRF430CL331HBitField;
sensorBitField = sensorBitField | kWarpFlashRF430CL331HBitField;
#endif

/*
* Add RV8803C7 to sensorBitField
*/
#if (WARP_BUILD_ENABLE_DEVRV8803C7)
// sensorBitField = sensorBitField | kWarpFlashRV8803C7BitField;
sensorBitField = sensorBitField | kWarpFlashRV8803C7BitField;
#endif

// Add readingCount, 1 x timing, numberofConfigErrors
Expand Down Expand Up @@ -3442,10 +3425,10 @@ writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever)
bytesWrittenIndex += appendSensorDataBME680(flashWriteBuf + bytesWrittenIndex);
#endif
#if (WARP_BUILD_ENABLE_DEVBNO055)
// bytesWrittenIndex += appendSensorDataBNO055(flashWriteBuf + bytesWrittenIndex);
bytesWrittenIndex += appendSensorDataBNO055(flashWriteBuf + bytesWrittenIndex);
#endif
#if (WARP_BUILD_ENABLE_DEVRF430CL331H)
// bytesWrittenIndex += appendSensorDataRF430CL331H(flashWriteBuf + bytesWrittenIndex);
bytesWrittenIndex += appendSensorDataRF430CL331H(flashWriteBuf + bytesWrittenIndex);
#endif
#if (WARP_BUILD_ENABLE_DEVBMX055)
bytesWrittenIndex += appendSensorDataBMX055accel(flashWriteBuf + bytesWrittenIndex);
Expand All @@ -3462,7 +3445,7 @@ writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever)
#endif

#if (WARP_BUILD_ENABLE_DEVRV8803C7)
// bytesWrittenIndex += appendSensorDataRV8803C7(flashWriteBuf + bytesWrittenIndex);
bytesWrittenIndex += appendSensorDataRV8803C7(flashWriteBuf + bytesWrittenIndex);
#endif

/*
Expand Down Expand Up @@ -3490,11 +3473,11 @@ writeAllSensorsToFlash(int menuDelayBetweenEachRun, int loopForever)

// if (menuDelayBetweenEachRun > 0)
// {
// while (OSA_TimeGetMsec() - timeAtStart < menuDelayBetweenEachRun)
// {
// }
// // while (OSA_TimeGetMsec() - timeAtStart < menuDelayBetweenEachRun)
// // {
// // }

// timeAtStart = OSA_TimeGetMsec();
// // timeAtStart = OSA_TimeGetMsec();
// status = warpSetLowPowerMode(kWarpPowerModeVLPS, menuDelayBetweenEachRun);

// if (status != kWarpStatusOK)
Expand Down Expand Up @@ -3686,7 +3669,6 @@ printAllSensors(bool printHeadersAndCalibration, bool hexModeFlag,
warpPrint(" numberOfConfigErrors");
warpPrint("\n\n");
}

do
{

Expand Down Expand Up @@ -3718,10 +3700,7 @@ printAllSensors(bool printHeadersAndCalibration, bool hexModeFlag,
printSensorDataBME680(hexModeFlag);
#endif
#if (WARP_BUILD_ENABLE_DEVBNO055)
if(gWarpSleepMode)
{
printSensorDataBNO055(hexModeFlag);
}
#endif
#if (WARP_BUILD_ENABLE_DEVBMX055)
printSensorDataBMX055accel(hexModeFlag);
Expand Down
Loading
Loading