busvoodoo_spi.c File Reference

BusVoodoo SPI mode (code) More...

Go to the source code of this file.

## Macros

#define | BUSVOODOO_SPI_ID 2
| SPI peripheral.

## Enumerations

enum | busvoodoo_spi_setting_t { BUSVOODOO_SPI_SETTING_NONE, BUSVOODOO_SPI_SETTING_DUPLEX, BUSVOODOO_SPI_SETTING_FREQUENCY, BUSVOODOO_SPI_SETTING_DATABITS, BUSVOODOO_SPI_SETTING_BITORDER, BUSVOODOO_SPI_SETTING_MODE, BUSVOODOO_SPI_SETTING_DRIVE, BUSVOODOO_SPI_SETTING_DONE }
| mode setup stage

## Functions

static bool | busvoodoo_spi_setup (char **prefix, const char *line)
| setup SPI mode More...
static void | busvoodoo_spi_write (uint16_t value)
| write to SPI More...
static void | busvoodoo_spi_read (void)
| read from SPI
static void | busvoodoo_spi_exit (void)
| exit SPI mode
static bool | busvoodoo_spi_action (const char *action, uint32_t repetition, bool perform)
| perform SPI action More...
static void | busvoodoo_spi_command_actions (void *argument)
| command to perform actions More...

## Variables

static enum busvoodoo_spi_setting_t | busvoodoo_spi_setting = BUSVOODOO_SPI_SETTING_NONE
| current mode setup stage
static bool | busvoodoo_spi_duplex = true
| SPI duplex mode (true = full-duplex, false = bidirectional)
static uint8_t | busvoodoo_spi_baudrate = 1
| SPI baud rate (corresponding to baud rate control, e.g. More...
static uint8_t | busvoodoo_spi_databits = 8
| SPI data frame bit width (8 or 16)
static bool | busvoodoo_spi_bitorder = true
| SPI data frame bit order (true = MSb first, false = LSb first)
static uint8_t | busvoodoo_spi_standard_mode = 0
| SPI mode (defining clock polarity and phase)
static bool | busvoodoo_spi_drive = true
| pin drive mode (true = push-pull, false = open-drain)
static bool | busvoodoo_spi_pullup = true
| if embedded pull-up resistors are used
static const struct menu_command_t | busvoodoo_spi_commands []
| SPI menu commands. More...
const struct busvoodoo_mode_t | busvoodoo_spi_mode
| SPI mode interface definition. More...

## Detailed Description

BusVoodoo SPI mode (code)

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

Date
  2018

Note
  peripherals used: SPI SPI peripheral used for SPI communication

Definition in file busvoodoo_spi.c.

## Function Documentation

## busvoodoo_spi_action()

static bool busvoodoo_spi_action | ( | const char * | action,
|  | uint32_t | repetition,
|  | bool | perform
| ) |  |

static

perform SPI action

Parameters

  [in] | action | action to perform
  [in] | repetition | how many times to perform the action
  [in] | perform | the action (true) or just check it (false)

Returns
  true if the action has been performed, false if it is malformed

Definition at line 344 of file busvoodoo_spi.c.

## busvoodoo_spi_command_actions()

static void busvoodoo_spi_command_actions | ( | void * | argument | ) |

static

command to perform actions

Parameters

  [in] | argument | actions to perform

Definition at line 458 of file busvoodoo_spi.c.

## busvoodoo_spi_setup()

static bool busvoodoo_spi_setup | ( | char ** | prefix,
|  | const char * | line
| ) |  |

static

setup SPI mode

Parameters

  [out] | prefix | terminal prompt prefix
  [in] | line | terminal prompt line to configure mode

Returns
  if setup is complete

Definition at line 76 of file busvoodoo_spi.c.

## busvoodoo_spi_write()

static void busvoodoo_spi_write | ( | uint16_t | value | ) |

static

write to SPI

Parameters

  [in] | value | value to write

Definition at line 276 of file busvoodoo_spi.c.

## Variable Documentation

## busvoodoo_spi_baudrate

uint8_t busvoodoo_spi_baudrate = 1

static

SPI baud rate (corresponding to baud rate control, e.g.

36MHz/(2<<br)))

Definition at line 59 of file busvoodoo_spi.c.

## busvoodoo_spi_commands

const struct menu_command_t busvoodoo_spi_commands[]

static

Initial value:
= {
{
.shortcut = 'a',
.name = "action",
.command_description = "perform protocol actions",
.argument = MENU_ARGUMENT_STRING,
.argument_description = "[actions]",
.command_handler = &busvoodoo_spi_command_actions,
},
}
busvoodoo_spi_command_actions
static void busvoodoo_spi_command_actions(void *argument)
command to perform actions
Definition: busvoodoo_spi.c:458

SPI menu commands.

Definition at line 488 of file busvoodoo_spi.c.

## busvoodoo_spi_mode

const struct busvoodoo_mode_t busvoodoo_spi_mode

Initial value:
= {
.name = "spi",
.description = "Serial Peripheral Interface",
.full_only = false,
.setup = &busvoodoo_spi_setup,
.commands = busvoodoo_spi_commands,
.commands_nb = LENGTH(busvoodoo_spi_commands),
.exit = &busvoodoo_spi_exit,
}
busvoodoo_spi_setup
static bool busvoodoo_spi_setup(char **prefix, const char *line)
setup SPI mode
Definition: busvoodoo_spi.c:76
busvoodoo_spi_exit
static void busvoodoo_spi_exit(void)
exit SPI mode
Definition: busvoodoo_spi.c:326
LENGTH
#define LENGTH(x)
get the length of an array
Definition: global.h:26
busvoodoo_spi_commands
static const struct menu_command_t busvoodoo_spi_commands[]
SPI menu commands.
Definition: busvoodoo_spi.c:488

SPI mode interface definition.

Definition at line 499 of file busvoodoo_spi.c.