You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.5 KiB
86 lines
2.5 KiB
/*
|
|
* File: idibus_hw.h
|
|
* Author: Michail
|
|
*
|
|
* Created on 20 ÿíâàðÿ 2026 ã., 16:12
|
|
*/
|
|
|
|
#ifndef IDIBUS_HW_H
|
|
#define IDIBUS_HW_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#include "config.h"
|
|
//=============================================================================
|
|
// RSLINK SECTION
|
|
// Define specific macros for MCU
|
|
// Currently supports Ext with shift register and modules with address
|
|
// and speed on two different ports
|
|
//=============================================================================
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Status LED
|
|
//-----------------------------------------------------------------------------
|
|
#define RSLINK_LED_DDR DDRB
|
|
#define RSLINK_LED_PORT PORTB
|
|
#define RSLINK_LED_PIN PINB
|
|
#define RSLINK_LED_BIT 0
|
|
|
|
#ifdef _SLAVE_EXT_
|
|
//-----------------------------------------------------------------------------
|
|
// DIP switch - Address, Speed, Bus Type
|
|
//-----------------------------------------------------------------------------
|
|
#define RSLINK_DIPS_CP_PORT PORTD
|
|
#define RSLINK_DIPS_CP_DDR DDRD
|
|
#define RSLINK_DIPS_CP_PIN PIND
|
|
#define RSLINK_DIPS_CP_BIT 7
|
|
|
|
#define RSLINK_DIPS_nPL_PORT PORTD
|
|
#define RSLINK_DIPS_nPL_DDR DDRD
|
|
#define RSLINK_DIPS_nPL_PIN PIND
|
|
#define RSLINK_DIPS_nPL_BIT 6
|
|
|
|
#define RSLINK_DIPS_Q7_PORT PORTD
|
|
#define RSLINK_DIPS_Q7_DDR DDRD
|
|
#define RSLINK_DIPS_Q7_PIN PIND
|
|
#define RSLINK_DIPS_Q7_BIT 5
|
|
//------------------------------------------------------------------------------
|
|
#endif
|
|
|
|
#ifdef _SLAVE_MODULE_
|
|
//------------------------------------------------------------------------------
|
|
// Dip switch Adders, Speed, Bus Type
|
|
#define RSLINK_ADDR_DDR DDRA
|
|
#define RSLINK_ADDR_PORT PORTA
|
|
#define RSLINK_ADDR_PIN PINA
|
|
#define RSLINK_ADDR_MASK 0xFF
|
|
|
|
#define RSLINK_SPEED_DDR DDRL
|
|
#define RSLINK_SPEED_PORT PORTL
|
|
#define RSLINK_SPEED_PIN PINL
|
|
#define RSLINK_SPEED_MASK 0b111
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#endif
|
|
|
|
#ifdef _CUSTOM_TYPE_
|
|
//Define custom type here
|
|
|
|
#endif
|
|
|
|
void RSLink_StatusLedInit(void);
|
|
void RSLink_StatusLedSetOn(void);
|
|
void RSLink_StatusLedSetOff(void);
|
|
|
|
void RSLink_DipsInit(void);
|
|
uint8_t RSLink_SpeedDecode(void);
|
|
uint8_t RSLink_AddrDecode(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* IDIBUS_HW_H */
|
|
|