| ISF 1.1 Intelligent Sensing Framework

- Main Page
- Data Structures
- Files
- Sensor Adapters

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Data Structures | Defines | Enumerations | Functions | Variables
Include/psp/fxlc95000_util.h File Reference

Fxlc95000 utility header file. More...

`#include "isf_types.h"`

Go to the source code of this file.

## Data Structures
struct | fxlc9500x_afe_data_t
| A single sample set of AFE sensor data. More...
struct | fxlc9500x_idle_t
| Stop mode configuration during idle. More...
struct | fxlc9500x_vars_t
| Freescale firmware variables. More...
## Defines
#define | TPMxSC_TOIE_MASK 0x40
#define | TPMxSC_TOF_MASK 0x80
#define | TPMxSC_CLK_BUSCLK 0x08
#define | TPMxSC_CLK_SYSCLK 0x10
#define | NUM_SENSOR_AXIS 5
| Specifies the total number of axis/sensors in the (AFE) Analog Front End.
## Enumerations
enum | afe_csr_options_t { AFE_CSR_GRANGE_8G = 0xC0, AFE_CSR_GRANGE_4G = 0x80, AFE_CSR_GRANGE_2G = 0x40, AFE_CSR_C4MODE_NONE = 0x00, AFE_CSR_C4MODE_TEMP = 0x10, AFE_CSR_C4MODE_EXT = 0x20, AFE_CSR_CMODE_10BIT = 0x0C, AFE_CSR_CMODE_12BIT = 0x08, AFE_CSR_CMODE_14BIT = 0x04, AFE_CSR_CMODE_16BIT = 0x00 }
| Configures the AFE (Analog Front End) through the AFE CSR (Control and Status Register). More...
enum | framerate_t { FRAMERATE_NONE = 0x00, FRAMERATE_3906HZ = 0x04, FRAMERATE_1953HZ = 0x05, FRAMERATE_977HZ = 0x06, FRAMERATE_488HZ = 0x07, FRAMERATE_244HZ = 0x08, FRAMERATE_122HZ = 0x09, FRAMERATE_61HZ = 0x0A, FRAMERATE_30HZ = 0x0B, FRAMERATE_15HZ = 0x0C, FRAMERATE_8HZ = 0x0D, FRAMERATE_4HZ = 0x0E, FRAMERATE_2HZ = 0x0F, FRAMERATE_1HZ = 0x10, FRAMERATE_POINT5HZ = 0x11, FRAMERATE_POINT2HZ = 0x12 }
| Configures the FIC (Frame Interval Counter) frequency through the CK_OSCTRL register. More...
enum | idle_bits_t { IDLE_BITS_CKOSC = (1<<0), IDLE_BITS_AFE = (1<<1), IDLE_BITS_RSVD_2 = (1<<2), IDLE_BITS_RSVD_3 = (1<<3), IDLE_BITS_RSVD_4 = (1<<4), IDLE_BITS_RSVD_5 = (1<<5), IDLE_BITS_RSVD_6 = (1<<6), IDLE_BITS_RSVD_7 = (1<<7), IDLE_BITS_RSVD_8 = (1<<8), IDLE_BITS_RSVD_9 = (1<<9), IDLE_BITS_RSVD_10 = (1<<10), IDLE_BITS_RSVD_11 = (1<<11), IDLE_BITS_RSVD_12 = (1<<12), IDLE_BITS_RSVD_13 = (1<<13), IDLE_BITS_RSVD_14 = (1<<14), IDLE_BITS_RSVD_15 = (1<<15), IDLE_BITS_USER_0 = (1<<16), IDLE_BITS_USER_1 = (1<<17), IDLE_BITS_USER_2 = (1<<18), IDLE_BITS_USER_3 = (1<<19), IDLE_BITS_USER_4 = (1<<20), IDLE_BITS_USER_5 = (1<<21), IDLE_BITS_USER_6 = (1<<22), IDLE_BITS_USER_7 = (1<<23), IDLE_BITS_USER_8 = (1<<24), IDLE_BITS_USER_9 = (1<<25), IDLE_BITS_USER_10 = (1<<26), IDLE_BITS_USER_11 = (1<<27), IDLE_BITS_USER_12 = (1<<28), IDLE_BITS_USER_13 = (1<<29), IDLE_BITS_USER_14 = (1<<30), IDLE_BITS_USER_15 = (1<<31) }
| Determines which bits of the idle mode are being configured. More...
enum | idle_config_t { IDLE_USE_STOP_FC_CLEAR = 0, IDLE_USE_STOP_FC_SET = 1, IDLE_USE_STOP_SC_CLEAR = 2, IDLE_USE_STOP_SC_SET = 3 }
| Determines the idle mode that is being configured. More...
## Functions
asm uint32 | fxlc9500x_idle (void)
| Executes the idle processing function, to sleep until the next exception.
framerate_t | fxlc9500x_framerate_set (framerate_t rate)
| Sets the FIC (Frame Interval Counter) frequency.
void | fxlc9500x_afe_conversion_start (void)
| Starts an AFE conversion cycle.
void | fxlc9500x_afe_interrupt_clear (void)
| Clears the AFE conversion complete interrupt source.
void | fxlc9500x_afe_raw_sensor_data_get (int16 *pData_ptr)
| Gets raw (semi-trimmed) data from the AFE sensors.
void | fxlc9500x_afe_csr_set (uint32 options)
| Configures the AFE (Analog Front End) by setting the AFE CSR (Control and Status Register) contents.
afe_csr_options_t | fxlc9500x_afe_csr_get (void)
| Gets the AFE CSR (Control and Status Register) contents.
void | fxlc9500x_afe_raw_sensor_data_trim (int16 *pTrim_ptr, int16 *pData_ptr)
| Trims the supplied raw AFE sensor data to get trimmed AFE sensor values.
void | fxlc9500x_afe_offsets_set (int16 *pData_ptr)
| Gets the current AFE accelerometer user offset values.
void | fxlc9500x_afe_offsets_get (int16 *pData_ptr)
| Gets the current AFE accelerometer user offset values.
void | fxlc9500x_afe_trimmed_sensor_data_get (int16 *trim_ptr)
| Gets trimmed data from the AFE sensors.
void | fxlc9500x_afe_interrupt_set (boolean bEnable_irq)
| Enable or disable the AFE conversion complete interrupt.
void | setup_TPM (boolean bIrq_enable, uint16 modulo, uint8 prescale)
| Configures the TPM timer.
## Variables
fxlc9500x_vars_t | fxlc9500x_vars_int

