-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathone_wire_simpleSwitch.c
81 lines (70 loc) · 2.06 KB
/
one_wire_simpleSwitch.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
Licensed under the EUPL V.1.1, Lizenziert unter EUPL V.1.1
*/
/*
* VERSION 1.0 Januar 7th 2010 LATE File: 'one_wire_simpleSwitch.c'
* Author: Linda Fouedjio based on Alejandro Gil
* modified (heavily rather rebuild): Peter Zumbruch
*/
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/iocan128.h>
#include "one_wire.h"
#include "one_wire_adc.h"
#include "one_wire_dualSwitch.h"
#include "one_wire_simpleSwitch.h"
#include "read_write_register.h"
#include "one_wire_temperature.h"
#include "adc.h"
#include "api.h"
#include "api_define.h"
#include "api_global.h"
#include "api_debug.h"#include "can.h"
#include "mem-check.h"
#include "OWIDeviceSpecific.h"
#include "OWIHighLevelFunctions.h"
#include "OWIBitFunctions.h"
static const char filename[] PROGMEM = __FILE__;
/*this function contains all the functions that are necessary
*to read state of simple switch
*/
void read_status_simpleSwitches( struct uartStruct *ptr_uartStruct )
{
NumDevicesFound = owiReadDevicesID(BUSES);
if ( 0 < NumDevicesFound )
{
owiFindFamilyDevicesAndAccessValues(BUSES, NumDevicesFound, OWI_FAMILY_DS2405_SIMPLE_SWITCH, NULL );
}
#warning TODO: add else
}
/*
*this function
*/
uint16_t ReadSimpleSwitches( unsigned char bus, unsigned char * id )
{
CommunicationError_p(ERRG, dynamicMessage_ErrorIndex, TRUE, PSTR("device DS2405 not supported any more"));
return owiReadWriteStatus_MAXIMUM_INDEX << 8;
// uint16_t value = 0;
// if ( 0 == OWI_DetectPresence(bus) )
// {
// return owiReadStatus_no_device_presence << 8; /* Error*/
// }
//
// OWI_MatchRom(id, bus); /* Match id found earlier*/
// OWI_SendByte(0xF5, bus); //PIO Access read command //???
//
// /*Read two first bytes and place them in the 16 bit channel variable*/
// value = OWI_ReceiveByte(bus);
//
// return value | owiReadWriteStatus_OK << 8;
}//END of ReadSimpleSwitches function