feat: onewire and ds18b20 driver
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include <8052.h>
|
||||
#include "serial_command.h"
|
||||
|
||||
#include "temp.h"
|
||||
#include "onewire.h"
|
||||
#include "ds18b20.h"
|
||||
|
||||
typedef unsigned int u16;
|
||||
typedef unsigned char u8;
|
||||
@@ -199,7 +200,8 @@ void ProcessTempCmd(void) {
|
||||
#endif
|
||||
if (tempCmdCode == CTRL_CODE_TEMP_Enable) {
|
||||
EA = 0;
|
||||
temp = Ds18b20ReadTemp();
|
||||
DS18B20_startConvert();
|
||||
temp = DS18B20_readTemperature();
|
||||
EA = 1;
|
||||
tc = MCU_CMD_TEMP << 12;
|
||||
td = (u16) temp & 0xFFF;
|
||||
@@ -222,6 +224,8 @@ int ProcessGasCmd(void) {
|
||||
|
||||
void main(void) {
|
||||
int gasFlag, bodyFlag;
|
||||
DS18B20_startConvert();
|
||||
delay(100);
|
||||
UsartInit();
|
||||
while (1) {
|
||||
ProcessCommand();
|
||||
|
||||
Reference in New Issue
Block a user