📄 satmb.c
字号:
/*! \file satmb.c \brief Satellite Motherboard Driver Functions. */
//*****************************************************************************
//
// File Name : 'satmb.c'
// Title : Satellite Motherboard Driver Functions
// Author : Pascal Stang - Copyright (C) 2004
// Created : 2004.10.13
// Revised : 2004.10.13
// Version : 0.1
// Target MCU : Atmel AVR series
// Editor Tabs : 4
//
// This code is distributed under the GNU Public License
// which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************
//----- Include Files ---------------------------------------------------------
#include <avr/io.h> // include I/O definitions (port names, pin names, etc)
#include <avr/signal.h> // include "signal" names (interrupt names)
#include <avr/interrupt.h> // include interrupt support
#include "global.h" // include our global settings
#include "satmb.h"
// globals
// functions
void satmbInit(void)
{
// preset serial port power to on
satmbSetSerialPortPower(1);
}
void satmbSetSerialPortPower(u08 on)
{
// set I/O control line to output
sbi(SATMB_SER_PWR_DDR, SATMB_SER_PWR_PIN);
// set serial port power state
if(on)
sbi(SATMB_SER_PWR_PORT, SATMB_SER_PWR_PIN);
else
cbi(SATMB_SER_PWR_PORT, SATMB_SER_PWR_PIN);
}
void satmbSerialRtsCtsInit(void)
{
// initialize RTS/CTS lines for operation
// RTS is input, set pullup
cbi(SATMB_SER_RTS_DDR, SATMB_SER_RTS_PIN);
sbi(SATMB_SER_RTS_PORT, SATMB_SER_RTS_PIN);
// CTS is output, init low
sbi(SATMB_SER_CTS_DDR, SATMB_SER_CTS_PIN);
cbi(SATMB_SER_CTS_PORT, SATMB_SER_CTS_PIN);
}
u08 satmbSerialRtsCheck(void)
{
if(inp(SATMB_SER_RTS_PORTIN) & (1<<SATMB_SER_RTS_PIN))
return TRUE;
else
return FALSE;
}
void satmbSerialCtsSet(u08 state)
{
if(state)
sbi(SATMB_SER_CTS_PORT, SATMB_SER_CTS_PIN);
else
cbi(SATMB_SER_CTS_PORT, SATMB_SER_CTS_PIN);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -