Fix names
This commit is contained in:
parent
4a8b6137d1
commit
a8be04b583
@ -28,7 +28,7 @@ void check_eeprom_is_ready(){
|
||||
// Checks if it has been written information at the address
|
||||
// If true, the infromation is replaced with the intaken struct
|
||||
// else the intaken struct is written at the address.
|
||||
void write_struct_in_EEPROM(config_t write_struct){
|
||||
void write_struct_from_EEPROM(config_t write_struct){
|
||||
uint8_t struct_size;
|
||||
struct_size = sizeof(write_struct);
|
||||
|
||||
@ -38,7 +38,7 @@ void write_struct_in_EEPROM(config_t write_struct){
|
||||
|
||||
}
|
||||
|
||||
// Reads the memory block at the address 0x00
|
||||
// Reads the memory block at the address start_address_controller
|
||||
// returns a struct in form of config_t
|
||||
config_t read_struct_from_EEPROM(){
|
||||
//is eeprom ready??
|
||||
@ -55,14 +55,14 @@ config_t read_struct_from_EEPROM(){
|
||||
// checks if EEPROM is ready
|
||||
// If the dataset is 1, the datapoint is written at the address.
|
||||
// If the dataset is 2 its written at another point.
|
||||
void write_data_point_in_EEPROM(uint8_t data_point, uint8_t data){
|
||||
void write_data_point_in_EEPROM(uint8_t byte, uint8_t fan_num){
|
||||
|
||||
check_eeprom_is_ready();
|
||||
if (data == 1){
|
||||
eeprom_update_byte(current_address_fan1, data_point);
|
||||
if (fan_num == 1){
|
||||
eeprom_update_byte(current_address_fan1, byte);
|
||||
current_address_fan1++;
|
||||
} else if (data == 2){
|
||||
eeprom_update_byte(current_address_fan2, data_point);
|
||||
} else if (fan_num == 2){
|
||||
eeprom_update_byte(current_address_fan2, byte);
|
||||
current_address_fan2++;
|
||||
} else{
|
||||
// error???
|
||||
@ -72,25 +72,25 @@ void write_data_point_in_EEPROM(uint8_t data_point, uint8_t data){
|
||||
|
||||
// Reads all the datapoints to the choosen data.
|
||||
// it writes the data points in the USART stream.
|
||||
void read_data_point_speed_info(uint8_t data){
|
||||
uint8_t data_point = 0;
|
||||
void read_data_point_speed_info(uint8_t fan_num){
|
||||
uint8_t byte = 0;
|
||||
|
||||
if (data == 1){
|
||||
if (fan_num == 1){
|
||||
uint8_t len = current_address_fan1 - start_address_fan1;
|
||||
|
||||
check_eeprom_is_ready();
|
||||
|
||||
for (uint8_t i = 0; i <len; i++){
|
||||
data_point = eeprom_read_byte(i);
|
||||
printf("Fanspeed nr %u : %u", i, data_point);
|
||||
byte = eeprom_read_byte(i);
|
||||
printf("Fanspeed nr %u : %u", i, byte);
|
||||
}
|
||||
} else if (data == 2){
|
||||
} else if (fan_num == 2){
|
||||
uint8_t len = current_address_fan2 - start_address_fan2;
|
||||
check_eeprom_is_ready();
|
||||
|
||||
for (uint8_t i = 0; i <len; i++){
|
||||
data_point = eeprom_read_byte(i);
|
||||
printf("Fanspeed nr %u : %u", i, data_point);
|
||||
byte = eeprom_read_byte(i);
|
||||
printf("Fanspeed nr %u : %u", i, byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* File: eeprom.h
|
||||
* Author: athamantis
|
||||
* Author: Helle Augland Grasmo
|
||||
*
|
||||
* Created on 06 March 2024, 15:30
|
||||
*/
|
||||
@ -30,16 +30,16 @@ typedef struct {
|
||||
void check_eeprom_is_ready();
|
||||
|
||||
// Writes a struct in EEPROM
|
||||
void write_struct_in_EEPROM(config_t write_struct);
|
||||
void write_struct_from_EEPROM(config_t write_struct);
|
||||
|
||||
// Read data from EEPROM and return it as a controller struct
|
||||
config_t read_struct_from_EEPROM();
|
||||
|
||||
// Writes a datapoint in EEPROM
|
||||
void write_data_point_in_EEPROM(uint8_t data_point, uint8_t data);
|
||||
void write_data_point_from_EEPROM(uint8_t byte, uint8_t fan_num);
|
||||
|
||||
// Reads all the dataPoints form EEPROM
|
||||
void read_data_point_speed_info(uint8_t data);
|
||||
void read_data_point_speed_info(uint8_t fan_num);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -1,28 +1,15 @@
|
||||
/*
|
||||
* File: main.c
|
||||
* Author: Sebastian H. Gabrielli
|
||||
* Author: Sebastian H. Gabrielli, Helle Augland Grasmo
|
||||
*
|
||||
* Created on March 6, 2024, 12:34 PM
|
||||
*/
|
||||
/*
|
||||
* File: main.c
|
||||
* Author: athamantis
|
||||
*
|
||||
* Created on 01 March 2024, 10:34
|
||||
*/
|
||||
|
||||
|
||||
#include "eeprom.h"
|
||||
#include <avr/io.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#define F_CPU 4E6
|
||||
#include <util/delay.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <stdbool.h>
|
||||
#define USART3_BAUD_RATE(BAUD_RATE) ((float)(F_CPU * 64 / (16 *(float) BAUD_RATE)) + 0.5)
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user