Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed X_NUCLEO_PLC01A1 ros_lib_melodic
io24v.cpp@0:43eb9ccc1583, 2020-08-08 (annotated)
- Committer:
- yamadola
- Date:
- Sat Aug 08 23:54:01 2020 +0000
- Revision:
- 0:43eb9ccc1583
Uncomplete
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| yamadola | 0:43eb9ccc1583 | 1 | #include "io24v.h" |
| yamadola | 0:43eb9ccc1583 | 2 | #include "plc_controller.h" |
| yamadola | 0:43eb9ccc1583 | 3 | |
| yamadola | 0:43eb9ccc1583 | 4 | /** |
| yamadola | 0:43eb9ccc1583 | 5 | * @brief Initialize 24V output pin |
| yamadola | 0:43eb9ccc1583 | 6 | * @param pinNum: Target pin number |
| yamadola | 0:43eb9ccc1583 | 7 | * @param &plcAccessor: Pointer of plc_controller |
| yamadola | 0:43eb9ccc1583 | 8 | */ |
| yamadola | 0:43eb9ccc1583 | 9 | DigitalOut24V::DigitalOut24V( uint8_t pinNum, PLCController *pPlcController ){ |
| yamadola | 0:43eb9ccc1583 | 10 | _pinNum = pinNum; |
| yamadola | 0:43eb9ccc1583 | 11 | _pPlcController = pPlcController; |
| yamadola | 0:43eb9ccc1583 | 12 | } |
| yamadola | 0:43eb9ccc1583 | 13 | |
| yamadola | 0:43eb9ccc1583 | 14 | /** |
| yamadola | 0:43eb9ccc1583 | 15 | * @brief Set output pin state with "=" operator |
| yamadola | 0:43eb9ccc1583 | 16 | * @param val: Output pin state HIGH:1 or LOW:0 |
| yamadola | 0:43eb9ccc1583 | 17 | * @retval None |
| yamadola | 0:43eb9ccc1583 | 18 | */ |
| yamadola | 0:43eb9ccc1583 | 19 | DigitalOut24V &DigitalOut24V::operator =( bool val ){ |
| yamadola | 0:43eb9ccc1583 | 20 | _pPlcController->output(_pinNum, val); |
| yamadola | 0:43eb9ccc1583 | 21 | return *this; |
| yamadola | 0:43eb9ccc1583 | 22 | } |
| yamadola | 0:43eb9ccc1583 | 23 | |
| yamadola | 0:43eb9ccc1583 | 24 | /** |
| yamadola | 0:43eb9ccc1583 | 25 | * @brief Initialize 24V output pin |
| yamadola | 0:43eb9ccc1583 | 26 | * @param pinNum: Target pin number |
| yamadola | 0:43eb9ccc1583 | 27 | * @param &plcAccessor: Pointer of plc_controller |
| yamadola | 0:43eb9ccc1583 | 28 | */ |
| yamadola | 0:43eb9ccc1583 | 29 | DigitalIn24V::DigitalIn24V( uint8_t pinNum, PLCController *pPlcController ){ |
| yamadola | 0:43eb9ccc1583 | 30 | _pinNum = pinNum; |
| yamadola | 0:43eb9ccc1583 | 31 | _pPlcController = pPlcController; |
| yamadola | 0:43eb9ccc1583 | 32 | } |
| yamadola | 0:43eb9ccc1583 | 33 | |
| yamadola | 0:43eb9ccc1583 | 34 | |
| yamadola | 0:43eb9ccc1583 | 35 | /** |
| yamadola | 0:43eb9ccc1583 | 36 | * @brief Get input pin state with "=" operator |
| yamadola | 0:43eb9ccc1583 | 37 | * @param None |
| yamadola | 0:43eb9ccc1583 | 38 | * @retval Input pin state HIGH:1 or LOW:0 |
| yamadola | 0:43eb9ccc1583 | 39 | */ |
| yamadola | 0:43eb9ccc1583 | 40 | DigitalIn24V::operator bool() const{ |
| yamadola | 0:43eb9ccc1583 | 41 | return _pPlcController->input(_pinNum); |
| yamadola | 0:43eb9ccc1583 | 42 | } |