Use I2C Device by C# - c#

I want to control the I2C device through C# on Windows 10.
According to the I2cDevice class from MS, it seems that the class MUST be used by UWP?
If the class can be used only by UWP, I want to know how to control the I2C Device by general C#?
Hope someone can provide some suggestions. Thank you!

About the I2cDevice class,
I had asked the MS engineer a few days ago in a seminar.
He told me there are two limitation to use the library:
The OS MUST be the IoT core rather than the general Win10.
It MUST be programmed by the UWP.
If the OS is not the IoT core, it needs the driver from Intel to control the I2C device.
Hope this information is useful for someone:)

You can use the I2C protocol from Windows 7, 8 or 10 and any .NET languages, with the library MadeInTheUSB.Nusbio.Lib.dll.
Here is a smaple to control an I2C LCD in C#.
Here are samples to control some Adafruit I2C devices.

Related

Bluetooth discovery and signal strength (RSSI)

I need some kind of code sample to make a bluetooth "radar" in Visual Studio Community 2015 with Visual C#. I just need to detect the nearby Bluetooth devices and the transmission signal.
I only get here:
https://msdn.microsoft.com/es-es/library/ff536587(v=vs.85).aspx
Found some old library (32FEET) but outdated.
But not even a single C# example. I need Bluetooth LE but i don't mind just test bluetooth 2.0.
In Java i found bluecode and in Linux bluez libraries.
Edit: for Windows 7
You're question is too broad but I'll answer it anyway.
Since your target is Windows 7, you won't get BLE support out of the box (as it is first introduced in Windows 8.1). You could work around this by talking to the dongle directly (like I do in the open source WinBeacon library) or by using a VM/Raspberry PI that runs Linux with bluez-stack that exposes some kind of Web API you can use.
For detecting BT 2.0 devices, I would recommend the 32feet library as I've used it in the past for detecting and pairing and it just works. When using the Microsoft BT stack, the 32feet library uses the Windows Bluetooth Socket API, which is well documented on MSDN. So if you only want to scan for devices, you might as well directly use the Socket API and use the 32feet source code as inspiration.
Good luck.

Metro app with FTDI-USB driver

(Note: the following question is about a Intel based full Windows 8 tablet for which the drivers work perfectly for regular Windows Desktop (i. e. non-Metro) applications.)
For Metro applications, there's the generic WinUSB support, but I'm unsure what is needed to use the widely used FTDI driver and f2dx.dll user space handler. Due to the fact that the FTDI chips don't support direct endpoint based communication, but instead impose some additional custom protocol, I cannot simply use the endpoint based WinUSB driver. Would switching to the CDC mode of FTDI work with Metro (essentially, this causes the device to appear as a serial port) ?
This question under electronics seems to say that switching to CDC mode with your FTDI device is not an option, as the CDC mode is not true CDC, but rather a CDC-like implementation.
Unfortunately, I don't have a suggestion yet on what should work - looking into the exact same thing myself.
It seems that there's now an official guide from FTDI regarding this topic: WinRT Guide

Developing for BLE windows 8.1

