ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
FXLC95000_1.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** This component module is generated by Processor Expert. Do not modify it.
3 ** Filename : FXLC95000_1.c
4 ** CDE edition : Standard
5 ** Project : ISF2P2_K64F_MQX_PROJ
6 ** Processor : MK64FN1M0VLL12
7 ** Component : ISF_KSDK_Sensor_FXLC95000_Accelerometer
8 ** Version : Component 02.500, Driver 01.00, CPU db: 3.00.000
9 ** Repository : My Components
10 ** Compiler : GNU C Compiler
11 ** Date/Time : 2016-10-06, 13:38, # CodeGen: 0
12 ** Abstract :
13 **
14 ** Settings :
15 ** Component Name : FXLC95000_1
16 ** Device Address : 0x4C
17 ** Comm Channel : I2C1
18 ** Allowed Sample Rates : 800Hz
19 ** Allowed Full-scale Range : ±2 g
20 ** Contents :
21 ** No public methods
22 **
23 ** (c) Copyright Freescale Semiconductor Inc, 2015
24 http://www.freescale.com
25 ** ###################################################################*/
26 /*!
27 ** @file FXLC95000_1.c
28 ** @version 01.00
29 ** @brief
30 **
31 */
32 /*!
33 ** @addtogroup FXLC95000_1_module FXLC95000_1 module documentation
34 ** @{
35 */
36 
37 /* MODULE FXLC95000_1. */
38 
39 #include "FXLC95000_1.h"
40 #include "isf_util.h"
41 
43 
44 const uint8 const BootToFlash[] = { 0x29, 0x00, 0xFF, 0xFF, 0xFF, 0xFF };
45 const uint8 const ConfigureMBoxCmd1[] = { 0x01, 0x02, 0x18, 0x14, 0x02, 0x03, 0x02, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0x05, 0x02, 0x04, 0x02, 0x07, 0x02, 0x06, 0x02, 0x09, 0x02, 0x08 };
47 const uint8 const QuickReadInterruptEnable[] = { 0x01, 0x02, 0x39, 0x01, 0x03 };
48 const uint8 const QuickReadInterruptDisable[] = { 0x01, 0x02, 0x39, 0x01, 0x02 };
49 const uint8 const StartDataCmd[] = { 0x02, 0x02, 0x00, 0x01, 0x52 };
50 const uint8 const EndDataCmd[] = { 0x02, 0x02, 0x00, 0x01, 0x51 };
51 const uint8 const ShutdownCmd[] = { 0x02, 0x02, 0x00, 0x01, 0x50 };
53 const uint8 const UnprotectFlash[] = { 0x40, 0x00 };
54 const uint8 const EraseMainFlashArray[] = { 0x12, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF };
55 const uint8 const ProtectFlash[] = { 0x38, 0x00 };
56 
58 {
59  {
60  .offset = 0,
61  .nByteWrite = sizeof(BootToFlash),
62  .pWriteBuffer = (uint8* const)&BootToFlash
63  }
64 };
65 
67 {
68  {
69  .offset = 0,
70  .nByteWrite = sizeof(ReadConfigRegistersCmd),
71  .pWriteBuffer = (uint8* const)&ReadConfigRegistersCmd
72  }
73 };
74 
76 {
77  {
78  .offset = 0,
79  .nByteWrite = sizeof(ConfigureMBoxCmd1),
80  .pWriteBuffer = (uint8* const)&ConfigureMBoxCmd1
81  },
82  {
83  .offset = 0,
84  .nByteWrite = sizeof(QuickReadInterruptEnable),
85  .pWriteBuffer = (uint8* const)&QuickReadInterruptEnable
86  }
87 };
88 
90 {
91  {
92  .offset = 0,
93  .nByteWrite = sizeof(StartDataCmd),
94  .pWriteBuffer = (uint8* const)&StartDataCmd
95  }
96 };
97 
99 {
100  {
101  .offset = 0,
102  .nByteWrite = sizeof(EndDataCmd),
103  .pWriteBuffer = (uint8* const)&EndDataCmd
104  }
105 };
106 
107 
109 {
110  {
111  .offset = 0,
112  .nByteWrite = sizeof(ShutdownCmd),
113  .pWriteBuffer = (uint8* const)&ShutdownCmd
114  }
115 };
116 
118 {
119  {
120  .offset = 0,
121  .nByteWrite = sizeof(ConfigWritePreamble),
122  .pWriteBuffer = (uint8* const)&ConfigWritePreamble
123  }
124 };
125 
127 {
128  {
129  .offset = 0,
130  .nByteWrite = sizeof(UnprotectFlash),
131  .pWriteBuffer = (uint8* const)&UnprotectFlash
132  },
133  {
134  .offset = 0,
135  .nByteWrite = sizeof(EraseMainFlashArray),
136  .pWriteBuffer = (uint8* const)&EraseMainFlashArray
137  }
138 };
139 
141 {
142  {
143  .offset = 0,
144  .nByteWrite = sizeof(ProtectFlash),
145  .pWriteBuffer = (uint8* const)&ProtectFlash
146  }
147 };
148 
150 {
152  .sampleDataSize = FXLC95000_1_SAMPLE_SIZE,
153  .configRegisterReadOffset = FXLC95000_1_CONFIG_REGISTER_READ_OFFSET,
154  .configRegisterReadSize = FXLC95000_1_CONFIG_REGISTER_SIZE,
155  .engFloatConversionFactor = FXLC95000_1_ACC_FLOAT_CONVERSION_FACTOR,
156  .engFixedTotalWidth = 32,
157  .engFixedIntegerWidth = 16,
158  .engFixedSignBit = 1,
162  .writeConfigRegisterPreamble = { .numCommands=sizeof(WriteConfigPreambleSequence)/sizeof(fxlc95000_Command_t),.commands=WriteConfigPreambleSequence},
163  .readConfigCommands = { .numCommands=sizeof(ReadConfigRegistersSequence)/sizeof(fxlc95000_Command_t),.commands=ReadConfigRegistersSequence},
164  .initializeCommands = { .numCommands=sizeof(InitializeSequence)/sizeof(fxlc95000_Command_t),.commands=InitializeSequence},
165  .validateSettingsCommands = { .numCommands=0, .commands=NULL},
166  .configureCommands = { .numCommands=sizeof(ConfigureSequence)/sizeof(fxlc95000_Command_t), .commands=ConfigureSequence},
167  .startDataCommands = { .numCommands=sizeof(StartDataSequence)/sizeof(fxlc95000_Command_t), .commands=StartDataSequence},
168  .endDataCommands = { .numCommands=sizeof(EndDataSequence)/sizeof(fxlc95000_Command_t), .commands=EndDataSequence},
169  .calibrateCommands = { .numCommands=0, .commands=NULL},
170  .shutdownCommands = { .numCommands=sizeof(ShutdownSequence)/sizeof(fxlc95000_Command_t), .commands=ShutdownSequence},
171  .getDataCommands = { .numCommands=0, .commands=NULL},
172  .flashPreprocessCommands = { .numCommands=sizeof(FlashPreprocessSequence)/sizeof(fxlc95000_Command_t), .commands=FlashPreprocessSequence},
173  .flashPostprocessCommands = { .numCommands=sizeof(FlashPostprocessSequence)/sizeof(fxlc95000_Command_t), .commands=FlashPostprocessSequence}
174 };
175 
176 /*!
177  * @brief This creates the sensor adapter instance for the target sensor.
178  *
179  */
181 {
183  .devInfo.pSupportedSensorDataTypes = fxlc95000_SupportedDataTypes,
184  .devInfo.nNativeDataSetSize = sizeof(fxlc95000_DataBuffer_t),
185  .control.Initialize = &fsl_fxlc95000_Initialize,
186  .control.ValidateSettings = &fsl_fxlc95000_ValidateSettings,
187  .control.Configure = &fsl_fxlc95000_Configure,
188  .control.StartData = &fsl_fxlc95000_StartData,
189  .control.EndData = &fsl_fxlc95000_EndData,
190  .control.Calibrate = &fsl_fxlc95000_Calibrate,
191  .control.Shutdown = &fsl_fxlc95000_Shutdown,
192  .control.Flash = &fsl_fxlc95000_Flash,
193  .control.Convert = &fsl_fxlc95000_Convert
194 };
195 
196 const i2c_device_t FXLC95000_1_DeviceInfo =
197 {
198  .baudRate_kbps = 400, // default baud rate (kbps).
199  .address = 76 // instance specific device address.
200 };
201 
202 
203 
204 /* END FXLC95000_1. */
205 
206 /*!
207 ** @}
208 */
209 /*
210 ** ###################################################################
211 **
212 ** This file was created by Processor Expert 10.5 [05.21]
213 ** for the Freescale Kinetis series of microcontrollers.
214 **
215 ** ###################################################################
216 */
const isf_dsa_Adapter_t FXLC95000_1_Adapter
This creates the sensor adapter instance for the target sensor.
Definition: FXLC95000_1.c:180
unsigned char uint8
Definition: isf_types.h:76
const fxlc95000_Command_t const StartDataSequence[]
Definition: FXLC95000_1.c:89
isf_dsa_status_t fsl_fxlc95000_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
#define FXLC95000_1_CONFIG_REGISTER_CMD_OFFSET
Definition: FXLC95000_1.h:53
#define FXLC95000_1_SAMPLE_OFFSET
Definition: FXLC95000_1.h:51
#define FXLC95000_1_SAMPLE_SIZE
Definition: FXLC95000_1.h:52
const uint8 const ConfigWritePreamble[]
Definition: FXLC95000_1.c:52
const uint8 const QuickReadInterruptEnable[]
Definition: FXLC95000_1.c:47
const fxlc95000_Command_t const ReadConfigRegistersSequence[]
Definition: FXLC95000_1.c:66
isf_dsa_status_t fsl_fxlc95000_Flash(isf_SensorHandle_t *pSensorHandle, void *pFlashData, uint8 numBytes)
isf_SensorDataTypes_t fxlc95000_SupportedDataTypes[]
#define FXLC95000_1_CONFIG_REGISTER_READ_OFFSET
Definition: FXLC95000_1.h:54
const fxlc95000_Command_t const WriteConfigPreambleSequence[]
Definition: FXLC95000_1.c:117
This structure defines the dummy DSA data buffer format.
isf_dsa_status_t fsl_fxlc95000_Convert(volatile isf_SensorHandle_t *pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void *pNativeSample, void *pConvertedSample, int32 *numBytes)
This function converts the raw sample data to the desired output type.
isf_dsa_status_t fsl_fxlc95000_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
#define FXLC95000_1_CONFIG_REGISTER_SIZE
Definition: FXLC95000_1.h:55
const fxlc95000_Command_t const FlashPreprocessSequence[]
Definition: FXLC95000_1.c:126
const fxlc95000_Command_t const InitializeSequence[]
Definition: FXLC95000_1.c:57
isf_dsa_status_t fsl_fxlc95000_EndData(isf_SensorHandle_t *pSensorHandle)
const uint8 const QuickReadInterruptDisable[]
Definition: FXLC95000_1.c:48
#define FXLC95000_1_ACC_ACCEL_RESOLUTION_16_BIT
Definition: FXLC95000_1.h:62
const uint8 const EraseMainFlashArray[]
Definition: FXLC95000_1.c:54
isf_dsa_DeviceInfoBlock_t devInfo
const uint8 const UnprotectFlash[]
Definition: FXLC95000_1.c:53
const uint8 const EndDataCmd[]
Definition: FXLC95000_1.c:50
isf_SensorTypes_t fxlc95000_SupportedSensorTypes[]
Supported sensor and data types.
The isf_util.h file contains the utility method declarations and macros.
This defines the DSA adapter structure required for static initialization of the concrete instance of...
const fxlc95000_Command_t const ConfigureSequence[]
Definition: FXLC95000_1.c:75
#define FXLC95000_1_ACC_ACCEL_RANGE_2G
Definition: FXLC95000_1.h:58
isf_SensorTypes_t * pSupportedSensorTypes
isf_dsa_status_t fsl_fxlc95000_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSubSettings)
#define FXLC95000_1_ACC_MODE_ACCEL_ONLY
Definition: FXLC95000_1.h:61
const uint8 const ConfigureMBoxCmd1[]
Definition: FXLC95000_1.c:45
const uint8 const ShutdownCmd[]
Definition: FXLC95000_1.c:51
const uint8 const StartDataCmd[]
Definition: FXLC95000_1.c:49
isf_dsa_status_t fsl_fxlc95000_StartData(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t fsl_fxlc95000_Initialize(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t fsl_fxlc95000_Shutdown(isf_SensorHandle_t *pSensorHandle)
const fxlc95000_Command_t const ShutdownSequence[]
Definition: FXLC95000_1.c:108
const fxlc95000_Command_t const EndDataSequence[]
Definition: FXLC95000_1.c:98
#define FXLC95000_1_ACC_FLOAT_CONVERSION_FACTOR
Definition: FXLC95000_1.h:57
uint8 FXLC95000_1_ConfigRegisterBuffer[FXLC95000_1_CONFIG_REGISTER_SIZE]
Definition: FXLC95000_1.c:42
const uint8 const ProtectFlash[]
Definition: FXLC95000_1.c:55
const uint8 const ReadConfigRegistersCmd[]
Definition: FXLC95000_1.c:46
const uint8 const BootToFlash[]
Definition: FXLC95000_1.c:44
const i2c_device_t FXLC95000_1_DeviceInfo
This allows access to the sensor communications specific configuration.
Definition: FXLC95000_1.c:196
fxlc95000_Sensor_Specific_Settings_t FXLC95000_1_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
Definition: FXLC95000_1.c:149
const fxlc95000_Command_t const FlashPostprocessSequence[]
Definition: FXLC95000_1.c:140