OneWay  3.0-3-ge9d4fa4
Functions | Variables
htv.c File Reference

Main struct of the project and eventually defaults. More...

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <util/crc16.h>
#include <avr/io.h>
#include <avr/eeprom.h>
#include "htv.h"
Include dependency graph for htv.c:

Functions

void htv_store_address (struct htv_t *htv)
 store the address of the unit in EEPROM.
 
struct htv_thtv_init (struct htv_t *htv)
 initialize the htv struct
 
void htv_free (struct htv_t *htv)
 free the htv struct. More...
 
uint8_t crc8_str (const char *str)
 return the crc8 of the string. More...
 
void aaaa_to_htv (struct htv_t *htv)
 convert a pre-formatted string to the struct htv. More...
 
void s5_to_htv (struct htv_t *htv)
 AAAAC to htv_t. More...
 
void s7_to_htv (struct htv_t *htv)
 AAAAPPC to htv_t. More...
 
void s8_to_htv (struct htv_t *htv)
 AAAAC:RR to htv_t. More...
 
void s10_to_htv (struct htv_t *htv)
 AAAAPPC:RR to htv_t. More...
 
uint8_t htv_check_cmd (struct htv_t *htv)
 check the validity of the x10str command string. More...
 

Variables

uint16_t EEMEM EE_address
 
uint16_t EEMEM EE_naddress
 

Detailed Description

Main struct of the project and eventually defaults.

Function Documentation

◆ aaaa_to_htv()

void aaaa_to_htv ( struct htv_t htv)

convert a pre-formatted string to the struct htv.

This convert the AAAA part to htv_t->address.

Note
the string is stored in the struct itself.

◆ crc8_str()

uint8_t crc8_str ( const char *  str)

return the crc8 of the string.

Parameters
strthe string

◆ htv_check_cmd()

uint8_t htv_check_cmd ( struct htv_t htv)

check the validity of the x10str command string.

Based on the string lenght, choose which protocol to check. If cmd is not correct clear the cmd string and return FALSE else if cmd is ok, modify cmd and keep only AAAAPPC.

Returns
true: string OK, false: error
Todo:
should return errno code.

◆ htv_free()

void htv_free ( struct htv_t htv)

free the htv struct.

Note
this should be never used.

◆ s10_to_htv()

void s10_to_htv ( struct htv_t htv)

AAAAPPC:RR to htv_t.

See also
aaaa_to_htv

◆ s5_to_htv()

void s5_to_htv ( struct htv_t htv)

AAAAC to htv_t.

See also
aaaa_to_htv

◆ s7_to_htv()

void s7_to_htv ( struct htv_t htv)

AAAAPPC to htv_t.

See also
aaaa_to_htv.

◆ s8_to_htv()

void s8_to_htv ( struct htv_t htv)

AAAAC:RR to htv_t.

See also
aaaa_to_htv

Variable Documentation

◆ EE_address

uint16_t EEMEM EE_address

The HTV network address

◆ EE_naddress

uint16_t EEMEM EE_naddress

The ~EE_address to check the correct value of the address