## Detailed Description

Fxlc95000 utility header file.

Definition in file fxlc95000_util.h.

## Define Documentation

#define NUM_SENSOR_AXIS 5

Specifies the total number of axis/sensors in the (AFE) Analog Front End.

For the FXLC9500xL the sensor/axis are:

- accelerometer X, Y, Z
- temperature
- external input

Definition at line 45 of file fxlc95000_util.h.

#define TPMxSC_CLK_BUSCLK 0x08

Definition at line 29 of file fxlc95000_util.h.

#define TPMxSC_CLK_SYSCLK 0x10

Definition at line 30 of file fxlc95000_util.h.

#define TPMxSC_TOF_MASK 0x80

Definition at line 27 of file fxlc95000_util.h.

#define TPMxSC_TOIE_MASK 0x40

Definition at line 26 of file fxlc95000_util.h.

## Enumeration Type Documentation

enum afe_csr_options_t

Configures the AFE (Analog Front End) through the AFE CSR (Control and Status Register).

Since the AFE_CSR is not directly accessible in user mode it can be accessed using the Freescale fxlc9500x_afe_csr_set() and fxlc9500x_afe_csr_get() functions.

The AFE_CSR controls three parameters of the AFE operation:

- G range selection - The AFE can operate in +/-2g, +/- 4g or +/-8g range.

- 4th Conversion - the X, Y and Z accelerometer channels are measured using 3 out of 4 of the ADC channels. The fourth channel can be disabled or used to measure the temperature or external ADC input.

- Conversion mode - the ADC can perform a 10, 12, 14 or 16 bit conversion. A higher bit conversion will give more resolution in the result but takes longer to complete and so consumes more power. Note that the significance of the most significant bit remains the same in all conversion modes, so if the conversion mode is less than 16 bits, the least significant bits of the raw sensor value will be 0.

