How to use the max44009 middleware library?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RoBe_1502026
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

Hi all,

I am trying to use the max4409 (Ambient Light Sesnor ) middleware library.

I am using the cybt-213043-mesh board and there are no examples I can find that use it.

I see the init but it has some parameter on hardware like scl sda that appear to need defining.

How? what is the correct syntax, is it simple the pin label such as 'scl' 'sda' or is it the pin number?

Please help,

Best Regards,

Rob Berry

0 Likes
1 Solution

Hi Rob,

From the response I believe you want the guidance for using I2C interface  for PCA9555.

I would suggest you to use the APIs available in wiced_hal_i2c (.....ModusToolbox_1.1\libraries\bt_20819A1-1.0\components\BT-SDK\20819-A1_Bluetooth\include\20819\hal) PCA9555 work flow.

Thanks,

Anjana

View solution in original post

7 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi Rob,

You need to pass the WICED GPIO pins to be used as scl and sda to the init function.

For example,

uint8_t cfg_data[2] = { MAX44009_CFG_REGISTER, 0x40 };

uint8_t irq_set[2] = { MAX44009_INTERRUPT_ENABLE, 0x01 };

uint8_t low_threshold_set[2] = { MAX44009_LOW_THRESHOLD, 0x03 }; //set low threadhold to 2.16

uint8_t threshold_timer_set[2] = { MAX44009_THRESHOLD_TIMER, 0x00 };

static void         max44009IntProc(void* data, uint8_t port_pin);

MAX44009_USR_SET max44009_usr_set = { .scl_pin = WICED_P27,

        .sda_pin = WICED_P32, .irq_pin = WICED_P29, .cfg_reg = cfg_data,

        .interrupt_enable = irq_set, .low_threashHold = low_threshold_set,

        .threadHold_timer = threshold_timer_set

};

void max44009IntProc(void* data, uint8_t port_pin) {

 

    max44009IntClean();

}

max44009_init(&max44009_usr_set, max44009IntProc, NULL);

Thanks,
Anjana

0 Likes
lock attach
Attachments are accessible only for community members.

Anjana,

Thanks for the response. It cleared things up a bit.

I am trying to use this process for access a PCA9555 i/o extender. Here is the datasheet:

https://www.nxp.com/docs/en/data-sheet/PCA9555.pdf

Here are the registers for the IC:

#define PCA9555_ADDRESS1 0x40 //0b01000000

#define PCA9555_DATA_REGISTER0 0x00

#define PCA9555_DATA_REGISTER1 0x01

#define PCA9555_OUT_REGISTER0 0x02

#define PCA9555_OUT_REGISTER1 0x03

#define PCA9555_POL_REGISTER0 0x04

#define PCA9555_POL_REGISTER1 0x05

#define PCA9555_CFG_REGISTER0 0x06

#define PCA9555_CFG_REGISTER1 0x07

I am not having much success.

Can you please give me some assistance?

Best Regards,

Rob Berry

0 Likes

Hi Rob,

From the response I believe you want the guidance for using I2C interface  for PCA9555.

I would suggest you to use the APIs available in wiced_hal_i2c (.....ModusToolbox_1.1\libraries\bt_20819A1-1.0\components\BT-SDK\20819-A1_Bluetooth\include\20819\hal) PCA9555 work flow.

Thanks,

Anjana

Anjana,

I do not see that directory. Could it be somewhere else?

Rob Berry

R&J control

When the power fails...

We won't!

0 Likes

I found the file. That’s the API I am using.

Will continue using it and figure it out.

Thanks,

Rob Berry

R&J control

When the power fails...

We won't!

0 Likes

Hi again

I have successfully been able to communicate with the pca9555 and set a bit and trigger a relay (as my system is designed.)

But now I want to retrieve a value on the inputs. I am not sure what is the best BLE profile to use to transfer this data value. Do I simply use something like the sensor profile and send it that way?

Also I am not 100% clear where to put the data to send or receive. In my first test I just trigger on the button and send the i2c data hardcoded. (simply send a hex value over the i2c when the button is pushed)

I would like to send a hex value over the ble mesh.

Best Regards,

Rob

0 Likes
0 Likes