|
@ -136,7 +136,7 @@ typedef int16_t pin_t; |
|
|
// Public Variables
|
|
|
// Public Variables
|
|
|
// ------------------------
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
|
/** result of last ADC conversion */ |
|
|
// result of last ADC conversion
|
|
|
extern uint16_t HAL_adc_result; |
|
|
extern uint16_t HAL_adc_result; |
|
|
|
|
|
|
|
|
// ------------------------
|
|
|
// ------------------------
|
|
@ -149,30 +149,35 @@ extern uint16_t HAL_adc_result; |
|
|
// Enable hooks into setup for HAL
|
|
|
// Enable hooks into setup for HAL
|
|
|
void HAL_init(void); |
|
|
void HAL_init(void); |
|
|
|
|
|
|
|
|
/** clear reset reason */ |
|
|
// Clear reset reason
|
|
|
void HAL_clear_reset_source (void); |
|
|
void HAL_clear_reset_source (void); |
|
|
|
|
|
|
|
|
/** reset reason */ |
|
|
// Reset reason
|
|
|
uint8_t HAL_get_reset_source(void); |
|
|
uint8_t HAL_get_reset_source(void); |
|
|
|
|
|
|
|
|
void _delay_ms(const int delay); |
|
|
void _delay_ms(const int delay); |
|
|
|
|
|
|
|
|
extern "C" char* _sbrk(int incr); |
|
|
extern "C" char* _sbrk(int incr); |
|
|
|
|
|
|
|
|
|
|
|
#pragma GCC diagnostic push |
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-function" |
|
|
|
|
|
|
|
|
static inline int freeMemory() { |
|
|
static inline int freeMemory() { |
|
|
volatile char top; |
|
|
volatile char top; |
|
|
return &top - reinterpret_cast<char*>(_sbrk(0)); |
|
|
return &top - reinterpret_cast<char*>(_sbrk(0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#pragma GCC diagnostic pop |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
// 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
|
|
|
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); |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
@ -182,8 +187,8 @@ uint8_t spiRec(uint32_t chan); |
|
|
// 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
|
|
|