The AFE_CSR setting value is normally constructed by OR-ing one entry from each of the 3 sections, and casting it to the correct type. e.g.

      \\ Configure the AFE Control and Status Register
      fxlc9500x_afe_csr_set((afe_csr_options_t)(
                AFE_CSR_GRANGE_2G   | // Use +/- 2 g range
                AFE_CSR_C4MODE_TEMP | // Measure X, Y, Z and Temperature
                AFE_CSR_CMODE_10BIT   // Use 10 bit conversion
              );

See also:
  fxlc9500x_afe_csr_set(), fxlc9500x_afe_csr_get()

Enumerator:

  AFE_CSR_GRANGE_8G | Set the AFE to the +/-8g range, so each LSB is 0.244 mg
  AFE_CSR_GRANGE_4G | Set the AFE to the +/-4g range, so each LSB is 0.122 mg
  AFE_CSR_GRANGE_2G | Set the AFE to the +/-2g range, so each LSB is 0.061 mg
  AFE_CSR_C4MODE_NONE | Do not measure anything with the ADCs 4th channel
  AFE_CSR_C4MODE_TEMP | Use the ADCs 4th channel to measure the temperature sensor
  AFE_CSR_C4MODE_EXT | Use the ADCs 4th channel to measure the external inputs
  AFE_CSR_CMODE_10BIT | Perform a 10 bit ADC conversion so the 6 LSBs will be 0
  AFE_CSR_CMODE_12BIT | Perform a 12 bit ADC conversion so the 4 LSBs will be 0
  AFE_CSR_CMODE_14BIT | Perform a 14 bit ADC conversion so the 2 LSBs will be 0
  AFE_CSR_CMODE_16BIT | Perform a 16 bit ADC conversion using all 16 data bits

Definition at line 99 of file fxlc95000_util.h.

enum framerate_t

Configures the FIC (Frame Interval Counter) frequency through the CK_OSCTRL register.

The frame interval counter is the primary mechanism for waking the device up periodically to take some action such as reading the AFE values. The Frame Interval Counter register is accessible in user mode, but a function is provided to set the framerate for two reasons:

- The upper three bits of the CK_OSCTRL register control other attributes of the oscillator so should be preserved when the framerate is changed.

- In order for the Frame interval Counter to run the lowest power idle mode that can be used is Stop SC (slow clock). This is ensured by setting the IDLE_BITS_CKOSC bit in the idle

  # fxlc9500x_idle_t use_stop_sc field. While this field can be accessed by user code, it should

only be modified while interrupts are disabled, either in the exception or trap handlers, or when interrupts have been disabled.

If the framerate is set to FRAMERATE_NONE then the IDLE_BITS_CKOSC bit in the idle

# fxlc9500x_idle_t use_stop_sc field is cleared to enable idle mode to drop to the lowest power

Stop NC (no clock) mode. If the framerate is set to any other valid value then the

# IDLE_BITS_CKOSC bit in the idle fxlc9500x_idle_t use_stop_sc field is set so that the idle

mode cannot drop below the Stop SC (slow clock) mode. If the device enters the Stop NC state then the frame interval counter will not run and cannot wake the device up at the start of each frame.

See also:
  fxlc9500x_framerate_set()

Enumerator:

  FRAMERATE_NONE | The Frame Interval Counter is disabled and will NOT wake up the FXLC9500X periodically.
  FRAMERATE_3906HZ | Configures the frame interval counter to run at 3906 Hz
  FRAMERATE_1953HZ | Configures the frame interval counter to run at 1953 Hz
  FRAMERATE_977HZ | Configures the frame interval counter to run at 977 Hz
  FRAMERATE_488HZ | Configures the frame interval counter to run at 488 Hz
  FRAMERATE_244HZ | Configures the frame interval counter to run at 244 Hz
  FRAMERATE_122HZ | Configures the frame interval counter to run at 122 Hz
  FRAMERATE_61HZ | Configures the frame interval counter to run at 61 Hz
  FRAMERATE_30HZ | Configures the frame interval counter to run at 30.5 Hz
  FRAMERATE_15HZ | Configures the frame interval counter to run at 15.3 Hz
  FRAMERATE_8HZ | Configures the frame interval counter to run at 7.6 Hz
  FRAMERATE_4HZ | Configures the frame interval counter to run at 3.8 Hz
  FRAMERATE_2HZ | Configures the frame interval counter to run at 1.9 Hz
  FRAMERATE_1HZ | Configures the frame interval counter to run at 0.95 Hz
  FRAMERATE_POINT5HZ | Configures the frame interval counter to run at 0.48 Hz
  FRAMERATE_POINT2HZ | Configures the frame interval counter to run at 0.24 Hz

Definition at line 144 of file fxlc95000_util.h.

enum idle_bits_t

Determines which bits of the idle mode are being configured.

These value may be used individually or combined by the fxlc9500x_idle_use_stop_config() to set how the bit field will be used to modify the idle mode operation.

Bits can be individually to separate tasks so that when tasks modify the idle mode configuration they don't overwrite the configuration set by other tasks/activities.

This bit fields may also be used when directly modifying the idle_config_t fields within the user_exception_handler, or any other time when interrupts are disabled.

The first 16 idle bits are reserved for Freescale use and should not be used by user code, while the second set of 16 bits are available for use in customer code.

See also:
  fxlc9500x_idle_use_stop_config()

Enumerator:

  IDLE_BITS_CKOSC | sets the idle configuration for the frame interval counter
  IDLE_BITS_AFE | sets the idle configuration for the AFE (Analog Front End)
  IDLE_BITS_RSVD_2 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_3 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_4 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_5 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_6 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_7 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_8 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_9 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_10 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_11 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_12 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_13 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_14 | idle configuration bit reserved for Freescale use
  IDLE_BITS_RSVD_15 | idle configuration bit reserved for Freescale use
  IDLE_BITS_USER_0 | user assignable idle configuration bit
  IDLE_BITS_USER_1 | user assignable idle configuration bit
  IDLE_BITS_USER_2 | user assignable idle configuration bit
  IDLE_BITS_USER_3 | user assignable idle configuration bit
  IDLE_BITS_USER_4 | user assignable idle configuration bit
  IDLE_BITS_USER_5 | user assignable idle configuration bit
  IDLE_BITS_USER_6 | user assignable idle configuration bit
  IDLE_BITS_USER_7 | user assignable idle configuration bit
  IDLE_BITS_USER_8 | user assignable idle configuration bit
  IDLE_BITS_USER_9 | user assignable idle configuration bit
  IDLE_BITS_USER_10 | user assignable idle configuration bit
  IDLE_BITS_USER_11 | user assignable idle configuration bit
  IDLE_BITS_USER_12 | user assignable idle configuration bit
  IDLE_BITS_USER_13 | user assignable idle configuration bit
  IDLE_BITS_USER_14 | user assignable idle configuration bit
  IDLE_BITS_USER_15 | user assignable idle configuration bit

Definition at line 184 of file fxlc95000_util.h.

enum idle_config_t

Determines the idle mode that is being configured.

This value is used by the fxlc9500x_idle_use_stop_config() to set how the bit field will be used to modify the idle mode operation.

See also:
  fxlc9500x_idle_use_stop_config()

Enumerator:

  IDLE_USE_STOP_FC_CLEAR | Clear (remove) a bit in the use_stop_fc field of the fxlc9500x_idle_t structure
  IDLE_USE_STOP_FC_SET | Set a bit in the use_stop_fc field of the fxlc9500x_idle_t structure. This will force the idle function to stop using the Stop_FC mode so that the system clock still runs at full speed
  IDLE_USE_STOP_SC_CLEAR | Clear (remove) a bit in the use_stop_sc field of the fxlc9500x_idle_t structure
  IDLE_USE_STOP_SC_SET | Set a bit in the use_stop_sc field of the fxlc9500x_idle_t structure. This will prevent the idle function from using the Stop_NC mode so that the system clock still run

Definition at line 228 of file fxlc95000_util.h.

## Function Documentation

void fxlc9500x_afe_conversion_start | ( | void |  | ) |

Starts an AFE conversion cycle.

This triggers the AFE to start an ADC conversion cycle. The duration of the conversion depends on the AFE_CSR configuration. When the conversion completes the VectorNumber_Vconversion_complete exception will occur and can be used by the interrupt service routine to start subsequent processing.

This function can be called from anywhere in user code, but is usually called from within the Start of Frame interrupt is serviced, to minimize the jitter on the AFE sampling:

Returns:
  None

Errors:

Constraints:
  The ADC requires the system clock to run at full speed during the AFE conversion. If idle mode is used, StopFC mode should be set.

Reentrant: No

See also:

afe_csr_options_t fxlc9500x_afe_csr_get | ( | void |  | ) |

Gets the AFE CSR (Control and Status Register) contents.

This function reads the configuration bits from the AFE CSR register.

      afe_csr_options_t csr;
      csr = fxlc9500x_afe_csr_get(); // Read the current AFE CSR value

Returns:
  The current setting of the AFE CSR options

Errors:

Constraints:

Reentrant: No

See also:
  fxlc9500x_afe_csr_set(), afe_csr_options_t

void fxlc9500x_afe_csr_set | ( | uint32 | options | ) |

Configures the AFE (Analog Front End) by setting the AFE CSR (Control and Status Register) contents.

The AFE_CSR is not directly accessible in user mode so this function enables it to be set by the user, and it preserves some fixed configuration settings.

The AFE_CSR controls three parameters of the AFE operation:

- G range selection - The AFE can operate in +/-2g, +/- 4g or +/-8g range.

- 4th Conversion - the X, Y and Z accelerometer channels are measured using 3 out of 4 of the ADC channels. The fourth ADC channel can be disabled or used to measure the temperature or external input.

- Conversion mode - the ADC can perform a 10, 12, 14 or 16 bit conversion. A higher bit conversion will give more resolution in the result but takes longer to complete and so consumes more power. Note that the significance of the most significant bit remains the same in all conversion modes, so if the conversion mode is less than 16 bits, the least significant bits of the raw sensor value will be 0.

The AFE_CSR setting value is normally constructed by OR-ing one entry from each of the 3 sections, and casting it to the correct type. e.g.

      // Configure the AFE Control and Status Register
      fxlc9500x_afe_csr_set((afe_csr_options_t)(
                AFE_CSR_GRANGE_2G   | // Use +/- 2 g range
                AFE_CSR_C4MODE_TEMP | // Measure X, Y, Z and Temperature
                AFE_CSR_CMODE_10BIT   // Use 10 bit conversion
              );

Returns:
  None

Errors:

Constraints:

Reentrant: No

See also:
  afe_csr_options_t

void fxlc9500x_afe_interrupt_clear | ( | void |  | ) |

Clears the AFE conversion complete interrupt source.

This resets the AFE conversion complete bit that is set on the completion of the ADC conversion. It also clears the IDLE_BITS_AFE in the idle_config_t use_stop_fc field so that the fxlc9500x_idle() function is no longer forced to use StopFC (fast clock) during any idle time.

Users do not normally need to call this function unless they are operating with interrupts disabled. If the AFE is setup to generate an interrupt when a conversion complete occurs, then the interrupt service routine should clear the conversion complete bit.

Returns:
  None

Errors:

Constraints:

Reentrant: No

See also:

void fxlc9500x_afe_interrupt_set | ( | boolean | bEnable_irq | ) |

Enable or disable the AFE conversion complete interrupt.

Parameters:

  bEnable_irq | - (in) TRUE to enable AFE interrupt FALSE to disable

Returns:
  None

Errors:

Constraints:

Reentrant: No

See also:

void fxlc9500x_afe_offsets_get | ( | int16 * | pData_ptr | ) |

Gets the current AFE accelerometer user offset values.

This function enables the user to read the current values of the 3 accelerometer user offset settings. The offset values are in 8g mode, so the hex value of 0x4000 corresponds to an offset of 1g.

      int_16 offsets[3]; // X, Y and Z offsets in 8 g mode
      fxlc9500x_afe_offsets_get(offsets);

The user offset values are reset whenever the device is reset.

Returns:
  None

Errors:

Constraints:
  The user must ensure that the supplied data structure is large enough to hold the values from all 3 of the accelerometer axis.

Reentrant: No

See also:
  fxlc9500x_afe_offsets_set() - location containing the 3 AFE offset values

void fxlc9500x_afe_offsets_set | ( | int16 * | pData_ptr | ) |

Gets the current AFE accelerometer user offset values.

The fxlc9500x_afe_trimmed_sensor_data_get() and fxlc9500x_afe_raw_sensor_data_trim() functions add user programmable offset values to the trimmed accelerometer readings. These values may be set or read by the user.

The offset values are treated as values in the 8 g range (where the hex value 0x4000 equates to 1 g), and are adjusted automatically to the appropriate g range when the g range is changed with the fxlc9500x_afe_csr_set() function. The values can be determined by putting the device into the 8 g mode, reading the accelerometer values without the effects of gravity, and then negating these values.

      int16 offsets[3] = { 0, 0, 0x4000 }; // X, Y and Z offsets in 8 g mode
      fxlc9500x_afe_offsets_set(offsets);

The user offset values are reset whenever the device is reset.

Returns:
  None

Errors:

Constraints:
  The user must ensure that the supplied data structure is large enough to hold the values from all of the axis/sensors. The number of axis/sensors is set in the NUM_SENSOR_AXIS definition.

Reentrant: No

See also:
  fxlc9500x_afe_offsets_get(), fxlc9500x_afe_trimmed_sensor_data_get()

void fxlc9500x_afe_raw_sensor_data_get | ( | int16 * | pData_ptr | ) |

Gets raw (semi-trimmed) data from the AFE sensors.

Normally the trimmed AFE sensor values are read using the fxlc9500x_afe_trimmed_sensor_data_get() function which reads the hardware registers and applies the trim calculations in a single function call.

This function copies the semi-trimmed sensor values directly from the AFE hardware registers into the supplied data structure. The raw sensor values can then be trimmed using the fxlc9500x_afe_raw_sensor_data_trim() function. This can be useful to save power when basic operations can be performed on the sensor data (such as decimation) prior to applying the trim calculations.

         fxlc9500x_afe_data_t raw_afe_data;
         ...
         fxlc9500x_afe_raw_sensor_data_get(raw_afe_data.data);

The raw sensor values are stored in the array of 16 bit signed integers in the order:

- Accelerometer X axis
- Accelerometer Y axis
- Accelerometer Z axis
- Temperature
- External input

The Temperature and External input values will not change if the AFE_CSR is not configured to measure them using the fourth ADC channel.

Returns:
  None

Errors:

Constraints:
  The user must ensure that the supplied data structure is large enough to hold the values from all of the axis/sensors. The number of axis/sensors is set in the NUM_SENSOR_AXIS definition.

Reentrant: No

See also:
  fxlc9500x_afe_trimmed_sensor_data_get(), fxlc9500x_afe_raw_sensor_data_trim(), fxlc9500x_afe_data_t, NUM_SENSOR_AXIS Address to store the raw AFE sensor data values

void fxlc9500x_afe_raw_sensor_data_trim | ( | int16 * | pTrim_ptr,
|  | int16 * | pData_ptr
| ) |  |

Trims the supplied raw AFE sensor data to get trimmed AFE sensor values.

Normally the trimmed AFE sensor values are read using the fxlc9500x_afe_trimmed_sensor_data_get() function which reads the hardware registers and applies the trim calculations in a single function call.

This function trims previously read semi-trimmed sensor values, that were read using the fxlc9500x_afe_raw_sensor_data_get() function, and optionally pre-processed. The trim processing is identical to the fxlc9500x_afe_trimmed_sensor_data_get() function.

         fxlc9500x_afe_data_t raw_afe_data;
         fxlc9500x_afe_data_t trimmed_afe_data;
         ...
         fxlc9500x_afe_raw_sensor_data_trim(trimmed_afe_data.data, raw_afe_data.data);

Returns:
  None

Errors:

Constraints:
  The user must ensure that the supplied data structure is large enough to hold the values from all of the axis/sensors. The number of axis/sensors is set in the NUM_SENSOR_AXIS definition.

Reentrant: No

See also:
  fxlc9500x_afe_trimmed_sensor_data_get(), fxlc9500x_afe_raw_sensor_data_get(), fxlc9500x_afe_data_t

Parameters:

  pTrim_ptr | Address to store the trimmed AFE sensor data values
  pData_ptr | Address of the raw AFE sensor data to be trimmed

void fxlc9500x_afe_trimmed_sensor_data_get | ( | int16 * | trim_ptr | ) |

Gets trimmed data from the AFE sensors.

This function reads the data from the AFE sensor hardware registers and applies the trim calculations to provide the accurate values.

The accelerometer sensor values are corrected for gain and offset using device specific trim values. User specified offsets are also be applied to account for offsets caused by board mounting during the assembly process. The user offsets can be set using the fxlc9500x_afe_offsets_set() function.

         fxlc9500x_afe_data_t trimmed_afe_data;
         ...
         fxlc9500x_afe_trimmed_sensor_data_get(trimmed_afe_data.data);

The trimmed sensor values are stored in the array of 16 bit signed integers in the order:

- Accelerometer X axis
- Accelerometer Y axis
- Accelerometer Z axis
- Temperature
- External input

The Temperature and External input values will remain unchanged if the AFE_CSR is not configured to measure them using the fourth ADC channel.

Warning:
  The user must ensure that the supplied data structure is large enough to hold the values from all of the axis/sensors. The number of axis/sensors is set in the

  # NUM_SENSOR_AXIS definition.

See also:
  fxlc9500x_afe_offsets_set(), fxlc9500x_afe_data_t Address to store the trimmed AFE sensor data values

framerate_t fxlc9500x_framerate_set | ( | framerate_t | rate | ) |

Sets the FIC (Frame Interval Counter) frequency.

This function configures the FIC (Frame Interval Counter) with the supplied frequency. If the framerate is invalid then it is ignored and the frame rate is not adjusted.

Parameters:

  rate | - (in) A framerate_t type value to specify the desired frame rate.

Returns:
  The resulting framerate value in the Frame Interval Counter. This should be the same as the requested value, unless the requested value was invalid, in which case the current framerate setting in the Frame Interval Counter will be returned.

Errors:

Constraints:
  At the highest supported framerate of 3.906 kHz the 16 and 14 bit AFE conversion cannot be completed within the frame interval, so only an AFE conversion length of 12 bits of less should be used.

Reentrant: No

See also:
  framerate_t

asm uint32 fxlc9500x_idle | ( | void |  | ) |

Executes the idle processing function, to sleep until the next exception.

The fxlc9500x_idle() manages the CPU stop modes to use the lowest possible power Stop mode based upon the configuration set in the idle_config_t fields and the fxlc9500x_vars_t events field, using the following procedure:

- if the fxlc9500x_vars_t events field is non-zero then return. This will occur if there are unhandled events that should be processed before entering Stop mode.
- if the idle_config_t stop_cfg field is negative then return. This enables the use of Stop modes to be disabled for debug purposes.
- if the idle_config_t stop_cfg field is positive then the value is loaded directly into the STOP_CR register and a stop issued. This enables testing of particular Stop configurations but should not generally be used.
- If the idle_config_t stop_cfg field is 0 and the idle_config_t use_stop_fc is non-zero then the device uses StopFC (fast clock) mode.
- If the idle_config_t stop_cfg and use_stop_fc fields are 0, and the idle_config_t use_stop_sc field is non-zero then the device uses StopSC (slow clock) mode.
- If the idle_config_t stop_cfg, use_stop_fc and use_stop_sc fields are all zero then the device uses StopNC (no clock) mode which is the lowest power mode.

void setup_TPM | ( | boolean | bIrq_enable,
|  | uint16 | modulo,
|  | uint8 | prescale
| ) |  |

Configures the TPM timer.

This function configures the TPM timer to run with various parameters given by the caller. This function sets the TPM to run using the bus clock (16Mhz).

Parameters:

  bIrq_enable | - (in) TRUE to enable TPM overflow interrupt FALSE to disable overflow interrupt
  modulo | - (in) 16-bit modulo counter. When the TPM counter value matches the modulo value, an interrupt is generated (if TPM irq is enabled). See Fxlc95000 manual for more information.
  prescale | - (in) TPM clock prescaler. Possible values are 0-7. The resulting clock divisor is: Prescaler Divisor 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128

Returns:
  None

Errors:
  None

Constraints:
  None

Reentrant: No

See also:
  None

## Variable Documentation

fxlc9500x_vars_t fxlc9500x_vars_int