cancel
Showing results for 
Search instead for 
Did you mean: 

How do I handle 8 bit I2C address when I port ST32 driver to 8 bit device driver?

HKPhysicist
Associate

Dear ST Engineers,
I am planning to port this device driver to another 8 bit MCU:
https://www.st.com/en/embedded-software/stsw-img023.html

My 8 bit MCU has I2C slave address range from 0x00 to 0x7F.

However, hint of that ST driver code insists on using uint16_t as I2C address, for example,

 

typedef struct
{
	/* To be filled with customer's platform. At least an I2C address/descriptor
	 * needs to be added */
	/* Example for most standard platform : I2C address of sensor */
    uint16_t address;
} VL53L5CX_Platform;

 

How do I reconcile this conflict?  Or do I misunderstand something about ARM 32 bit architect?

Please give your valuable opinions.  :cowboy_hat_face:

1 ACCEPTED SOLUTION

Accepted Solutions
HKPhysicist
Associate

Porting 32 bit driver to 8 bit driver is not trivial.

I accomplished it by porting it to another 32 bit MCU.

View solution in original post

3 REPLIES 3
xisco
Associate III

Making a 1 bit right displacement.

If your address for STM32 is

xxxxxxx0

The address for others will be

0xxxxxxx

 

I2C has a 7-bit and 10-bit addressing mode, the register is large enough to accommodate either.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
HKPhysicist
Associate

Porting 32 bit driver to 8 bit driver is not trivial.

I accomplished it by porting it to another 32 bit MCU.