From c3cfaba4b2cbaea3805146f346670cf27af9f258 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Sat, 26 Mar 2022 13:42:10 +0100 Subject: [PATCH] Renamed zones into banks to align to M17 codeplug naming convention. --- openrtx/include/core/cps.h | 6 +-- openrtx/include/core/state.h | 4 +- openrtx/include/core/ui.h | 4 +- openrtx/include/interfaces/nvmem.h | 10 ++--- openrtx/src/core/state.c | 2 +- openrtx/src/ui/ui.c | 58 ++++++++++++++-------------- openrtx/src/ui/ui_main.c | 18 ++++----- openrtx/src/ui/ui_menu.c | 20 +++++----- platform/drivers/NVM/nvmData_GDx.h | 4 +- platform/drivers/NVM/nvmem_GDx.c | 28 +++++++------- platform/drivers/NVM/nvmem_MD3x0.c | 14 +++---- platform/drivers/NVM/nvmem_MD9600.c | 16 ++++---- platform/drivers/NVM/nvmem_MDUV3x0.c | 16 ++++---- platform/drivers/NVM/nvmem_Mod17.c | 4 +- platform/drivers/NVM/nvmem_linux.c | 24 ++++++------ tests/platform/codeplug_demo.c | 10 ++--- 16 files changed, 119 insertions(+), 119 deletions(-) diff --git a/openrtx/include/core/cps.h b/openrtx/include/core/cps.h index 30b08c6e..8bff58fa 100644 --- a/openrtx/include/core/cps.h +++ b/openrtx/include/core/cps.h @@ -123,14 +123,14 @@ __attribute__((packed)) channel_t; /** - * Data structure containing all the information of a zone. + * Data structure containing all the information of a bank. */ typedef struct { - char name[16]; /**< Zone name */ + char name[16]; /**< Bank name */ uint16_t member[64]; /**< Channel indexes */ } -__attribute__((packed)) zone_t; +__attribute__((packed)) bank_t; /** * Data structure containing all the information of a contact. diff --git a/openrtx/include/core/state.h b/openrtx/include/core/state.h index c61a6b05..eb820c2d 100644 --- a/openrtx/include/core/state.h +++ b/openrtx/include/core/state.h @@ -94,8 +94,8 @@ typedef struct uint16_t channel_index; channel_t channel; channel_t vfo_channel; - bool zone_enabled; - zone_t zone; + bool bank_enabled; + bank_t bank; uint8_t rtxStatus; bool rtxShutdown; diff --git a/openrtx/include/core/ui.h b/openrtx/include/core/ui.h index 5873f1a1..6cb55cbb 100644 --- a/openrtx/include/core/ui.h +++ b/openrtx/include/core/ui.h @@ -43,7 +43,7 @@ enum uiScreen MODE_VFO, MODE_MEM, MENU_TOP, - MENU_ZONE, + MENU_BANK, MENU_CHANNEL, MENU_CONTACTS, MENU_GPS, @@ -72,7 +72,7 @@ enum SetRxTx // menu elements even if some elements may be missing (GPS) enum menuItems { - M_ZONE = 0, + M_BANK = 0, M_CHANNEL, M_CONTACTS, #ifdef HAS_GPS diff --git a/openrtx/include/interfaces/nvmem.h b/openrtx/include/interfaces/nvmem.h index e1574d73..665cc0bf 100644 --- a/openrtx/include/interfaces/nvmem.h +++ b/openrtx/include/interfaces/nvmem.h @@ -73,19 +73,19 @@ int nvm_readVFOChannelData(channel_t *channel); int nvm_readChannelData(channel_t *channel, uint16_t pos); /** - * Read one zone from table stored in nonvolatile memory. + * Read one bank from table stored in nonvolatile memory. * - * @param zone: pointer to the zone_t data structure to be populated. - * @param pos: position, inside the zone table, from which read data. + * @param bank: pointer to the bank_t data structure to be populated. + * @param pos: position, inside the bank table, from which read data. * @return 0 on success, -1 on failure */ -int nvm_readZoneData(zone_t *zone, uint16_t pos); +int nvm_readBankData(bank_t *bank, uint16_t pos); /** * Read one contact from table stored in nonvolatile memory. * * @param contact: pointer to the contact_t data structure to be populated. - * @param pos: position, inside the zone table, from which read data. + * @param pos: position, inside the bank table, from which read data. * @return 0 on success, -1 on failure */ int nvm_readContactData(contact_t *contact, uint16_t pos); diff --git a/openrtx/src/core/state.c b/openrtx/src/core/state.c index 59b9da67..50e4a098 100644 --- a/openrtx/src/core/state.c +++ b/openrtx/src/core/state.c @@ -73,7 +73,7 @@ void state_init() state.rssi = rtx_getRssi(); state.channel_index = 1; // Set default channel index (it is 1-based) - state.zone_enabled = false; + state.bank_enabled = false; state.rtxStatus = RTX_OFF; state.rtxShutdown = false; state.emergency = false; diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index 7609bc0e..1734d6be 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -90,7 +90,7 @@ extern void _ui_drawModeVFO(); extern void _ui_drawModeMEM(); /* UI menu functions, their implementation is in "ui_menu.c" */ extern void _ui_drawMenuTop(ui_state_t* ui_state); -extern void _ui_drawMenuZone(ui_state_t* ui_state); +extern void _ui_drawMenuBank(ui_state_t* ui_state); extern void _ui_drawMenuChannel(ui_state_t* ui_state); extern void _ui_drawMenuContacts(ui_state_t* ui_state); #ifdef HAS_GPS @@ -114,7 +114,7 @@ extern bool _ui_drawMacroMenu(); const char *menu_items[] = { - "Zone", + "Banks", "Channels", "Contacts", #ifdef HAS_GPS @@ -537,26 +537,26 @@ bool _ui_drawDarkOverlay() { return true; } -int _ui_fsm_loadChannel(uint16_t zone_index, bool *sync_rtx) { - uint16_t channel_index = zone_index; +int _ui_fsm_loadChannel(uint16_t bank_index, bool *sync_rtx) { + uint16_t channel_index = bank_index; channel_t channel; - // If a zone is active, get index from current zone - if(state.zone_enabled) + // If a bank is active, get index from current bank + if(state.bank_enabled) { - // Calculate zone size - const uint8_t zone_size = sizeof(state.zone.member)/sizeof(state.zone.member[0]); - if((zone_index <= 0) || (zone_index > zone_size)) + // Calculate bank size + const uint8_t bank_size = sizeof(state.bank.member)/sizeof(state.bank.member[0]); + if((bank_index <= 0) || (bank_index > bank_size)) return -1; else - // Channel index is 1-based while zone array access is 0-based - channel_index = state.zone.member[zone_index - 1]; + // Channel index is 1-based while bank array access is 0-based + channel_index = state.bank.member[bank_index - 1]; } int result = nvm_readChannelData(&channel, channel_index); // Read successful and channel is valid if(result != -1 && _ui_channel_valid(&channel)) { // Set new channel index - state.channel_index = zone_index; + state.channel_index = bank_index; // Copy channel read to state state.channel = channel; *sync_rtx = true; @@ -1262,8 +1262,8 @@ void ui_updateFSM(event_t event, bool *sync_rtx) { switch(ui_state.menu_selected) { - case M_ZONE: - state.ui_screen = MENU_ZONE; + case M_BANK: + state.ui_screen = MENU_BANK; break; case M_CHANNEL: state.ui_screen = MENU_CHANNEL; @@ -1296,7 +1296,7 @@ void ui_updateFSM(event_t event, bool *sync_rtx) _ui_menuBack(ui_state.last_main_state); break; // Zone menu screen - case MENU_ZONE: + case MENU_BANK: // Channel menu screen case MENU_CHANNEL: // Contacts menu screen @@ -1306,12 +1306,12 @@ void ui_updateFSM(event_t event, bool *sync_rtx) _ui_menuUp(1); else if(msg.keys & KEY_DOWN || msg.keys & KNOB_RIGHT) { - if(state.ui_screen == MENU_ZONE) + if(state.ui_screen == MENU_BANK) { - zone_t zone; + bank_t bank; // menu_selected is 0-based while channels are 1-based - // menu_selected == 0 corresponds to "All Channels" zone - if(nvm_readZoneData(&zone, ui_state.menu_selected + 1) != -1) + // menu_selected == 0 corresponds to "All Channels" bank + if(nvm_readBankData(&bank, ui_state.menu_selected + 1) != -1) ui_state.menu_selected += 1; } else if(state.ui_screen == MENU_CHANNEL) @@ -1331,25 +1331,25 @@ void ui_updateFSM(event_t event, bool *sync_rtx) } else if(msg.keys & KEY_ENTER) { - if(state.ui_screen == MENU_ZONE) + if(state.ui_screen == MENU_BANK) { - zone_t newzone; + bank_t newbank; int result = 0; - // If "All channels" is selected, load default zone + // If "All channels" is selected, load default bank if(ui_state.menu_selected == 0) - state.zone_enabled = false; + state.bank_enabled = false; else { - state.zone_enabled = true; - result = nvm_readZoneData(&newzone, ui_state.menu_selected); + state.bank_enabled = true; + result = nvm_readBankData(&newbank, ui_state.menu_selected); } if(result != -1) { - state.zone = newzone; + state.bank = newbank; // If we were in VFO mode, save VFO channel if(ui_state.last_main_state == MAIN_VFO) state.vfo_channel = state.channel; - // Load zone first channel + // Load bank first channel _ui_fsm_loadChannel(1, sync_rtx); // Switch to MEM screen state.ui_screen = MAIN_MEM; @@ -1705,8 +1705,8 @@ void ui_updateGUI() _ui_drawMenuTop(&ui_state); break; // Zone menu screen - case MENU_ZONE: - _ui_drawMenuZone(&ui_state); + case MENU_BANK: + _ui_drawMenuBank(&ui_state); break; // Channel menu screen case MENU_CHANNEL: diff --git a/openrtx/src/ui/ui_main.c b/openrtx/src/ui/ui_main.c index 506830a6..99d4fda0 100644 --- a/openrtx/src/ui/ui_main.c +++ b/openrtx/src/ui/ui_main.c @@ -71,15 +71,15 @@ void _ui_drawMainTop() } } -void _ui_drawZoneChannel() +void _ui_drawBankChannel() { - // Print Zone name - if(!last_state.zone_enabled) + // Print Bank name + if(!last_state.bank_enabled) gfx_print(layout.line1_pos, layout.line1_font, TEXT_ALIGN_LEFT, - color_white, "zone: All channels"); + color_white, "bank: All channels"); else gfx_print(layout.line1_pos, layout.line1_font, TEXT_ALIGN_LEFT, - color_white, "zone: %.13s", last_state.zone.name); + color_white, "bank: %.13s", last_state.bank.name); // Print Channel name gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_LEFT, color_white, " %03d: %.12s", @@ -158,9 +158,9 @@ void _ui_drawMainBottom() // Squelch bar float rssi = last_state.rssi; float squelch = last_state.settings.sqlLevel / 16.0f; - uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; - uint16_t meter_height = layout.bottom_h; - point_t meter_pos = { layout.horizontal_pad, + uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; + uint16_t meter_height = layout.bottom_h; + point_t meter_pos = { layout.horizontal_pad, SCREEN_HEIGHT - meter_height - layout.bottom_pad}; uint8_t mic_level = platform_getMicLevel(); switch(last_state.channel.mode) @@ -210,7 +210,7 @@ void _ui_drawMainMEM() { gfx_clearScreen(); _ui_drawMainTop(); - _ui_drawZoneChannel(); + _ui_drawBankChannel(); _ui_drawFrequency(); _ui_drawMainBottom(); } diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index 22db05df..205738e9 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -256,20 +256,20 @@ int _ui_getInfoValueName(char *buf, uint8_t max_len, uint8_t index) return 0; } -int _ui_getZoneName(char *buf, uint8_t max_len, uint8_t index) +int _ui_getBankName(char *buf, uint8_t max_len, uint8_t index) { int result = 0; - // First zone "All channels" is not read from flash + // First bank "All channels" is not read from flash if(index == 0) { snprintf(buf, max_len, "All channels"); } else { - zone_t zone; - result = nvm_readZoneData(&zone, index); + bank_t bank; + result = nvm_readBankData(&bank, index); if(result != -1) - snprintf(buf, max_len, "%s", zone.name); + snprintf(buf, max_len, "%s", bank.name); } return result; } @@ -302,14 +302,14 @@ void _ui_drawMenuTop(ui_state_t* ui_state) _ui_drawMenuList(ui_state->menu_selected, _ui_getMenuTopEntryName); } -void _ui_drawMenuZone(ui_state_t* ui_state) +void _ui_drawMenuBank(ui_state_t* ui_state) { gfx_clearScreen(); - // Print "Zone" on top bar + // Print "Bank" on top bar gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, - color_white, "Zone"); - // Print zone entries - _ui_drawMenuList(ui_state->menu_selected, _ui_getZoneName); + color_white, "Bank"); + // Print bank entries + _ui_drawMenuList(ui_state->menu_selected, _ui_getBankName); } void _ui_drawMenuChannel(ui_state_t* ui_state) diff --git a/platform/drivers/NVM/nvmData_GDx.h b/platform/drivers/NVM/nvmData_GDx.h index daef5add..7e5886d6 100644 --- a/platform/drivers/NVM/nvmData_GDx.h +++ b/platform/drivers/NVM/nvmData_GDx.h @@ -125,8 +125,8 @@ typedef struct { __attribute__((packed)) gdxZone_t; typedef struct { - uint8_t bitmap[32]; // bit set when zone valid - gdxZone_t zone[250]; + uint8_t bitmap[32]; // bit set when bank valid + gdxZone_t bank[250]; } __attribute__((packed)) gdxZoneBank_t; diff --git a/platform/drivers/NVM/nvmem_GDx.c b/platform/drivers/NVM/nvmem_GDx.c index b9a64918..463a8222 100644 --- a/platform/drivers/NVM/nvmem_GDx.c +++ b/platform/drivers/NVM/nvmem_GDx.c @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -259,7 +259,7 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) // Channels are organized in 128-channel banks uint8_t bank_num = (pos - 1) / 128; - // Note: pos is 1-based because an empty slot in a zone contains index 0 + // Note: pos is 1-based because an empty slot in a bank contains index 0 uint8_t bank_channel = (pos - 1) % 128; // ### Read channel bank bitmap ### @@ -372,36 +372,36 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return 0; } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { if((pos <= 0) || (pos > maxNumZones)) return -1; - // zone number is 1-based to be consistent with channels + // bank number is 1-based to be consistent with channels // Convert to 0-based index to fetch data from flash uint16_t index = pos - 1; - // ### Read zone bank bitmap ### + // ### Read bank bank bitmap ### uint8_t bitmap[32]; AT24Cx_readData(zoneBaseAddr, ((uint8_t *) &bitmap), sizeof(bitmap)); uint8_t bitmap_byte = index / 8; uint8_t bitmap_bit = index % 8; - // The zone is marked not valid in the bitmap + // The bank is marked not valid in the bitmap if(!(bitmap[bitmap_byte] & (1 << bitmap_bit))) return -1; gdxZone_t zoneData; uint32_t zoneAddr = zoneBaseAddr + sizeof(bitmap) + index * sizeof(gdxZone_t); AT24Cx_readData(zoneAddr, ((uint8_t *) &zoneData), sizeof(gdxZone_t)); - // Check if zone is empty + // Check if bank is empty if(wcslen((wchar_t *) zoneData.name) == 0) return -1; - memcpy(zone->name, zoneData.name, sizeof(zoneData.name)); + memcpy(bank->name, zoneData.name, sizeof(zoneData.name)); // Terminate string with 0x00 instead of 0xFF - _addStringTerminator(zone->name, sizeof(zoneData.name)); - // Copy zone channel indexes + _addStringTerminator(bank->name, sizeof(zoneData.name)); + // Copy bank channel indexes for(uint16_t i = 0; i < 16; i++) { - zone->member[i] = zoneData.member[i]; + bank->member[i] = zoneData.member[i]; } return 0; } diff --git a/platform/drivers/NVM/nvmem_MD3x0.c b/platform/drivers/NVM/nvmem_MD3x0.c index a4458725..4c66fd18 100644 --- a/platform/drivers/NVM/nvmem_MD3x0.c +++ b/platform/drivers/NVM/nvmem_MD3x0.c @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -252,7 +252,7 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return 0; } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { if((pos <= 0) || (pos > maxNumZones)) return -1; @@ -274,12 +274,12 @@ int nvm_readZoneData(zone_t *zone, uint16_t pos) */ for(uint16_t i = 0; i < 16; i++) { - zone->name[i] = ((char) (zoneData.name[i] & 0x00FF)); + bank->name[i] = ((char) (zoneData.name[i] & 0x00FF)); } // Copy zone channel indexes for(uint16_t i = 0; i < 16; i++) { - zone->member[i] = zoneData.member[i]; + bank->member[i] = zoneData.member[i]; } return 0; diff --git a/platform/drivers/NVM/nvmem_MD9600.c b/platform/drivers/NVM/nvmem_MD9600.c index 7e88599b..e4e1b4a4 100644 --- a/platform/drivers/NVM/nvmem_MD9600.c +++ b/platform/drivers/NVM/nvmem_MD9600.c @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -186,7 +186,7 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return _nvm_readChannelAtAddress(channel, readAddr); } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { if((pos <= 0) || (pos > maxNumZones)) return -1; @@ -211,17 +211,17 @@ int nvm_readZoneData(zone_t *zone, uint16_t pos) */ for(uint16_t i = 0; i < 16; i++) { - zone->name[i] = ((char) (zoneData.name[i] & 0x00FF)); + bank->name[i] = ((char) (zoneData.name[i] & 0x00FF)); } // Copy zone channel indexes for(uint16_t i = 0; i < 16; i++) { - zone->member[i] = zoneData.member_a[i]; + bank->member[i] = zoneData.member_a[i]; } // Copy zone extension channel indexes for(uint16_t i = 0; i < 48; i++) { - zone->member[16 + i] = zoneExtData.ext_a[i]; + bank->member[16 + i] = zoneExtData.ext_a[i]; } return 0; diff --git a/platform/drivers/NVM/nvmem_MDUV3x0.c b/platform/drivers/NVM/nvmem_MDUV3x0.c index 51806e39..f0cde89c 100644 --- a/platform/drivers/NVM/nvmem_MDUV3x0.c +++ b/platform/drivers/NVM/nvmem_MDUV3x0.c @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -286,7 +286,7 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return _nvm_readChannelAtAddress(channel, readAddr); } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { if((pos <= 0) || (pos > maxNumZones)) return -1; @@ -311,17 +311,17 @@ int nvm_readZoneData(zone_t *zone, uint16_t pos) */ for(uint16_t i = 0; i < 16; i++) { - zone->name[i] = ((char) (zoneData.name[i] & 0x00FF)); + bank->name[i] = ((char) (zoneData.name[i] & 0x00FF)); } // Copy zone channel indexes for(uint16_t i = 0; i < 16; i++) { - zone->member[i] = zoneData.member_a[i]; + bank->member[i] = zoneData.member_a[i]; } // Copy zone extension channel indexes for(uint16_t i = 0; i < 48; i++) { - zone->member[16 + i] = zoneExtData.ext_a[i]; + bank->member[16 + i] = zoneExtData.ext_a[i]; } return 0; diff --git a/platform/drivers/NVM/nvmem_Mod17.c b/platform/drivers/NVM/nvmem_Mod17.c index 69b131bc..68e7e9e7 100644 --- a/platform/drivers/NVM/nvmem_Mod17.c +++ b/platform/drivers/NVM/nvmem_Mod17.c @@ -63,9 +63,9 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return -1; } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { - (void) zone; + (void) bank; (void) pos; return -1; } diff --git a/platform/drivers/NVM/nvmem_linux.c b/platform/drivers/NVM/nvmem_linux.c index 5861aa6c..08b6366b 100644 --- a/platform/drivers/NVM/nvmem_linux.c +++ b/platform/drivers/NVM/nvmem_linux.c @@ -1,8 +1,8 @@ /*************************************************************************** - * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * Silvano Seva IU2KWO * + * Copyright (C) 2020 - 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -247,17 +247,17 @@ int nvm_readChannelData(channel_t *channel, uint16_t pos) return 0; } -int nvm_readZoneData(zone_t *zone, uint16_t pos) +int nvm_readBankData(bank_t* bank, uint16_t pos) { if((pos <= 0) || (pos > maxNumZones)) return -1; - /* Generate dummy zone name */ - snprintf(zone->name, 16, "Zone %d", pos); - memset(zone->member, 0, sizeof(zone->member)); - // Add fake zone member indexes - zone->member[0] = pos; - zone->member[1] = pos+1; - zone->member[2] = pos+2; + /* Generate dummy bank name */ + snprintf(bank->name, 16, "Zone %d", pos); + memset(bank->member, 0, sizeof(bank->member)); + // Add fake bank member indexes + bank->member[0] = pos; + bank->member[1] = pos+1; + bank->member[2] = pos+2; return 0; } diff --git a/tests/platform/codeplug_demo.c b/tests/platform/codeplug_demo.c index e61bafc5..255b7981 100644 --- a/tests/platform/codeplug_demo.c +++ b/tests/platform/codeplug_demo.c @@ -51,17 +51,17 @@ int main() printf("Zones:\r\n"); for(int pos=0,result=0; result != -1; pos++) { - zone_t zone; - result = nvm_readZoneData(&zone, pos); + zone_t bank; + result = nvm_readZoneData(&bank, pos); if(result != -1) { printf("Zone n.%d:\r\n", pos+1); - printf(" %s\r\n", zone.name); + printf(" %s\r\n", bank.name); for(int x=0; x < 64; x++) { - if(zone.member[x] != 0) + if(bank.member[x] != 0) { - printf(" - Index: %d, Channel %d\r\n", x, zone.member[x]); + printf(" - Index: %d, Channel %d\r\n", x, bank.member[x]); } } }