busvoodoo_global.c File Reference

BusVoodoo global definitions and methods (code) More...

Go to the source code of this file.

## Macros

#define | BUSVOODOO_LED_TIMER 5
| timer peripheral

## Functions

void | busvoodoo_setup (void)
| setup BusVoodoo board
void | busvoodoo_safe_state (void)
| set safe state by disabling all outputs
bool | busvoodoo_vout_switch (bool on)
| switch 3V3 and 5V power outputs on I/O connector More...
float | busvoodoo_vreg_get (uint8_t channel)
| read voltage from power rail More...
float | busvoodoo_lv_set (float voltage)
| set voltage on low voltage adjustable voltage regulator More...
float | busvoodoo_hv_set (float voltage)
| set voltage on high voltage adjustable voltage regulator More...
float | busvoodoo_embedded_pullup (bool on)
| enable embedded pull-up resistors More...
static void | busvoodoo_led_update (void)
| update LED status according to LED flags
void | busvoodoo_led_blue_pulse (uint16_t ms)
| pulse blue LED for short duration More...
void | busvoodoo_led_red_pulse (uint16_t ms)
| pulse red LED for short duration More...
bool | busvoodoo_global_actions (char *actions, bool perform, bool(*action_handler)(const char *action, uint32_t repetition, bool perform))
| parse and perform actions More...
static void | busvoodoo_global_power (void *argument)
| switch 3V3 and 5V power rails on/off More...
static void | busvoodoo_global_lv (void *argument)
| set lV linear drop-out voltage regulator voltage More...
static void | busvoodoo_global_hv (void *argument)
| set HV step-up voltage regulator voltage More...
static void | busvoodoo_global_pinout (void *argument)
| display I/O and RS/CAN connector pinouts More...
void TIM_ISR() | BUSVOODOO_LED_TIMER (void)
| interrupt service routine called on LED timeout

## Variables

