Sonochan II 0.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
generic_driver.c File Reference

Generic driver. More...

`#include "generic_driver.h"`

## Functions
GD_DATA_VALUE | gd_if_big_endian_convert_big_to_little_endian (uint8_t i_little_endian, GD_DATA_VALUE i_32b_value, GD_DATA_TYPE e_data_type)
| If big endian is detected, then input big endian data converted to little endian. More...
GD_DATA_VALUE | gd_if_big_endian_convert_little_to_big_endian (uint8_t i_little_endian, GD_DATA_VALUE i_32b_value, GD_DATA_TYPE e_data_type)
| If big endian is detected, then input little endian data are converted to big endian. More...
GD_RES_CODE | gd_void_function (void)
| Void function. Do nothing. More...
GD_RES_CODE | gd_get_setting (const gd_metadata *p_metadata, uint16_t i_cmd_ID, gd_config_struct *p_config_table)
| Get settings data from driver. More...
GD_RES_CODE | gd_set_setting (const gd_metadata *p_metadata, uint16_t i_cmd_ID, GD_DATA_VALUE i_data)
| Set settings data to driver. More...

## Variables
volatile GD_DATA_VALUE | gd_void_value = {.data_uint32 = 0}
| Empty value. More...

## Detailed Description

Generic driver.

Important note for AVR8 architecture: functions, that read from
flash memory presume that constants are stored in low 64 kB of flash
memory. If not, please take a look at
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=93874

Created 26.08.2013
Modified 12.05.2014

Version
  1.3.1

Author
  Martin Stejskal

## Function Documentation

GD_RES_CODE gd_get_setting | ( | const gd_metadata * | p_metadata,
|  | uint16_t | i_cmd_ID,
|  | gd_config_struct * | p_config_table
| ) |  |

Get settings data from driver.

Parameters

  p_metadata | Pointer to metadata of driver (max CMD ID and so on)
  i_cmd_ID | Command ID. Thru commands user can control target device
  p_config_table | Pointer to image of configure table - 1 structure. Settings will be saved to this structure

Returns
  GD_SUCCESS if all OK. Else please refer GD_RES_CODE

GD_DATA_VALUE gd_if_big_endian_convert_big_to_little_endian | ( | uint8_t | i_little_endian,
|  | GD_DATA_VALUE | i_32b_value,
|  | GD_DATA_TYPE | e_data_type
| ) |  |
| inline

If big endian is detected, then input big endian data converted to
little endian.

Because higher layers expect little endian order, it is good idea to
convert bytes to little endian. Conversion is done only if needed.

Parameters

  i_little_endian | Detected endian. 0 - big endian ; 1 - little endian
  i_32b_value | Input data (32 bit)
  e_data_type | Define which data type will be presented

Returns
  corrected 32 bit value.

GD_DATA_VALUE gd_if_big_endian_convert_little_to_big_endian | ( | uint8_t | i_little_endian,
|  | GD_DATA_VALUE | i_32b_value,
|  | GD_DATA_TYPE | e_data_type
| ) |  |
| inline

If big endian is detected, then input little endian data are
converted to big endian.

Because higher layers works with little endian logic, it is good idean to
conver bytes to big endian. Conversion is done only if needed.

Parameters

  i_little_endian | Detected endian. 0 - big endian ; 1 - little endian
  i_32b_value | Input data (32 bit)
  e_data_type | Define which data type will be presented

Returns
  corrected 32 bit value.

GD_RES_CODE gd_set_setting | ( | const gd_metadata * | p_metadata,
|  | uint16_t | i_cmd_ID,
|  | GD_DATA_VALUE | i_data
| ) |  |

Set settings data to driver.

Parameters

  p_metadata | Pointer to metadata of driver (max CMD ID and so on)
  i_cmd_ID | Command ID. Thru commands user can control target device.
  i_data | Data in union structure GD_DATA_VALUE

Returns
  GD_SUCCESS if all OK. Else please refer GD_RES_CODE

GD_RES_CODE gd_void_function | ( | void | ) |  |

Void function. Do nothing.

Sometimes is need to point to function, that does not do anything, so
there is

Returns
  Always GD_SUCCESS

## Variable Documentation

volatile GD_DATA_VALUE gd_void_value = {.data_uint32 = 0}

Empty value.

Useful when called function has no parameter -> link to this "empty value"
-> no compilation problems, no reading problems