OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [demo_twi/] [main.c] - Diff between revs 51 and 60

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 51 Rev 60
Line 62... Line 62...
/**********************************************************************//**
/**********************************************************************//**
 * This program provides an interactive console to communicate with TWI devices.
 * This program provides an interactive console to communicate with TWI devices.
 *
 *
 * @note This program requires the UART and the PWM to be synthesized.
 * @note This program requires the UART and the PWM to be synthesized.
 *
 *
 * @return Irrelevant.
 * @return 0 if execution was successful
 **************************************************************************/
 **************************************************************************/
int main() {
int main() {
 
 
  char buffer[8];
  char buffer[8];
  int length = 0;
  int length = 0;
  int bus_claimed = 0;
  int bus_claimed = 0;
 
 
  // check if UART unit is implemented at all
  // check if UART unit is implemented at all
  if (neorv32_uart_available() == 0) {
  if (neorv32_uart_available() == 0) {
    return 0;
    return 1;
  }
  }
 
 
 
 
  // capture all exceptions and give debug info via UART
  // capture all exceptions and give debug info via UART
  // this is not required, but keeps us safe
  // this is not required, but keeps us safe
Line 94... Line 94...
 
 
 
 
  // check if TWI unit is implemented at all
  // check if TWI unit is implemented at all
  if (neorv32_twi_available() == 0) {
  if (neorv32_twi_available() == 0) {
    neorv32_uart_printf("No TWI unit implemented.");
    neorv32_uart_printf("No TWI unit implemented.");
    return 0;
    return 1;
  }
  }
 
 
 
 
  // info
  // info
  neorv32_uart_printf("This program allows to create TWI transfers by hand.\n"
  neorv32_uart_printf("This program allows to create TWI transfers by hand.\n"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.