There are a few ways that you could do something like this, and the best will depend on lots of factors… I would probably store the button/LED on/off states in an int (or 2 chars) and update the CS accordingly. You could use arrays to ‘group’ these ints.
generally spoken, this is a nice, clean (clearly named) and effective method to set some values; very small in size - and by making a union out of the structure, these states can easily be accessed as an unsigned int, which makes conversions unnecessary (eg when reading or writing a patch - or setting all bits at once!).
The disadvantage is, that SDCC currently only allowes bitfields of 8 bits maximum, which might make things complicated (at least it has been for SDCC 2.4.x, dunno about 2.7.x).
Another disadvantage can be the way to access the bits. For example, you need to loop through all values in the struct, one by one. This way you either have to work on the bits with bitmasks or you need to address all struct names seperately which is not possible with a counter.
I guess, a (boolean) array should be nearly as effective as a bitfield. Its maximum is 255 bytes (? can’t remember exactly, nevertheless this is big). Access is easy, but not that straightforward if you want to load/save the whole array.
I’m looking for somebody who can help me with led groups for buttons [notes]
example:
While pressing button #1 - the led under the button will turn on
While pressing button #6 - the led under the button #1 will turn off and the led under button #6 will turn on
I have one group of 10 buttons with leds and another group of 10 buttons with leds, and i want that groups of leds work independently. So that, when I push the button from 1st group and the button from 2nd group, they both led will be turn on. But when I turn on, for example, the other button from 2nd group, the led from the 2nd group will switch(the new one will be now shinning) but in the 1st group nothing will change.
My controller (check the enclosure):
group 1:
90x00
90x01
90x02
90x03
90x04
90x05
90x06
90x07
90x08
90x09
90x0A
90x0B
Group 2:
90x1C
90x2C
90x3C
90x4C
90x5C
90x6C
90x7C
Group3:
90x1D
90x2D
90x3D
90x4D
90x5D
90x6D
90x7D
Group4:
90x10
90x11
90x12
90x13
90x14
90x15
90x16
90x17
90x18
90x19
90x1A
90x1B
90x20
90x21
90x22
90x23
90x24
90x25
90x26
90x27
90x28
90x29
90x2A
90x2B
90x30
90x31
90x32
90x33
90x34
90x35
90x36
90x37
90x38
90x39
90x3A
90x3B
90x40
90x41
90x42
90x43
90x44
90x45
90x46
90x47
90x48
90x49
90x4A
90x4B
90x50
90x51
90x52
90x53
90x54
90x55
90x56
90x57
90x58
90x59
90x5A
90x5B
90x60
90x61
90x62
90x63
90x64
90x65
90x66
90x67
90x68
90x69
90x6A
90x6B
90x70
90x71
90x72
90x73
90x74
90x75
90x76
90x77
90x78
90x79
90x7A
90x7B
NEXT NOTES Of WHAT I NEED:
90x0C
90x0D
90x0F
90x1F
90x2F
90x3F
90x4F
90x5F
90x6F
But leds for that and rest notes must be like that, I push the button>led turn on, I push the button again (turn off the effect)>led turn off
Can anyone help me to change ain64_din128_dout128_v1_3 code?
I’m looking for somebody who can help me with led groups for buttons [notes]
example:
While pressing button #1 - the led under the button will turn on
While pressing button #6 - the led under the button #1 will turn off and the led under button #6 will turn on
I have one group of 10 buttons with leds and another group of 10 buttons with leds, and i want that groups of leds work independently. So that, when I push the button from 1st group and the button from 2nd group, they both led will be turn on. But when I turn on, for example, the other button from 2nd group, the led from the 2nd group will switch(the new one will be now shinning) but in the 1st group nothing will change.
My controller (check the enclosure):
group 1:
90x00
90x01
90x02
90x03
90x04
90x05
90x06
90x07
90x08
90x09
90x0A
90x0B
Group 2:
90x1C
90x2C
90x3C
90x4C
90x5C
90x6C
90x7C
Group3:
90x1D
90x2D
90x3D
90x4D
90x5D
90x6D
90x7D
Group4:
90x10
90x11
90x12
90x13
90x14
90x15
90x16
90x17
90x18
90x19
90x1A
90x1B
90x20
90x21
90x22
90x23
90x24
90x25
90x26
90x27
90x28
90x29
90x2A
90x2B
90x30
90x31
90x32
90x33
90x34
90x35
90x36
90x37
90x38
90x39
90x3A
90x3B
90x40
90x41
90x42
90x43
90x44
90x45
90x46
90x47
90x48
90x49
90x4A
90x4B
90x50
90x51
90x52
90x53
90x54
90x55
90x56
90x57
90x58
90x59
90x5A
90x5B
90x60
90x61
90x62
90x63
90x64
90x65
90x66
90x67
90x68
90x69
90x6A
90x6B
90x70
90x71
90x72
90x73
90x74
90x75
90x76
90x77
90x78
90x79
90x7A
90x7B
NEXT NOTES Of WHAT I NEED:
90x0C
90x0D
90x0F
90x1F
90x2F
90x3F
90x4F
90x5F
90x6F
But leds for that and rest notes must be like that, I push the button>led turn on, I push the button again (turn off the effect)>led turn off
Can anyone help me to change ain64_din128_dout128_v1_3 code?