I've found scatterings around the web but no concise answer. Everyone talks about developing BLE for Android and iOS, but how does one develop for Windows in C# (.NET)?
I've found this
http://social.msdn.microsoft.com/Forums/windowsapps/en-US/2f236b71-a6ac-4c42-aef3-723c3691cbf8/how-to-discover-connectdisconnect-and-reconnect-to-bluetooth-low-energy-device-from-windows-81?forum=wdk
I've tried the C# example, but I don't have any devices with health profiles (and I don't know how to set searching for a generic device). I did try modifying the code but it didn't help
I have a sensor tag and also a generic BLE HM-10 module useful for arduino projects. My iPhone can find both of these devices using the SensorTag application or LightBlue.
I also found this
http://orcs.sebsoft.com/openvision/index.php/8-vision/37-how-to-acquire-data-by-c-from-bluetooth-4-bluetooth-low-energy-ti-ble-keyfob-ti-sensor-tag
I tried starting it up and scanning, but it didn't find any BLE devices. I don't even know if what I'm doing it right.
I have a BT 4.0 USB dongle.
How on earth do I detect a bluetooth device?
Thanks
Here is a two-part blog post about enumerating and configuring BLE devices in Windows 8.1.
BLE for developers in Windows 8.1 Part I
BLE for developers in Windows 8.1 Part II
After reading this, the documentation on MSDN seemed to make a lot more sense.
This is just a guess, but if you're using a generic HM-10 BT module, you might need to program it first to be discoverable and pairable.
You do that using AT commands which you can find in the HM-10 datasheet. The way to send those commands to the module is up to you, you can either use a microcontroller, Arduino for example, or via a serial console.

How to identify third party hardware devices for credit cards and their APIs for Windows 8 Tablet?

I am new to Windows 8 tablet. My question is how to identify third party hardware devices for credit cards and their APIs that need to integrate into Windows 8 Tablet Type for Onsite Studio App?
Which type of languages support this API for Windows 8 tablets?
By Windows 8 tablet, I presume you mean a metro/modern style application? If so you'll be limited using Windows 8 for this. Instead I would highly recommend looking at the API's provided in Windows 8.1. Using the newer APIs you have three options:
1) Windows.Devices.PointOfService - which is the port of POS.NET across to the WinRT namespace. This basic API's allow you to access POS peripherals such as MSR readers. Example code can be found on: http://msdn.microsoft.com/en-us/library/windows/apps/bg182882.aspx#two
2) If you want to use NFC-based cards (tap and pay) - theoretically you can use the WinRT port of the Smartcard framework. This isn't as straightforward as the above, and requires some understanding of how smartcards work. http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.smartcards.aspx
3) You can assess devices such as Square which use a 3.5mm audio jack. WinRT provides functionality to access audio devices, and you'll need to convert the incoming WAV data into bytes which represent the MSR information. Again not so straight forward but is a commonly requested approach.
All three of the above solutions are independent of language (C#/C++/JS), but hopefully the above APIs point you in the right direction.

Getting video with USB SPI from device with FTDI

I need to implement Device manager for some card with FTDI chip.
We are looking into JAVA or C#, and we need to use it for transferring vedio using SPI.
Do we need to use FTDI DLL for java or C#?
Can we encounter serious problems implementing this in java ?
I have used the direct connection with the FTDI DLL using both Java and C#. For Java I have used ftd2xxj, even contributed some extensions to that. Works very and seems actively being maintained. I switched to C# 2 years ago and I'm using the wrapper provided by FTDI FTDI C# Wrapper. This also works perfectly, and I would say using one of these libraries is the recommended way to connect to your device instead of using a serial port connection. You can tune a lot of things such as the latency on the USB port and packet buffer sizes and such. I can imagine this can come in handy with video.
The Java option is fully open-source and business friendly, the C# version is provided as is without any restrictions to redistribute etc.
I have an app that uses ftdi. The solution I selected is to use a C DLL and call the c routines with JNI.
There's also the libftdi/libusb approach if you want a more open source approach. I'm not to sure what interfaces to these exist for Java and c# though.
I have tested multiple FTDI chips in C and C# to do USB to SPI/I2C from Windows.
For Video generally SPI with an extra pin called D/C (data command ) is what is supported by displays devices.
Here is a video with an FT232H board + an OLED 128x64 display in SPI
I used the default ftdi windows C SPI library. The FT232H can deliver up to 3M byte/S in SPI in theory.
The device Nusbio (based on the FT232RL) also support I2C/SPI at a smaller transfer speed and works with the OLED 128x64 display in SPI.
Nusbio can deliver up to 20 K byte/S in SPI for display. The Nusbio library is written in C#.
I am currently experimenting with the FT4222 chip in I2C or SPI using the FTDI C library on top of which I wrote a C# library. The FT4222 can deliver up to 500 K byte/S.
In conclusion you have to pick your chip and if your OS target is Windows C + C#
would be my advice. FTDI does not provide a lot of support/samples for C#, but that is what I do.

Categories

Resources