eeprom8 2.0.0.0
main.c File Reference

EEPROM8 Click example. More...

#include "board.h"
#include "log.h"
#include "eeprom8.h"

Macros

#define TEST_NBYTES   ( 150 )
 
#define TEST_MEM_LOCATION   ( EEPROM8_BLOCK_ADDR_START + 1024ul )
 

Functions

err_t run_first_pass (eeprom8_t *ctx, uint8_t *write_buf, uint8_t *read_buf)
 First pass function.
 
err_t run_second_pass (eeprom8_t *ctx, uint8_t *write_buf, uint8_t *read_buf)
 Second pass function.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

EEPROM8 Click example.

Description

This example demonstrates the use of EEPROM 8 click board by writing specified data to the memory and reading it back.

The demo application is composed of two sections :

Application Init

Initializes the driver and USB UART logging.

Application Task

Task writes a desired number of data bytes to the EEPROM 8 memory and verifies that it is written correctly by reading from the same memory location and in case of successful read, displays the memory content on the USB UART. This is done in two passes.

Author
Stefan Popovic

Macro Definition Documentation

◆ TEST_MEM_LOCATION

#define TEST_MEM_LOCATION   ( EEPROM8_BLOCK_ADDR_START + 1024ul )

◆ TEST_NBYTES

#define TEST_NBYTES   ( 150 )

Function Documentation

◆ application_init()

void application_init ( void )

< Click config object.

< Logger config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )

◆ run_first_pass()

err_t run_first_pass ( eeprom8_t * ctx,
uint8_t * write_buf,
uint8_t * read_buf )

First pass function.

This function writes and reads defined number of bytes with zero values

Parameters
[in]ctxClick object.
[in]write_bufData to be written.
[out]read_bufData to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ run_second_pass()

err_t run_second_pass ( eeprom8_t * ctx,
uint8_t * write_buf,
uint8_t * read_buf )

Second pass function.

This function writes and reads defined number of bytes with the values following arithmetical progression

Parameters
[in]ctxClick object.
[in]write_bufData to be written.
[out]read_bufData to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.