# CAMERA_I2CContextSwitch*

## Syntax

  `#include <twl/camera.h>`
  `CAMERAResult CAMERA_I2CContextSwitch(CAMERASelect camera, CAMERAContext context);`
  `CAMERAResult CAMERA_I2CContextSwitchAsync(CAMERASelect camera, CAMERAContext context, CAMERACallback callback, void *arg);`

## Arguments

camera | Camera to change the context for (`CAMERA_SELECT_IN` or `CAMERA_SELECT_OUT`).
context | Context to change.
callback | Function that is called when asynchronous processing has completed.
arg | Arguments when the callback function is invoked.

## Return Values

Returns `CAMERA_RESULT_SUCCESS` if changes were possible.

## Description

Switches the camera settings context. It is faster to switch the context than to configure settings individually.
Because this function replaces the specified camera's settings with the settings in the specified context (A or B), you cannot set camera to `CAMERA_SELECT_NONE` or context to `CAMERA_CONTEXT_BOTH`.
Unlike `CAMERA_I2CContextSwitch`, the `CAMERA_I2CContextSwitchAsync` function returns control immediately and runs asynchronously. Use callback to confirm that processing has completed.
Note:
If camera settings are changed using any of the `CAMERA_I2C*` functions, the changes may be delayed for approximately one frame before they are applied. If camera settings are changed during image capture, therefore, an application's timing may make it impossible to get an image with the changes applied.
・About Occasional Shifting of the Capture Image
The captured image may shift if the context is switched from CAMERA_CONTEXT_B to CAMERA_CONTEXT_A with this function during image capture.
When switching from `CAMERA_CONTEXT_B` to `CAMERA_CONTEXT_A`, first stop the image capture with `CAMERA_StopCapture`. Then call this function. After this function completes execution, restart the image capture with `CAMERA_StartCapture`.

## See Also

`CAMERASelect`
`CAMERAContext`
`CAMERACallback`
`CAMERAResult`

## Revision History

2009/11/11 Explained the occasional shifting of captured images.
2009/03/25 Added information about changing camera settings during capture operations.
2007/10/12 Initial version.

CONFIDENTIAL