Skip to content

Commit

Permalink
fixed ESP8266 issues
Browse files Browse the repository at this point in the history
- added default eeprom code to mcu if RAM only mode is active
- fixed SPI typo
- fixed function return if EEPROM emulation address is invalid
  • Loading branch information
Paciente8159 committed Jan 21, 2025
1 parent 6aaddb8 commit e854418
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
3 changes: 2 additions & 1 deletion uCNC/src/hal/mcus/esp8266/esp8266_arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ extern "C"

bool mcu_spi_bulk_transfer(const uint8_t *out, uint8_t *in, uint16_t len)
{
SPI.transferBytes(out, int, len);
SPI.transferBytes(out, in, len);
return false;
}

Expand Down Expand Up @@ -1027,6 +1027,7 @@ extern "C"
if (NVM_STORAGE_SIZE <= address)
{
DBGMSG("EEPROM invalid address @ %u", address);
return;
}
EEPROM.write(address, value);
}
Expand Down
31 changes: 27 additions & 4 deletions uCNC/src/hal/mcus/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,16 +877,16 @@ void __attribute__((weak)) mcu_io_init(void)
#endif
#endif
#if ASSERT_PIN_IO(SPI2_CLK)
mcu_config_output(SPI2_CLK);
mcu_config_output(SPI2_CLK);
#endif
#if ASSERT_PIN_IO(SPI2_SDI)
mcu_config_output(SPI2_SDI);
mcu_config_output(SPI2_SDI);
#endif
#if ASSERT_PIN_IO(SPI2_SDO)
mcu_config_output(SPI2_SDO);
mcu_config_output(SPI2_SDO);
#endif
#if ASSERT_PIN(SPI2_CS)
mcu_config_output(SPI2_CS);
mcu_config_output(SPI2_CS);
#endif

#ifdef MCU_HAS_UART
Expand Down Expand Up @@ -932,6 +932,29 @@ void __attribute__((weak)) mcu_io_reset(void)
}
#endif

// Non volatile memory
/**
* gets a byte at the given EEPROM (or other non volatile memory) address of the MCU.
* */
uint8_t __attribute__((weak)) mcu_eeprom_getc(uint16_t address)
{
return 0;
}

/**
* sets a byte at the given EEPROM (or other non volatile memory) address of the MCU.
* */
void __attribute__((weak)) mcu_eeprom_putc(uint16_t address, uint8_t value)
{
}

/**
* flushes all recorded registers into the eeprom.
* */
void __attribute__((weak)) mcu_eeprom_flush(void)
{
}

// ISR
// New uint8_t handle strategy
// All ascii will be sent to buffer and processed later (including comments)
Expand Down

0 comments on commit e854418

Please sign in to comment.