Simple demo for exercising the board

Dependencies:   MAX11300 MAX4822 OneWire Terminal ds3231 mbed

Committer:
j3
Date:
Fri Jul 29 22:38:59 2016 +0000
Revision:
1:03c04017a728
Parent:
0:24b8a6f0a563
Child:
2:0c0994f70fd2
Working, need to improve analog out/in user interface

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j3 0:24b8a6f0a563 1 /**********************************************************************
j3 0:24b8a6f0a563 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
j3 0:24b8a6f0a563 3 *
j3 0:24b8a6f0a563 4 * Permission is hereby granted, free of charge, to any person obtaining a
j3 0:24b8a6f0a563 5 * copy of this software and associated documentation files (the "Software"),
j3 0:24b8a6f0a563 6 * to deal in the Software without restriction, including without limitation
j3 0:24b8a6f0a563 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
j3 0:24b8a6f0a563 8 * and/or sell copies of the Software, and to permit persons to whom the
j3 0:24b8a6f0a563 9 * Software is furnished to do so, subject to the following conditions:
j3 0:24b8a6f0a563 10 *
j3 0:24b8a6f0a563 11 * The above copyright notice and this permission notice shall be included
j3 0:24b8a6f0a563 12 * in all copies or substantial portions of the Software.
j3 0:24b8a6f0a563 13 *
j3 0:24b8a6f0a563 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
j3 0:24b8a6f0a563 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
j3 0:24b8a6f0a563 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
j3 0:24b8a6f0a563 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
j3 0:24b8a6f0a563 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
j3 0:24b8a6f0a563 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
j3 0:24b8a6f0a563 20 * OTHER DEALINGS IN THE SOFTWARE.
j3 0:24b8a6f0a563 21 *
j3 0:24b8a6f0a563 22 * Except as contained in this notice, the name of Maxim Integrated
j3 0:24b8a6f0a563 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
j3 0:24b8a6f0a563 24 * Products, Inc. Branding Policy.
j3 0:24b8a6f0a563 25 *
j3 0:24b8a6f0a563 26 * The mere transfer of this software does not imply any licenses
j3 0:24b8a6f0a563 27 * of trade secrets, proprietary technology, copyrights, patents,
j3 0:24b8a6f0a563 28 * trademarks, maskwork rights, or any other form of intellectual
j3 0:24b8a6f0a563 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
j3 0:24b8a6f0a563 30 * ownership rights.
j3 0:24b8a6f0a563 31 **********************************************************************/
j3 0:24b8a6f0a563 32
j3 0:24b8a6f0a563 33 #include "mbed.h"
j3 0:24b8a6f0a563 34 #include "ds3231.h"
j3 0:24b8a6f0a563 35 #include "MAX4822.h"
j3 0:24b8a6f0a563 36 #include "MAX11300.h"
j3 0:24b8a6f0a563 37 #include "Terminal.h"
j3 0:24b8a6f0a563 38 #include "OneWire.h"
j3 0:24b8a6f0a563 39
j3 0:24b8a6f0a563 40 using namespace OneWire;
j3 0:24b8a6f0a563 41 using namespace RomCommands;
j3 0:24b8a6f0a563 42
j3 0:24b8a6f0a563 43 void set_rtc(Terminal & term, Ds3231 & rtc);
j3 0:24b8a6f0a563 44 void get_time_date(Terminal & term, Ds3231 & rtc);
j3 0:24b8a6f0a563 45 void search_ow_bus(Terminal & term, DS2484 & owm);
j3 0:24b8a6f0a563 46 void print_rom_id(Terminal & term, RomId & romId);
j3 0:24b8a6f0a563 47
j3 0:24b8a6f0a563 48 int main(void)
j3 0:24b8a6f0a563 49 {
j3 0:24b8a6f0a563 50 Terminal term(USBTX, USBRX);
j3 0:24b8a6f0a563 51 term.baud(57600);
j3 0:24b8a6f0a563 52 term.cls();
j3 0:24b8a6f0a563 53 term.home();
j3 0:24b8a6f0a563 54 term.printf("Starting Demo\n");
j3 0:24b8a6f0a563 55
j3 0:24b8a6f0a563 56 SPI spi_bus(D11, D12, D13);
j3 0:24b8a6f0a563 57 MAX4822 rly_drvr(spi_bus, D10);
j3 0:24b8a6f0a563 58 DigitalOut rly_drvr_set(D7, 1);
j3 0:24b8a6f0a563 59 DigitalOut rly_drvr_reset(D6, 1);
j3 0:24b8a6f0a563 60
j3 0:24b8a6f0a563 61 rly_drvr.reset_all_relays(rly_drvr_reset);
j3 0:24b8a6f0a563 62
j3 1:03c04017a728 63 MAX11300 pixi(spi_bus, D8, NC, D9);
j3 0:24b8a6f0a563 64
j3 0:24b8a6f0a563 65 //set all analog outs to 0
j3 0:24b8a6f0a563 66 for(uint8_t idx = 0; idx < 9; idx++)
j3 0:24b8a6f0a563 67 {
j3 0:24b8a6f0a563 68 pixi.single_ended_dac_write(static_cast<MAX11300::MAX11300_Ports>(idx), 0);
j3 0:24b8a6f0a563 69 }
j3 0:24b8a6f0a563 70
j3 0:24b8a6f0a563 71 //ensure latching relays are reset
j3 0:24b8a6f0a563 72 for(uint8_t idx = 0; idx < 3; idx++)
j3 0:24b8a6f0a563 73 {
j3 0:24b8a6f0a563 74 pixi.gpio_write(static_cast<MAX11300::MAX11300_Ports>(idx + 9), 1);
j3 0:24b8a6f0a563 75 wait_ms(100);
j3 0:24b8a6f0a563 76 pixi.gpio_write(static_cast<MAX11300::MAX11300_Ports>(idx + 9), 0);
j3 0:24b8a6f0a563 77 }
j3 0:24b8a6f0a563 78
j3 0:24b8a6f0a563 79 I2C i2c_bus(D14, D15);
j3 0:24b8a6f0a563 80 i2c_bus.frequency(400000);
j3 0:24b8a6f0a563 81
j3 0:24b8a6f0a563 82 Ds3231 rtc(i2c_bus);
j3 0:24b8a6f0a563 83
j3 0:24b8a6f0a563 84 DS2484 owm(i2c_bus);
j3 0:24b8a6f0a563 85 OneWireMaster::CmdResult owm_result = owm.OWInitMaster();
j3 0:24b8a6f0a563 86 while(owm_result != OneWireMaster::Success)
j3 0:24b8a6f0a563 87 {
j3 0:24b8a6f0a563 88 wait_ms(100);
j3 0:24b8a6f0a563 89 term.printf("Failed to initialize OneWire master\n");
j3 0:24b8a6f0a563 90 owm_result = owm.OWInitMaster();
j3 0:24b8a6f0a563 91 }
j3 0:24b8a6f0a563 92 term.printf("OneWire master initialized\n\n");
j3 0:24b8a6f0a563 93
j3 0:24b8a6f0a563 94 int32_t user_entry = 0;
j3 0:24b8a6f0a563 95 int32_t relay = 0;
j3 0:24b8a6f0a563 96
j3 0:24b8a6f0a563 97 uint16_t analog_out, analog_val;
j3 1:03c04017a728 98 float aio, aii;
j3 0:24b8a6f0a563 99
j3 0:24b8a6f0a563 100 const int32_t QUIT = 14;
j3 0:24b8a6f0a563 101
j3 1:03c04017a728 102 MAX11300::CmdResult pixi_result;
j3 1:03c04017a728 103 MAX4822::CmdResult rly_drvr_result;
j3 1:03c04017a728 104
j3 0:24b8a6f0a563 105 while(user_entry != QUIT)
j3 0:24b8a6f0a563 106 {
j3 0:24b8a6f0a563 107 term.printf("1. Set RTC\n");
j3 0:24b8a6f0a563 108 term.printf("2. Get Time/Date\n");
j3 0:24b8a6f0a563 109 term.printf("3. Search OneWire bus\n");
j3 0:24b8a6f0a563 110 term.printf("4. Set non-latching relay\n");
j3 0:24b8a6f0a563 111 term.printf("5. Reset non-latching relay\n");
j3 0:24b8a6f0a563 112 term.printf("6. Set all non-latching relays\n");
j3 0:24b8a6f0a563 113 term.printf("7. Reset all non-latching relays\n");
j3 0:24b8a6f0a563 114 term.printf("8. Set latching relay\n");
j3 0:24b8a6f0a563 115 term.printf("9. Reset latching relay\n");
j3 0:24b8a6f0a563 116 term.printf("10. Set 0-10 analog out\n");
j3 0:24b8a6f0a563 117 term.printf("11. Set 4-20 out\n");
j3 0:24b8a6f0a563 118 term.printf("12. Get 4-20 in\n");
j3 0:24b8a6f0a563 119 term.printf("%d. Clear Screen\n", (QUIT - 1));
j3 0:24b8a6f0a563 120 term.printf("%d. Quit\n\n", QUIT);
j3 0:24b8a6f0a563 121
j3 0:24b8a6f0a563 122 user_entry = term.get_int32("Please select an option above: ", 1, QUIT);
j3 0:24b8a6f0a563 123
j3 0:24b8a6f0a563 124
j3 0:24b8a6f0a563 125 //get non-latching relay
j3 0:24b8a6f0a563 126 if((user_entry == 4) || (user_entry == 5))
j3 0:24b8a6f0a563 127 {
j3 0:24b8a6f0a563 128 relay = term.get_int32("Select a relay from 1 to 8: ", 1, 8);
j3 0:24b8a6f0a563 129 }
j3 0:24b8a6f0a563 130
j3 0:24b8a6f0a563 131 //get latching relay
j3 0:24b8a6f0a563 132 if((user_entry == 8) || (user_entry == 9))
j3 0:24b8a6f0a563 133 {
j3 0:24b8a6f0a563 134 relay = (8 + term.get_int32("Select a relay from 1 to 3: ", 1, 3));
j3 0:24b8a6f0a563 135 }
j3 0:24b8a6f0a563 136
j3 0:24b8a6f0a563 137 switch(user_entry)
j3 0:24b8a6f0a563 138 {
j3 0:24b8a6f0a563 139 case 1:
j3 0:24b8a6f0a563 140 set_rtc(term, rtc);
j3 0:24b8a6f0a563 141 break;
j3 0:24b8a6f0a563 142
j3 0:24b8a6f0a563 143 case 2:
j3 0:24b8a6f0a563 144 get_time_date(term, rtc);
j3 0:24b8a6f0a563 145 break;
j3 0:24b8a6f0a563 146
j3 0:24b8a6f0a563 147 case 3:
j3 0:24b8a6f0a563 148 search_ow_bus(term, owm);
j3 0:24b8a6f0a563 149 break;
j3 0:24b8a6f0a563 150
j3 0:24b8a6f0a563 151 case 4:
j3 1:03c04017a728 152 rly_drvr_result = rly_drvr.set_relay(static_cast<MAX4822::RelayChannel>(relay));
j3 1:03c04017a728 153 if(rly_drvr_result != MAX4822::Success)
j3 1:03c04017a728 154 {
j3 1:03c04017a728 155 term.printf("Failed to set relay\n");
j3 1:03c04017a728 156 }
j3 0:24b8a6f0a563 157 break;
j3 0:24b8a6f0a563 158
j3 0:24b8a6f0a563 159 case 5:
j3 1:03c04017a728 160 rly_drvr_result = rly_drvr.reset_relay(static_cast<MAX4822::RelayChannel>(relay));
j3 1:03c04017a728 161 if(rly_drvr_result != MAX4822::Success)
j3 1:03c04017a728 162 {
j3 1:03c04017a728 163 term.printf("Failed to reset relay\n");
j3 1:03c04017a728 164 }
j3 0:24b8a6f0a563 165 break;
j3 0:24b8a6f0a563 166
j3 0:24b8a6f0a563 167 case 6:
j3 0:24b8a6f0a563 168 rly_drvr.set_all_relays(rly_drvr_set);
j3 0:24b8a6f0a563 169 term.printf("\n");
j3 0:24b8a6f0a563 170 break;
j3 0:24b8a6f0a563 171
j3 0:24b8a6f0a563 172 case 7:
j3 0:24b8a6f0a563 173 rly_drvr.reset_all_relays(rly_drvr_reset);
j3 0:24b8a6f0a563 174 term.printf("\n");
j3 0:24b8a6f0a563 175 break;
j3 0:24b8a6f0a563 176
j3 0:24b8a6f0a563 177 case 8:
j3 1:03c04017a728 178 pixi_result = pixi.gpio_write(static_cast<MAX11300::MAX11300_Ports>(relay), 1);
j3 1:03c04017a728 179 if(pixi_result != MAX11300::Success)
j3 1:03c04017a728 180 {
j3 1:03c04017a728 181 term.printf("Failed to set relay\n");
j3 1:03c04017a728 182 }
j3 0:24b8a6f0a563 183 break;
j3 0:24b8a6f0a563 184
j3 0:24b8a6f0a563 185 case 9:
j3 1:03c04017a728 186 pixi_result = pixi.gpio_write(static_cast<MAX11300::MAX11300_Ports>(relay), 0);
j3 1:03c04017a728 187 if(pixi_result != MAX11300::Success)
j3 1:03c04017a728 188 {
j3 1:03c04017a728 189 term.printf("Failed to reset relay\n");
j3 1:03c04017a728 190 }
j3 0:24b8a6f0a563 191 break;
j3 0:24b8a6f0a563 192
j3 0:24b8a6f0a563 193 case 10:
j3 1:03c04017a728 194 analog_out = (term.get_int32("Please select a 0-10V output; 1-8: ", 1, 8) - 1);
j3 1:03c04017a728 195 analog_val = term.get_int32("Please select a value from 0-4095: ", 0, 4095);
j3 1:03c04017a728 196
j3 1:03c04017a728 197 pixi_result = pixi.single_ended_dac_write(static_cast<MAX11300::MAX11300_Ports>(analog_out), analog_val);
j3 1:03c04017a728 198 if(pixi_result != MAX11300::Success)
j3 1:03c04017a728 199 {
j3 1:03c04017a728 200 term.printf("Failed to set 0-10 out\n");
j3 1:03c04017a728 201 }
j3 0:24b8a6f0a563 202 break;
j3 0:24b8a6f0a563 203
j3 0:24b8a6f0a563 204 case 11:
j3 1:03c04017a728 205 analog_val = term.get_int32("Please select a value from 0-4095: ", 0, 4095);
j3 1:03c04017a728 206
j3 1:03c04017a728 207 pixi_result = pixi.single_ended_dac_write(MAX11300::PORT8, analog_val);
j3 1:03c04017a728 208 if(pixi_result != MAX11300::Success)
j3 1:03c04017a728 209 {
j3 1:03c04017a728 210 term.printf("Failed to set 4-20 out\n");
j3 1:03c04017a728 211 }
j3 0:24b8a6f0a563 212 break;
j3 0:24b8a6f0a563 213
j3 0:24b8a6f0a563 214 case 12:
j3 1:03c04017a728 215 pixi_result = pixi.single_ended_adc_read(MAX11300::PORT12, analog_val);
j3 1:03c04017a728 216 aii = ((9.7e-6 *analog_val) + 2.3e-5);
j3 1:03c04017a728 217 if(pixi_result == MAX11300::Success)
j3 1:03c04017a728 218 {
j3 1:03c04017a728 219 term.printf("4-20 in = %.2e\n", aii);
j3 1:03c04017a728 220 }
j3 1:03c04017a728 221 else
j3 1:03c04017a728 222 {
j3 1:03c04017a728 223 term.printf("Failed to read 4-20 in\n");
j3 1:03c04017a728 224 }
j3 0:24b8a6f0a563 225 break;
j3 0:24b8a6f0a563 226
j3 0:24b8a6f0a563 227 case (QUIT - 1):
j3 0:24b8a6f0a563 228 term.cls();
j3 0:24b8a6f0a563 229 term.home();
j3 0:24b8a6f0a563 230 break;
j3 0:24b8a6f0a563 231
j3 0:24b8a6f0a563 232 case QUIT:
j3 0:24b8a6f0a563 233 term.printf("\nEnding Program\n");
j3 0:24b8a6f0a563 234 break;
j3 0:24b8a6f0a563 235
j3 0:24b8a6f0a563 236 default:
j3 0:24b8a6f0a563 237 mbed_die();
j3 0:24b8a6f0a563 238 break;
j3 0:24b8a6f0a563 239 }
j3 0:24b8a6f0a563 240 }
j3 0:24b8a6f0a563 241 }
j3 0:24b8a6f0a563 242
j3 0:24b8a6f0a563 243 //*********************************************************************
j3 0:24b8a6f0a563 244 void set_rtc(Terminal & term, Ds3231 & rtc)
j3 0:24b8a6f0a563 245 {
j3 0:24b8a6f0a563 246 //default, use bit masks in ds3231.h for desired operation
j3 0:24b8a6f0a563 247 ds3231_cntl_stat_t rtc_control_status = {0,0};
j3 0:24b8a6f0a563 248 ds3231_time_t rtc_time;
j3 0:24b8a6f0a563 249 ds3231_calendar_t rtc_calendar;
j3 0:24b8a6f0a563 250
j3 0:24b8a6f0a563 251 rtc.set_cntl_stat_reg(rtc_control_status);
j3 0:24b8a6f0a563 252
j3 0:24b8a6f0a563 253 //get day from user
j3 0:24b8a6f0a563 254 rtc_calendar.day = term.get_int32("\nPlease enter day of week, 1 for Sunday (1-7): ", 1, 7);
j3 0:24b8a6f0a563 255
j3 0:24b8a6f0a563 256 //get day of month from user
j3 0:24b8a6f0a563 257 rtc_calendar.date = term.get_int32("\nPlease enter day of month (1-31): ", 1, 31);
j3 0:24b8a6f0a563 258
j3 0:24b8a6f0a563 259 //get month from user
j3 0:24b8a6f0a563 260 rtc_calendar.month = term.get_int32("\nPlease enter the month, 1 for January (1-12): ", 1, 12);
j3 0:24b8a6f0a563 261
j3 0:24b8a6f0a563 262 //get year from user
j3 0:24b8a6f0a563 263 rtc_calendar.year = term.get_int32("\nPlease enter the year (0-99): ", 0, 99);
j3 0:24b8a6f0a563 264
j3 0:24b8a6f0a563 265 //Get time mode
j3 0:24b8a6f0a563 266 rtc_time.mode = term.get_int32("\nWhat time mode? 1 for 12hr 0 for 24hr: ", 0, 1);
j3 0:24b8a6f0a563 267
j3 0:24b8a6f0a563 268 if(rtc_time.mode)
j3 0:24b8a6f0a563 269 {
j3 0:24b8a6f0a563 270 //Get AM/PM status
j3 0:24b8a6f0a563 271 rtc_time.am_pm = term.get_int32("\nIs it AM or PM? 0 for AM 1 for PM: ", 0, 1);
j3 0:24b8a6f0a563 272 //Get hour from user
j3 0:24b8a6f0a563 273 rtc_time.hours = term.get_int32("\nPlease enter the hour (1-12): ", 1, 12);
j3 0:24b8a6f0a563 274 }
j3 0:24b8a6f0a563 275 else
j3 0:24b8a6f0a563 276 {
j3 0:24b8a6f0a563 277 //Get hour from user
j3 0:24b8a6f0a563 278 rtc_time.hours = term.get_int32("\nPlease enter the hour (0-23): ", 0, 23);
j3 0:24b8a6f0a563 279 }
j3 0:24b8a6f0a563 280
j3 0:24b8a6f0a563 281 //Get minutes from user
j3 0:24b8a6f0a563 282 rtc_time.minutes = term.get_int32("\nPlease enter the minute (0-59): ", 0, 59);
j3 0:24b8a6f0a563 283
j3 0:24b8a6f0a563 284
j3 0:24b8a6f0a563 285 //Get seconds from user
j3 0:24b8a6f0a563 286 rtc_time.seconds = term.get_int32("\nPlease enter the second (0-59): ", 0, 59);
j3 0:24b8a6f0a563 287
j3 0:24b8a6f0a563 288 term.printf("\n");
j3 0:24b8a6f0a563 289
j3 0:24b8a6f0a563 290 rtc.set_time(rtc_time);
j3 0:24b8a6f0a563 291 rtc.set_calendar(rtc_calendar);
j3 0:24b8a6f0a563 292 }
j3 0:24b8a6f0a563 293
j3 0:24b8a6f0a563 294 //*********************************************************************
j3 0:24b8a6f0a563 295 void get_time_date(Terminal & term, Ds3231 & rtc)
j3 0:24b8a6f0a563 296 {
j3 0:24b8a6f0a563 297 time_t epoch_time;
j3 0:24b8a6f0a563 298
j3 0:24b8a6f0a563 299 epoch_time = rtc.get_epoch();
j3 0:24b8a6f0a563 300 term.printf("\n%s\n", ctime(&epoch_time));
j3 0:24b8a6f0a563 301 }
j3 0:24b8a6f0a563 302
j3 0:24b8a6f0a563 303 //*********************************************************************
j3 0:24b8a6f0a563 304 void search_ow_bus(Terminal & term, DS2484 & owm)
j3 0:24b8a6f0a563 305 {
j3 0:24b8a6f0a563 306 OneWireMaster::CmdResult result = owm.OWReset();
j3 0:24b8a6f0a563 307 SearchState search_state;
j3 0:24b8a6f0a563 308
j3 0:24b8a6f0a563 309 if(result == OneWireMaster::Success)
j3 0:24b8a6f0a563 310 {
j3 0:24b8a6f0a563 311 term.printf("\nOWReset success, starting search\n");
j3 0:24b8a6f0a563 312
j3 0:24b8a6f0a563 313 result = OWFirst(owm, search_state);
j3 0:24b8a6f0a563 314 if(result == OneWireMaster::Success)
j3 0:24b8a6f0a563 315 {
j3 0:24b8a6f0a563 316 while(result == OneWireMaster::Success)
j3 0:24b8a6f0a563 317 {
j3 0:24b8a6f0a563 318 //print current devices rom id
j3 0:24b8a6f0a563 319 print_rom_id(term, search_state.romId);
j3 0:24b8a6f0a563 320
j3 0:24b8a6f0a563 321 //find the next device if any
j3 0:24b8a6f0a563 322 result = OWNext(owm, search_state);
j3 0:24b8a6f0a563 323 }
j3 0:24b8a6f0a563 324 term.printf("\n");
j3 0:24b8a6f0a563 325 }
j3 0:24b8a6f0a563 326 else
j3 0:24b8a6f0a563 327 {
j3 0:24b8a6f0a563 328 term.printf("\nSearch failed\n");
j3 0:24b8a6f0a563 329 term.printf("\nError code = %d\n", result);
j3 0:24b8a6f0a563 330 }
j3 0:24b8a6f0a563 331 }
j3 0:24b8a6f0a563 332 else
j3 0:24b8a6f0a563 333 {
j3 0:24b8a6f0a563 334 term.printf("\nFailed to find any 1-wire devices on bus\n");
j3 0:24b8a6f0a563 335 term.printf("\nError code = %d\n", result);
j3 0:24b8a6f0a563 336 }
j3 0:24b8a6f0a563 337 }
j3 0:24b8a6f0a563 338
j3 0:24b8a6f0a563 339 //*********************************************************************
j3 0:24b8a6f0a563 340 void print_rom_id(Terminal & term, RomId & romId)
j3 0:24b8a6f0a563 341 {
j3 0:24b8a6f0a563 342 //print the rom number
j3 0:24b8a6f0a563 343 term.printf("\n");
j3 0:24b8a6f0a563 344 int8_t idx = (RomId::byteLen - 1);
j3 0:24b8a6f0a563 345 do
j3 0:24b8a6f0a563 346 {
j3 0:24b8a6f0a563 347 if(romId[idx] < 16)
j3 0:24b8a6f0a563 348 {
j3 0:24b8a6f0a563 349 term.printf("0x0%x ", romId[idx--]);
j3 0:24b8a6f0a563 350 }
j3 0:24b8a6f0a563 351 else
j3 0:24b8a6f0a563 352 {
j3 0:24b8a6f0a563 353 term.printf("0x%2x ", romId[idx--]);
j3 0:24b8a6f0a563 354 }
j3 0:24b8a6f0a563 355 }
j3 0:24b8a6f0a563 356 while(idx >= 0);
j3 0:24b8a6f0a563 357 term.printf("\n");
j3 0:24b8a6f0a563 358 }