EEPROM_STM_Arduino 1.0.1
EEPROM:M24C02 class driver
Loading...
Searching...
No Matches
M24C02 Class Reference

#include <M24C02.h>

Inheritance diagram for M24C02:

Public Member Functions

 M24C02 (uint8_t i2c_address=(0xA0 > > 1))
 
 M24C02 (TwoWire &wire, uint8_t i2c_address=(0xA0 > > 1))
 
virtual ~M24C02 ()
 
void begin (void)
 
int wait_write_complete (int n)
 
int write (int byte_adr, uint8_t data)
 
int write (int byte_adr, const uint8_t *dp, int length)
 
uint8_t read (int byte_adr)
 
int read (int byte_adr, uint8_t *dp, int length)
 

Static Private Attributes

static constexpr int PAGE_WRITE_SIZE = 16
 
static constexpr int PAGE_READ_SIZE = 32
 

Detailed Description

EEPROM:M24C02 operation library for Arduino

Author
Tedd OKANO

Released under the MIT license License M24C02 class

M24C02 class is a sample code for the PCA9846PW-ARD and the PCA9617ADP-ARD operation

Definition at line 23 of file M24C02.h.

Constructor & Destructor Documentation

◆ M24C02() [1/2]

M24C02::M24C02 ( uint8_t i2c_address = (0xA0 >> 1))

Create a M24C02 instance with specified address

Parameters
i2c_addressI2C-bus address (default: (0xA0>>1))

Definition at line 3 of file M24C02.cpp.

◆ M24C02() [2/2]

M24C02::M24C02 ( TwoWire & wire,
uint8_t i2c_address = (0xA0 >> 1) )

Create a M24C02 instance with specified address

Parameters
wireTwoWire instance
i2c_addressI2C-bus address (default: (0xA0>>1))

Definition at line 7 of file M24C02.cpp.

◆ ~M24C02()

M24C02::~M24C02 ( )
virtual

Definition at line 11 of file M24C02.cpp.

Member Function Documentation

◆ begin()

void M24C02::begin ( void )

Begin the device operation

This method turns-on the device

Definition at line 15 of file M24C02.cpp.

◆ read() [1/2]

uint8_t M24C02::read ( int byte_adr)

Read data

Parameters
byte_adrbyte address
Returns
1 byte read data

Definition at line 72 of file M24C02.cpp.

◆ read() [2/2]

int M24C02::read ( int byte_adr,
uint8_t * dp,
int length )

Read data

Parameters
byte_adrbyte address. The address can be arbitrary. It not needed to be aligned to page size.
dppointer to data array
lengthdata size
Returns
size of data read

Definition at line 77 of file M24C02.cpp.

◆ wait_write_complete()

int M24C02::wait_write_complete ( int n)

Wait write complete

Parameters
nloop count (in mili-second)
Returns
remain count: 0 means timeout

Definition at line 61 of file M24C02.cpp.

Referenced by write(), and write().

◆ write() [1/2]

int M24C02::write ( int byte_adr,
const uint8_t * dp,
int length )

Write data

Parameters
byte_adrbyte address. The address can be arbitrary. It not needed to be aligned to page size.
dppointer to data array
lengthdata size
Returns
size of data written or -10 if failed (timeout)

Definition at line 32 of file M24C02.cpp.

◆ write() [2/2]

int M24C02::write ( int byte_adr,
uint8_t data )

Write data

Parameters
byte_adrbyte address
data1 byte data for writing
Returns
size of data written or -10 if failed (timeout)

Definition at line 19 of file M24C02.cpp.

Member Data Documentation

◆ PAGE_READ_SIZE

int M24C02::PAGE_READ_SIZE = 32
staticconstexprprivate

Definition at line 88 of file M24C02.h.

Referenced by read().

◆ PAGE_WRITE_SIZE

int M24C02::PAGE_WRITE_SIZE = 16
staticconstexprprivate

Definition at line 87 of file M24C02.h.

Referenced by write().


The documentation for this class was generated from the following files: