Touch Sensor to SPI
My progress is very slow as I merely managed to complete one module, which is the sensor module. The sensor finally worked on the simulator. Whenever the touch pad is clicked, the sensor will detect and return HIGH. The user can then perform any actions based on the output from the sensor.
The next module I am working with is SPI (Serial Peripheral Interface). SPI is basically used for communicating with one or more peripheral devices quickly over short distances. There is always one master device to control the peripheral devices (slaves). There are 4 basic lines for each devices: MISO (Master In Slave Out), MOSI (Master Out Slave In), SCK (Serial Clock) and SS (Slave Select). SS is an active low pin, so when the pin state is LOW, it will be able to communicate with the master.
In real life, SPI requires clock pulse to start data transmission. However, in a virtual simulator, clock pulse is unnecessary. It only needs to be able to transfer data when SPI devices are connected. I am currently working on the master SPI (MSPI). MSPI controls which slave device to be connected, and transfer data (bit by bit) to the slave device through MOSI. At the same time, the slave will send data to the master using MISO to be read.
What I need to do is program the MSPI to be able to transfer data when it is connected to a SPI device. When it is not connected, no data is transmitted and the slave SPI device cannot read the data at all. Currently, I am trying to figure out the ways to prevent this issue to happen. Hopefully I can complete this asap as I am already slow in completing my tasks.