私はポインターの世界で少し迷っています:-) readSystemValに数値を渡して値を読み取るのは魅力的ですが、今度はwriteSystemValを使用してこれらの変数に書き込みたいと思います。
私がすべきことを実際に見つけることができません: *systemVal は変数のアドレスを保持していますが、どのように値を変数に書き込めますか?
よろしければご覧いただけますか?
(システム: AVR、エクリプス、atmega644)
// User Changeable variables
uint8_t MIDIchan1 = 0; // midichannel osc 1
uint8_t MIDIchan2 = 1; // midichannel osc 2
uint8_t MIDIchan3 = 2; // midichannel osc 3
uint8_t pbRange = 12; // pitchbend
uint8_t omniModus = 0x00; // 3 osc modus or 1 omni modus
uint8_t midiThru = 0x01; // midiTrhu on/off
uint8_t *systemValList[] = {&MIDIchan1, &MIDIchan2, &MIDIchan3, &pbRange, &omniModus, &midiThru};
//**************************************************
// readSystemVal
// DESCRIPTION:
// Hele simpele note off routine
//**************************************************
uint8_t readSystemVal (uint8_t systemItem)
{
uint8_t *systemVal = (uint8_t *)systemValList[(uint8_t)systemItem];
uint8_t returnVal = *systemVal;
return returnVal;
}
void writeSystemVal (uint8_t ctrlValue, uint8_t systemItem)
{
/*
uint8_t *systemVal = (uint8_t *)systemValList[(uint8_t)systemItem];
//uint8_t returnVal = *systemVal;
// systemVal = ctrlValue;
*/
}