Driver of ST X-NUCLEO-OUT01A1 Industrial Digital output expansion board based on ISO8200BQ component.

Dependents:   HelloWorld_OUT01A1

Committer:
nikapov
Date:
Mon Feb 12 17:22:42 2018 +0000
Revision:
0:c77427077cff
Initial revision.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nikapov 0:c77427077cff 1 /**
nikapov 0:c77427077cff 2 ******************************************************************************
nikapov 0:c77427077cff 3 * @file XNucleoOUT01A1.h
nikapov 0:c77427077cff 4 * @author ST CLab
nikapov 0:c77427077cff 5 * @version V1.0.0
nikapov 0:c77427077cff 6 * @date 1 February 2018
nikapov 0:c77427077cff 7 * @brief Abstract class of X-NUCLEO-OUT01A1 board
nikapov 0:c77427077cff 8 ******************************************************************************
nikapov 0:c77427077cff 9 * @attention
nikapov 0:c77427077cff 10 *
nikapov 0:c77427077cff 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
nikapov 0:c77427077cff 12 *
nikapov 0:c77427077cff 13 * Redistribution and use in source and binary forms, with or without modification,
nikapov 0:c77427077cff 14 * are permitted provided that the following conditions are met:
nikapov 0:c77427077cff 15 * 1. Redistributions of source code must retain the above copyright notice,
nikapov 0:c77427077cff 16 * this list of conditions and the following disclaimer.
nikapov 0:c77427077cff 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
nikapov 0:c77427077cff 18 * this list of conditions and the following disclaimer in the documentation
nikapov 0:c77427077cff 19 * and/or other materials provided with the distribution.
nikapov 0:c77427077cff 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
nikapov 0:c77427077cff 21 * may be used to endorse or promote products derived from this software
nikapov 0:c77427077cff 22 * without specific prior written permission.
nikapov 0:c77427077cff 23 *
nikapov 0:c77427077cff 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
nikapov 0:c77427077cff 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
nikapov 0:c77427077cff 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
nikapov 0:c77427077cff 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
nikapov 0:c77427077cff 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nikapov 0:c77427077cff 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
nikapov 0:c77427077cff 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
nikapov 0:c77427077cff 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
nikapov 0:c77427077cff 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nikapov 0:c77427077cff 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nikapov 0:c77427077cff 34 *
nikapov 0:c77427077cff 35 ******************************************************************************
nikapov 0:c77427077cff 36 */
nikapov 0:c77427077cff 37
nikapov 0:c77427077cff 38
nikapov 0:c77427077cff 39 /* Prevent recursive inclusion -----------------------------------------------*/
nikapov 0:c77427077cff 40
nikapov 0:c77427077cff 41 #ifndef __XNUCLEOOUT01A1_H__
nikapov 0:c77427077cff 42 #define __XNUCLEOOUT01A1_H__
nikapov 0:c77427077cff 43
nikapov 0:c77427077cff 44
nikapov 0:c77427077cff 45 /* Includes ------------------------------------------------------------------*/
nikapov 0:c77427077cff 46
nikapov 0:c77427077cff 47 #include "ISO8200BQ.h"
nikapov 0:c77427077cff 48
nikapov 0:c77427077cff 49 /* Class Declaration ---------------------------------------------------------*/
nikapov 0:c77427077cff 50
nikapov 0:c77427077cff 51 /* Types ---------------------------------------------------------------------*/
nikapov 0:c77427077cff 52
nikapov 0:c77427077cff 53 typedef enum
nikapov 0:c77427077cff 54 {
nikapov 0:c77427077cff 55 mode_sync,
nikapov 0:c77427077cff 56 mode_direct
nikapov 0:c77427077cff 57 } control_mode_t;
nikapov 0:c77427077cff 58
nikapov 0:c77427077cff 59 /**
nikapov 0:c77427077cff 60 * Abstract class of X-NUCLEO_OUT01A1 Expansion Board.
nikapov 0:c77427077cff 61 * Default reflecting STM32 Nucleos pinout.
nikapov 0:c77427077cff 62 */
nikapov 0:c77427077cff 63
nikapov 0:c77427077cff 64 class XNucleoOUT01A1
nikapov 0:c77427077cff 65 {
nikapov 0:c77427077cff 66 public:
nikapov 0:c77427077cff 67
nikapov 0:c77427077cff 68 XNucleoOUT01A1(control_mode_t ctl_mode=mode_direct,
nikapov 0:c77427077cff 69 PinName CTL_MODE_PIN=NC, PinName OUT_EN=A3, PinName N_SYNC=A4,
nikapov 0:c77427077cff 70 PinName N_LOAD=A5, PinName IN1=A0, PinName IN2=A1, PinName IN3=NC,
nikapov 0:c77427077cff 71 PinName IN4=A2, PinName IN5=D5, PinName IN6=D4, PinName IN7=D14,
nikapov 0:c77427077cff 72 PinName IN8=D15);
nikapov 0:c77427077cff 73
nikapov 0:c77427077cff 74 void set_inputs(uint8_t input_values);
nikapov 0:c77427077cff 75
nikapov 0:c77427077cff 76 void update_outputs(void);
nikapov 0:c77427077cff 77
nikapov 0:c77427077cff 78 void enable_outputs(bool enable);
nikapov 0:c77427077cff 79
nikapov 0:c77427077cff 80 private:
nikapov 0:c77427077cff 81 ISO8200BQ iso8200bq;
nikapov 0:c77427077cff 82 control_mode_t _mode;
nikapov 0:c77427077cff 83 DigitalIn *_ctl_mode_pin;
nikapov 0:c77427077cff 84 DigitalOut *_in_array[8];
nikapov 0:c77427077cff 85 };
nikapov 0:c77427077cff 86
nikapov 0:c77427077cff 87
nikapov 0:c77427077cff 88 #endif