Arduino pure C-programming part -3 EEPROM


/*
Writing to the AVR EEPROM
*/

#include <avr/io.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>

struct accelerometer_data
{
int x,y,z;
};

struct accelerometer_data data = {10,12,32};

uint8_t i=123;

int main()
{


while(!eeprom_is_ready()); //wait for the eeprom to be ready

cli();
eeprom_write_block((const void*)&data,(void *)0,sizeof(struct accelerometer_data));
sei();

while(!eeprom_is_ready());  //wait for the eeprom to be ready

cli();
eeprom_write_byte((uint8_t *)40,i);
sei();

while(1);

}

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto