1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

HAL cleanups

This commit is contained in:
Scott Lahteine 2019-02-20 06:13:07 -06:00
parent 89bbc30a09
commit 631d867dc9
5 changed files with 27 additions and 12 deletions

View File

@ -112,10 +112,8 @@ uint8_t HAL_get_reset_source(void); // get reset reason
// Write single byte to specified SPI channel // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
// Write buffer to specified SPI channel // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n); void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
// Read single byte from specified SPI channel // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);

View File

@ -176,7 +176,10 @@ static inline int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
//
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */ /** Write single byte to specified SPI channel */
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ /** Write buffer to specified SPI channel */
@ -184,18 +187,19 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ /** Read single byte from specified SPI channel */
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
//
// EEPROM // EEPROM
//
/** // Wire library should work for i2c EEPROMs
* Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(uint8_t *pos, unsigned char value); void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos); uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n);
//
// ADC // ADC
//
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)

View File

@ -185,7 +185,10 @@ static int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
//
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */ /** Write single byte to specified SPI channel */
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ /** Write buffer to specified SPI channel */
@ -193,19 +196,22 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ /** Read single byte from specified SPI channel */
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
//
// EEPROM // EEPROM
//
/** /**
* TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. * TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort.
* Wire library should work for i2c eeproms. * Wire library should work for i2c EEPROMs.
*/ */
void eeprom_write_byte(uint8_t *pos, unsigned char value); void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos); uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n);
//
// ADC // ADC
//
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG); #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG);

View File

@ -195,7 +195,10 @@ static int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
//
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */ /** Write single byte to specified SPI channel */
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ /** Write buffer to specified SPI channel */
@ -203,18 +206,22 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ /** Read single byte from specified SPI channel */
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
//
// EEPROM // EEPROM
//
/** /**
* TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. * TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort.
* Wire library should work for i2c eeproms. * Wire library should work for i2c EEPROMs.
*/ */
void eeprom_write_byte(uint8_t *pos, unsigned char value); void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos); uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n);
//
// ADC // ADC
//
#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT)

View File

@ -240,7 +240,7 @@
#error "Remove DELTA_PROBEABLE_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead." #error "Remove DELTA_PROBEABLE_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead."
#elif defined(UBL_MESH_INSET) #elif defined(UBL_MESH_INSET)
#error "UBL_MESH_INSET is now just MESH_INSET. Please update your configuration." #error "UBL_MESH_INSET is now just MESH_INSET. Please update your configuration."
#elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y) #elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y)
#error "UBL_MESH_(MIN|MAX)_[XY] is now just MESH_(MIN|MAX)_[XY]. Please update your configuration." #error "UBL_MESH_(MIN|MAX)_[XY] is now just MESH_(MIN|MAX)_[XY]. Please update your configuration."
#elif defined(ABL_PROBE_PT_1_X) || defined(ABL_PROBE_PT_1_Y) || defined(ABL_PROBE_PT_2_X) || defined(ABL_PROBE_PT_2_Y) || defined(ABL_PROBE_PT_3_X) || defined(ABL_PROBE_PT_3_Y) #elif defined(ABL_PROBE_PT_1_X) || defined(ABL_PROBE_PT_1_Y) || defined(ABL_PROBE_PT_2_X) || defined(ABL_PROBE_PT_2_Y) || defined(ABL_PROBE_PT_3_X) || defined(ABL_PROBE_PT_3_Y)
#error "ABL_PROBE_PT_[123]_[XY] is now PROBE_PT_[123]_[XY]. Please update your configuration." #error "ABL_PROBE_PT_[123]_[XY] is now PROBE_PT_[123]_[XY]. Please update your configuration."