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

Dependents:   HelloWorld_OUT01A1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers XNucleoOUT01A1.h Source File

XNucleoOUT01A1.h

Go to the documentation of this file.
00001 /**
00002  ******************************************************************************
00003  * @file    XNucleoOUT01A1.h
00004  * @author  ST CLab
00005  * @version V1.0.0
00006  * @date    1 February 2018
00007  * @brief   Abstract class of X-NUCLEO-OUT01A1 board
00008  ******************************************************************************
00009  * @attention
00010  *
00011  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012  *
00013  * Redistribution and use in source and binary forms, with or without modification,
00014  * are permitted provided that the following conditions are met:
00015  *   1. Redistributions of source code must retain the above copyright notice,
00016  *      this list of conditions and the following disclaimer.
00017  *   2. Redistributions in binary form must reproduce the above copyright notice,
00018  *      this list of conditions and the following disclaimer in the documentation
00019  *      and/or other materials provided with the distribution.
00020  *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021  *      may be used to endorse or promote products derived from this software
00022  *      without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  ******************************************************************************
00036  */
00037 
00038 
00039 /* Prevent recursive inclusion -----------------------------------------------*/
00040 
00041 #ifndef __XNUCLEOOUT01A1_H__
00042 #define __XNUCLEOOUT01A1_H__
00043 
00044 
00045 /* Includes ------------------------------------------------------------------*/
00046 
00047 #include "ISO8200BQ.h"
00048 
00049 /* Class Declaration ---------------------------------------------------------*/
00050 
00051 /* Types ---------------------------------------------------------------------*/
00052 
00053 typedef enum
00054 {
00055     mode_sync, 
00056     mode_direct
00057 } control_mode_t;
00058 
00059 /**
00060  * Abstract class of X-NUCLEO_OUT01A1 Expansion Board. 
00061  * Default reflecting STM32 Nucleos pinout. 
00062  */
00063  
00064 class XNucleoOUT01A1
00065 {
00066 public:
00067 
00068     XNucleoOUT01A1(control_mode_t ctl_mode=mode_direct, 
00069             PinName CTL_MODE_PIN=NC, PinName OUT_EN=A3, PinName N_SYNC=A4, 
00070             PinName N_LOAD=A5, PinName IN1=A0, PinName IN2=A1, PinName IN3=NC, 
00071             PinName IN4=A2, PinName IN5=D5, PinName IN6=D4, PinName IN7=D14, 
00072             PinName IN8=D15);
00073 
00074     void set_inputs(uint8_t input_values);
00075     
00076     void update_outputs(void);
00077     
00078     void enable_outputs(bool enable);
00079 
00080 private:
00081     ISO8200BQ iso8200bq;
00082     control_mode_t _mode; 
00083     DigitalIn *_ctl_mode_pin;
00084     DigitalOut *_in_array[8];
00085 };
00086     
00087 
00088 #endif