This commit is contained in:
Gogs 2019-06-07 21:40:14 +08:00
parent f17a957cf1
commit 5249c300ff
3 changed files with 59 additions and 1 deletions

View File

@ -26,6 +26,8 @@ int init_DS18B20(void)
{
unsigned int result;
DQ_OUT;
DQ_H;
udelay(2);
DQ_L;
udelay(480); //480~960
DQ_H;
@ -34,6 +36,7 @@ int init_DS18B20(void)
result = DQ_V;
udelay(420);
DQ_OUT;
DQ_H;
printk("ds18b20 init result %d", result);
return result;
}
@ -96,11 +99,12 @@ void write_char(unsigned char dat)
for(i=0; i<8; i++)
{
DQ_L;
udelay(10);
if (dat & 0x01)
DQ_H;
else
DQ_L;
udelay(60);
udelay(50);
dat >>= 1;
}
//spin_unlock(&lock);

27
ds18b20_223.mod.c Normal file
View File

@ -0,0 +1,27 @@
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
#ifdef RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "3C1EE49178DE9599A3E3742");

27
ds18b20_224.mod.c Normal file
View File

@ -0,0 +1,27 @@
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
#ifdef RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "9B05B907F56030A0F0E6D67");