Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef MAIN_H
- #define MAIN_H
- #include "mbed.h"
- #include "x_nucleo_plc01a1_class.h"
- //IO defintions
- DigitalOut LD2(LED1); //I guess this is LED1 cause the count starts at 0?)
- AnalogOut out(PA_4);
- //Class instances
- Ticker tickevent1;
- Ticker tickevent2;
- Ticker tickevent3;
- //Function Prototypes
- void dacticker();
- void ledticker();
- void relayticker();
- //Variable definitions
- double temp = 0.00;
- bool setup_complete = false;
- /**********************************************************
- ******************** PLC BOARD VARS ***********************
- /**********************************************************/
- uint8_t inputArray[2] = {0x00, 0x00}; /* Array for input data from Digital Input Termination Device */
- uint8_t outputArray[2] = {0x00, 0x00}; /* Array for output data to Solid State Relay */ //I actually still have no idea what goes in [0]...
- uint8_t Ch_On = 0x00; /* Number of channels in ON state */
- uint8_t relay_input = 0x80; /* Select the output of the PLC relays */
- void DigitalInputArrayHandler(X_NUCLEO_PLC01A1 &plc);
- void SsrelayHandler(X_NUCLEO_PLC01A1 &plc, uint8_t VNI_out);
- void setup(SPI &spi, int bits, int mode, int frequency_hz);
- /* Initializing SPI bus. */
- SPI spi(X_NUCLEO_PLC01A1_PIN_SPI_MOSI, X_NUCLEO_PLC01A1_PIN_SPI_MISO, X_NUCLEO_PLC01A1_PIN_SPI_SCLK);
- /* Initializing X_NUCLEO_PLC01A1 IO Channels Component. */
- X_NUCLEO_PLC01A1 plc(X_NUCLEO_PLC01A1_PIN_SPI_CS1, X_NUCLEO_PLC01A1_PIN_SPI_CS2, X_NUCLEO_PLC01A1_PIN_OUT_EN, spi);
- #endif // MAIN_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement