Just got my OnePlus 2 today and took a sec tonight to check out a suspicious set of connectors on the Styleswap cover.
We have a VERY easy way to add hardware Buttons and Sensors to the Phone.
On the OnePlus 2 StyleSwap cover connectors :
That connector is just a SMALL sticker with a single thin-film resistor in it.
The Bamboo cover has a 22.1k ohm resistor.
It means that ONE pin supplies the voltage (Lower Pin) while the other is a weak pulldown GND.
It shows the Voltage running across those two pins is 2V. This explains the relatively high values chosen for the resistor as it is already a weak pull and easily poll-able. I do not like however, that this pin set is set to 2V constantly in my limited testing that means a weak power drain and something to add noise to a system. At least its not adding more ground noise… a problem which plagued the ONEPLUS ONE which had weak starr-ed ground and virtually no smoothing capacitance or ground loop isolators which caused the most problems with AUDIO. The ground noise was beyod fixable for the Qualcomm DSP to be able to compensate for in something like a high end IEM.
GIVEN THIS
There is no possible way to connect NFC to the back plate UNLESS they devellop their own chips/protocol that require no ground reference. Also most NFC receiver chips use SPI or I2C connection interfaces as the communication clock frequency is important No ground reference shared… bad clocks.
So, if you are Chinese or get the Chinese version, All you need is some copper tape and a 20k ohm thin film resistor and you can have the Bamboo style theme…Cost is $0.01 maybe…plus shipping.
Then I found this in like 2 seconds .
Here is the code (complete with ASCII art schematic!) :
Its even interrupt driven! So no need to reboot the phone to get new data streams or be able to change dynamically like you would expect of a button.
https://github.com/OnePlusOSS/androi…heme.c
/*
* HW SCHEMATIC
* Cover | Phone
* |
* —–|—-R2(2K Ohm)——[3.3 V
* | |
* R1 |
* | |
* |____|___________ADC
* | |
* | |
* | R3(51K ohm)
* | |
* | = GND
*/
/*
* cover type | cover resist(K 0hm) | ADC voltage (V)
* 1 | 0 | 3.18
* 2 | 5.6 | 2.87
* 3 | 12 | 2.59
* 4 | 20 | 2.31
* 5 | 30.9 | 2.01
* 6 | 51 | 1.62
* 7 | 82 | 1.25
* 8 | 121 | 0.97
* 9 | 200 | 0.67
* 10 | 470 | 0.32
* .. | .. | …
*
*/
We can assume that Bamboo is Cover type 4.
Here is the Kernel Config paramerter
#changhua 2015-02-12 add for switch theme when change rare cover
config SWITCH_THEME
default n
tristate “switch theme when change rare cover support by ADC”
help
Say Y here if you want to enable the feature.
#add end
Connecting sensors
Will require a new API into the OS for accessing that info, but not very difficult honestly. Then we would need apps to be able to access that and make sure that we attach a “dangerous” level to the system permission for that API. Still, not a big deal.
We also have the RIGHT amount of voltage to be able to do this, even with a a native 2k impedance output from voltage. We can likely use the phone casing underneath the styleswap cover for Ground reference, since some of the panels are ground connected. So we could get Power (3.3V, low current), GND, and ADC input to the phone right under the OnePlus styleswap hardware.
Still, it will require a kernel patch and likely a shared object library topside with some simple tie-ins for frameworks on buttons (something I have done all of this before). However I know that this will take about a week of time after work with a simple API to get going in CyanogenMod. I am booked through mid-October with speaking gigs, travel, and contract engineering work.
Looks like we have a reasonable amount of bit-depth to work with here too. Humidity sensors anyone? Multiple Hardware buttons like Camera shutter? Answer Phone Calls?
0 Comments