44 #include "fsl_lptmr.h"    45 #include "clock_config.h"    48 #include "Driver_I2C.h"    51 #include "issdk_hal.h"    52 #include "gpio_driver.h"    56 #include "auto_detection_service.h"    61 #define SAMPLING_RATE_ms (100)                    62 #define MMA9553_ACCEL_DATA_SIZE (6)               63 #define mma9553_en_callback LPTMR0_IRQHandler     65 #define MMA9553_STREAM_DATA_SIZE (10)    68 #define APPLICATION_NAME "MMA9553 Pedometer Demo"    70 #define APPLICATION_VERSION "2.5"   103     LPTMR_ClearStatusFlags(LPTMR0, kLPTMR_TimerCompareFlag);
   109     uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, 
size_t *hostMsgSize, 
size_t respBufferSize)
   111     bool success = 
false;
   126         if (respBufferSize >= boardNameLen + shieldNameLen + appNameLen + 3)
   135         hostResponse[*hostMsgSize] = appNameLen;
   138         memcpy(hostResponse + *hostMsgSize, 
embAppName, appNameLen);
   139         *hostMsgSize += appNameLen;
   141         hostResponse[*hostMsgSize] = boardNameLen;
   144         memcpy(hostResponse + *hostMsgSize, 
boardString, boardNameLen);
   145         *hostMsgSize += boardNameLen;
   147         hostResponse[*hostMsgSize] = shieldNameLen;
   150         memcpy(hostResponse + *hostMsgSize, 
shieldString, shieldNameLen);
   151         *hostMsgSize += shieldNameLen;
   161         switch (hostCommand[0]) 
   196     lptmr_config_t lptmrConfig;
   220     LPTMR_GetDefaultConfig(&lptmrConfig);
   221     LPTMR_Init(LPTMR0, &lptmrConfig);
   222     LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
   223     LPTMR_SetTimerPeriod(LPTMR0, MSEC_TO_COUNT(
SAMPLING_RATE_ms, CLOCK_GetFreq(kCLOCK_LpoClk)));
   224     EnableIRQ(LPTMR0_IRQn);
   228     if (ARM_DRIVER_OK != status)
   234     status = pI2Cdriver->PowerControl(ARM_POWER_FULL);
   235     if (ARM_DRIVER_OK != status)
   241     status = pI2Cdriver->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
   242     if (ARM_DRIVER_OK != status)
   249     if (ARM_DRIVER_OK != status)
   255     status = pUartDriver->PowerControl(ARM_POWER_FULL);
   256     if (ARM_DRIVER_OK != status)
   263     if (ARM_DRIVER_OK != status)
   298     LPTMR_StartTimer(LPTMR0);
   317         if (ARM_DRIVER_OK != status)
 uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart)
Function to compute the Elapsed Time. 
 
char embAppName[ADS_MAX_STRING_LENGTH]
 
const uint8_t SetFSRange_2g[5]
Full-Scale Range Selections. 
 
int32_t MMA9553_I2C_CommandResponse(mma9553_i2c_sensorhandle_t *pSensorHandle, const registercommandlist_t *pCommandList, const registerreadlist_t *pResponseList, uint8_t *pBuffer)
The interface function to read the sensor data. 
 
#define HOST_PRO_CMD_W_CFG_TAG
 
#define APPLICATION_VERSION
Version to distinguish between instances the same application based on target Shield and updates...
 
volatile bool bMma9553DataReady
 
#define MMA9553_ACCEL_DATA_SIZE
 
#define HOST_S_SIGNAL_EVENT
 
void Host_IO_Receive(host_cmd_proc_fn_t process_host_command, uint8_t encoding)
 
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
 
#define BOARD_BootClockRUN
 
const uint8_t SetMBoxPriority_for30Hz[5]
 
#define MMA9553_XYZ_DATA_OFFSET
XYZ Data Register Offset. 
 
const uint8_t SetAFEPriority_for30Hz[5]
 
void(* toggle_pin)(pinID_t aPinId)
 
char shieldString[ADS_MAX_STRING_LENGTH]
 
This defines the sensor specific information for I2C. 
 
This structure defines the mma9553 pedometer data buffer. 
 
#define ADS_MAX_STRING_LENGTH
 
const uint8_t SetSampleRate_30Hz[5]
 
#define HOST_PRO_INT_DEV_TAG
 
uint8_t streamingPacket[STREAMING_HEADER_LEN+FXLS8962_STREAM_DATA_SIZE]
 
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type. 
 
void MMA9553_I2C_SetIdleTask(mma9553_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task. 
 
#define HOST_PRO_INT_CMD_TAG
Bit aligned values for Host Protocol Interface IDs (Bits 5-6). 
 
#define __END_READ_DATA__
 
int main(void)
Main function. 
 
int32_t MMA9553_I2C_Configure(mma9553_i2c_sensorhandle_t *pSensorHandle, const registercommandlist_t *pCommandList)
The interface function to configure he sensor. 
 
const registercommandlist_t cMma9553Config30Hz[]
 
volatile bool bStreamingEnabled
 
GENERIC_DRIVER_GPIO * pGpioDriver
 
gpioHandleKSDK_t GREEN_LED
 
#define mma9553_en_callback
 
registerDeviceInfo_t deviceInfo
 
#define APPLICATION_NAME
Unique Name for this application which should match the target GUI pkg name. 
 
#define __END_WRITE_CMD__
 
void Host_IO_Add_ISO_Header(uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload)
 
void Host_IO_Send(uint8_t *pMsg, size_t size, uint8_t encoding)
 
void(* clr_pin)(pinID_t aPinId)
 
int32_t MMA9553_I2C_Initialize(mma9553_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress)
The interface function to initialize the sensor. 
 
void BOARD_SystickEnable(void)
Function to enable systicks framework. 
 
#define I2C_S_DEVICE_INDEX
 
const registerreadlist_t cMma9553ReadRawOutput[]
 
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
 
#define BOARD_DEBUG_UART_BAUDRATE
 
The mma9553_drv.h file describes the MMA9553L driver interface and structures. 
 
ARM_DRIVER_I2C * pCommDrv
 
Access structure of the GPIO Driver. 
 
bool process_host_command(uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
 
void BOARD_SystickStart(int32_t *pStart)
Function to Record the Start systick. 
 
void BOARD_RunADS(const char *appName, char *boardString, char *shieldString, size_t bufferLength)
The function to register Application Name and initialte ADS. 
 
fxls8962_acceldataUser_t rawData
 
#define MMA9553_STREAM_DATA_SIZE
 
uint8_t Host_IO_Init(ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress)
 
volatile bool bMma9553Ready
 
This structure defines the Read command List. 
 
char boardString[ADS_MAX_STRING_LENGTH]
 
The host_io_uart.h file contains the Host Protocol interface definitions and configuration. 
 
#define STREAMING_HEADER_LEN
 
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
 
This structure defines the Block command List. 
 
#define I2C_S_SIGNAL_EVENT