From nobody Mon Oct 25 03:57:47 2021 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53C311811156 for ; Mon, 25 Oct 2021 03:58:06 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (mail.cs.ait.ac.th [192.41.170.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hd1Q53VFKz4SP1 for ; Mon, 25 Oct 2021 03:58:05 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (localhost [127.0.0.1]) by mail.cs.ait.ac.th (Postfix) with ESMTP id A22B0112502; Mon, 25 Oct 2021 10:58:01 +0700 (+07) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cs.ait.ac.th; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:in-reply-to:subject:subject:from:from :received:received:received; s=selector1; t=1635134281; x= 1636948682; bh=uso7j4OZuReZwOqBva0cM+yTF0QnS+q4feSMEkIy//w=; b=J avZtev4nLQhs8ez3proHs0ZD5+yj2eynSzKzaAx21me0340FvanwgZexI2CYjCTg aWlI/BCSfzTwZO79l3fz1330P5m236WUe7O2kKiF7lbMRZLd90AbOkzCLI6kohec 3Vd3Oq67Ts+tKJBWip/zOUEqbMcifuRG+Qevcs18xw= X-Virus-Scanned: amavisd-new at cs.ait.ac.th Received: from mail.cs.ait.ac.th ([127.0.0.1]) by mail.cs.ait.ac.th (mail.cs.ait.ac.th [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id e8KpCKEM5IcY; Mon, 25 Oct 2021 10:58:01 +0700 (+07) Received: from banyan.cs.ait.ac.th (banyan.cs.ait.ac.th [192.41.170.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cs.ait.ac.th (Postfix) with ESMTPS id 23A24112501; Mon, 25 Oct 2021 10:58:01 +0700 (+07) Received: (from on@localhost) by banyan.cs.ait.ac.th (8.15.2/8.15.2/Submit) id 19P3vlPJ063083; Mon, 25 Oct 2021 10:57:47 +0700 (ICT) (envelope-from on@banyan.cs.ait.ac.th) From: Olivier To: "Dr. Rolf Jansen" Cc: freebsd-arm@freebsd.org Subject: Re: Using 20x4 LCD display In-Reply-To: (rj@obsigna.com) Date: Mon, 25 Oct 2021 10:57:47 +0700 Message-ID: List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Hd1Q53VFKz4SP1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cs.ait.ac.th header.s=selector1 header.b="J avZtev"; dmarc=pass (policy=none) header.from=cs.ait.ac.th; spf=pass (mx1.freebsd.org: domain of Olivier.Nicole@cs.ait.ac.th designates 192.41.170.16 as permitted sender) smtp.mailfrom=Olivier.Nicole@cs.ait.ac.th X-Spamd-Result: default: False [-2.70 / 15.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[cs.ait.ac.th:s=selector1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[cs.ait.ac.th:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[cs.ait.ac.th,none]; RCVD_IN_DNSWL_MED(-0.20)[192.41.170.16:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:4767, ipnet:192.41.170.0/24, country:TH] X-ThisMailContainsUnwantedMimeParts: N "Dr. Rolf Jansen" writes: >> Am 22.10.2021 um 03:52 schrieb Olivier : >>=20 >> I would like to use a 20x4 LCD display attached to a Raspberry Pi >> running FreeBSd 12.2. >>=20 >> I can talk to the display through the I2C interface, when I send >> something the back light will turn off and on, so the link is >> established. > > I use a 20x4 LCD (HD44780 type) over I2C (via PCF8574T) on a BeagleBone B= lack. For this, I manually transcribed one of the many Python libraries int= o plain C, and I wrote a minimalistic I2C glue interface in C, so it can be= easily addressed. > > I just put a .zip file for downloading it on my web site: > > https://obsigna.com/Downloads/LCD_20x4_over_I2C.zip > > I added a Hello World test program (s. below). Perhaps you need to change= the I2C device number and the I2C address in lcd.c. Here I have: > > uint8_t lcd_iicid =3D 1; > uint8_t lcd_addr =3D 0x27; > > The Python code contained a lot of delays between various calls. This was= not necessary for the BeagleBone Black, I removed this and it let me optim= ize the subroutines for transferring data to the display. I don=E2=80=99t k= now whether this would work on a Raspberry Pi, though. > > Compile it with: cc i2c.c lcd.c hello.c -o hello > Run it with: ./hello > > #include > #include > #include > #include > > #include "i2c.h" > #include "lcd.h" > > int main(int argc, const char *argv[]) > { > lcd_begin(); > lcd_print("Hello, World!", 13); > lcd_setCursor(0, 1); > lcd_print("HD44780 over PCF8574", 20); > lcd_setCursor(0, 2); > lcd_print("If it does not work,", 20); > lcd_setCursor(0, 3); > lcd_print("do not ask me why.", 18); > > return 0; > } > > Best regards > > Rolf Than you Rolf, that was very usefull. Can I use your code in a small project that I am writting and that I will put online? (project is an access control system based on user password rather than fingerprint, RFID, etc., that password is taken directly from LDAP, so one less thing to manage when users come and go). What copyright/acknoledgment should I include then? Best regards, Olivier --=20