Beginners: please read this post and this post before posting to the forum.

0 Members and 1 Guest are viewing this topic.

int *multi[3]={H3, H4, H5};

int multi[3]={H5, H3, H4};

void *multi[3]={H3, H4, H5};

volatile const void *

const void *

Or, do it the right way: Figure out where in the headers H3, H4 and H5 are declared, and use the correct type to begin with ;-)

const void *multi[4][6]={ {multi_0_S0, multi_0_S1, multi_0_S2, multi_0_S3, multi_0_EN, multi_0_SIG}, {multi_1_S0, multi_1_S1, multi_1_S2, multi_1_S3, multi_1_EN, multi_1_SIG}, {multi_2_S0, multi_2_S1, multi_2_S2, multi_2_S3, multi_2_EN, multi_2_SIG}, {multi_3_S0, multi_3_S1, multi_3_S2, multi_3_S3, multi_3_EN, multi_3_SIG}};

Pin *multi[4][6]={ {&multi_0_S0, &multi_0_S1, &multi_0_S2, &multi_0_S3, &multi_0_EN, &multi_0_SIG}, {&multi_1_S0, &multi_1_S1, &multi_1_S2, &multi_1_S3, &multi_1_EN, &multi_1_SIG}, {&multi_2_S0, &multi_2_S1, &multi_2_S2, &multi_2_S3, &multi_2_EN, &multi_2_SIG}, {&multi_3_S0, &multi_3_S1, &multi_3_S2, &multi_3_S3, &multi_3_EN, &multi_3_SIG}};

Pin* aPin = multi[0][0];aPin->set(true); // or whatever you want to do with it.

const IOPin* multi[4][6]={ {multi_0_S0, multi_0_S1, multi_0_S2, multi_0_S3, multi_0_EN, multi_0_SIG}, {multi_1_S0, multi_1_S1, multi_1_S2, multi_1_S3, multi_1_EN, multi_1_SIG}, {multi_2_S0, multi_2_S1, multi_2_S2, multi_2_S3, multi_2_EN, multi_2_SIG}, {multi_3_S0, multi_3_S1, multi_3_S2, multi_3_S3, multi_3_EN, multi_3_SIG}};

const IOPin* aPin = multi[0][0];pin_set(aPin,true); // or whatever you want to do with it.

#include "hardware.h"const IOPin* multi[4][6]={ {multi_0_S0, multi_0_S1, multi_0_S2, multi_0_S3, multi_0_EN, multi_0_SIG}, {multi_1_S0, multi_1_S1, multi_1_S2, multi_1_S3, multi_1_EN, multi_1_SIG}, {multi_2_S0, multi_2_S1, multi_2_S2, multi_2_S3, multi_2_EN, multi_2_SIG}, {multi_3_S0, multi_3_S1, multi_3_S2, multi_3_S3, multi_3_EN, multi_3_SIG}};

// Declare definition of one myThingytypedef struct s_myThingy { const IOPin* pin1; const IOPin* pin2; const IOPin* pin3; const IOPin* pin4; const IOPin* pin5; ADC_CHANNEL channel;} myThingy;

// Create an array of myThingy'smyThingy multi[ /* you could specify 4 here but why bother as the compiler can work it out */] = { {multi_0_S0, multi_0_S1, multi_0_S2, multi_0_S3, multi_0_EN, multi_0_SIG}, {multi_1_S0, multi_1_S1, multi_1_S2, multi_1_S3, multi_1_EN, multi_1_SIG}, {multi_2_S0, multi_2_S1, multi_2_S2, multi_2_S3, multi_2_EN, multi_2_SIG}, {multi_3_S0, multi_3_S1, multi_3_S2, multi_3_S3, multi_3_EN, multi_3_SIG}};

myThingy* thing2 = &multi[1];// And we want to do something with the second io pin pin_set(thing2->pin2,true);// or read its adc channeluint16_t value = a2dConvert10bit(thing2->channel);