CARME-M4 BSP  V1.5
carme_io2.h File Reference

CARME IO2 extension module board support package. More...

#include <stm32f4xx.h>
#include <carme.h>
+ Include dependency graph for carme_io2.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CARME_ERROR_IO2_NO_DATA   (CARME_ERROR_IO2_BASE + 0)
 
#define CARME_ERROR_IO2_PWM_WRONG_CHANNEL   (CARME_ERROR_IO2_BASE + 1)
 
#define CARME_IO2_GPIO_OUT_PIN0   0x1
 
#define CARME_IO2_GPIO_OUT_PIN1   0x2
 
#define CARME_IO2_GPIO_OUT_PIN2   0x4
 
#define CARME_IO2_LTC2622_CMD_W   0x00
 
#define CARME_IO2_LTC2622_CMD_Un   0x01
 
#define CARME_IO2_LTC2622_CMD_WUa   0x02
 
#define CARME_IO2_LTC2622_CMD_WUn   0x03
 
#define CARME_IO2_LTC2622_CMD_Off   0x04
 
#define CARME_IO2_LTC2622_CMD_None   0xFF
 
#define CARME_IO2_LTC2622_ADDR_A   0x00
 
#define CARME_IO2_LTC2622_ADDR_B   0x01
 
#define CARME_IO2_LTC2622_ADDR_ALL   0x0F
 

Typedefs

typedef enum _CARME_IO2_ADC_CHANNEL CARME_IO2_ADC_CHANNEL
 ADC port names.
 
typedef enum _CARME_IO2_GPIO_OUT_MODE CARME_IO2_GPIO_OUT_MODE
 GPIO Out mode definitions.
 
typedef enum _CARME_IO2_DAC_CHANNEL CARME_IO2_DAC_CHANNEL
 DAC port names.
 
typedef enum _CARME_IO2_SPI_CHANNEL CARME_IO2_SPI_CHANNEL
 ADC port names.
 
typedef enum _CARME_IO2_PWM_CHANNEL CARME_IO2_PWM_CHANNEL
 PWM port names.
 
typedef enum _CARME_IO2_PWM_PHASE CARME_IO2_PWM_PHASE
 DC motor direction.
 

Enumerations

enum  _CARME_IO2_ADC_CHANNEL { CARME_IO2_ADC_PORT0 = 0, CARME_IO2_ADC_PORT1 = 1, CARME_IO2_ADC_PORT2 = 2 }
 ADC port names. More...
 
enum  _CARME_IO2_GPIO_OUT_MODE { CARME_IO2_GPIO_OUT_MODE_GPIO = GPIO_Mode_OUT, CARME_IO2_GPIO_OUT_MODE_PWM = GPIO_Mode_AF }
 GPIO Out mode definitions. More...
 
enum  _CARME_IO2_DAC_CHANNEL { CARME_IO2_DAC_OUT0 = CARME_IO2_LTC2622_ADDR_A, CARME_IO2_DAC_OUT1 = CARME_IO2_LTC2622_ADDR_B, CARME_IO2_DAC_OUT_BOTH = CARME_IO2_LTC2622_ADDR_ALL }
 DAC port names. More...
 
enum  _CARME_IO2_SPI_CHANNEL { CARME_IO2_nPSC0 = 0, CARME_IO2_nPSC1 = 1 }
 ADC port names. More...
 
enum  _CARME_IO2_PWM_CHANNEL { CARME_IO2_PWM0, CARME_IO2_PWM1, CARME_IO2_PWM2, CARME_IO2_PWM3 }
 PWM port names. More...
 
enum  _CARME_IO2_PWM_PHASE { CARME_IO2_PWM_NORMAL_DIRECTION, CARME_IO2_PWM_OPPOSITE_DIRECTION }
 DC motor direction. More...
 

Functions

void CARME_IO2_Init (void)
 CARME IO2 initialization. More...
 
void CARME_IO2_GPIO_OUT_Settings (uint8_t pin, CARME_IO2_GPIO_OUT_MODE mode)
 Configure the CARME IO2 GPIO Out 0..2 as GPIO or PWM. More...
 
void CARME_IO2_ADC_Get (CARME_IO2_ADC_CHANNEL channel, uint16_t *pValue)
 Get the value of an ADC channel. More...
 
void CARME_IO2_DAC_Set (CARME_IO2_DAC_CHANNEL channel, uint16_t Value)
 Set the value of an DAC channel. More...
 
void CARME_IO2_SPI_Select (CARME_IO2_SPI_CHANNEL select)
 Select the peripheral SPI chip. More...
 
void CARME_IO2_SPI_CS_Out (uint8_t cs)
 Generate the chip select pin. More...
 
void CARME_IO2_SPI_Send (uint16_t data)
 Send a half word over the SPI port. More...
 
void CARME_IO2_SPI_Receive (uint16_t *pValue)
 Receive a half word from the SPI input buffer. More...
 
void CARME_IO2_PWM_Settings (TIM_TimeBaseInitTypeDef *pTIM_TimeBaseStruct)
 Set the PWM time base settings. More...
 
ERROR_CODES CARME_IO2_PWM_Set (CARME_IO2_PWM_CHANNEL channel, uint16_t value)
 Set the PWM time base settings. More...
 
void CARME_IO2_PWM_Phase (CARME_IO2_PWM_PHASE dir)
 Set the DC motor direction. More...
 
void CARME_IO2_GPIO_IN_Get (uint8_t *pStatus)
 Get the GPIO In 0..3 value. More...
 
void CARME_IO2_GPIO_OUT_Set (uint8_t Status)
 Set the GPIO Out 0..3 value. More...
 
void CARME_IO2_OPTO_IN_Get (uint8_t *pStatus)
 Get the OPTO In 0..1 value. More...
 
void CARME_IO2_OPTO_OUT_Set (uint8_t Status)
 Set the OPTO Out 0..1 value. More...
 

Detailed Description

CARME IO2 extension module board support package.

Version
1.0
Date
2013-01-09
Author
rct1

This software can be used by students and other personal of the Bern University of Applied Sciences under the terms of the MIT license. For other persons this software is under the terms of the GNU General Public License version 2.

Copyright © 2013, Bern University of Applied Sciences. All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

GNU GENERAL PUBLIC LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Definition in file carme_io2.h.