Skip to content

Commit

Permalink
Merge from Dev (#49)
Browse files Browse the repository at this point in the history
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Increment size of emulated EEPROM

Defines paremeter Pages for use more than one page per bank on emulated EEPROM.

* Create TestCompile.yml

Initial version

* Update TestCompile.yml

* Changed Ethernet.h to Ethernet_STM.h

This was forgotten for this example

* Adding Adafruit Gfx library, excluding errorneous examples

* included libs excluded examples, removed debug

* more exludes

* excluded OLED_I2C examples

* Compatibility with current HEAD versions of Adafruit GFX and Adafruit BusIO.

* Adafruit_GFX_AS: Use a macro to achieve s/textsize/textsize_x/.

* Fix mistaken cast of wrong argument.

* STM32F4 backup domain registers and backup domain sram

STM32F4: update bkp.h, bkp.c add support for backup registers and backup sram.
added example in STM32F4/libraries/RTClock/examples/BkpTest

* STM32F4: RTClock - prevent clobbering if run on LSE and VBAT

updated RTClock.begin()
skip initialization of RTC running on LSE if it is already running
so that the time maintained on VBAT would not be reset

note that the change only prevents resetting RTC on LSE as only that is assured
when running on VBAT

* STM32F4 RTClock minor fix

in begin()
change:
  if(!lse_ison && RTCSEL_LSE) {
to:
  if(!lse_ison)

that RTCSEL_LSE is redundant. it suffice to test that lse_ison

* F1: fix for rogerclarkmelbourne#852: added function definition into pgmsapce.h

* USBComposite library updates: MIDI sysex support; bug fixes

* fix maple_upload dfu_address set to {runtime.ide.path} instead of {upload.dfuse_addr} or nothing rogerclarkmelbourne#854

* F1: Wire: add wire(const uint8*, int) to WireBase.h

* USB Composite 1.06 merge

* Delete unneeded file

* Update WireBase.h

added return value to write(const uint8* buf, int nr)

* Added blackpill_f411 variant

* added build options for the abilirty to select HSI clock source without a crystal - generic F103C8 only so far.

* Fix incorrect upload method for F411

* fixes rogerclarkmelbourne#883 

 random() without parameter like in standard Arduino API is missing.

* update USBComposite to 1.0.7

* Added workflow_dispatch for manual build check

This is a very handy feature :-)

* Using ln -s instead of cp

* Using ln -s instead of cp

* Fixing error: 'utoa' was not declared in this scope - see rogerclarkmelbourne#884

* Update README.md

removed invalid link to Gitter

* fix HardwareCANexample.ino

* Update wirish_digital.cpp - fix rogerclarkmelbourne#859

* fix boardPWMpins table for generic gdf103c variant

* fix boardPWMpins for generic F103c variant

* fix boardPWMpins table for generic F103C variant

* fix BOARD_NR_PWM_PIN for generic F103C variant

* Update SPI.cpp

remove some obsolete flags

* F1: DMA transfer setup function - changed parameter definition

* F1: SPI rework

* Update Print.cpp

added serial PRINTF and DBG_PRINTF

* F1: fixed generic F103 board PWM pins

* F1: added function to check if spi is in master mode

* Update SPI.cpp

- fixed DMA wait for completion in slave mode
- limited text columns to 120

* F1: SPI dmaTransferRepeat() got 2 optional parmaeters

* Rename hid-flash to hid_flash

rogerclarkmelbourne#895

* systick allows up to 4 callbacks

* F4: added PRINTF

* F4: added soft-reset nvic_sys_reset()

* F4: optimized ring_buffer

* renamed tools/macosx/hid_flash

* F4: fix heap start address for F411 boards

* F4: Wire support of alternative pins

* F4: added I2S library

* Update SPI.h

* F4: removed arduino_uip library (not used)

* F4: added Adafruit_ILI9341_STM library

* Delete AdvancedChatServer.ino

* F4: allow output pin speed selection

* F4: small changes

* F1: small changes in Adafruit_ILI9341_STM

* F1: small changes in Serasidis_VS1003B lib

* F1: removed timer setup from board init

* F1: SPI settings get initialized when creating the instance

* Update wirish.h

* Delete c_cpp_properties.json

* Update .gitignore

* Update rcc_private.h

* small fixes after previous merge

* Update SPI.h

* remove some not needed files

---------

Co-authored-by: Phonog <[email protected]>
Co-authored-by: Roger Clark <[email protected]>
Co-authored-by: svmac <[email protected]>
Co-authored-by: Armin <[email protected]>
Co-authored-by: Kiki Lamb <[email protected]>
Co-authored-by: ag88 <ag88@github>
Co-authored-by: arpruss <[email protected]>
Co-authored-by: Tomas kovacik <[email protected]>
Co-authored-by: board707 <[email protected]>
Co-authored-by: purewack <[email protected]>
  • Loading branch information
11 people authored Feb 28, 2024
1 parent ae25e64 commit 85f22c4
Show file tree
Hide file tree
Showing 70 changed files with 3,198 additions and 327 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/TestCompile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# TestCompile.yml
# Github workflow script to test compile all examples of an Arduino core repository.
#
# Copyright (C) 2020 Armin Joachimsmeyer
# https://github.com/ArminJo/Github-Actions
#

# This is the name of the workflow, visible on GitHub UI.
name: TestCompile
on:
workflow_dispatch: # To run it manually
description: 'manual build check'
push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
paths:
- '**.ino'
- '**.cpp'
- '**.h'
- '**TestCompile.yml'
pull_request:
jobs:
build:
name: Test compiling examples for Arduino_STM32
runs-on: ubuntu-latest
env:
# PLATFORM_DEFAULT_URL: http://dan.drown.org/stm32duino/package_STM32duino_index.json
# Comma separated list without double quotes around the list.
REQUIRED_LIBRARIES: SdFat,Streaming,Adafruit GFX Library,Adafruit SSD1306,Adafruit STMPE610,Adafruit TouchScreen,SD

strategy:
matrix:
# The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn`
# In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command
#
# Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega
# arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native"
# ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro
# STM32:stm32:GenF1:pnum=BLUEPILL_F103C8
# esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
#############################################################################################################
arduino-boards-fqbn:
- stm32duino:STM32F1:genericSTM32F103C
#- stm32duino:STM32F1:nucleo_f103rb
#- stm32duino:STM32F1:mapleMini

# Specify parameters for each board.
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list.
#############################################################################################################
include:
- arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C
# errors: BOARD_BUTTON_PIN not defined, 'textsize' was not declared in this scope, 'A0' was not declared in this scope, 'BOARD_LED_PIN' was not declared in this scope, no matching function for call to 'SPIClass::transfer(uint8_t*&, size_t&)
sketches-exclude: Debounce,StateChangeDetection,Button,QASlave,InteractiveTest,WhileStatementConditional,HardwareTimerOnePulseMode,HardwareTimerPWMInput,StringEx_Parsing,hello_STM,MIDI_Classic_Mode,JeeUdp,multipacketSD,udpListener,etherNode,SingleChannelContinuousConversion,OLED_I2C_NumberFonts,OLED_I2C_TinyFont_View,OLED_I2C_Scrolling_Text,OLED_I2C_Bitmap,OLED_I2C_3D_Cube,OLED_I2C_ViewFont,OLED_I2C_Graph_Demo,OLED_I2C_Brightness,OLED_I2C_NumberFonts,OLED_I2C_TinyFont_View,coos_display_blink,rtos_blink,rtos_display_blink,Twitter_Serial_GW,XivelyClientString,XivelyClient,ssd1306_128x64_i2c_STM32,breakouttouchpaint,graphicstest,stm32_graphicstest,TFT_Rainbow_ILI9341,TFT_Clock_ILI9341,TFT_Clock_Digital_ILI9341,TFT_Show_Font_ILI9341,graphicstest,stm32_graphicstest,onoffbutton_breakout,onoffbutton_breakout,onoffbutton,spitftbitmap,ssd1306_128x64_spi,ssd1306_128x32_i2c,ssd1306_128x32_spi,sdreader

#- arduino-boards-fqbn: stm32duino:STM32F1:nucleo_f103rb
# Examples to exclude because of ...
#sketches-exclude: WiiClassicJoystick,BasicUsage,DigisparkOLED,SoftPwm13Pins,TinySoftPwmDemo,DigiUSB2LCD,DigisparkUSBDemo,ArduinoNunchukDemo,DigisparkJoystickDemo

# Do not cancel all jobs / architectures if one job fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@master

- name: Use this repo as Arduino core
run: |
mkdir --parents $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7 # dummy release number
# cannot move, since we want to compile the examples in the library subfolder :-)
ln -s $GITHUB_WORKSPACE/STM32F1/* $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7
#cp --recursive $GITHUB_WORKSPACE/STM32F1/* $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7/
#ls -l --dereference --recursive --all $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7/
- name: Compile all examples
uses: ArminJo/arduino-test-compile@master
with:
required-libraries: ${{ env.REQUIRED_LIBRARIES }}
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
arduino-platform: stm32duino:STM32F1,arduino:sam # we require the C compiler from it. See dependencies of package_STM32duino_index.json
#platform-default-url: ${{ env.PLATFORM_DEFAULT_URL }}
#platform-url: ${{ matrix.platform-url }}
sketches-exclude: ${{ matrix.sketches-exclude }}
build-properties: ${{ toJson(matrix.build-properties) }}
sketch-names: "*.ino"
sketch-names-find-start: STM32F1/libraries/*/examples/
#debug-install: true
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
## Summary:
This repo contains the "Hardware" files to support STM32 based boards on Arduino version 1.8.x (some older versions may also work) including [LeafLabs Maple, and Maple mini](http://www.leaflabs.com/about-maple/), and other generic STM32F103 boards.


***We are also on Gitter https://gitter.im/stm32duino/Lobby/***
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/stm32duino/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Background & Support:
* Based on https://github.com/bobc/maple-asp, which is in turn based on LibMaple by Leaflabs
* **Please read the wiki (https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki) for full details**
Expand Down
11 changes: 10 additions & 1 deletion STM32F1/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,16 @@ genericSTM32F103C.menu.upload_method.HIDUploadMethod.build.vect=VECT_TAB_ADDR=0x
genericSTM32F103C.menu.upload_method.HIDUploadMethod.build.ldscript=ld/hid_bootloader.ld

#-- CPU Clock frequency
genericSTM32F103C.menu.cpu_speed.speed_72mhz=72MHz (Normal)

genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz=64Mhz (HSI)
genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz.build.f_cpu=64000000L
genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz.build.hs_flag=-DUSE_HSI_CLOCK

genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz=48Mhz (HSI- USB)
genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz.build.f_cpu=48000000L
genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz.build.hs_flag=-DUSE_HSI_CLOCK -DHSI_USB_SPEED

genericSTM32F103C.menu.cpu_speed.speed_72mhz=72Mhz (Normal)
genericSTM32F103C.menu.cpu_speed.speed_72mhz.build.f_cpu=72000000L

genericSTM32F103C.menu.cpu_speed.speed_48mhz=48MHz (Slow - with USB)
Expand Down
1 change: 1 addition & 0 deletions STM32F1/cores/maple/avr/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef uint32_t prog_uint32_t;

#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#define strcpy_P(dest, src) strcpy((dest), (src))
#define strncpy_P(dest, src, size) strncpy((dest), (src), (size))
#define strcat_P(dest, src) strcat((dest), (src))
#define strchr_P(s, c) strchr((s), (c))
#define strcmp_P(a, b) strcmp((a), (b))
Expand Down
1 change: 1 addition & 0 deletions STM32F1/cores/maple/libmaple/rcc_f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const struct rcc_dev_info rcc_dev_table[] = {
[RCC_TIMER13] = { .clk_domain = APB1, .line_num = 7 },
[RCC_TIMER14] = { .clk_domain = APB1, .line_num = 8 },
#endif
[RCC_CAN] = { .clk_domain = APB1, .line_num = 25 }, //! JMD after X893
};

__deprecated
Expand Down
8 changes: 4 additions & 4 deletions STM32F1/cores/maple/libmaple/rcc_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

struct rcc_dev_info {
const rcc_clk_domain clk_domain;
const uint8 line_num;
const uint8_t line_num;
};

extern const struct rcc_dev_info rcc_dev_table[];
Expand All @@ -51,14 +51,14 @@ static inline rcc_clk_domain rcc_dev_clk(rcc_clk_id id) {
static inline void rcc_do_clk_enable(__IO uint32** enable_regs,
rcc_clk_id id) {
__IO uint32 *enable_reg = enable_regs[rcc_dev_clk(id)];
uint8 line_num = rcc_dev_table[id].line_num;
uint8_t line_num = rcc_dev_table[id].line_num;
bb_peri_set_bit(enable_reg, line_num, 1);
}

static inline void rcc_do_reset_dev(__IO uint32** reset_regs,
rcc_clk_id id) {
__IO uint32 *reset_reg = reset_regs[rcc_dev_clk(id)];
uint8 line_num = rcc_dev_table[id].line_num;
uint8_t line_num = rcc_dev_table[id].line_num;
bb_peri_set_bit(reset_reg, line_num, 1);
bb_peri_set_bit(reset_reg, line_num, 0);
}
Expand All @@ -75,7 +75,7 @@ static inline void rcc_do_set_prescaler(const uint32 *masks,
static inline void rcc_do_clk_disable(__IO uint32** enable_regs,
rcc_clk_id id) {
__IO uint32 *enable_reg = enable_regs[rcc_dev_clk(id)];
uint8 line_num = rcc_dev_table[id].line_num;
uint8_t line_num = rcc_dev_table[id].line_num;
bb_peri_set_bit(enable_reg, line_num, 0);
}

Expand Down
1 change: 1 addition & 0 deletions STM32F1/cores/maple/libmaple/series/rcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ typedef enum rcc_clk_id {
RCC_TIMER12,
RCC_TIMER13,
RCC_TIMER14,
RCC_CAN,
} rcc_clk_id;

/**
Expand Down
1 change: 1 addition & 0 deletions STM32F1/cores/maple/wirish.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <avr/dtostrf.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "itoa.h"

#include <libmaple/stm32.h>

Expand Down
2 changes: 1 addition & 1 deletion STM32F1/cores/maple/wirish_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void randomSeed(unsigned int seed);
* @return A pseudo-random number in the range [0,max).
* @see randomSeed()
*/
long random(long max);
long random(long max = __LONG_MAX__);

/**
* @brief Generate a pseudo-random number with lower and upper bounds.
Expand Down
4 changes: 4 additions & 0 deletions STM32F1/libraries/Adafruit_GFX_AS/Adafruit_GFX_AS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ POSSIBILITY OF SUCH DAMAGE.
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif

#define textsize textsize_x

Adafruit_GFX_AS::Adafruit_GFX_AS(int16_t w, int16_t h): Adafruit_GFX(w, h)
{
}
Expand Down Expand Up @@ -378,3 +380,5 @@ int16_t Adafruit_GFX_AS::drawFloat(float floatNumber, int16_t decimal, int16_t p
}
return sumX;
}

#undef textsize
31 changes: 23 additions & 8 deletions STM32F1/libraries/EEPROM/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
uint16 EEPROMClass::EE_CheckPage(uint32 pageBase, uint16 status)
{
uint32 pageEnd = pageBase + (uint32)PageSize;
uint32 pageEnd = pageBase + (uint32)PageSize * Pages;

// Page Status not EEPROM_ERASED and not a "state"
if ((*(__IO uint16*)pageBase) != EEPROM_ERASED && (*(__IO uint16*)pageBase) != status)
Expand Down Expand Up @@ -40,6 +40,10 @@ FLASH_Status EEPROMClass::EE_ErasePage(uint32 pageBase)
FlashStatus = FLASH_ErasePage(pageBase);
if (FlashStatus == FLASH_COMPLETE)
FlashStatus = FLASH_ProgramHalfWord(pageBase + 2, data);
for (size_t i = 1; i < Pages; i++)
{
FLASH_ErasePage(pageBase + PageSize * i);
}

return FlashStatus;
}
Expand Down Expand Up @@ -95,7 +99,7 @@ uint16 EEPROMClass::EE_GetVariablesCount(uint32 pageBase, uint16 skipAddress)
{
uint16 varAddress, nextAddress;
uint32 idx;
uint32 pageEnd = pageBase + (uint32)PageSize;
uint32 pageEnd = pageBase + (uint32)PageSize * Pages;
uint16 count = 0;

for (pageBase += 6; pageBase < pageEnd; pageBase += 4)
Expand Down Expand Up @@ -136,7 +140,7 @@ uint16 EEPROMClass::EE_PageTransfer(uint32 newPage, uint32 oldPage, uint16 SkipA
FLASH_Status FlashStatus;

// Transfer process: transfer variables from old to the new active page
newEnd = newPage + ((uint32)PageSize);
newEnd = newPage + ((uint32)PageSize * Pages);

// Find first free element in new page
for (newIdx = newPage + 4; newIdx < newEnd; newIdx += 4)
Expand All @@ -146,7 +150,7 @@ uint16 EEPROMClass::EE_PageTransfer(uint32 newPage, uint32 oldPage, uint16 SkipA
return EEPROM_OUT_SIZE;

oldEnd = oldPage + 4;
oldIdx = oldPage + (uint32)(PageSize - 2);
oldIdx = oldPage + (uint32)(PageSize * Pages - 2);

for (; oldIdx > oldEnd; oldIdx -= 4)
{
Expand Down Expand Up @@ -219,7 +223,7 @@ uint16 EEPROMClass::EE_VerifyPageFullWriteVariable(uint16 Address, uint16 Data)
return EEPROM_NO_VALID_PAGE;

// Get the valid Page end Address
pageEnd = pageBase + PageSize; // Set end of page
pageEnd = pageBase + PageSize * Pages; // Set end of page

for (idx = pageEnd - 2; idx > pageBase; idx -= 4)
{
Expand Down Expand Up @@ -254,7 +258,7 @@ uint16 EEPROMClass::EE_VerifyPageFullWriteVariable(uint16 Address, uint16 Data)
// Empty slot not found, need page transfer
// Calculate unique variables in page
count = EE_GetVariablesCount(pageBase, Address) + 1;
if (count >= (PageSize / 4 - 1))
if (count >= (PageSize * Pages / 4 - 1))
return EEPROM_OUT_SIZE;

if (pageBase == PageBase1)
Expand Down Expand Up @@ -284,6 +288,7 @@ EEPROMClass::EEPROMClass(void)
PageBase0 = EEPROM_PAGE0_BASE;
PageBase1 = EEPROM_PAGE1_BASE;
PageSize = EEPROM_PAGE_SIZE;
Pages = 1;
Status = EEPROM_NOT_INIT;
}

Expand All @@ -292,6 +297,16 @@ uint16 EEPROMClass::init(uint32 pageBase0, uint32 pageBase1, uint32 pageSize)
PageBase0 = pageBase0;
PageBase1 = pageBase1;
PageSize = pageSize;
Pages = 1;
return init();
}

uint16 EEPROMClass::init(uint32 pageBase0, uint32 pageBase1, uint32 pageSize, uint16 pages)
{
PageBase0 = pageBase0;
PageBase1 = pageBase1;
PageSize = pageSize;
Pages = pages;
return init();
}

Expand Down Expand Up @@ -481,7 +496,7 @@ uint16 EEPROMClass::read(uint16 Address, uint16 *Data)
return EEPROM_NO_VALID_PAGE;

// Get the valid Page end Address
pageEnd = pageBase + ((uint32)(PageSize - 2));
pageEnd = pageBase + ((uint32)(PageSize * Pages - 2));

// Check each active page address starting from end
for (pageBase += 6; pageEnd >= pageBase; pageEnd -= 4)
Expand Down Expand Up @@ -564,7 +579,7 @@ uint16 EEPROMClass::count(uint16 *Count)

uint16 EEPROMClass::maxcount(void)
{
return ((PageSize / 4)-1);
return ((PageSize * Pages / 4)-1);
}

EEPROMClass EEPROM;
2 changes: 2 additions & 0 deletions STM32F1/libraries/EEPROM/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class EEPROMClass

uint16 init(void);
uint16 init(uint32, uint32, uint32);
uint16 init(uint32, uint32, uint32, uint16);

uint16 format(void);

Expand All @@ -75,6 +76,7 @@ class EEPROMClass
uint32 PageBase0;
uint32 PageBase1;
uint32 PageSize;
uint16 Pages;
uint16 Status;
private:
FLASH_Status EE_ErasePage(uint32);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
int ledPin = 13; // LED connected to digital pin 13
const char HELP_MSG[] = "Press :\r\n" \
" 0 display configuration\r\n" \
" 1 set configuration to 0x801F000 / 0x801F800 / 0x400 (RB MCU)\r\n" \
" 2 set configuration to 0x801F000 / 0x801F800 / 0x800 (ZE/RE MCU)\r\n" \
" 1 set configuration to 0x801F000 / 0x801F800 / 0x400 / 2 (RB MCU)\r\n" \
" 2 set configuration to 0x801F000 / 0x801F800 / 0x800 / 1 (ZE/RE MCU)\r\n" \
" 3 write/read variable\r\n" \
" 4 increment address\r\n" \
" 5 display pages top/bottom\r\n" \
Expand Down Expand Up @@ -40,13 +40,15 @@ void loop()
EEPROM.PageBase0 = 0x801F000;
EEPROM.PageBase1 = 0x801F800;
EEPROM.PageSize = 0x400;
EEPROM.Pages = 2;
DisplayConfig();
}
else if (cmd == '2')
{
EEPROM.PageBase0 = 0x801F000;
EEPROM.PageBase1 = 0x801F800;
EEPROM.PageSize = 0x800;
EEPROM.Pages = 1;
DisplayConfig();
}
else if (cmd == '3')
Expand Down Expand Up @@ -111,6 +113,8 @@ void DisplayConfig(void)
Serial.print (" (");
Serial.print (EEPROM.PageSize, DEC);
Serial.println(")");
Serial.print ("EEPROM.Pages : ");
Serial.println(EEPROM.Pages, DEC);
}

void DisplayHex(uint16 value)
Expand Down Expand Up @@ -149,7 +153,7 @@ void DisplayPagesEnd(uint32 endIndex)
{
Serial.println("Page 0 Bottom Page 1");

for (uint32 idx = EEPROM.PageSize - endIndex; idx < EEPROM.PageSize; idx += 4)
for (uint32 idx = EEPROM.PageSize * EEPROM.Pages - endIndex; idx < EEPROM.PageSize * EEPROM.Pages; idx += 4)
{
Serial.print (EEPROM.PageBase0 + idx, HEX);
Serial.print (" : ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/

#include <SPI.h>
#include <Ethernet.h>
#include <Ethernet_STM.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
Expand Down
Loading

0 comments on commit 85f22c4

Please sign in to comment.