Corrections and further development of GPIO management for SPI

pull/53/head
Mike Hojnowski 2023-09-09 22:31:35 -04:00
rodzic 7b65449535
commit 709cfaa0d2
7 zmienionych plików z 42 dodań i 11 usunięć

Wyświetl plik

@ -15,7 +15,9 @@
/*------------------------------------------------------------------------*/
#include <stdint.h>
// kd2eat - add config.h to pick up any necessary defines
#include <config.h>
#include <gpio.h>
// kd2eat - define SILABS_RADIO_SI446X to enable support for Si4x6x chips.
#define SILABS_RADIO_SI446X
typedef unsigned char bit;

Wyświetl plik

@ -1,4 +1,3 @@
#ifdef DFM17
/*!
* File:
* radio_comm.h
@ -16,6 +15,8 @@
#include "bsp.h"
// kd2eat - rest of code inside a big ifdef
#ifdef DFM17
/* ======================================= *
* D E F I N I T I O N S *
* ======================================= */

Wyświetl plik

@ -1,7 +1,6 @@
#ifdef DFM17
/*!
* File:
* radio_hal.c
* radio_hal.c
*
* Description:
* This file contains RADIO HAL.
@ -16,6 +15,8 @@
#include "bsp.h"
// kd2eat - rest of code inside big ifdef
#ifdef DFM17
/* ======================================= *
* D E F I N I T I O N S *
@ -38,7 +39,7 @@ void radio_hal_AssertShutdown(void)
#if (defined SILABS_PLATFORM_RFSTICK) || (defined SILABS_PLATFORM_LCDBB) || (defined SILABS_PLATFORM_WMB)
RF_PWRDN = 1;
#else
PWRDN = 1;
GPIO_SetBits(BANK_SDN, PIN_SDN);
#endif
}
@ -47,23 +48,24 @@ void radio_hal_DeassertShutdown(void)
#if (defined SILABS_PLATFORM_RFSTICK) || (defined SILABS_PLATFORM_LCDBB) || (defined SILABS_PLATFORM_WMB)
RF_PWRDN = 0;
#else
PWRDN = 0;
GPIO_ResetBits(BANK_SDN, PIN_SDN);
#endif
}
void radio_hal_ClearNsel(void)
{
RF_NSEL = 0;
GPIO_ResetBits(BANK_NSEL, PIN_NSEL);
}
void radio_hal_SetNsel(void)
{
RF_NSEL = 1;
GPIO_SetBits(BANK_NSEL, PIN_NSEL);
}
BIT radio_hal_NirqLevel(void)
{
return RF_NIRQ;
// no NIRQ pin in the DFM17
return 0;
}
void radio_hal_SpiWriteByte(uint8_t byteToWrite)

Wyświetl plik

@ -1,4 +1,3 @@
#ifdef DFM17
/*!
* File:
* si446x_api_lib.c
@ -14,6 +13,8 @@
#include <stdint.h>
#include "bsp.h"
#ifdef DFM17
union si446x_cmd_reply_union Si446xCmd;
uint8_t Pro2Cmd[16];

Wyświetl plik

@ -1,4 +1,3 @@
#ifdef DFM17
/*
* Silicon Laboratories Confidential
* Copyright 2011 Silicon Laboratories, Inc.
@ -9,6 +8,7 @@
#include "stdint.h"
#include "bsp.h"
#ifdef DFM17
//SEGMENT_VARIABLE( Si446xChipPend, U8, SEG_BDATA );
//SBIT(Si446xWUTPend,Si446xChipPend,0);

Wyświetl plik

@ -1,8 +1,11 @@
#ifndef __GPIO_H
#define __GPIO_H
#include <system_stm32f10x.h>
#include <stm32f10x_gpio.h>
#include "config.h"
// GPIO definitions for devices we use
#if defined (RS41)

Wyświetl plik

@ -111,6 +111,28 @@ static void gpio_init()
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(BANK_RED_LED, &gpio_init);
#ifdef DFM17
// 4063 SDN (shutdown) pin
gpio_init.GPIO_Pin = PIN_SDN;
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(BANK_SDN, &gpio_init);
// 4063 GPIO2 pin
gpio_init.GPIO_Pin = PIN_4064_GPIO2;
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(BANK_4063_GPIO2, &gpio_init);
// 4063 GPIO3 pin
gpio_init.GPIO_Pin = PIN_4064_GPIO3;
gpio_init.GPIO_Mode = GPIO_Mode_Out_PP;
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(BANK_4063_GPIO3, &gpio_init);
#endif //DFM17
}
/**