ssd1306 device driver example - #37
Conversation
AleksandrBulyshchenko
left a comment
There was a problem hiding this comment.
@DevyatovAndrey,
Thank you for sharing the driver.
But could you rebase the branch onto this repo tree?
Because currently it's impossible to diff separate commits via github.
And also if possible -please fix checkpatch issues (at least for the ssd1306, but it make sense for userapp_analog_clock as well):
${BBB_KERNEL}/scripts/checkpatch.pl --file ${TRAINING_REPO}/ssd1306/*.[ch] --terse
| obj-m := ssd1306.o | ||
|
|
||
| KDIR ?= ${HOME}/BBB/bb_kernel/ | ||
| #KDIR ?= ~/BBB/KERNEL/ |
There was a problem hiding this comment.
Please avoid hardcodding any local path.
And unify expected env. vars with existent mpu6050 driver (see its makefile)
| @@ -0,0 +1,41 @@ | |||
| #!/bin/bash -e | |||
|
|
|||
| export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- | |||
There was a problem hiding this comment.
This hardcodded export will override anything set in user's environment.
Please avoid committing your paths.
| @@ -0,0 +1,415 @@ | |||
| /* | |||
There was a problem hiding this comment.
Could you use the same baseline version of am335x-bone-common.dtsi as mpu6050 uses? (see ee49cc6)
|
|
||
| clean: | ||
| rm fb_user | ||
|
|
There was a problem hiding this comment.
This makefile has very odd view.
Does it work at all?
I believe you meant something like the following
CROSS_COMPILE ?= arm-linux-gnueabihf-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -Wall
.PHONY: all clean
all: analog_clock
analog_clock: analog_clock.c
$(CC) $(CFLAGS) $^ -o $@
clean:
rm analog_clock
| @@ -0,0 +1,11 @@ | |||
| #!/bin/bash -e | |||
|
|
|||
| export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf- | |||
There was a problem hiding this comment.
Please avoid using hardcoded absolute paths - use just filename and add its location to $PATH
| @@ -0,0 +1,11 @@ | |||
| #!/bin/bash -e | |||
There was a problem hiding this comment.
Why do you have shell script and makefile same time.
I believe something one is enough (preferably Makefile if you don't have to use some complex shell scripting)
There was a problem hiding this comment.
It's just to have an unified way to build and deploy this application
There was a problem hiding this comment.
So which one is correct?
Now they use different options.
- Either
makeshould be called from the shell script and everything have to be defined in the makefile (as it done forssd1306); - or one of them should be removed to avoid confusion.
2fbf462 to
79f1a87
Compare
|
AleksandrBulyshchenko
left a comment
There was a problem hiding this comment.
@DevyatovAndrey,
Thank you for the fixes.
Here some more comments:
| u8 data[LCD_WIDTH * LCD_HEIGHT / 8]; | ||
|
|
||
| u8 data[LCD_WIDTH * LCD_HEIGHT / 8]; | ||
| } ssd1306_data_array; |
There was a problem hiding this comment.
ssd1306.c:90: WARNING: do not add new typedefs
|
|
||
| if (unlikely(ret < 0)) { | ||
| printk(KERN_ERR "i2c_master_send() has returned ERROR %d\n", ret); | ||
| return ret; |
There was a problem hiding this comment.
Better to use pr_err()
| @@ -4,15 +4,15 @@ export CROSS_COMPILE=${HOME}/BBB/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnuea | |||
|
|
|||
There was a problem hiding this comment.
I don't think this envsetup.sh should be published at all.
It will be different for everybody (and don't have to be at all)
There was a problem hiding this comment.
How to set up enviroment variables needed for these examples if there is no "envsetup.sh"?
There was a problem hiding this comment.
The idea of using environment variables - is exactly to allow to use own environment, which is different for every user (otherwise they should be defined in build scripts instead of passing from environment).
So storing environment settings in VCS doesn't make much sense, because they either will be changed by users and will create a noise in git status or won't be used.
| @@ -0,0 +1,11 @@ | |||
| #!/bin/bash -e | |||
There was a problem hiding this comment.
So which one is correct?
Now they use different options.
- Either
makeshould be called from the shell script and everything have to be defined in the makefile (as it done forssd1306); - or one of them should be removed to avoid confusion.
| echo "configure kernel" | ||
| make ARCH=arm config | ||
| ;; | ||
|
|
There was a problem hiding this comment.
redundant space line
| PWD := $(shell pwd) | ||
|
|
||
| default: | ||
| $(MAKE) ARCH=arm -C $(KDIR) M=$(PWD) modules |
There was a problem hiding this comment.
Please unify indentation - use single tab
32ee952 to
6d1bb82
Compare
added READMEs
6d1bb82 to
665c191
Compare
|
I've updated this PR:
|
This adds step by step example of writing kernel device driver for OLED LCD display based on ssd1306 controller.