Jolla and SailfishOS
CompanionTOH for Jolla Phone A
Working on yet another KeyboardTOH for the Jolla Phone A, I figured, that there are a couple of things that pretty much every TOH might need or some extensions that you might not want to loose, just because you switch TOH.
The first thing, that came to my mind was a Level Shifter, that:
- Converts the 1.8V signal level used by the phone, to the still more common 3.3V or 5V signal level used e.g. by the BeagleBoneBlack and the Arduino
- Protects the irreplaceable electronics on the phone PCB with something that is cheap and easy to replace, if I mess something up
Tossing around a couple of ideas, the CompanionTOH concept was born.
The main purpose of this TOH is to provide a
- Convenient way to clip-on and -off TOHs, that are frequently attached to and removed from the phone
- Mechanically stable base for extensions, independent of the direction a companion is attached to the phone
- Electrical connection that protects the internal electronics of the phone
So far so good!
But: If you clip-on the CompanionTOH only once and than leave it there just (de-)attaching Companions, there are a couple of things you take over the responsibility for.
Usually, if you clip-on a TOH, Jolla's toh-demon
- tries to read the NFC tag of TOH
The NFC tag information are used to look for, download and install TOH specific software from Jolla's Harbour store.
- tries to read the content of an I2C EEPROM on 0x50
The EEPROM can provide additional configuration information and can also be used in an
udev
script to e.g. start a specific software on the phone, whenever this TOH is clipped-on. - I haven't tried it yet, but from poking around a little I assume that if you de-attach TOH,
the toh-demon calls
udev
again with the right attributes set, to signal the new state.
This behaviour needs to be simulated by the CompanionTOH and the CompanionTOH driver.
Up to now I have worked on:
- Signal Level Shifting
- Companion attach / detach detection
- EEPROM (programming, PRoC emulation)
figuring, that it would be quite useful to have a MCU in the CompanionTOH, that provides a little more "intelligence".
Of course this opens Pandora's box of ideas, what additional value could be build into the CompanionTOH:
- all sorts of protocol bridges: I2C <-> SPI | I2S | RS232 | RS458 | CAN | LIN | ...
- I2C ADC and DAC access for Jolla software
- I2C GPIO, Timer, PWM access for Jolla software
- ...
but my current favourite is an I2C <-> BLE bridge, since I have not seen an example of Jolla's internal Bluetooth chip working with a BLE device.
So why not use a Cypress BLE PSoC or PRoC module and ...