Skip to content

Commit

Permalink
first attempt to remove some unusual types, converge to stdint
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel committed Dec 23, 2020
1 parent a1120a6 commit a826b7c
Show file tree
Hide file tree
Showing 73 changed files with 511 additions and 314 deletions.
2 changes: 1 addition & 1 deletion system/apps/105_avrprogrammer/source/ihex.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

uint32_t _strtol(char*str, char**p, int nBase)
{
ui32 nVal = 0;
uint32_t nVal = 0;
char ch;
while ( (ch = *str++) != 0 )
{
Expand Down
36 changes: 18 additions & 18 deletions system/apps/test23_screenshot/screenshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
#pragma pack(2)
struct BmpHdr
{
ui16 wBfType;
ui32 dwBfSize;
ui16 wBfReserved1;
ui16 wBfReserved2;
ui32 dwBfOffset;
uint16_t wBfType;
uint32_t dwBfSize;
uint16_t wBfReserved1;
uint16_t wBfReserved2;
uint32_t dwBfOffset;

ui32 dwBiSize;
ui32 dwBiWidth;
ui32 dwBiHeight;
ui16 wBiPlanes;
ui16 wBiBitDepth;
ui32 dwBiCompression;
ui32 dwBiSizeImage;
ui32 dwBiXPels;
ui32 dwBiYPels;
uint32_t dwBiSize;
uint32_t dwBiWidth;
uint32_t dwBiHeight;
uint16_t wBiPlanes;
uint16_t wBiBitDepth;
uint32_t dwBiCompression;
uint32_t dwBiSizeImage;
uint32_t dwBiXPels;
uint32_t dwBiYPels;

ui32 dwBiClrUsed;
ui32 dwBiClrImportant;
uint32_t dwBiClrUsed;
uint32_t dwBiClrImportant;
};
#pragma pack(pop)

Expand Down Expand Up @@ -55,7 +55,7 @@ bool SaveScreenshot16(char* strName)
for ( int y = BIOS::LCD::Height-1; y >= 0; y-- )
for ( int x = 0; x < BIOS::LCD::Width; x++ )
{
ui16 wPixel = BIOS::LCD::GetPixel( x, y );
uint16_t wPixel = BIOS::LCD::GetPixel( x, y );

if (((x>>2)+(y>>2))&1)
BIOS::LCD::PutPixel( x, y, wPixel^0x18e3);
Expand All @@ -76,7 +76,7 @@ bool SaveScreenshot16(char* strName)
{
if (((x>>2)+(y>>2))&1)
{
ui16 wPixel = BIOS::LCD::GetPixel( x, y );
uint16_t wPixel = BIOS::LCD::GetPixel( x, y );
BIOS::LCD::PutPixel( x, y, wPixel^0x18e3);
// ..... ...... .....
// ...11 ...111 ...11
Expand Down
18 changes: 9 additions & 9 deletions system/apps/test30_dcf77/dcf77.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class CWndDcf77 : public CWnd
int m_nBitIndex;
bool m_bRedraw;

ui32 m_DcfBits[2];
uint32_t m_DcfBits[2];

ui32 m_DcfValid[2];
uint32_t m_DcfValid[2];
int m_lDcfAcquired;

public:
virtual void Create(CWnd *pParent, ui16 dwFlags)
virtual void Create(CWnd *pParent, uint16_t dwFlags)
{
CWnd::Create("CWndDcf77", dwFlags | CWnd::WsNoActivate | CWnd::WsListener, CRect(0, 16, 400, 240), pParent);
}
Expand All @@ -32,7 +32,7 @@ class CWndDcf77 : public CWnd
m_lDcfAcquired = 0;
}

int GetBit(int nBitIndex, ui32 *pData = NULL)
int GetBit(int nBitIndex, uint32_t *pData = NULL)
{
if ( pData == NULL )
pData = m_DcfBits;
Expand All @@ -45,7 +45,7 @@ class CWndDcf77 : public CWnd
return 0;
}

int GetBits(int nIndex, int nLen, ui32 *pData = NULL)
int GetBits(int nIndex, int nLen, uint32_t *pData = NULL)
{
if ( pData == NULL )
pData = m_DcfBits;
Expand All @@ -58,7 +58,7 @@ class CWndDcf77 : public CWnd
return nResult;
}

int GetParity(int nIndex, int nLen, ui32 *pData = NULL)
int GetParity(int nIndex, int nLen, uint32_t *pData = NULL)
{
if ( pData == NULL )
pData = m_DcfBits;
Expand Down Expand Up @@ -161,7 +161,7 @@ class CWndDcf77 : public CWnd
nIndex++;

bool bCurrent = (m_nBitIndex-1) >= DcfItem.nStart && (m_nBitIndex-1) < DcfItem.nStart + DcfItem.nLength;
ui16 clrBack = bCurrent ? RGB565(0000b0) : RGB565(000000);
uint16_t clrBack = bCurrent ? RGB565(0000b0) : RGB565(000000);

BIOS::LCD::Print( x, y, RGB565(ffffff), clrBack, DcfItem.strName);

Expand Down Expand Up @@ -194,7 +194,7 @@ class CWndDcf77 : public CWnd
for (int j=0; j<DcfItem.nLength; j++)
{
nCurBit = GetBit(DcfItem.nStart+j);
ui16 clrB2 = (DcfItem.nStart+j == m_nBitIndex-1) ? RGB565(b00000) : clrBack;
uint16_t clrB2 = (DcfItem.nStart+j == m_nBitIndex-1) ? RGB565(b00000) : clrBack;
BIOS::LCD::Print( x+j*8+8, y, RGB565(ffffff), clrB2, itoa(nCurBit) );
}
break;
Expand Down Expand Up @@ -281,7 +281,7 @@ class CWndDcf77 : public CWnd
}
}

void dbg(char ch, ui16 clr)
void dbg(char ch, uint16_t clr)
{
/*
static int i=0;
Expand Down
2 changes: 1 addition & 1 deletion system/apps/test34_scope/graph/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void drawline_aa(fix16_t x1, fix16_t y1, fix16_t x2, fix16_t y2, int color)
if (reverse_xy)
swap(&x, &y);

u16 oldcolor = BIOS::LCD::GetPixel(x >> 8, y >> 8);
uint16_t oldcolor = BIOS::LCD::GetPixel(x >> 8, y >> 8);
BIOS::LCD::PutPixel(x >> 8, y >> 8, blend(color, oldcolor, c));
};

Expand Down
6 changes: 3 additions & 3 deletions system/apps/test4_snake/Snake.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//class CSnakeResources

static const ui32 sprites[] = {
static const uint32_t sprites[] = {
// wall
0x2ccccccc, 0xccccccc2,
0xcccccccc, 0xcccccccc,
Expand Down Expand Up @@ -423,8 +423,8 @@ class CWndSnake : public CWnd

virtual void OnTimer()
{
static si8 dx[4] = {1,0,-1,0};
static si8 dy[4] = {0,1,0,-1};
static int dx[4] = {1,0,-1,0};
static int dy[4] = {0,1,0,-1};

if ( GetFocus() != this )
return;
Expand Down
4 changes: 2 additions & 2 deletions system/apps/test4_snake/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class CUtils
{
public:
static int atoi(char *str);
static ui32 htoi(char *str);
static char* itoa(si16 i);
static uint32_t htoi(char *str);
static char* itoa(int16_t i);
static char* itoa2(ui8 n);
static char* ftoa(float f);
static char tohex(ui8 n);
Expand Down
2 changes: 1 addition & 1 deletion system/apps/test4_snake/Wnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void CWnd::KillTimer()

void CWnd::_UpdateTimers()
{
ui32 nTick = BIOS::SYS::GetTick();
uint32_t nTick = BIOS::SYS::GetTick();

for ( int i = 0; i < m_arrTimers.GetSize(); i++ )
{
Expand Down
6 changes: 3 additions & 3 deletions system/apps/test4_snake/Wnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CWnd
class CTimer
{
public:
CTimer( CWnd* pWnd, ui32 nInterval ) :
CTimer( CWnd* pWnd, uint32_t nInterval ) :
m_pWnd( pWnd ), m_nInterval( nInterval )
{
m_nNext = BIOS::SYS::GetTick() + nInterval;
Expand All @@ -20,8 +20,8 @@ class CWnd

public:
CWnd* m_pWnd;
ui32 m_nInterval;
ui32 m_nNext;
uint32_t m_nInterval;
uint32_t m_nNext;
};

class CModal
Expand Down
1 change: 1 addition & 0 deletions system/apps_ds213/58_gabmini/source/Framework.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "oldtypes.h"
#include "../../../os_host/source/framework/Wnd.h"
#include "../../../os_host/source/framework/Utils.h"
#include "../../../os_host/source/framework/Serialize.h"
Expand Down
8 changes: 8 additions & 0 deletions system/apps_ds213/58_gabmini/source/oldtypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdint.h>

typedef int8_t si8;
typedef int16_t si16;
typedef uint16_t ui16;
typedef uint32_t ui32;
typedef uint16_t u16;
typedef int32_t si32;
1 change: 1 addition & 0 deletions system/apps_ds213/60_gabgen/source/Framework.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "oldtypes.h"
#include "../../../os_host/source/framework/Wnd.h"
#include "../../../os_host/source/framework/Utils.h"
#include "../../../os_host/source/framework/Serialize.h"
Expand Down
8 changes: 8 additions & 0 deletions system/apps_ds213/60_gabgen/source/oldtypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdint.h>

typedef int8_t si8;
typedef int16_t si16;
typedef uint16_t ui16;
typedef uint32_t ui32;
typedef uint16_t u16;
typedef int32_t si32;
2 changes: 1 addition & 1 deletion system/apps_experiments/107_scheme/source/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void drawline_aa(fix16_t x1, fix16_t y1, fix16_t x2, fix16_t y2, int color)
if (reverse_xy)
swap(&x, &y);

u16 oldcolor = BIOS::LCD::GetPixel(x >> 8, y >> 8);
uint16_t oldcolor = BIOS::LCD::GetPixel(x >> 8, y >> 8);
BIOS::LCD::PutPixel(x >> 8, y >> 8, blend(color, oldcolor, c));
};

Expand Down
1 change: 1 addition & 0 deletions system/apps_experiments/53_213oscfpgatest/platform.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef const uint8_t uc8;
typedef const uint16_t uc16;
Expand Down
12 changes: 6 additions & 6 deletions system/apps_experiments/54_2x3_gaboscshell/ToolBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@

for ( int i = nMenu+nIgnoreFirst; pItems[i].m_eType == CBarItem::ISub; i++ )
{
ui8 bSelected = (i==nFocus);
u16 clr = bSelected ? clrSelected : clrNormal;
u16 bgr = bSelected ? 0 : RGBTRANS;
uint8_t bSelected = (i==nFocus);
uint16_t clr = bSelected ? clrSelected : clrNormal;
uint16_t bgr = bSelected ? 0 : RGBTRANS;

if ( HasFocus() && bSelected )
{
Expand Down Expand Up @@ -134,7 +134,7 @@
/*virtual*/ void CWndToolBar::OnKey(int nKey)
{
const CWndToolBar::CBarItem* pItems = GetMenuItems();
ui8 oldFocus = m_nFocus;
uint8_t oldFocus = m_nFocus;
if ( nKey == BIOS::KEY::Left)
{
if ( pItems[m_nFocus].m_eType == CBarItem::IMain )
Expand Down Expand Up @@ -190,7 +190,7 @@
CWnd::OnKey( nKey );
}

/*virtual*/ void CWndToolBar::ChangeFocus(ui8 oldFocus)
/*virtual*/ void CWndToolBar::ChangeFocus(uint8_t oldFocus)
{
const CWndToolBar::CBarItem* pItems = GetMenuItems();
SendMessage( GetParent(), ToWord('L', 'D'), (NATIVEPTR)pItems[oldFocus].m_pWndMenu );
Expand All @@ -205,7 +205,7 @@ Invalidate();
if ( code == ToWord('g', 'i') )
{
const CBarItem *pItems = GetMenuItems();
m_nFocus = (ui8)data;
m_nFocus = (uint8_t)data;
CWnd* pFocus = GetFocus();
SendMessage( GetParent(), ToWord('L', 'E'), (NATIVEPTR)pItems[m_nFocus].m_pWndMenu );
if ( GetFocus() == pFocus )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
eKPoints = 6
};

si16 m_arrCurveQin[eQPoints];
si32 m_arrCurveQout[eQPoints];
si16 m_arrCurveKin[eKPoints];
si32 m_arrCurveKout[eKPoints];
int16_t m_arrCurveQin[eQPoints];
int32_t m_arrCurveQout[eQPoints];
int16_t m_arrCurveKin[eKPoints];
int32_t m_arrCurveKout[eKPoints];
};

class LinApprox
Expand All @@ -92,8 +92,8 @@
};

float m_arrCurveIn[ePoints];
si16 m_arrCurveOut[ePoints];
typedef CalibrationCurve<float, si16, float, int, float, ePoints> Interpolator;
int16_t m_arrCurveOut[ePoints];
typedef CalibrationCurve<float, int16_t, float, int, float, ePoints> Interpolator;

int Get( float fVoltage )
{
Expand All @@ -105,8 +105,8 @@
{
public:
LinCalibCurve CalData[AnalogChannel::_ResolutionMax+1];
typedef CalibrationCurve<si16, si32, int, int, int, LinCalibCurve::eKPoints> InterpolatorK;
typedef CalibrationCurve<si16, si32, int, int, int, LinCalibCurve::eQPoints> InterpolatorQ;
typedef CalibrationCurve<int16_t, int32_t, int, int, int, LinCalibCurve::eKPoints> InterpolatorK;
typedef CalibrationCurve<int16_t, int32_t, int, int, int, LinCalibCurve::eQPoints> InterpolatorQ;

struct FastCalc
{
Expand All @@ -121,7 +121,7 @@
{50e-3f, 100e-3f, 200e-3f, 500e-3f, 1.0f, 2.0f, 5.0f, 10.0f};

LinCalibCurve& pCurCurve = CalData[ pSource->Resolution ];
si16& nVert = pSource->u16Position;
int16_t& nVert = pSource->u16Position;

fast.K = InterpolatorK::Get( pCurCurve.m_arrCurveKin, pCurCurve.m_arrCurveKout, nVert );
fast.Q = InterpolatorQ::Get( pCurCurve.m_arrCurveQin, pCurCurve.m_arrCurveQout, nVert );
Expand Down Expand Up @@ -183,7 +183,7 @@
{50e-3f, 100e-3f, 200e-3f, 500e-3f, 1.0f, 2.0f, 5.0f, 10.0f};

LinCalibCurve& pCurCurve = CalData[ pSource->Resolution ];
si16& nVert = pSource->u16Position;
int16_t& nVert = pSource->u16Position;

fast.K = InterpolatorK::Get( pCurCurve.m_arrCurveKin, pCurCurve.m_arrCurveKout, nVert );
fast.Q = InterpolatorQ::Get( pCurCurve.m_arrCurveQin, pCurCurve.m_arrCurveQout, nVert );
Expand Down
Loading

0 comments on commit a826b7c

Please sign in to comment.