static volatile bool | busvoodoo_global_led_blue = false
| blue LED status
static volatile bool | busvoodoo_global_led_red = false
| red LED status
static const float | busvoodoo_version_voltages [] = {100.0/(10.0+100.0)*3.3}
| hardware version voltages, calculated from divider ratios, starting with version A
const char * | busvoodoo_global_pinout_io [10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
| I/O connector pinout.
const char * | busvoodoo_global_pinout_rscan [5] = {NULL, NULL, NULL, NULL, NULL}
| RS/CAN connector pinout.
const char * | busvoodoo_io_names [13] = {"I2C_SMBA/SPI_NSS/I2S_WS/UART1_CK", "SDIO_CMD", "UART1_CTS/SPI_SCK/I2S_CK", "SDIO_D3/UART2_RX", "I2C_SDA/UART1_RX", "SDIO_D0", "SPI_MOSI/I2S_SD", "SDIO_CK", "I2C_SCL/UART1_TX", "SDIO_D1", "I2S_MCK", "UART1_RTS/SPI_MISO", "SDIO_D2/UART2_TX"}
| I/O individual signal names.
const uint32_t | busvoodoo_io_ports [13] = {GPIOB, GPIOD, GPIOB, GPIOC, GPIOB, GPIOC, GPIOB, GPIOC, GPIOB, GPIOC, GPIOC, GPIOB, GPIOC}
| port of individual signals
const uint32_t | busvoodoo_io_pins [13] = {GPIO12, GPIO2, GPIO13, GPIO11, GPIO11, GPIO8, GPIO15, GPIO12, GPIO10, GPIO9, GPIO6, GPIO14, GPIO10}
| pin of individual signals
const uint8_t | busvoodoo_io_groups [13] = {6, 6, 4, 4, 1, 1, 5, 5, 2, 2, 3, 3, 3}
| which I/O pin (group) does the signal belong to
bool | busvoodoo_full = false
| is the BusVoodoo board fully populated (with HV voltage regulator, RS-232, RS-485, CAN transceiver on the back side)
char | busvoodoo_version = '0'
| version of the hardware board
char | busvoodoo_global_string [64]
| shared string buffer, i.e. More...
const struct menu_command_t | busvoodoo_global_commands []
| list of supported commands for base BusVoodoo More...
const uint8_t | busvoodoo_global_commands_nb = LENGTH(busvoodoo_global_commands)
| number supported commands for base BusVoodoo
const struct menu_command_t | busvoodoo_global_full_commands []
| list of supported commands for BusVoodoo full only More...
const uint8_t | busvoodoo_global_full_commands_nb = LENGTH(busvoodoo_global_full_commands)
| number supported commands for BusVoodoo full only

## Detailed Description

BusVoodoo global definitions and methods (code)

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2018

Note
  peripherals used: time timer used to blink LED

Definition in file busvoodoo_global.c.

## Function Documentation

## busvoodoo_embedded_pullup()

float busvoodoo_embedded_pullup | ( | bool | on | ) |

enable embedded pull-up resistors

Note
  the embedded pull-up resistor use the voltage on the LV power rail (set or externally provided)

Parameters

  [in] | on | enable (true) or disable (false) embedded pull-up resistors

Returns
  voltage applied on pull-up resistors, or NaN if channel is invalid (or error happened)

Definition at line 348 of file busvoodoo_global.c.

## busvoodoo_global_actions()

bool busvoodoo_global_actions | ( | char * | actions,
|  | bool | perform,
|  | bool(*)(const char *action, uint32_t repetition, bool perform) | action_handler
| ) |  |

parse and perform actions

Note
  performing action is a common command in mode and this function helps parsing them

Parameters

  [in] | actions | actions to perform
  [in] | perform | the action (true) or just check it (false)
  [in] | action_handler | function handling the individual actions

Returns
  true if the actions have been performed, false if any of them is malformed

Note
  while parsing the actions the string will be modified

Definition at line 410 of file busvoodoo_global.c.

## busvoodoo_global_hv()

static void busvoodoo_global_hv | ( | void * | argument | ) |

static

set HV step-up voltage regulator voltage

Parameters

  [in] | argument | voltage to set (0 to switch off, NULL to get voltage)

Definition at line 546 of file busvoodoo_global.c.

## busvoodoo_global_lv()

static void busvoodoo_global_lv | ( | void * | argument | ) |

static

set lV linear drop-out voltage regulator voltage

Parameters

  [in] | argument | voltage to set (0 to switch off, NULL to get voltage)

Definition at line 509 of file busvoodoo_global.c.

## busvoodoo_global_pinout()

static void busvoodoo_global_pinout | ( | void * | argument | ) |

static

display I/O and RS/CAN connector pinouts

Parameters

  [in] | argument | not used

Definition at line 582 of file busvoodoo_global.c.

## busvoodoo_global_power()

static void busvoodoo_global_power | ( | void * | argument | ) |

static

switch 3V3 and 5V power rails on/off

Parameters

  [in] | argument | string: "on" to switch on, "off" to switch off, NULL to get status

Definition at line 475 of file busvoodoo_global.c.

## busvoodoo_hv_set()

float busvoodoo_hv_set | ( | float | voltage | ) |

set voltage on high voltage adjustable voltage regulator

Parameters

  [in] | voltage | voltage to set on adjustable voltage regulator (0, 3.3-24V)

Returns
  voltage output, or NaN if error happened

Definition at line 318 of file busvoodoo_global.c.

## busvoodoo_led_blue_pulse()

void busvoodoo_led_blue_pulse | ( | uint16_t | ms | ) |

pulse blue LED for short duration

Parameters

  [in] | ms | duration in ms (0-32768)

Definition at line 372 of file busvoodoo_global.c.

## busvoodoo_led_red_pulse()

void busvoodoo_led_red_pulse | ( | uint16_t | ms | ) |

pulse red LED for short duration

Parameters

  [in] | ms | duration in ms (0-32768)

Definition at line 391 of file busvoodoo_global.c.

## busvoodoo_lv_set()

float busvoodoo_lv_set | ( | float | voltage | ) |

set voltage on low voltage adjustable voltage regulator

Note
  for voltages above 4.85V it will use the 5.0V from USB

Parameters

  [in] | voltage | voltage to set on adjustable voltage regulator (0, 0.3-4.8, 5V)

Returns
  voltage output, or NaN if error happened

Definition at line 290 of file busvoodoo_global.c.

## busvoodoo_vout_switch()

bool busvoodoo_vout_switch | ( | bool | on | ) |

switch 3V3 and 5V power outputs on I/O connector

Parameters

  [in] | on | switch on (true) or off (false) power output

Returns
  if switching succeeded. else it means there is a probably a short on one of the outputs

Definition at line 207 of file busvoodoo_global.c.

## busvoodoo_vreg_get()

float busvoodoo_vreg_get | ( | uint8_t | channel | ) |

read voltage from power rail

Parameters

  [in] | channel | which power rail to read voltage from ADC inputs to measure voltages from voltage regulators

Returns
  voltage, or NaN if channel is invalid (or error happened)

Definition at line 228 of file busvoodoo_global.c.

## Variable Documentation

## busvoodoo_global_commands

const struct menu_command_t busvoodoo_global_commands[]

Initial value:
= {
{
.shortcut = 'p',
.name = "pinout",
.command_description = "show connector pinout",
.argument = MENU_ARGUMENT_NONE,
.argument_description = NULL,
.command_handler = &busvoodoo_global_pinout,
},
{
.shortcut = 'P',
.name = "power",
.command_description = "switch 3V3 and 5V power rails on/off, or read internal voltages",
.argument = MENU_ARGUMENT_STRING,
.argument_description = "[on|off]",
.command_handler = &busvoodoo_global_power,
},
{
.shortcut = 'L',
.name = "LV",
.command_description = "set voltage on low voltage power rail (0, 0.3-4.8, 5V), or read voltage on pin",
.argument = MENU_ARGUMENT_FLOAT,
.argument_description = "[voltage]",
.command_handler = &busvoodoo_global_lv,
},
}
busvoodoo_global_power
static void busvoodoo_global_power(void *argument)
switch 3V3 and 5V power rails on/off
Definition: busvoodoo_global.c:475
busvoodoo_global_lv
static void busvoodoo_global_lv(void *argument)
set lV linear drop-out voltage regulator voltage
Definition: busvoodoo_global.c:509
busvoodoo_global_pinout
static void busvoodoo_global_pinout(void *argument)
display I/O and RS/CAN connector pinouts
Definition: busvoodoo_global.c:582

list of supported commands for base BusVoodoo

Definition at line 726 of file busvoodoo_global.c.

## busvoodoo_global_full_commands

const struct menu_command_t busvoodoo_global_full_commands[]

Initial value:
= {
{
.shortcut = 'H',
.name = "HV",
.command_description = "set voltage on high voltage power rail (0, 3.3-24V), or read voltage on pin",
.argument = MENU_ARGUMENT_FLOAT,
.argument_description = "[voltage]",
.command_handler = &busvoodoo_global_hv,
},
}
busvoodoo_global_hv
static void busvoodoo_global_hv(void *argument)
set HV step-up voltage regulator voltage
Definition: busvoodoo_global.c:546

list of supported commands for BusVoodoo full only

Definition at line 755 of file busvoodoo_global.c.

## busvoodoo_global_string

char busvoodoo_global_string[64]

shared string buffer, i.e.

used when configuring modes

Definition at line 66 of file busvoodoo_global.c.