HAL cleanups
This commit is contained in:
parent
89bbc30a09
commit
631d867dc9
5 changed files with 27 additions and 12 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Reference in a new issue