📄 22eb06_lib_modulecontrol.h
字号:
/*
***********************************************************************
Embest Info&Tech Co., Ltd. All rights reserved.
www.embedinfo.com
***********************************************************************
---------------- file information -------------------------------------
file name: 22eb06_lib_modulecontrol.h
version : v0
author : peter pan / panqan@hotmail.com
begin : 2006-02-10
finish : 2006-02-10
define : lpc22eb06 module control to enable or disable the module
notes :
---------------- modify information -----------------------------------
version :
modify :
begin :
finish :
define :
-----------------------------------------------------------------------
*/
// (--------------------- compiler condition --------------------------
#ifndef h22eb06_lib_modulecontrol_h
#define h22eb06_lib_modulecontrol_h
// --------------------- compiler condition --------------------------)
/*-------------------------------------------------------------------*/
/* include files */
/*---------------------------------------------------------------- --*/
#include "..\..\com\type_redefine.h"
#include "..\..\com\lpc22xx_register.h"
#include "..\..\com\lpc_lib_spi\lpc_lib_spi.h"
/*-------------------------------------------------------------------*/
/* variable define */
/*-------------------------------------------------------------------*/
// 88 control
// P2 to 88_latch
// 88latch p2.19
// 88en p2.18
#define P2__16_31__GPIO (0x01<<4)
#define P2__16_31__GPIO_MASK (0x01<<4)
// GPIO2.18 to 88 en
#define GPIO2_18_88EN (0x01<<18)
#define GPIO2_18_88EN_MASK (0x01<<18)
// GPIO2.19 to 88 latch
#define GPIO2_19_88latch (0x01<<19)
#define GPIO2_19_88latch_MASK (0x01<<19)
// 88 data define
#define D88_A (0x1) //
#define D88_B (0x1<<1) //
#define D88_C (0x1<<2) //
#define D88_D (0x1<<3) //
#define D88_E (0x1<<4) //
#define D88_F (0x1<<5) //
#define D88_G (0x1<<6) //
#define D88_DP (0x1<<7) //
// assembled to digital data
#define D88_0 (D88_A+D88_B+D88_C+D88_D+D88_E+D88_F)
#define D88_1 (D88_B+D88_C)
#define D88_2 (D88_A+D88_B+D88_G+D88_E+D88_D)
#define D88_3 (D88_A+D88_B+D88_G+D88_C+D88_D)
#define D88_4 (D88_B+D88_G+D88_F+D88_C)
#define D88_5 (D88_A+D88_F+D88_G+D88_C+D88_D)
#define D88_6 (D88_A+D88_F+D88_G+D88_C+D88_D+D88_E)
#define D88_7 (D88_A+D88_B+D88_C)
#define D88_8 (D88_A+D88_B+D88_C+D88_D+D88_E+D88_F+D88_G)
#define D88_9 (D88_A+D88_B+D88_C+D88_D+D88_F+D88_G)
// GPIO2.16 to spi extend latch
#define GPIO2_16_spi_extend_latch (0x01<<16)
#define GPIO2_16_spi_extend_latch_MASK (0x01<<16)
// GPIO2.17 to spi extend out en
#define GPIO2_17_spi_extend_out (0x01<<17)
#define GPIO2_17_spi_extend_out_MASK (0x01<<17)
// extend module control mask define
#define module_c_USB_MASK (0x1) //
#define module_c_MOTOR_MASK (0x1<<1) //
#define module_c_MMC_SD_MASK (0x1<<2) //
#define module_c_U0_MASK_1 (0x1<<3) //
#define module_c_U0_MASK_2 (0x1<<4) //
#define module_c_U1_MASK (0x1<<5) //
#define module_c_RS485_MASK1 (0x1<<6) //
#define module_c_RS485_MASK2 (0x1<<7) //
// next 8 bit
#define module_c_AUDIO_MASK (0x1<<8) //
#define module_c_PS2_MASK (0x1<<9) //
#define module_c_SSEL1_C_MASK (0x1<<10) //
#define module_c_LCM_EN_MASK (0x1<<11) //
#define module_c_USB_RESET_MASK (0x1<<12) //
#define module_c_LCM_RESET_MASK (0x1<<13) //
#define module_c_CF_RESET_MASK (0x1<<14) //
#define module_c_CF_EN_MASK (0x1<<15) //
// extend module control value define
#define module_c_USB_HALT_EN1 (0x1) //
#define module_c_MOTOR_EN0 (0x0<<1) //
#define module_c_MMC_SD_EN0 (0x0<<2) //
#define module_c_U0_EN1_EN1 (0x1<<3) //
#define module_c_U0_EN2_EN0 (0x0<<4) //
#define module_c_U1_EN1 (0x1<<5) //
#define module_c_RS485_EN1_EN0 (0x0<<6) //
#define module_c_RS485_EN2_EN1 (0x1<<7) //
// next 8 bit
#define module_c_AUDIO_EN0 (0x0<<8) //
#define module_c_PS2_EN0 (0x0<<9) //
#define module_c_SSEL1_C_EN1 (0x1<<10) //
#define module_c_LCM_EN0 (0x0<<11) //
#define module_c_USB_RESET_EN0 (0x0<<12) //
#define module_c_LCM_RESET_EN0 (0x0<<13) //
#define module_c_CF_RESET_EN0 (0x0<<14) //
#define module_c_CF_EN0 (0x0<<15) //
#define module_c_all_off (~(module_c_USB_HALT_EN1+module_c_MOTOR_EN0+module_c_MMC_SD_EN0\
+module_c_U0_EN1_EN1+module_c_U0_EN2_EN0+module_c_U1_EN1+module_c_RS485_EN1_EN0\
+module_c_RS485_EN2_EN1+module_c_AUDIO_EN0+module_c_PS2_EN0+module_c_SSEL1_C_EN1\
+module_c_LCM_EN0+module_c_USB_RESET_EN0+module_c_LCM_RESET_EN0\
+module_c_CF_RESET_EN0+module_c_CF_EN0))
/*
// next 8 bit
#define module_c_AUDIO_EN0 (0x0) //
#define module_c_PS2_EN0 (0x0<<1) //
#define module_c_SSEL1_C_EN1 (0x1<<2) //
#define module_c_LCM_EN0 (0x0<<3) //
#define module_c_USB_RESET_EN0 (0x0<<4) //
#define module_c_LCM_RESET_EN0 (0x0<<5) //
#define module_c_CF_RESET_EN0 (0x0<<6) //
#define module_c_CF_EN0 (0x0<<7) //
// extend module control value define
#define module_c_USB_HALT_DIS (0x0) //
#define module_c_MOTOR_DIS (0x1<<1) //
#define module_c_MMC_SD_DIS (0x1<<2) //
#define module_c_U0_EN1_DIS (0x0<<3) //
#define module_c_U0_EN2_DIS (0x1<<4) //
#define module_c_U1_DIS (0x0<<5) //
#define module_c_RS485_EN1_DIS (0x1<<6) //
#define module_c_RS485_EN2_DIS (0x0<<7) //
// next 8 bit
#define module_c_AUDIO_DIS (0x1) //
#define module_c_PS2_DIS (0x1<<1) //
#define module_c_SSEL1_C_DIS (0x0<<2) //
#define module_c_LCM_DIS (0x1<<3) //
#define module_c_USB_RESET_DIS (0x1<<4) //
#define module_c_LCM_RESET_DIS (0x1<<5) //
#define module_c_CF_RESET_DIS (0x1<<6) //
#define module_c_CF_DIS (0x1<<7) //
#define module_c_all_module_off_b1 (module_c_USB_HALT_DIS + module_c_MOTOR_DIS + module_c_MMC_SD_DIS\
+module_c_U0_EN1_DIS + module_c_U0_EN2_DIS + module_c_U1_DIS\
+module_c_RS485_EN1_DIS + module_c_RS485_EN2_DIS))
#define module_c_all_module_off_b2 (module_c_AUDIO_DIS + module_c_PS2_DIS + module_c_SSEL1_C_DIS\
+module_c_LCM_DIS + module_c_USB_RESET_DIS + module_c_LCM_RESET_DIS\
+module_c_CF_RESET_DIS + module_c_CF_DIS )
#define module_motor_en (module_c_USB_HALT_DIS + module_c_MOTOR_EN0 + module_c_MMC_SD_DIS\
+module_c_U0_EN1_DIS + module_c_U0_EN2_DIS + module_c_U1_DIS\
+module_c_RS485_EN1_DIS + module_c_RS485_EN2_DIS)
#define module_uart0_en (module_c_USB_HALT_DIS + module_c_MOTOR_DIS + module_c_MMC_SD_DIS\
+module_c_U0_EN1_EN1 + module_c_U0_EN2_EN0 + module_c_U1_DIS\
+module_c_RS485_EN1_DIS + module_c_RS485_EN2_DIS)
*/
//motor control bin set to gpio
#define P0_11_GPIO_PINSEL0 (0x0<<22) //motor3
#define P0_12_GPIO_PINSEL0 (0x0<<24) //motor4
#define P0_13_GPIO_PINSEL0 (0x0<<26) //motor5
#define P0_14_GPIO_PINSEL0 (0x0<<28) //motor1
#define P0_15_GPIO_PINSEL0 (0x0<<30) //motor2
#define P0_11_GPIO_PINSEL0_MASK (0x3<<22) //
#define P0_12_GPIO_PINSEL0_MASK (0x3<<24) //
#define P0_13_GPIO_PINSEL0_MASK (0x3<<26) //
#define P0_14_GPIO_PINSEL0_MASK (0x3<<28) //
#define P0_15_GPIO_PINSEL0_MASK (0x3<<30) //
#define P0_0_GPIO_PINSEL0 (0x0) //pwm1
#define P0_0_GPIO_PINSEL0_MASK (0x3)
#define P0_1_GPIO_PINSEL0 (0x0) //pwm3
#define P0_1_GPIO_PINSEL0_MASK (0x3)
typedef enum {
module_c_MOTOR_EN,
module_c_MMC_SD_EN,
module_c_U0_EN,
module_c_U1_EN,
module_c_RS485_EN,
// next 8 bit
module_c_AUDIO_EN,
module_c_PS2_EN,
module_c_SSEL1_C_EN,
module_c_LCM_EN,
module_c_USB_RESET_EN,
module_c_LCM_RESET_EN,
module_c_CF_RESET_EN,
module_c_CF_EN,
} module_c_device;
// global variable for 22eb06_lib_modulecontrol.c
/*-------------------------------------------------------------------*/
/* local function declare */
/*-------------------------------------------------------------------*/
void spi_extend_set(INT32U extend_io_onoff, module_c_device device_name);
void spi_extend_onoff(INT32U extend_onoff);
INT32U display88_latch(INT32U LATCH_EN);
INT32U display88_outputen(INT32U OUTPUTEN);
INT32U spi_extend_latch(INT32U LATCH_EN);
INT32U spi_extend_outputen(INT32U OUTPUTEN);
/*-------------------------------------------------------------------*/
/* extern function declare */
/*-------------------------------------------------------------------*/
/*--- define in XXX.c ---
extern void XXX();
*/
/*-------------------------------------------------------------------*/
/* extern variable declare */
/*-------------------------------------------------------------------*/
/*--- USED in XXX() ---
XXX SSS; // used inXXX()
*/
/*-------------------------------------------------------------------*/
/* function code */
/*-------------------------------------------------------------------*/
/**********************************************************************
* name : xxxxx
* func : xxxxx
* para : xxxx
* ret : xxxx
* glob : xxxx
* inc :
* author:
* date :
* modify:
* comment:
**********************************************************************/
/*void xxx(xxx xxx)
{
}
*/
#endif //h22eb06_lib_modulecontrol_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -