-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Legacy) develop_FW-866 OpenRadio interface #504
base: develop
Are you sure you want to change the base?
Changes from 40 commits
6ffee84
92a27e9
9035323
9999fe1
ff29667
eebd083
133dc1c
984444a
9273ca3
a6468d7
1669b80
999f50f
917665d
64006b5
0de94cb
185038e
ecc3bd2
56ed0cf
480f1dc
9226da2
6dda3e9
39a1bdc
f0d59e5
6bae185
75b7eb1
d2b9c40
0166d42
aa7237b
2464d80
f23a799
4882b35
c9f560e
e5fdab3
4e484f2
74ca322
48f3080
6ecca16
49d565f
a506320
6a8f446
5e6ca11
ba85ad8
c861218
5110952
5538db7
1a1926b
cdf2911
e5b34b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,16 +22,50 @@ typedef enum { | |
KICK_SCHEDULER = 1, | ||
} kick_scheduler_t; | ||
|
||
typedef enum { | ||
minarady1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TIME_MS, | ||
TIME_TICS, | ||
} time_type_t; | ||
|
||
//=========================== typedef ========================================= | ||
typedef struct { | ||
uint16_t PORT_SLOTDURATION; | ||
minarady1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uint16_t PORT_TsSlotDuration; | ||
|
||
// execution speed related | ||
// also implementation related (e.g. SoC radio or spi-connected radio because of the time to load a packet to/from radio) | ||
uint16_t PORT_maxTxDataPrepare; | ||
uint16_t PORT_maxRxAckPrepare; | ||
uint16_t PORT_maxRxDataPrepare; | ||
uint16_t PORT_maxTxAckPrepare; | ||
|
||
// radio speed related | ||
// also implementation related (because the time to execute the Tx/Rx command is highly dependent on the radio AND the configuration) | ||
uint16_t PORT_delayTx; | ||
uint16_t PORT_delayRx; | ||
} slot_board_vars_t; //board specific slot vars | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this is the timeslot template. Suggest renaming to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh no, the timelost template is defined in the ieee154e.h. This struct is strictly for board specific parameters (regardless of which 154e timeslot template is used) |
||
|
||
// available slot templates | ||
typedef enum{ | ||
SLOT_10ms, | ||
SLOT_20ms_24GHZ, | ||
SLOT_40ms_24GHZ, | ||
SLOT_40ms_FSK_SUBGHZ, | ||
SLOT_40ms_OFDM1MCS0_3_SUBGHZ, | ||
MAX_SLOT_TYPES, | ||
} slotType_t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why the slot duration is in the name. Just have 3 timeslot templates, for the 3 radio settings we care about.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also a 10ms slot template and 20ms slot template. Thoe former is for python the latter has been classically used for 2.4GHz). |
||
|
||
//=========================== variables ======================================= | ||
|
||
//=========================== prototypes ====================================== | ||
|
||
void board_init(void); | ||
void board_sleep(void); | ||
void board_reset(void); | ||
|
||
void board_init(void); | ||
void board_sleep(void); | ||
void board_reset(void); | ||
void board_init_slot_vars(void); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't understand why this function exists. Remove? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved it to the private section, it is necessary to initialize the lookup table for the board_vars relevant to each radioSetting |
||
uint16_t board_getSlotDuration (time_type_t time_type); | ||
void board_setSlotType(slotType_t slot_type); | ||
slot_board_vars_t board_getSlotTemplate (void); | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. those 3 functions should be removed. Replace by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so I combined |
||
\} | ||
\} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ | |
#include "nvic.h" | ||
#include "debugpins.h" | ||
|
||
//=========================== variable ======================================== | ||
//=========================== variables ============================================ | ||
|
||
slot_board_vars_t slot_board_vars [MAX_SLOT_TYPES]; | ||
slotType_t selected_slot_type; | ||
|
||
//=========================== private ========================================= | ||
|
||
|
@@ -25,6 +28,8 @@ void GPIO_Config_ALL_AIN(void); | |
// configure the hard fault exception | ||
void board_enableHardFaultExceptionHandler(void); | ||
|
||
|
||
|
||
//=========================== main ============================================ | ||
|
||
extern int mote_main(void); | ||
|
@@ -96,8 +101,48 @@ void board_init(void){ | |
debugpins_init(); | ||
//enable nvic for the radio | ||
NVIC_radio(); | ||
|
||
board_init_slot_vars(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't call another function, fill in the structre here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about having an approach like #504 (comment)? You would need fewer lines of code modifications in every There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @twatteyne not sure I understand, which structure do you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @minarady1 I PR'd what I meant to your branch minarady1#1. Did it only for 1 board. |
||
} | ||
|
||
|
||
//==== bootstrapping slot info lookup table | ||
void board_init_slot_vars(void){ | ||
|
||
// 20ms slot | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_SLOTDURATION = 20 ; // ms | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_TsSlotDuration = 655 ; // 20ms | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxTxDataPrepare = 110 ; // 3355us (not measured) | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxRxAckPrepare = 20 ; // 610us (not measured) | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxRxDataPrepare = 33 ; // 1000us (not measured) | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxTxAckPrepare = 50 ; // 1525us (not measured) | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_delayTx = 18 ; // 549us (not measured) | ||
slot_board_vars [SLOT_20ms_24GHZ].PORT_delayRx = 0 ; // 0us (can not measure) | ||
} | ||
|
||
// To get the current slotDuration at any time | ||
// used during initialization by sixtop to fire the first sixtop EB | ||
uint16_t board_getSlotDuration (time_type_t time_type) | ||
{ | ||
if (time_type == TIME_MS) | ||
minarady1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return slot_board_vars [selected_slot_type].PORT_SLOTDURATION; | ||
minarady1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
return slot_board_vars [selected_slot_type].PORT_TsSlotDuration; | ||
} | ||
|
||
// Getter function for slot_board_vars | ||
slot_board_vars_t board_getSlotTemplate (void) | ||
{ | ||
return slot_board_vars [selected_slot_type]; | ||
} | ||
|
||
// Getter function for selected_slot_type | ||
void board_setSlotType(slotType_t slot_type) | ||
{ | ||
selected_slot_type = slot_type; | ||
} | ||
|
||
|
||
void board_sleep(void) { | ||
DBGMCU_Config(DBGMCU_STOP, ENABLE); | ||
// Enable PWR and BKP clock | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good