コード例 #1
0
ファイル: sx1276-LoRa.c プロジェクト: witc/Muj_Obojek_GPS
void SX1276LoRaReset( void )
{
    SX1276SetReset( RADIO_RESET_ON );
    
    // Wait 1ms
    uint32_t startTick = GET_TICK_COUNT( );
    while( ( GET_TICK_COUNT( ) - startTick ) < TICK_RATE_MS( 1 ) );    

    SX1276SetReset( RADIO_RESET_OFF );
    
    // Wait 6ms
    startTick = GET_TICK_COUNT( );
    while( ( GET_TICK_COUNT( ) - startTick ) < TICK_RATE_MS( 6 ) );    
}
コード例 #2
0
void SX1272FskRxCalibrate( void )
{
    uint32_t startTick;
	
    SX1272Write( REG_IMAGECAL, RF_IMAGECAL_AUTOIMAGECAL_OFF |
                               RF_IMAGECAL_IMAGECAL_START |
                               RF_IMAGECAL_TEMPTHRESHOLD_10 |
                               RF_IMAGECAL_TEMPMONITOR_OFF );

    // Wait 8ms
    startTick = GET_TICK_COUNT( );
    while( ( GET_TICK_COUNT( ) - startTick ) < TICK_RATE_MS( 8 ) );    
}
コード例 #3
0
int8_t SX1272FskGetRawTemp( void )
{
    int8_t temp = 0;
    uint8_t previousOpMode;
    uint32_t startTick;
    
    // Enable Temperature reading
    SX1272Read( REG_IMAGECAL, &SX1272->RegImageCal );
    SX1272->RegImageCal = ( SX1272->RegImageCal & RF_IMAGECAL_TEMPMONITOR_MASK ) | RF_IMAGECAL_TEMPMONITOR_ON;
    SX1272Write( REG_IMAGECAL, SX1272->RegImageCal );

    // save current Op Mode
    SX1272Read( REG_OPMODE, &SX1272->RegOpMode );
    previousOpMode = SX1272->RegOpMode;

    // put device in FSK RxSynth
    SX1272->RegOpMode = RF_OPMODE_SYNTHESIZER_RX;
    SX1272Write( REG_OPMODE, SX1272->RegOpMode );

    // Wait 1ms
    startTick = GET_TICK_COUNT( );
    while( ( GET_TICK_COUNT( ) - startTick ) < TICK_RATE_MS( 2 ) );  

    // Disable Temperature reading
    SX1272Read( REG_IMAGECAL, &SX1272->RegImageCal );
    SX1272->RegImageCal = ( SX1272->RegImageCal & RF_IMAGECAL_TEMPMONITOR_MASK ) | RF_IMAGECAL_TEMPMONITOR_OFF;
    SX1272Write( REG_IMAGECAL, SX1272->RegImageCal );

    // Read temperature
    SX1272Read( REG_TEMP, &SX1272->RegTemp );
    
    temp = SX1272->RegTemp & 0x7F;
    
    if( ( SX1272->RegTemp & 0x80 ) == 0x80 )
    {
        temp *= -1;
    }

    // Reload previous Op Mode
    SX1272Write( REG_OPMODE, previousOpMode );

    return temp;
}