Manages the 1-wire bus
Dependents: oldheating heating
http/http-1wire-query.c@1:c272b1fcc834, 2019-04-26 (annotated)
- Committer:
- andrewboyson
- Date:
- Fri Apr 26 14:29:44 2019 +0000
- Revision:
- 1:c272b1fcc834
Moved pin set up to a local 1-wire-bus-pin.h file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 1:c272b1fcc834 | 1 | #include <string.h> |
andrewboyson | 1:c272b1fcc834 | 2 | #include <stdlib.h> |
andrewboyson | 1:c272b1fcc834 | 3 | #include "http.h" |
andrewboyson | 1:c272b1fcc834 | 4 | #include "1-wire-device.h" |
andrewboyson | 1:c272b1fcc834 | 5 | #include "settings.h" |
andrewboyson | 1:c272b1fcc834 | 6 | #include "ds18b20.h" |
andrewboyson | 1:c272b1fcc834 | 7 | |
andrewboyson | 1:c272b1fcc834 | 8 | void HttpOneWireQuery(char* pQuery) |
andrewboyson | 1:c272b1fcc834 | 9 | { |
andrewboyson | 1:c272b1fcc834 | 10 | while (pQuery) |
andrewboyson | 1:c272b1fcc834 | 11 | { |
andrewboyson | 1:c272b1fcc834 | 12 | char* pName; |
andrewboyson | 1:c272b1fcc834 | 13 | char* pValue; |
andrewboyson | 1:c272b1fcc834 | 14 | pQuery = HttpQuerySplit(pQuery, &pName, &pValue); |
andrewboyson | 1:c272b1fcc834 | 15 | |
andrewboyson | 1:c272b1fcc834 | 16 | HttpQueryUnencode(pValue); |
andrewboyson | 1:c272b1fcc834 | 17 | |
andrewboyson | 1:c272b1fcc834 | 18 | int value = HttpQueryValueAsInt(pValue); |
andrewboyson | 1:c272b1fcc834 | 19 | |
andrewboyson | 1:c272b1fcc834 | 20 | if (HttpSameStr(pName, "rom0")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[0](rom); } |
andrewboyson | 1:c272b1fcc834 | 21 | if (HttpSameStr(pName, "rom1")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[1](rom); } |
andrewboyson | 1:c272b1fcc834 | 22 | if (HttpSameStr(pName, "rom2")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[2](rom); } |
andrewboyson | 1:c272b1fcc834 | 23 | if (HttpSameStr(pName, "rom3")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[3](rom); } |
andrewboyson | 1:c272b1fcc834 | 24 | |
andrewboyson | 1:c272b1fcc834 | 25 | if (HttpSameStr(pName, "onewiretrace" )) ChgTraceOneWire(); |
andrewboyson | 1:c272b1fcc834 | 26 | } |
andrewboyson | 1:c272b1fcc834 | 27 | } |