NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions | Variables
main.c File Reference

TWI bus explorer. More...

#include <neorv32.h>
#include <string.h>

Macros

User configuration
#define BAUD_RATE   19200
 

Functions

void scan_twi (void)
 
void set_clock (void)
 
void send_twi (void)
 
void check_claimed (void)
 
void toggle_mack (void)
 
uint32_t hexstr_to_uint (char *buffer, uint8_t length)
 
void print_hex_byte (uint8_t data)
 
int main ()
 

Variables

int bus_claimed
 

Detailed Description

TWI bus explorer.

Author
Stephan Nolting

Macro Definition Documentation

◆ BAUD_RATE

#define BAUD_RATE   19200

UART BAUD rate

Function Documentation

◆ check_claimed()

void check_claimed ( void  )

Check if the TWI is currently claimed.

◆ hexstr_to_uint()

uint32_t hexstr_to_uint ( char *  buffer,
uint8_t  length 
)

Helper function to convert N hex chars string into uint32_t

Parameters
[in,out]bufferPointer to array of chars to convert into number.
[in,out]lengthLength of the conversion string.
Returns
Converted number.

◆ main()

int main ( void  )

This program provides an interactive console to communicate with TWI devices.

Note
This program requires the UART and the PWM to be synthesized.
Returns
0 if execution was successful

◆ print_hex_byte()

void print_hex_byte ( uint8_t  data)

Print byte as hex chars via UART0.

Parameters
data8-bit data to be printed as two hex chars.

◆ scan_twi()

void scan_twi ( void  )

Scan 7-bit TWI address space and print results

◆ send_twi()

void send_twi ( void  )

Read/write menu to transfer 1 byte from/to bus

◆ set_clock()

void set_clock ( void  )

TWI clock speed menu

◆ toggle_mack()

void toggle_mack ( void  )

Toggle MACK (ACK generated by controller/host)