mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-02 14:13:42 -04:00
a80ae0cde3
This commit changes the way libraries headers are included in source files: - If the header is in the same directory the source belongs to, so the notation '#include ""' is used with the path relative to the directory containing the source. - If the header is outside the directory containing the source, then we use the notation '#include <>' with the path relative to libraries folder. Some of the advantages of such approach: - Only one search path for libraries headers. - OSs like Windows may have a better lookup time.
32 lines
770 B
C++
32 lines
770 B
C++
#include <AP_HAL/AP_HAL.h>
|
|
#if (CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2)
|
|
|
|
#include <avr/io.h>
|
|
#include <avr/eeprom.h>
|
|
#include "Storage.h"
|
|
using namespace AP_HAL_AVR;
|
|
|
|
void AVREEPROMStorage::read_block(void *dst, uint16_t src, size_t n)
|
|
{
|
|
eeprom_read_block(dst,(const void*)src,n);
|
|
}
|
|
|
|
void AVREEPROMStorage::write_block(uint16_t dst, const void *src, size_t n)
|
|
{
|
|
uint8_t *p = (uint8_t *)src;
|
|
while (n--) {
|
|
/*
|
|
it is much faster to read than write, so it is worth
|
|
checking if the value is already correct
|
|
*/
|
|
uint8_t b = eeprom_read_byte((uint8_t*)dst);
|
|
if (b != *p) {
|
|
eeprom_write_byte((uint8_t*)dst, *p);
|
|
}
|
|
dst++;
|
|
p++;
|
|
}
|
|
}
|
|
|
|
#endif
|